• Tutorials

  • Home
  • $RUN_AREA_SE_SCRIPTS

    Some spells leave lingering effects on the combat map. These effects can affect combatants who occupy the affected cells of the map. To illustrate the principle, we will provide an example:

    Let us start with a spell that leaves lingering effects on the map. Our spell will be called "Adrenaline Cloud". It effects a circular area of the map and each cell that is affected will display a small clock face to indicate that the occupant of that cell can do twice as much in the same amount of time.

    The effects of adrenaline on a combatant are twofold:
    He can move twice as far per turn. This effect will be accomplished with the hook named “GetAdjMaxMovement”.
    He can attack twice as many times per turn. This effect will be accomplished with the hook named "GetNumberOfAttacks".

    Each of these hooks ("GetAdjMaxMovement" and "GetNumberOfAttacks") will use this function ($RUN_AREA_SE_SCRIPTS) to find any lingering spell effects in the combatant's location and make adjustments to the movement and attack numbers. As Follows:
    $SET_HOOK_PARAMETER(6, [default speed of movement or attack]);
    $RUN_AREA_SE_SCRIPTS("AdjustSpeeds", [combatant index]);
    "[default speed of movement or attack]" is the number of steps or number of attacks before any adjustments. For example “6” or “12”.
    "[combatant index\" is the index of the combatant whose spped is to be adjusted. For example, "$IndexOf($CharacterContext)".

    For each spell that has a lingering effect on the cell that the combatant is occupying, the engine will search that spell's Special Abilities for a script by the specified name ("AdjustSpeeds" in this case) and will run any such script in the context of the calling script ("GetAdjustMaxMovement" or "GetNumberOfAttacks" in this case) plus the context of the spell causing the lingering effect on the map. In this case, such a script might look like this:

    $VAR speed
    speed = $GET_HOOK_PARAMETER(6);
    speed = speed *# 2;
    $SET_HOOK_PARAMETER(6, speed);