Basic Tutorial: Using Event Trigger - Execute GPDL function
Spell in Effect
General:
- A GPDL trigger causes an event to execute if it returns a 1.
- Functions in the script are applied regardless of whether the event executes.
- Valid actors are $Myself() for the active character, and $Name( String ).
- Character special abilities may be set and fetched.
- Character, party, and global ASLs may be set and fetched.
- Quest stages may be set and fetched.
- Most non-combat functions are valid.
GPDL scripts offer great flexibility in determining whether an event should fire. Many parameters can be tested in a single script, which may eliminate the need for multiple chained events. It can also improve the game flow by performing tasks without player input.
For example, here is a script to use to test if a spell is in effect.
$RETURN $IS_AFFECTED_BY_SPELL( $Myself(), "My Spell" );
Script notes:
- You need a spell with a duration, in this case "My Spell".
- This script checks for a spell that effects the whole party.
Slightly more complicated, is the introduction of a $WHILE loop to check each party member for the spell effect.
$VAR index; $VAR name; index = 0; $WHILE (index <# $PARTYSIZE()) { name = $GET_CHAR_NAME(index); $IF ($IS_AFFECTED_BY_SPELL($Name(name),"My Spell")) {$RETURN 1;}; index = index +# 1; };
Script notes:
- You need a spell with a duration, in this case "My Spell".
- This script checks each member of the party for the spell effect.