Custom Damage Types (DSB 0.78+)

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Custom Damage Types (DSB 0.78+)

Post by Sophia »

As of DSB 0.78 you'll be able to add custom damage types. In your custom Lua scripts you'll need to add code like:

Code: Select all

inventory_info.damage_types = 4
inventory_info.dtype.psychic = 3
This increases the total number of damage types to 4 (health, stamina, mana, and our new type) and adds a new damage type, "psychic," to the dtype table with id 3. (health has id 0, stamina has id 1, and mana has id 2)

If you provide a suitable image, DSB will automatically draw it, when you invoke it with code like:

Code: Select all

dsb_damage_popup(ppos, inventory_info.dtype.psychic, damage_amount)
The easiest way to have your image drawn is to extend the default DSB damage images. Add a fourth image of equal width and height below the first three and DSB will automatically draw it.

You can do this for however many new damage types you want to add, for example:

Code: Select all

inventory_info.damage_types = 5
inventory_info.dtype.psychic = 3
inventory_info.dtype.something_else = 4
If you need the default images to modify, here they are:
Image

Image

However, you can also use a purely custom renderer, if you'd like. Take a look at h_damage_popup in base/hooks.lua for details.
User avatar
Automaton
Journeyman
Posts: 88
Joined: Sat Aug 28, 2004 10:49 am

Re: Custom Damage Types (DSB 0.78+)

Post by Automaton »

Very cool!

Looking forward to getting my regen looking proper!

Cheers
Nick K.
Post Reply