Recursive damage (previously called damage over time) is a sub-set of an attack that causes repeat damage to the entity over a period of time. Each attack may apply a single recursive damage effect at a time, but a given entity may be the victim of any number of recursive damage effects.
Native
To add a recursive damage effect, you need to add the recursive commands to an attack.
Command | Default | Description |
---|---|---|
attack.damage.recursive.force | 0 | Amount of damage to apply for each tick of recursive damage. |
attack.damage.recursive.index | 0 | A unique identifier for the recursive effect. Entities may be subject to an unlimited number of recursive effects, but only one recursive effect of a given index. If an entity with an active recursive damage effect is hit by the same attack again or a different attack with the same recursive index, its current recursive effect with that index is overwritten. If the recursive attack has a different index, both effects take place, and so on (a bad day for that entity!). |
attack.damage.recursive.mode | none | How the recursive damage will apply. Accepts one or more of Accepts one or more of the following: * none – Recursive damage still runs, but won’t have any effect on its own. Overridden if combined with any other value. * hp – Hit points. Damage applies to entity’s hit points. * mp – Magic points. Damage applies to entity’s magic points. * non-lethal – Recursive damage can reduce hit points to 1, but not below. |
attack.damage.recursive.tag | 0 | This is a user defined integer value you may use for scripting purposes. It passes to the recipient on hit but has no effect on its own. Note: Subject to removal on completion of meta_data feature. |
attack.damage.recursive.time | 0 | How long (in centiseconds) the recursive damage effect will last. |
attack.damage.recursive.type | same | Attack type used for hit point damage. Accepts the following: * same – Same type as parent attack.* Any attack type. See attack.damage.type. |
attack.damage.recursive.rate | 0 | How long (in centiseconds) between each tick of recursive damage. |
Command | Default | Description |
Example
In this example, an entity hit with this recursive damage will take 2 points of damage every 10 centiseconds for 500 centiseconds or until the damage would take it below 1 hit point. If this same recursive attack hits again, its effects are reset (i.e. the time will start over again). If another recursive attack with an index of 1 hits, its values will apply instead.
attack.damage.recursive.force 2 attack.damage.recursive.index 1 attack.damage.recursive.mode hp non-lethal attack.damage.recursive.time 100 attack.damage.recursive.rate 10
Script
Recursive damage uses the same underlying data structure for the attack that inflicts a recursive damage effect and the entity subject to one. In the case of attack boxes, there is only ever one set recursion data per attack box. Entities may have any number of recursion effects active. These are managed by a linked list.
Recursive properties are exposed to script through the get_recursive_damage_property(<pointer> recursive damage, <string> property)
and set_recursive_damage_property(<pointer> recursive damage, <string> property, <mixed> value)
functions. You will need the pointer to a recursion node first.
Name | Type | Description |
---|---|---|
force | Integer | Amount of damage applied on each tick. |
index | Integer | The index assigned to this recursive effect. |
mode | Integer | How the recursive damage will apply. Bit masked with following constants: * openborconstant("DAMAGE_RECURSIVE_MODE_NONE") – No effect (overridden if used in conjunction with any other constant). * openborconstant("DAMAGE_RECURSIVE_MODE_HP") – Damage applies to hit points. * openborconstant("DAMAGE_RECURSIVE_MODE_MP") – Damage applies to magic points. * openborconstant("DAMAGE_RECURSIVE_MODE_NON_LETHAL") – Damage to hit points (if any) can reduce HP to 1, but not below. |
next | Pointer | Pointer to next item in linked list of recursive damage effects. If this is NULL, you are at the last (or only) item in list. |
owner | Pointer | Entity that inflicted the recursive damage effect. Logically, this property will always be NULL if you are accessing an attack box’s recursive damage properties. |
rate | Integer | How long (in centiseconds) between each tick of recursive damage |
tag | Integer | User defined value. Recursive tag values are passed from attacker to recipient, but otherwise have no affect on functionality. Use this for your own purposes. |
tick | Integer | Time to apply next tick. Each time a tick is applied, this value is populated with the rate property + elapsed time. When elapsed time catches up, a tick of recursive damage is applied. |
time | Integer | Acts as both time set and expiration. When a recursive damage attack hits, the receiving entity’s recursive time property is populated with the attack box’s recursive time property + elapsed time . When elapsed time catches up, the recursive effect expires and is deleted from receiving entity. |
type | Integer | Attack Type of the damage when applied to hit points. Only used by the receiving entity. On impact, the receiving entity’s recursive type value is populated with the attack box’s primary damage type. |
Name | Type | Description |
Legacy
attack.damage.recursive.mode uses the following items. You cannot combine values.
1
= Nonlethal HP (can reduce to 1 but not below).2
= MP.3
= MP and nonlethal HP.4
= HP.5
= MP and HP.
The tag property does not exist.