• Tutorials

  • Home
  • Special Abilities Scripts

    See also Special Abilities

    Special ability scripts are called with zero parameters. Each has access to parameters via the function $GET_HOOK_PARAM(n).

    Parameter number Usage
    0 Result of previous script called for this hook.
    1 – 4 Not used....reserved for enhancements.
    5 - 9 Up to 5 parameters for particular hook scripts. The value of these parameters is described in each of the descriptions for particular hooks. Unused parameters will be initialized to empty strings. These five aparameters can be modified by the scripts using $SET_HOOK_PARAM(n). When a hook is activated, several special abilities may be examined and several scripts might be called. These five parameters are set before the call to the first script and are not modified for subsequent calls. Therefore, they may be used to communicate between several scripts.

    Hooks

    The rightmost column of this table lists the object or objects searched and the name of the script we search for. For example, 'spell/InvokeSpellOnTarget' means that we search the spell's special abilities looking for any special ability with an associated script named 'InvokeSpellOnTarget'.

    Each of the script names listed in the rightmost column of this table is called within an 'SA Context'. This 'SA Context' provides information that the script can use to examine the particular characters, spells, items, etc that might be of interest. The documentation for each hook lists the 'SA contexts' that are valid for that particular hook. For example, a hook that determines if a spell can affect a particular target might like to know details of the spell and the target. There are simple functions to retrieve Special Abilities parameters from the objects represented by the 'SA Contexts' (example $SA_SPELL_GET) and to retrieve identifiers for the objects represented by the 'SA Contexts' (Example $ITEM).

    When Why Special Abilities / Script name
    Action Initiative assigned at start of combat round Adjust initiative Combatant / AdjustInitiative
    Character / AdjustInitiative
    MonsterType / AdjustInitiative
    Aura Effect in Combat Manipulate Aura Effects AURA Hooks and FUnctions
    Combatant starts action Does Engine control combatant Combatant / AutoAction
    Drawing 3D Viewport Substitute backdrop graphics Global Special Ability / "BackdropSubstitutions"
    Party Rests Rest Period Starts; Adjust effects such as poison. Character / BeginResting
    Player selects “AIM” in combat Allow or disallow a combatant to take aim on a target. Weapon / CanAim
    Character (attacker) / CanAim
    Display Adventure Menu Should we display "CAST" as a possible menu selection. Character / CanCastSpells
    Class / CanCastSpells
    Training Hall Event: Change Class Decide which classes should be allowed when changing from a class Global Special Ability "ChangeClass"
    Class / CanChangeFromClass
    Training Hall Event: Change Class Decide which classes should be allowed when changing to a class Global Special Ability "ChangeClass"
    Class / CanChangeToClass
    Display 'View Character' menu Control 'CURE' menu option Character (Active) / CanCureOrWhatever
    Class / CanCureOrWhatever
    Give Treasure Event Should "Detect" be a menu option? Active Character / CanCharacterDetectMagic
    Display VIEW/ITEMS menu Control “Examine” option Character / CanExamineOrWhatever
    Item / CanExamineOrWhatever
    Player examines characters items Decide if player can identify an item Character / CanIdentify
    The player is going to select spells for a new character Should a spell be displayed Character / CanKnowSpell
    Spell / CanKnowSpell
    Display 'View Character' menu Control 'LAY' menu option Character (Active) / CanLayOrWhatever
    Class / CanLayOrWhatever
    Display MAGIC menu

    Party Resting
    Should we display “MEMORIZE” as a menu option.

    Should character memorize spells while resting
    Character / CanMemorizeSpells
    Class / CanMemorizeSpells
    Global_Memorize / CanMemorizeSpells
    The player attempts to Ready or UnReady an item. Decide if the action is allowed and print a message. Item / CanReady
    Display Magic Menu Control “Scribe” menu option Character (Active) / CanScribeOrWhatever
    Class / CanScribeOrWhatever
    Combat Character has option to Turn Undead Should the option “TURN” be displayed? Combatant / CanTurn
    Character View Screen Set the layout for the character view screen Global_Display / CharacterViewScreen
    When a character or combatant's status is displayed. Get the text that describes the character or combatant's condition. Character / CharDisplayStatus
    Combatant / CharDisplayStatus
    About to Display Combat Menu or combatant moving into another combatant Information Only Combatant / CombatMainMenu
    For each combatant when player selects a 'Special Action' Perform special action on each combatant and display special message. Attacker / CombatSpecialAction
    Damage Roll Adjust damage Script: ComputeDamage
    Search List:
    1 - Weapon
    2 - Target Combatant
    3 - Target Monstertype (eg. Orc)
    Spell Applied to Character Adjust modification to character attribute Script: ComputeSpellDamage
    Search List:
    1 - Spell
    2 - Target Monstertype
    3 - Target Combatant
    Monster Added to Combat Modify monster characteristics Global_CreateMonsterCombatant / CreateMonsterCombatant
    MonsterType / CreateMonsterCombatant
    Player selects 'CURE' on View Character menu Control results of 'CURE' selection Character (Active) / CureOrWhatever
    Class / CureOrWhatever
    Display Party Location and Time Allow designer to modify text, text location , and color Global_Display / Display Party Location and Time
    Display Character Stats Modify 'Class' Display Character / DisplayCharacterClass
    Display Character Stats Modify 'Race' Display Character / DisplayCharacterRace
    Attack Roll Did attack Succeed Attacker / DoesAttackSucceed
    Target / DoesAttackSucceed
    Item / DoesAttackSucceed
    Spell effects being applied to a target. Did spell work? Display text. Spell / DoesSpellAttackSucceed
    Combat Move Menu Construction Allow or prevent character movement Combatant / DrawMoveMenu
    Examining an ite Designer control of what occurs when an items EXAMINE button is selected Character / ExamineOrWhatever
    Item / ExamineOrWhatever
    3D and Area view screen Chenge the text for the direction the party is facing Global_Display / FacingText
    Player Selects “FIX” Control Spell casting Spell / FixCharacter
    At start of character's turn in combat. We want to determine the maximum number of steps the character or monster may take. Character / GetAdjMaxMovement
    Combatant / GetAdjMaxMovement
    Player examines characters items Allows player to identify an item Character / Identify
    When a character has been hit by an item in combat. Determine hitpoints to subtract. Target / GetItemTargetHitBonus
    Item / GetItemTargetHitBonus
    At the start of a combat round and during character creation. Determine the number of attacks per combat round. Character / GetNumberOfAttacks
    Combatant / GetNumberOfAttacks
    Competing | Guarding Hooks
    When a Spell is cast Perform spell actions Spell / InvokeSpellOnTarget
    During Character Creation Determine if classes with a particular baseclass is allowed based on gender Combatant / IsBaseclassAllowed
    At start of each turn of combat. Determine if the combatant is able to fight. Commonly this means not sleeping or held or whatever. Character / IsCombatReady
    Combatant / IsCombatReady
    Selecting a target Exclude 'blinked', etc Combatant / IsValidTarget
    A character joins (or re-joins) the party esigner control Combatant / JoinParty
    Character might be eligible to add spells to his 'Knowable' list. Control the number of spells and which spells can be added. Class / KnowableSpells
    Spell / KnowableSpells
    Character might be eligible to add spells to his 'Knowable' list. Control the number of spells and which spells can be added. Class / KnowableSpellsMinMax
    Player selects 'LAY' on View Character menu Control results of 'LAY' selection Character (Active) / LayOrWhatever
    Class / LayOrWhatever
    Character is allowed to add spells to his spellbook Control which spells can be added Class / LearnSpells
    Spell / LearnSpells
    Character is allowed to add spells to his spellbook Control number of spells that can be added Class / LearnSpellsNum
    3D and Area view screen Chenge the text for the party location Global_Display / LocationText
    End of Combat Designer Hook Combatant / OnEndCombat
    An Item is 'Readied' or 'un-Readied' Designer Hook Item / OnReadyor OnUnReady
    Combatant Selects 'Ready' Ready Equipment set Combatant / OnReadyCombatEquipment
    Start of Combat Designer Hook Combatant / OnStartCombat
    Combatant begins action Information only Combatant / OnStartCombatantAction
    Combatant Moves Frighten nearby opponents Combatant / OnStep
    Whenever gametime is incremented Perform time-related operations such as automatically healing party members. Global_Time / OnTimeElapsed
    Combat - Last weapon is used Designer Hook Character / OnUseLastWeapon
    Player selects a spell to cast Give the player options Spell / OverrideSpellSelection
    Player Selects Spell Target in Combat Give the player options Spell / OverrideSpellTargeting
    Spell / ProcessSpellTargetOverride
    Combat Begins Determine arrangement of party members on playing field Global_Combat / PartyArrangement
    Combat Begins Determine origin of party members on playing field, when party is facing East. Global_Combat / PartyOriginEast
    Combat Begins Determine origin of party members on playing field, when party is facing North. Global_Combat / PartyOriginNorth
    Combat Begins Determine origin of party members on playing field, when party is facing South. Global_Combat / PartyOriginSouth
    Combat Begins Determine origin of party members on playing field, when party is facing West. Global_Combat / PartyOriginWest
    Combat Begins or a monster is added to the combat Determine where the monster should be placed. Used when combat range is 'Up Close'. CombatPlacement / PlaceMonsterClose
    Combat Begins or a monster is added to the combat Determine where the monster should be placed. Used when combat range is 'Far Away'. CombatPlacement / PlaceMonsterFar
    Combat Begins or a monster is added to the combat Determine where the monster should be placed. Used when combat range is 'Near By'. CombatPlacement / PlaceMonsterNear
    After assigning character's Class Designer Hook, See CreateCharacter Hooks Global_CreateCharacter / PostClass
    During character creation process, just prior to saving. Designer Hook, See CreateCharacter Hooks Global_CreateCharacter / PostCreateCharacter
    Class / PostCreateCharacter
    Race / PostCreateCharacter
    Start of combat Designer Hook Combatant / PreStartCombat
    Damage roll Adjust Damaged based on baseclass skill Script: RangerDamageBonus
    Search List: Baseclasses that define RangerBonusLevel
    Spell Missile arrives at target Allow missile to be redirected to a different target. Character (target) / RedirectSpell
    Spell / RedirectSpell
    Player selects 'SCRIBE' on Magic menu Control results of 'SCRIBE' selection Character (Active) / ScribeOrWhatever
    Class / ScribeOrWhatever
    3D and Area view screen Chenge the text for the party searching Global_Display / SearchingText
    Selecting Character Class Remove Class from list of selectable choices Class / SelectCharacterClass
    >Selecting Character Race Remove Race from list of selectable choices Race / SelectCharacterRace
    Drawing indoor adventure screen Allow additional designer graphic to be drawn UpdateIndoorView / SpecialGraphic
    A spell is cast. Determine caster's class level Spell / SpellCasterLevel
    A spell is cast. Determine the duration of the spell's effects. Spell / SpellDuration
    Combatant considers entering a cell Decide if lingering spell blocks movement Spell / SpellLingerBlockage
    A Spell is cast Cancel effects of previous spells Spell / SpellLingeringScripts
    A spell is cast. Determine the number of targets of the spell. Spell / SpellNumTargets
    A spell is cast. Determine the range of the spell. Spell / SpellRange
    Start of each combat round SA initialization/cleanup Combatant / StartCombatRound
    --- --- System Special Abilities and Skills
    3D and Area view screen Chenge the text for the time and date Global_Display / TimeText
    Character Trains Designer Hook Character / TrainingCharacter
    Party transferred by Transfer Module Replace Text or Remove Drow Equipment Global_Transfer / TransferModule
    Combat Character selects the “TURN” option Which monsters should be turned? Combatand / TurnAttempt
    Party encounters a door that is 'Spell Locked' Does the party have a spell that will open the door? Memorized Spells / Unlock Door Spells
    Drawing 3D Viewport Substitute wall graphics Global Special Ability / "WallSubstitutions"

    Event Hooks

    When Why Special Abilities / Script name
    Tavern Event Player “Drinks” in Tavern
    Replace standard 'DRINK' text
    EventTavernDrink
    Who Tries Event Does the selected character succeed? $Event_WhoTries Hooks
    Events with a menu Modify text of menu items EventMenuText
    Events that display text Replace Event Text EventText1
    EventText2
    EventText3

    Additional GPDL functions.

    Some discussion of the terms 'ACTOR', 'Combatant ID', and so on is in order here. It is confusing to me so I imagine it will be confusing to you.

    These are special values that cannot be treated as a string. Some functions return such values and they cannot be used in any way except as parameters to functions that accept these particular values. For example:

    $VAR me;
    me = $MySelf(); /// Illegal. Using ACTOR value as if it were a string.
    -----------
    $VAR me;
    me = $IndexOf($Myself()); // Works OK because '$IndexOf' expects an ACTOR.
    -----------
    Combatant id
    Only in combat, obviously. It is the index of a combatant. This is a number from zero to one less than the number of combatants. Combatants may be added during combat and additional 'combatant id's are assigned. Combatants who die or flee retain their 'combatant id' until the combat is completely finished.
    Character id
    During combat this is identical to 'combatant id'. Outside of combat, this is a number that uniquely represents a particular character within the party. A character's id never changes as long as he remains in the party. Therefore, as characters are added and deleted, these ids are not necessarily contiguous. For example, a two-character party might have character id of 5 and 7.

    Functions that are only useful in Special Abilities Scripts

    $SA_PARAM_GET() Get parameter value for the special ability that triggered this script.
    $SA_PARAM_SET(value) Set the parameter value of the special ability that triggered this script.
    $SA_NAME() Get the name of the Special Ability that triggered this script.
    $SA_SOURCE_TYPE() The type of object that contained the Special Ability that triggered this script. For example: “COMBATANT” or “SPELL”.
    $SA_SOURCE_NAME() The name of the object that contained the Special Ability triggered this script. For example: “George of the Jungle” or “Heal Minor Wounds”.
    $SA_REMOVE() Remove the Special Ability that triggered this script
    $SA_X_GET (Name)
    $GET_X_SA (object, Name)
    $SET_X_SA (object, Name, value)
    $DELETE_X_SA (object, Name)

    'X' can be any of the following:

    CHARACTER
    COMBATANT
    ITEM
    SPELL
    SPELLGROUP
    MONSTERTYPE
    RACE
    ABILITY
    TRAIT
    CLASS

    'Name' is a string containing a special ability name.

    'object' is a string naming the object except that for characters and combatants it is an 'actor'.
    $SA_X_GET uses the script context to search for special abilities. For example, $SA_ITEM_GET will only work if the script is running in the context of an item and it will search that item for the named special ability.

    The other three functions require that you name the object (ITEM, CHARACTER, etc) that is to be searched.

    $GET_X_SA fetches the parameter value of the special ability. If no such special ability exists then the function returns the value “-?-?-”

    $SET_X_SA either replaces the parameter value of the named special ability if it already exists or inserts a new special ability with the specified parameter value.

    $DELETE_X_SA removes the special ability conpletely if it exists.

    $SA_SPELL_GET("Electrical") would search the spell in the current spell context for a Special Ability named 'Electrical' and return the parameter associated with that Special Ability. If no such special ability exits then result is "-?-?-".

    $GET_SPELL_SA (“Fireball”, “”Toast”) would search the spell name 'Fireball' for a special ability named 'Toast' and would return the associated parameter value which might be “Dark”.
    $GET_HOOK_PARAM(n) Fetch the value of Hook_Parameter[n]
    $SET_HOOK_PARAM(n, value) Set the value of Hook_Parameter[n]
    $ItemContext() The name of the item in the current SA item context
    $SpellContext() The name of the spell in the current SA spell context.
    $AttackerContext() Returns the 'actor' of the current combatant in the 'Attacker' context.
    $CombatantContext() Returns the actor in the current combatant in the 'Combatant' Context
    $TargetContext() Returns the 'actor' of the current combatant in the 'Target' context
    $CharacterContext() Returns the 'actor' of the current character in the 'Character' context
    $SpellgroupContext() The name of the spellgroup in the spellgroup context
    $MonsterTypeContext() The name of the monster type in the nonsterType context
    $RaceContext() The name of the race in the race context.
    $TraitContext() The name of the trait in the trait context
    $AbilityContext() The name of the ability in the ability context

    Functions that have nothing to do with special abilities

    $AddCombatant(monsterName, friendlyFlag) Adds a monster to the combat. Eg: $AddCombatant("Ettin",0)
    $CALL_GLOBAL_SCRIPT (SpecialAbilityName, ScriptName) This function searches the Special Ability database for the specified script belonging to the specified Special Ability and runs it as a “Subroutine” of the calling script. In particular, the hook parameters are the same hook parameters and the context is the same context. It is very much as if you entered the text of the called script into the calling script itself. This feature allows you to have one copy of complex code rather than having to duplicate it in each script that needs the code.
    The value returned by this function is the value returned by the called script. If no such script exists, then the value will be whatever is in hookParameter[0].
    The word 'GLOBAL' only means that the script belongs to a Special Ability that is defined in the database but is not necessarily attached to any character, spell, etc.
    $CastSpellOnTarget(Target, Spell, Caster)
    $CastSpellOnTargetAs(Target, Spell, Caster)
    Provides a way that a script can cast a spell on a character.
    Target and Caster are actors.
    Spell is the name of a spell.
    If a Caster is provided then that character casts the spell; otherwise, a fake, high-level Cleric-Mage is temporarily created to cast the spell.
    $COMBATANT_AVAILATTACKS(actor, value, function) Examines/Modifies the number of attacks a combatant has available in the current combat round.
    Function = 0 : Set Available Attacks to value.
    Function = 1 : Add value to Available Attacks
    Function returns new value of Available Attacks.
    So, to examine Available Attacks, you should add zero.
    $ComputeAttackDamage(attackerID, targetID) Both Ids are combatant Ids. Perform the standard ToHit and Damage computations as if the attacker had attacked the target. Returns resultant HitPoint damage.
    $DAT_Baseclass_Experience(class, level)
    $DAT_Baseclass_Level(class, experience)
    Fetches information from the 'baseclass.dat' file.
    Example:
    $DAT_Baseclass_Experience(“Cleric”,5)
    fetches the minimum experience requirement for a level 7 cleric.
    $DAT_Class_xxxxx Get values from the Items Database
    See GPDL$DAT_Class
    $DAT_Item_xxxxx Get values from the Items Database
    See GPDL$DAT_Item
    $DAT_Race_xxxxxx Get values from the Race Database.
    See GPDL$DAT_Race
    $DebugWrite(string) Simply writes the string to the engine debug file "UafErr_Engine.txt". You should supply your own linefeed characters.
    Delimited String Manipulation See: Delimited Strings
    $DrawAdventureScreen() Attempts to redraw the 3D 'adventure' screen. If called from a 'Special Graphics' hook, it will not recursively call the hook. This is to avoid infinite recursion.
    $ForEachPartyMember (SpecialAbilityName, ScriptName) For each character in the party, this function runs the script described by the two parameters. The script will run with $CharacterContext defined for that character.
    $ForEachPossession(actor, scriptName) For each item in the character' possession, this function will search the item's Special Abilities and run any scripts with the given name. The scripts will run with $CharacterContext and $ItemContext. The $ItemContext will be specific for each possession so that if the character possesses two items with the same name, the script will be run twice and each $ItemContext will indicate one item the first time and a different item the second time.
    $GET_CHAR_Ready(actor, bodyLocation, itemNumber) Gets the name of the item readied at the given body location. Because there may be several items readied at a particular body location, you must specify which – by providing an 'itemNumber'. '0' is the first item at that location, '1' is the second, etc.
    $GET_CONFIG(name) Get values from “config'txt”.
    See GPDL$GET_CONFIG
    $GET_EVENT_Attribute(depth, name) In general there is always an event active. Even while the party is wandering around the dungeon, an “Adventure” event is active, although it is not editable. Events can have a list of attributes (See the first page of the Event Editor). This function allows a script to retrieve the value of an Event Attribute. The depth parameter will generally be zero, to retrieve an attribute from the active event. On occasion one event will start another event and wait for its results. The event that is waiting is at depth one. 'name' is the name of the attribute and the function returns the value of that attribute of “-?-?-” if no such attribute is found.
    $GET_PARTY_LOCATION() Returns the party location in the form:
    “/level/x/y”
    For example “/3/14/5”
    $GET_SPELL_Level(SPELL) Get the 'level' of the spell identified by spell ID 'SPELL'
    $GET_SPELLBOOK(actor, delimiters) Gets information that the player would see on the “Memorize” page during the game: See GPDL$GET_SPELLBOOK
    $GetBaseclassLevel(index, baseclassName) Return the current of the character's baseclass. A return value of zero indicates some error.
    $GetCombatantState(actor) 'actor' is a combatant context. This function returns one of the following:
    • "ICS_None" – Waiting for player choice
    • "ICS_Casting"
    • "ICS_Attacking"
    • "ICS_Guarding"
    • "ICS_Bandaging"
    • "ICS_Using"
    • "ICS_Moving"
    • "ICS_Turning"
    • "ICS_Fleeing"
    • "ICS_Fled"
    • "ICS_ContinueGuarding" – Continue guard into new round
    $GetCombatRound() Returns the current Round number. This number starts at zero and in incremented for each round of combat. The turn number can be computed by dividing the round number by 10.
    $GetFriendly(combatantIndex, type) Actor should be a character in combat or a combatant
    type is the type of data you want.
    Each combatant starts combat with a 'basic' friendliness. Monsters are generally not friendly and party members are generally friendly. A script can adjust the friendliness of a combatant with the $SetFriendly function.

    If (type == "B") result is Basic friendliness
    0 = not friendly
    1 = friendly

    If (type == "A") result is Adjustment to friendliness
    0 = no adjustment
    1 = forced to be friendly
    2 = forced to be not friendly
    3 = toggle friendly

    If (type == "F") result is Final adjusted friendliness
    0 = not friendly
    1 = friendly

    Else result is "Huh?";
    $GetHighestLevelBaseclass(index) 'index' is party index outside of combat and combatant index when in combat. The function examines the character's baseclasses and returns the name of the baseclass with the highest level. An empty string indicates some sort of error...no such character, for example.
    $GrSet, $GrPrint, etc.... See GraphicsDraqwingFunctions
    $IntegerTable(SAName,table,value,operation) This function allow you to lookup and search tables of integers. A table is defined in a Special Ability, in an entry marked as an 'Integer Table', containing integers, one to a line. Each integer can be followed by a non-numeric character followed by a comment. For example, an experience table might look like this:
    0
    1000 ; Experience for level 1 Cleric.
    2000
    4000
    8000
    The table entries are indexed starting at zero. In the example, the entry corresponding to index 3 would be 4000.
    The function takes four parameters:
    1. Name of the Special Ability that contains the table.
    2. Name of the Table
    3. An integer value used to find the desired line of the table. (See below)
    4. A search operation. The engine only examines the first character of the operation so you can abbreviate it or misspell it if you like that sort of thing.
    The Operation
    “Index” - This operation uses the integer value as an index into the table and the function returns the value of the corresponding table entry.
    “Equal” - this operation returns the index of the table entry that equals the specified value. If none is equal then it returns -1.
    “Greater” - This operation returns the index of the first entry greater than the specified value. If none is greater then it returns the number of entries in the table.
    “Less” - This operation returns the index of the first table entry less than the specified value. If none is less, then it returns the number of entries in the table.
    Errors
    The function can return several different error codes which will be negative:
    • -1 No 'Equal' entry was found in the table
    • -2 Special Ability entry was not marked as being an 'Integer Table”
    • -3 No Special Ability entry found with the specified Table Name
    • -4 No Special Ability was found with the specified SAName.
    $IsIdentified(actor, key, num)
    • 'actor' is the character who possesses an item
    • 'key' is the item number in the character's inventory.
    • 'num' tells how the item's 'identified' status should be changed
    1. num > 0: set the identified flag for 'what' items of the same type.
    2. num < 0: clear the identified flag for '-what' items of the same type.
    3. num = 0: change nothing. Return non-zero if the item is already identified.
    When 'num' is non-zero, we attempt to change that many items. The first item changed is the item with the specified key and it counts as one item changed even if it is already set to the proper value and is therefore unchanged. Then we attempt to change identical items sequentially starting at key = 1 and, if they are not set to the proper value, we set set them to the proper value. Only those that are actually changed count against the specified number 'num'. So this function can change 'num' minus one items in addition to the item whose key is specified.
    If 'num' is non-zero, the return value is the number of items actually changed (not the number of items examined). If 'num' is zero, the return value is the status of the one item whose key is specified.
    $IsLineOfSight(x1, y1, x2, y2, unused) Combat only. Returns “” or “1” depending on whether a character can see the location (x2,y2) from (x1,y1). The unused parameter may be used someday to add flags such as “Character can see over Orcs less than two inches tall”.
    $ListAdjacentCombatants(combatantID) In Combat only. List the 'CombatantID's of all combatants that are immediately adjacent to the parameter combatant. The result is a 'Delimited String'. For Example “|2|4|5|8”.
    $Memorize(actor) Memorize selected spells
    GPDL$MODIFY_CHAR_ATTRIBUTE functions to modify the character's attributes. see GPDL$MODIFY_CHAR_ATTRIBUTES
    $MonsterPlacement(string) Place monsters in combat.
    $NextCreatureIndex(creatureIndex, filter) Given a creatureIndex, this function returns the next index or the empty string if there are no more. To get the index of the first creature, start with an empty string. The filter parameter allows you to skip over certain creatures. A value of 1 skips over dead creatures. A value of 2 skips over creatures friendly to the party. A value of 4 skips over creatures that are non-friendly. A value of 8 skips over creatures that are off the map. You add these values to skip over combinations. To skip over dead creatures and creatures off the map, specify 9. Other filter functions can be added if you find something useful. So, to look through all the living creatures you should start with an empty string and do $NextCreatureIndex until you get another empty string.

    index = $NextCreatureIndex("", 1)

    $WHILE (index != "")

    {

    index = $NextCreatureIndex(index, 1)

    };

    $REMOVE_SPELL_EFFECT(actor, SEIdentifier) See $RUN_CHAR_SE_SCRIPTS(). This function removes a 'Spell Effect' (SE) from a character.
    $RollHitPointDice(baseclassName, low, high) When a character gains a level in a baseclass, he gains Hit Points as defined in the baseclass definition. The number of hitpoints is defined as a dice roll of the form nDm+k. For example: 1D10+0 or 0D0+2. This function performs those dice rolls for each level from low to high and returns the sum of the results.
    $RUN_AREA_SE_SCRIPTS(scriptName, combatantIndex) Can only be used in combat.
    Some spells leave lingering effects on the combat map. These effects may affect the combatants who occupy the cells. A script can determine the effects on a combatant by running scripts associated with the spell that caused the lingering effects. See detailed documentation and example at $RUN_AREA_SE_SCRIPTS.
    $RUN_CHAR_PS_SCRIPTS(actor, scriptName) When a spell is cast in combat, it may take some time for the casting to actually occur. During this time, the spell is kept in the caster's 'Pending Spell' (PS) list. This function ($RUN_CHAR_PS_SCRIPTS) examines a character's Pending Spell List and, for each entry in the list it searches the associated spell for a script by the provided name. These scripts are run in the context of the spell that is pending and in the context of the combatant who originally cast the spell.
    f the return value of this function contains the letter 'R' then the spell is 'R'emoved from the combatant's Pending Spell List and the combatant continues to participate in the combat as if the casting time had expired but the spell fizzled.
    $RUN_CHAR_SCRIPTS(creatureIndex, scriptName) See $IsLegalCreature for the meaning of 'creatureIndex'. This function searches the specified creature's Special Abilities for scripts of the given name. Any that are found are run until one of them returns a value starting with 'N'. If none returns an 'N' then, in combat mode, the associated combatant's Special Abilities are similarly searched and scripts are run in the same way. The scripts that are found share the Hook Parameters with the script containing this function call. Thus you can pass parameters to the called scripts and receive results back via the $GET/SET_HOOK_PARAM functions. The value returned by this function is currently undefined.
    $RUN_CHAR_SE_SCRIPTS(actor, scriptName) Certain spells attach a 'Spell Effect' (SE) to the target of the spell. This function examines each such SE attached to a character, finds the spell that caused the SE, and runs any of that spell's scripts with the provided name. These scripts run in the context of the spell and of the character to which the SE is attached. Hook parameter[5] will be set to an identifier that uniquely identifies the SE, so that, for example, the script could use $REMOVE_SPELL_EFFECT() to remove the SE from the character.
    $SelectSpell(actor , string) Provide the name of the spell to select.
    $SET_CHAR_Ready(actor, bodyPosition, itemName) Readies the named item at the given bodyPosition. 'itemName' may be blank to unready any item at that position.
    $SET_PARTY_XY(x, y) Sets the Party location on the current level. To change the party's level, you can put a Transfer Event somewhere on the same level and $Set_PARTY_XY to the location of that Transfer Event.
    This function works under the following circumstances:
    • When executed in a GPDL Function used as an 'Event Trigger' in an Event Chain.
    • When executed within a Logic Block Event
    • When executed in a 'Begin Script' for a Spell that is 'CAST' while the party is 'ENCAMPED'.
    • When executed in the 'Begin Script' of a Spell attached to an Item that a PC 'USES' in Combat.
    In all cases, the party is moved as quickly as possible without further processing of the event chain or the spell. For example, a 'Heal' spell that contains this function in its Begin Script will do no healing.
    If the Party is moved to a cell containing a Transfer Event and you do not want the player to see that cell before being transferred, then the Transfer Event should have the 'Activate when Party attempts entry' option selected.
    $SetFriendly(combatantID, value) Value
    0=No modification (default)
    1=Unconditionally friendly
    2=Unconditionally un-friendly
    3=Toggle default friendly
    any other=no change returns old value
    $SetMemorizeCount(actor, spell,adj) Sets the 'Memorized' count for a particular spell in a particular character's spellbook. The “adj” parameter can be an absolute number or a number preceeded by a plus or minus sign to add or subtract from the current count. The result of the function is the new memorized count, which will be limited to non-negative values. If the character does not have such a spell, then the function will return “-1” (minus one).
    $SetWall (level,x,y,facing,value)
    $SetDoor
    $SetOverlay
    $SetBackground
    $SetBlockage

    $GetWall(level,x,y,facing)
    $GetDoor
    $GetOverlay
    $GetBackground
    $GetBlockage
    Provide 'overrides' for the wall, door, etc that is displayed in a dungeon cell. For the Wall, Door, and Overlay the value is a wall-slot number. The $SetDoor will cause the door associated with the specified wall-slot to be displayed.

    The levels are numbered starting with 1.
    The 'facing' is 0=North, 1=East, 2=South, and 3=West.
    The x and y values will be taken modulo the width and height of the level. Thus, if x is negative one, it will be interpreted as the rightmost cell on the level. This makes it easier to supply overrides for both sides of a wall because you need not worry about the level actually having the topology of a torus. The 'direction' is modulo 4 so that placing overrides on both sides of a wall is easier (simply add 4 to get to the other side).
    The value is a number from 0 to 255 representing the wall/door/overlay/backdrop slot in the respective editor, starting with 0 in the upper left corner. The blockage list is in the wall editor and starts with 0 representing 'Open'.

    If you provide a value equal to 255, the override will be removed and the display will return to that provided by the editor.

    When using $GetBackground/Blockage/Door/Overlay/Wall, a value returned of 255 indicates that no override has been used in that square and direction.
    $SkillAdj(actor, skill, id, type, value) actor identifies the character to modify.
    skill is the name of the skill to be adjusted. For example: “BackstabMultiplier”.
    id is an arbitrary string you can use to identify the adjustment. A skill may have many adjustments and the id would be used to identify a particular adjustment to be added/modified/removed and to determine the order that the adjustments are made.
    type defines the type of adjustment to be made to the skill
    '+' : the value will be added to the skill.
    '-' : the value will be subtracted from the skill
    '*' : The skill will be multiplied by the value
    'D' : the adjustment will be deleted.
    '% : the adjustment is a percentage adjustment. For example 110 would cause the skill to be increased by 10 percent.
    '=' : the skill will be set to an absolute value.
    'F' : Compute the 'F'inal skill value after all modifications and adjustments have been made.
    'A' : return the named 'A'djustment for a particular id. This option does not check to see that such a skill exists or if basclass-level or ability-score adjustments exist. It only retrieves the adjustment created with the specified id. If no such 'named' adjustment exists, the return value is “noSkill”.
    'B' : Return the highest skill value before any modifications or adjustments. If there is none, then it returns an empty string.
    value is the numeric adjustment to be made.
    The function returns the skill value for the 'B', 'F', and 'A' cases and otherwise an empty string. A special reservered value of “NoSkill” is returned when the character has no such skill. If this special value is intepreted as an integer, it will result in a numeric value of zero.
    A character can have any number of skills. Generally, the skills are defined in the baseclass data (for example, a thief might have a 'PickPocket' skill). The baseclass and race databases can also define modifiecations to the skill's value based on ability scores and baseclass levels. When a skill is required, the engine finds the highest skill value definition among the character's baseclasses and race (There are exceptions for some system-defined skills. For example, MaxLevel$SYS$ uses the smallest value.). It then applies (in this order) the baseclass, race, and ability adjustments, first from the race database and then from the baseclass data bases in alphabetical order (again, exceptions may exist for system-defined skills. For example, MaxLevel$SYS only uses one baseclass for multi-baseclass characters.). Then the final value is subject to modification as a result of adjustments specified by $SkillAdj(). If there are several $SkillAdj() adjustments for a single skill, then they are performed in alphbetical order of the associated 'id' identifiers.
    $SkillAdj() can add a skill to a character that he would otherwise not have. The skill need not appear in the baseclass or race database. The skill value will then be assumed to be zero before the adjustment is applied.
    Adjustments for a character must be unique in the skill name and id. If $SkillAdj() attempts to add an adjustment for a skill/id that already exists, then the old type and value are replaced.
    $SLEEP(milliseconds) Everything stops for the given amount of time.
    $SpellAdj(actor,school,id,first,last,p,b) For an individual character, we compute the number of spells he can cast in each spell school and at each spell level. For each individual character and each spell school and for each spell level within that school you want this number to be temporarily or permanently modified.
    So we provide a two-dimensional matrix for each character....
    The row names the spell school.
    There is a column for each spell level.
    Each entry gives the adjustment to the computed number of spells allowed for that school and spell level. And each entry might have several modifications (A red magic wrench might halve an entry and a blue magic wrench might double it; canceling each other).
    This function that provides seven parameters.
    The Character (actor)
    The spell School (or "*" for all)
    An Identification (In case there are multiple modifications for a single school/level)
    The first spell level to modify.
    The last spell level to modify.
    Two constants (p and b) defining a linear
    transformation (999999,n to remove
    the n-th layer of transformation with the specified Identification.)
    newValue = p*oldValue/100 + b

    p= percent
    b = bonus

    To double use: a=200 b=0
    To halve use: a=50 b=0
    To disable use: a=0 b=0
    To add 3 use: a=100 b=3
    To subtract one use: a=100 b=-1
    To set to 5 use: a=0 b=5
    To remove oldest adjustment use: a=999999 b=0

    Adjustments would be made in alphabetic order of Identification and first-in/first-out (adjustments with the same identification get done in the same order they were created).
    $TeleportCombatant(id, x, y) In combat only. 'id' is the 'combatant id' of the combatant to teleport to location (x,y). Eg: $TeleportCombatant($IndexOF($Myself()),12,22)