• Tutorials

  • Home
  • ComputeDamage

    Just prior to subtracting hitpoints from a combatant as a result of an attack, we set hookParameter[0] to the empty string. Then we search for scripts named “ComputeDamage” in the following places:

    1. The Weapon (if any)
    2. The Target's Monster Type (eg: orc)
    3. The Target Combatant.
    Each script can examine hook parameter[0] and return a value that will replace hook parameter[0]. If, after all scripts have been called, hook parameter[0] is non-empty, then its value will be used as the damage.

    Parameters

    Parameter [5] = contains the damage as computed by the engine. If the script returns any value then that value is subtracted from the target's hitpoints.
    Parameter [6] = contains a "1" if the damage is considered 'non-lethal'.
    Parameter [7] = used to replace the normal "Rolls and hits for points" message. There are actually two messages: "Rolls and hits" and "Rolls and backstabs". Hook parameter 7, if non-empty, will replace whichever of the two would otherwise be displayed.

    Context

    Character (attacker - $Attacker)
    Character (target - $Target)
    Item (weapon - $Item) - If the combatant has no weapon then $ItemContext() will refer to an item with an empty name and no Special Abilities.