• Tutorials

  • Home
  • Intermediate Example: Bug Report for Dispel Magic

    Action

    Result

    ===== spell: Entangle|Ranger =====

    SA: spell_Entangle

    --script: CharDisplayStatus

    --script: InvokeSpellOnTarget

    --script: SpellLingerBlockage

    ***** TEMPLAR40 casts Entangle|Ranger on Giant Rats *****

    We run:

    ..spell: Entangle|Ranger

    --SA: spell_Entangle = druid

    ----script: InvokeSpellOnTarget

    • attaches IsEntangled0 to the target

    ----script: CharDisplayStatus

    • sets display to "" so as not to show the SE and the status for the now attached SA

    ----script: SpellLingerBlockage

    • returns "N" is target has SA IsEntangled1

    --SE: Entangle|Ranger

    monster: Giant Rat

    ..SA: IsEntangled0

    ----script: ComputeDamage

    ----script: Dispell

    ----script: IsCombatReady

    ..SE: Entangled|Ranger

    ***** TEMPLAR40 casts Entangle|Ranger on Warrior40 (Paragon40) *****

    We run:

    ..spell: Entangle|Ranger

    --SA: spell_Entangle = druid

    ----script: InvokeSpellOnTarget

    • attaches IsEntangled1 to the target

    ----script: CharDisplayStatus

    • sets display to "" so as not to show the SE and the status for the now attached SA

    ----script: SpellLingerBlockage

    • returns "N" is target has SA IsEntangled1

    --SE Entangle|Ranger

    combatant: Warrior40 (Paragon40)

    ..SA: IsEntangled1

    ----script: CharDisplayStatus

    ----script: Dispell

    ----script: GetAdjMaxMovement

    ..SE: Entangled|Ranger

    ***** When the Giant Rat is about to attack *****

    We run:

    ..monster: GiantRat

    --SA:IsEntangled0

    ----script:IsCombatReady

    • That script returns "N"

    ----script: CharDisplayStatus

    • "IsEntangled0"

    monster: Giant Rat

    ..SA: IsEntangled0

    ----script: ComputeDamage

    ----script: Dispell

    ----script: IsCombatReady

    ----script: CharDisplayStatus

    ..SE: Entangled|Ranger

    ***** When it's Warrior40s turn *****

    We run:

    ..combatant: Warrior40

    --SA:IsEntangled1

    ----script:  GetAdjMaxMovement

    • movement is reduced by half

    ----script:  CharDisplayStatus

    • "IsEntangled1"

    combatant: Warrior40 (Paragon40)

    ..SA: IsEntangled1

    ----script: CharDisplayStatus

    ----script: Dispell

    ----script: GetAdjMaxMovement

    ..SE: Entangled|Ranger

    -----script: Dispell SE


    ===== spell: Dispell =====

    ..SA: dispell =

    ----script: InvokeSpellOnTarget

    ***** AVATAR40 casts Dispell on Giant Rats *****

    We run:

    ..spell: Dispell

    --SA: dispell

    ----script: InvokeSpellOnTarget

    • It runs target (Giant Rat) scripts named "Dispell"; IsEntangled0 contains "Dispell" which runs and removes the SA named 'IsEntangled0'.

    • It runs the target's SE scripts named 'Dispell SE' using $RUN_CHAR_SE_SCRIPTS(). So the 'Entangle' script by that name removes the SE

    monster: Giant Rat

    ..SA: none

    ..SE: none

    And here are the scripts themselves:

    name = dispell
    [InvokeSpellOnTarget] = $VAR targ;
    targ = $IndexOf($TargetContext());
    
    $DEBUG("Dispelling" + $GET_CHAR_NAME( $IndexOf($TargetContext()) ));
    
    $RUN_CHAR_SCRIPTS( targ, "Dispell" );
    $RUN_CHAR_SE_SCRIPTS ($TargetContext(), “Dispell SE”);
    name = Global_Dispell
    [Dispell] = $DEBUG("Global Dispell");
    $SA_REMOVE();
    $REMOVE_SPELL_EFFECT($CharacterContext(), $GET_HOOK_PARAMETER(5));
    name = IsEntangled0
    [CharDisplayStatus] = $SET_HOOK_PARAM( 7, "IsEntangled0" );
    $RETURN 1;
    [ComputeDamage] = $RETURN $GET_CHAR_HITPOINTS($IndexOf($TargetContext())) +# 1;
    [Dispell] = $CALL_GLOBAL_SCRIPT( "Global_Dispell", "Dispell" );
    [GetAdjMaxMovement] = $RETURN "0";
    [IsCombatReady] = $VAR duration;
    duration = $SA_PARAM_GET();
    $IF ($GET_PARTY_TIME() >=# duration)
            {
                    $SA_REMOVE();
                    $RETURN "Y";
            }
    $ELSE {$RETURN "N";};
    name = IsEntangled1
    [CharDisplayStatus] = $SET_HOOK_PARAM( 7, "IsEntangled1" );
    $RETURN 1;
    [Dispell] = $CALL_GLOBAL_SCRIPT( "Global_Dispell", "Dispell" );
    [GetAdjMaxMovement] = $RETURN $SA_PARAM_GET();
    name = spell_Entangle
    [CharDisplayStatus] = $SET_HOOK_PARAM( 7,"");
    $SET_HOOK_PARAM( 6,"");
    $RETURN 1;
    [Dispell] = $CALL_GLOBAL_SCRIPT( "Global_Dispell", "Dispell" );
    [InvokeSpellOnTarget] = $VAR tgt;
    tgt = $IndexOf($TargetContext());
    $IF ($GET_CHAR_SAVEVSSP(tgt) ># $RANDOM(20))
      {$SET_COMBATANT_SA($TargetContext(),"IsEntangled0",$GET_PARTY_TIME() +# 10);
    $DEBUG("spell invokes Entangled0");}
    $ELSE
      {$SET_COMBATANT_SA($TargetContext(),"IsEntangled1",$GET_CHAR_MAXMOVE(tgt) /# 2);
    $DEBUG("spell invokes Entangled1");};
    [SpellLingerBlockage] = $IF ($GET_COMBATANT_SA($CombatantContext(),"IsEntangled1") != "-?-?-"){$RETURN "N";};

    The 'Dispell' works well for removing the 'Entangled' Special Abilities from the affected combatants but it leaves the engine's hard-wired Spell Effects attached to the affected combatants. Also, the display still shows the lingering effect in the form of 'wavering vines'. These are the problems:

    1. We need a way of removing the engine's Spell Effects for those combatants within the range of the Dispell|Ranger' spell.
    2. We need a way to remove the lingering spell-effect graphics. The 'Dispell|Ranger' spell has a area circle effect. It would be nice to remove only that portion of the lingering graphics. If we cannot do that, then the next best thing is to remove them all.