PST Script Actions

This action can be used to do nothing - many characters walk around randomly or stand in one place doing nothing:

IF
  True()
THEN
  RESPONSE #50
    RandomWalk()
  RESPONSE #50
    NoAction()
END

NoAction() is also commonly used as a hanging (dummy) action in targeting blocks. This is a matter of good practice rather than necessary. The NoAction() action will never be run since the block always returns false, but having an action in the scripting block allows scripting programs to accurately check for errors.

IF
  See(NearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
    NoAction()
END

This action can be used to control another creature. A creature referenced as the result of SetTokenObject() is not a valid target for the ActionOverride() action. The following is from the Irenicus cutscene after leaving his abode in chapter 1.

IF
  True()
THEN
  RESPONSE #100
    CutSceneId(Player1)
    Wait(1)
    FadeToColor([20.0],0)
    Wait(2)
    JumpToPoint([869.340])
    MoveViewPoint([909.346],INSTANT)
    ActionOverride(Player2,JumpToPoint([825.370]))
    ActionOverride(Player3,JumpToPoint([886.384]))
    ActionOverride(Player4,JumpToPoint([952.386]))
    ActionOverride(Player5,JumpToPoint([987.362]))
    ActionOverride(Player6,JumpToPoint([1005.404]))
    Face(10)
    ActionOverride(Player2,Face(10))
    ActionOverride(Player3,Face(10))
    ActionOverride(Player4,Face(8))
    ActionOverride(Player5,Face(6))
    ActionOverride(Player6,Face(6))
    ActionOverride("Anomen",JumpToPoint([909.346]))
    ActionOverride("Anomen",Face(10))
    Wait(1)
    FadeFromColor([20.0],0)
    Wait(2)
    ActionOverride("Anomen",StartDialogueNoSet(Player1))
END

This action is used to set waypoints for a creature to move between; it is commonly used from area scripts to script barmaids moving in a route around the bar. The point parameter represents the X and Y coordinates of the waypoint to add.

IF
  Global("KRNEWWAY","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("KRNEWWAY","GLOBAL",1)
    AddWayPoint([100.200])
    AddWayPoint([200.300])
END

The following script, showing how to move to waypoints preset in the area file, is taken from the barmaid at the Copper Coronet.

IF
  Detect([PC])
  Allegiance(Myself,NEUTRAL)
  Global("quest1","LOCALS",0)
THEN
  RESPONSE #100
    MoveToObject("Way3")
    ActionOverride("DRUNK2",DisplayStringHead(Myself,4592)
    Wait(1)
    DisplayStringHead(Myself,4604)
    Wait(2)
    MoveToObject("Way4")
    Wait(1)
    MoveToObject("Way3")
    DisplayStringHead(Myself,4611)
    Wait(2)
    SetGlobal("quest1","LOCALS",1)
END

This action instructs the active creature to continually attack the target, i.e. the active creature will not switch targets until its target is dead.

IF
  See([EVILCUTOFF])
  Class(LastSeenBy(),MAGE_ALL)
  !InParty(LastSeenBy())
THEN
  RESPONSE #100
    Attack(LastSeenBy())
END

This action instructs the active creature to backstab the specified target. Note that some creatures (notably dragons and golems) are immune to being backstabbed, that not all weapons are valid to backstab with, and that the active creature must be hidden to make a successful backstab. This action causes the game to crash. As long as the correct conditions are met, the first attack of a hidden creature will count as a backstab attack.

IF
  See(NearestEnemyOf())
  Range(NearestEnemyOf(),4)
  !Race(NearestEnemyOf(),DRAGON)
  !Race(NearestEnemyOf(),GOLEM)
  !InParty(NearestEnemyOf(Myself))
  OR(2)
    StateCheck(Myself,STATE_INVISIBLE)
    StateCheck(Myself,STATE_IMPROVEDINVISIBLITY)
THEN
  RESPONSE #100
    Attack(NearestEnemyOf())
END

This action is used to create a creature - either an NPC, a neutral creature or an enemy. NewObject is the filename of the creature to create, Location is the coordinates to create the creature at ([x.y] format) and direction being the direction the creature is facing (0-15, 0 being south and the facing values increasing as the character turns clockwise). Note that a coordinate of [-1.-1] will create the creature next to the active creature.

This script is from the area script for the Copper Coronet (AR0406) and creates extra guards when the Player is discovered in the off limits area.

IF
  Global("CopperGuards","GLOBAL",1)
THEN
  RESPONSE #100
    CreateCreature("ccguard1",[2338.412],14)
    CreateCreature("ccguard2",[2318.457],14)
    CreateCreature("ccguard1",[2749.793],6)
    CreateCreature("ccguard2",[2791.831],6)
    CreateCreature("ccguard1",[1981.762],14)
    CreateCreature("ccguard1",[1286.1500],14)
END

See Dialogue.

This action instructs the active creature to initiate dialog with the target creature. Dialog will not be initiated if the creature using this action has been assigned a dialog that has all top level conditions returning false.

IF
  GlobalTimerExpired("Yeslick","GLOBAL")
  Global("FLOODED","GLOBAL",0)
THEN
  RESPONSE #100
    Dialogue([PC])
END

This action instructs the active creature to drop the specified item at the specified location (relative to the active creature). The active creature must have the item to be dropped. Note that a coordinate of [-1.-1] will drop the item next to the active creature.

IF
  Clicked([ANYONE])
  Range(LastTrigger,12)
THEN
  RESPONSE #100
    DropItem("SCRL1B",[345.1210])
END

This action is used to change the allegiance of the active creature to enemy (making them hostile to the PC). This example script, from a peasant, will turn the creature hostile if it is attacked.

IF
  AttackedBy([GOODCUTOFF],DEFAULT)
  Allegiance(Myself,NEUTRAL)
THEN
  RESPONSE #100
    Enemy()
END

This action instructs the active creature to equip the specified item. The item needs to be in one of the creatures quickslots.

IF
  HasItem("Sw1h01",Myself)
  !HasItemEquipedReal("Sw1h01",Myself)
THEN
  RESPONSE #100
    Equip("Sw1h01",Myself)
END

This action instructs the active creature to enter Detect Traps modal state. This action can be used for any creature (not just thieves) though success in detecting traps is dependent on points in the Find Traps skill.

IF
  ActionListEmpty()
  !Exists([EVILCUTOFF])
  !ModalState( Myself,DETECTTRAPS)
  OR(2)
  !StateCheck(Myself,STATE_INVISIBLE)
  !StateChe ck(Myself,STATE_IMPROVEDINVISIBILITY)
THEN
  RESPONSE #100
    FindTraps()
END

IF
  See([ANYONE])
  !HasItem("Sw1h01",Myself)
  HasItem("Sw1h01",LastSeenBy ())
THEN
  RESPONSE #100
    MoveToObject(LastSeenBy())
    GetItem("Sw1h01",LastSeenBy())
END

This action instructs the active creature to give the specified item (parameter 1) to the specified target (parameter 2). The active creature must possess the item to pass it. The sample script makes uses of modified IDS files (action, instant, trigger and svtiobj) though such modification are not necessary to use the GiveItem action itself.

IF
  HPPercentLT(Myself,40)
  !HasItem("potn52",Myself)
THEN
  RESPONSE #100
    GlobalShout(3015)
    SetGlobal("KRNEEDITEM","GLOBAL",1)
END

IF
  Heard([GOODCUTOFF],3015)
  HasItem("potn52",Myself)
  HPPercentGT(Myself,40)
  Global("KRNEEDITEM","GLOBAL",1)
THEN
  RESPONSE #100
    MoveToObject(LastHeardBy())
    GiveItem("potn52",LastHeardBy())
    SetGlobal("KRNEEDITEM","GLOBAL",0)
END

This action is used in conjunction with the ReceivedOrder trigger, and works in a similar way to a global shout. The action passes a numeric order to the specified creature. Only one creature at a time responds to an order, and creatures to not detect their own orders.

IF
  See([EVILCUTOFF])
  OR(3)
  Class(Myself,FIGHTER_ALL)
  Class(Myself,RANGER_ALL)
  Class(Myse lf,PALADIN_ALL)
THEN
  RESPONSE #100
    GiveOrder([PC.0.0.THIEF_ALL],100)
END

IF
  ReceivedOrder(Myself,100)
  Class(Myself,THIEF_ALL)
THEN
  RESPONSE #100
    RunAwayFrom([EVILCUTOFF],120)
    Hide()
END

This action acts similar to shout, but does not accept values. The range of the Help action is slightly larger than the default visual radius of NPCs.

IF
  HitBy([ANYONE],CRUSHING)
THEN
  RESPONSE #50
    Help()
    Attack(NearestEnemyOf(Myself))
  RESPONSE #50
    RunAwayFrom(NearestEnemyOf(Myself),75)
END

IF
  Help([0.0.GIBBERLING])
THEN
  RESPONSE #100
    Attack(NearestEnemyOf(LastHelp(Myself)))
END

IF
  See(NearestEnemyOf(Myself))
THEN
  RESPONSE #100
    Help()
    AttackReevaluate(NearestEnemyOf(Myself),30)
END

This action instructs the active creature to attempt to Hide in Shadows. This action can be used for any creature (not just thieves) though success in hiding is dependent on points in the Stealth skill. A hidden creature is treated as STATE_INVISIBLE.

IF
  !See([EVILCUTOFF])
  OR(2)
  !StateCheck(Myself,STATE_INVISIBLE)
  !StateCheck(Myself,STATE_IMPROVEDINVISIBLITY)
THEN
  RESPONSE #100
    Hide()
END

This action adds the active creature to the party. If the party is currently full the ‘select party members’ dialog is shown. JoinParty clears the ActionQueue of the active creature.

IF
  See([PC])
  Global("KRJOINPARTY","GLOBAL",0)
THEN
  RESPONSE #100
    JoinParty()
END
19 JoinPartyEx(I:JoinGroup*Boolean) Variants: [PST/PSTEE] [BG1/BG2/BGEE/IWD1/IWD2]

This action is a leftover from BG1 - it does not work in PST.

This action causes the active creature to leave the party. This action calls DropInventory() as part of its execution.

IF
  HappinessLT(Myself,-299)
THEN
  RESPONSE #100
    ChangeAIScript("",DEFAULT)
    SetLeavePartyDialogFile()
    LeaveParty()
    EscapeArea()
END

This action instructs the active creature to move to the specified object. The action does not update the current position of the actor, saved in ARE files. The example script shows the creature moving towards the nearest enemy.

IF
  See(NearestEnemyOf())
  !Range(NearestEnemyOf(),4)
THEN
  RESPONSE #100
    MoveToObject(NearestEnemyOf())
END

This action causes the active creature to move to the specified coordinates. The action will update the position of creatures as stored in ARE files (first by setting the coordinates of the destination point, then by setting the coordinates of the current point once the destination is reached).

IF
  True()
THEN
  RESPONSE #100
    MoveToPoint([526.1193])
    Wait(3)
    RandomWalk()
    Wait(5)
    RandomWalk()
END

This action causes the active creature to move randomly around the screen.

IF
  HPPercentLT(Myself,15)
THEN
  RESPONSE #100
   Panic()
END

This action instructs the active creature to attempt to pickpocket the target. This action can be used for any creature (not just thieves) though success in pick pocketing is dependent on points in the Pickpocket skill. Note that a failed pickpocket attempt is treated as an attack, hence the Attacked() trigger will return true if a pickpocket attempt is failed.

IF
  See([ANYONE])
  OR(2)
  Class(Myself,THIEF_ALL)
  Class(Myself,BARD_ALL)
THEN
  RESPONSE #100
    PickPockets([ANYONE])
END

This action will cause the active creature to play the specified sound. Both WAV and WAVC files can be played by the action. Sound is played through the sound effects channel. Volume fades if the viewport is moved further away from the active creature.

IF
  True()
THEN
  RESPONSE #100
    PlaySound("CAS_M06")
END

This action causes the active creature to guard the specified point, staying within the specified range.

IF
  True()
THEN
  RESPONSE #100
    ProtectPoint([1738.543],10)
END

This action causes the active creature to attempt to disarm the specified trap. This action can be used for any creature (not just thieves) though success in disarming is dependent on points in the Disarm Trap skill.

IF
  See("Trap01")
  Class(Myself,THIEF_ALL)
THEN
  RESPONSE #100
    RemoveTraps("Trap01")
END

This action causes the active creature to run away from the specified creature, for the specified time. The time parameter is measured in AI updates, which default to 15 updates per second. Occasionally, fleeing creatures stop to attack another creature.

IF
  HPPercentLT(Myself,30)
THEN
  RESPONSE #100
    RunAwayFrom(LastAttackerOf(Myself),180)
END
30 GlobalSet(S:Name*,S:Area*,I:Value*) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action sets a variable (specified by name) in the scope (specified by area) to the value (specified by value). See the variable type appendix for details on variables.

IF
  Global("KRINAREA","AR0400",0)
THEN
  RESPONSE #100
    CreateCreature("ORC01",[1738.543],0)
    SetGlobal("KRINAR EA","AR0400",1)
END

This action causes the active creature to cast the specified spell at the target object. The spell must currently be memorised by the caster, and may be interrupted while being cast. The caster must meet the level requirements of the spell.This action may not be reliable.

IF
  See([EVILCUTOFF])
  !InParty([EVILCUTOFF])
  !HasBounceEffects([ EVILCUTOFF])//like cloak of mirroring or spell deflection
  !HasImmunityEffects([EVILCUTOFF])//
  HaveSpell(WIZARD_MAGIC_MISSILE)
  OR(2)
  !StateCheck([EVILCUTOFF],STATE_INVISIBLE)
  !StateCheck([EVILCUTOFF],STATE_IMPROVEDINVISIBLITY)
  CheckStatLT([EVILCUTOFF], 30,RESISTMAGIC)
  !Race([EVILCUTOFF],LICH)
  !Race([EVILCUTOFF],RAKSHASA)
THEN
  RESPONSE #100
    Spell([EVILCUTOFF],WIZARD_MAGIC_MISSILE)
END

This action turns any undead creatures within range of the active creature. This action can be used for any creature (not just paladins/clerics) though success in turning is dependent on the Turn Undead level of the creature, which is only calculated for paladins and clerics. The chance to successfully turn undead is based on creatures level and class. Paladins turn at 2 levels less than clerics of the same level. An undead creature will be destroyed/controlled if its level is more than 7 levels below the active creatures turn undead level. An undead creature may be turned (i.e. forced to flee) is its level is equal to, or up to 4 levels below, the active creatures turn undead level.

IF
  See([EVILCUTOFF])
  General([EVILCUTOFF],UNDEAD)
  LevelGT(Mysel f,12)
  OR(2)
  Class(Myself,PALADIN_ALL)
  Class(Myself,CLERIC_ALL)
THEN
  RESPONSE #100
    Turn()
END

This action instructs the active creature to use the specified item (object) on the specified target (target). The ability number (i.e. extended header index) to use may be specified. This action is most often used to allow use of potions and wands. The item to be used must exist in the active creature’s inventory (though it need not be equipped).

IF
  HPPercentLT(Myself,50)
  HasItem("potn52",Myself)
THEN
  RESPONSE #100
    DisplayStringHead(Myself,46150) //quaffs a potion
    UseItem("potn52",Myself)
    Continue()
END

See UseItem.

See UseItem.

This action instructs the script parser to continue looking for actions in the active creatures action list. This is mainly included in scripts for efficiency. Continue should also be appended to any script blocks added to the top of existing scripts, to ensure correct functioning of any blocks which include the OnCreation trigger. Continue may prevent actions being completed until the script parser has finished its execution cycle. Continue() must be the last command in an action list to function correctly.

IF
  See(NearestEnemyOf())
  !InParty(NearestEnemyOf())
THEN
  RESPONSE #100
    AttackOneRound(NearestEnemyOf())
    Continue()
END

This action instructs the active creature to play the swing weapon animation. Note that some objects do not have this animation.

IF
  True()
THEN
  RESPONSE #100
    Swing()
END

This action instructs the active creature to play the recoil animation. Note that some objects do not have this animation.

IF
  TookDamage()
THEN
  RESPONSE #100
    Recoil()
END

This action instructs the active creature to “play dead”, i.e. to lay on the ground, for the specified interval (measured in AI updates per second (AI updates default to 15 per second). If used on a PC, the player can override the action by issuing a standard move command.

IF
  HPPercentLT(Myself,30)
THEN
  RESPONSE #100
    PlayDead(240)
END

This action can used to make the active creature follow the creature specified by the leader parameter, maintain a relative position determined by the offset parameter.

IF
  CombatCounter(0)
  Allegiance(Myself,NEUTRAL)
THEN
  RESPONSE #100
    Formation("QSLMAGE1",[-2.-5])
END

This action instantly moves the active creature to the specified point.

IF
  True()
THEN
  RESPONSE #100
    ClearAllActions()
    FadeToColor([20.0],0)
    MoveViewPoint([1738.543],INSTANT)
    JumpToPoint([1738.543])
    Wait(1)
    CreateVisualEffectObject("SPCLOUD1",Player1)
    Wait(1)
    CreateVisualEffectObject("SPFLESHS",Player1)
END

This action scrolls the view point (i.e. the area of the current map being displayed onscreen) to the target point ([x.y] at the specified speed. Speeds are taken from scroll.ids (VERY_FAST is equivalent to normal walking speed).

This action scrolls the view point (i.e. the area of the current map being displayed onscreen) to the target object ([x.y] at the specified speed. Speeds are taken from scroll.ids (VERY_FAST is equivalent to normal walking speed). The example script is from a cutscene; CUT03C.bcs.

IF
  True()
THEN
  RESPONSE #100
    CutSceneId(Player1)
    FadeToColor([20.0],0)
    Wait(1)
    ActionOverride("SPY406",DestroySelf())
    MoveViewObject(Myself,INSTANT)
    Wait(1)
    FadeFromColor([20.0],0)
    ActionOverride("cpchick1",DestroySelf())
    ActionOverride("cpchick2",DestroySelf())
    Wait(1)
    ActionOverride("Surly",StartDialogueNoSet(Player1))
END

This action changes the assigned script file for the active creature. The new script name is specified in the scriptfile parameter. The level parameter dictates the script level to change - values are from scrlev.ids. Scripts can be set for any scriptable object (container, creature, door etc.), but are not persisted.

IF
  See([EVILCUTOFF.0.DOG])
THEN
  RESPONSE #100
    ChangeAIScript("DOGFIGHT",DEFAULT)
END

This action starts a timer local to the active creature. The timer is measured in seconds, and the timer value is not saved in save games. The timer is checked with the TimerExpired trigger.

IF
  Global("KRDEAD","LOCALS",0 )
  Dead("Shadra01")
THEN
  RESPONSE #100
    StartTimer("SPAWNMON",12)
    SetGlobal("KRDEAD","LOCALS",1)
END

IF
  Timer Expired("SPAWNMON")
  Global("KRDEAD","LOCALS",1)
THEN
  RESPONSE #100
    CreateCreature("Grothgar",[700.700],0)
END

This action is used as a form of script communication, in conjunction with the Trigger() trigger. The action has the same range as GiveOrder and affects only one creature at a time. Note that the LastTrigger() object does not get set after receiving a trigger.

This action causes a delay in script processing. The time is measured in seconds.

IF
  See(Player1)
  See(Player6)
THEN
  RESPONSE #100
    MoveToObject(Player1)
    Wait(2)
    MoveToObject(Player6)
    Wait(4)
END

This action resets the fog of war for the area the active creature is in.

IF
  True()
THEN
  RESPONSE #100
    UndoExplore()
END

This action removes the fog of war for the area the active creature is in.

IF
  True()
THEN
  RESPONSE #100
    Explore()
END

This action changes the time of day. The time parameter is taken from time.ids, though a direct number can be specified. The example script is from when Irenicus leaves his dungeon.

IF
  Global("AmaWaukeen","GLOBAL",1)
THEN
  RESPONSE #100
    DayNight(MIDNIGHT)
    SetGlobal("AmaWaukeen","GLOBAL",2)
    FadeToColor([20.0],0)
    CreateCreature("shthass1",[877.898],7)
    StartCutSceneMode()
    StartCutScene("cut24a")
END

This action changes the weather. The action only works in outdoors areas that have weather enabled in the ARE file. Values for the weather parameter are from weather.ids. Note that the fog weather type does not work.

IF
  Global("KRSTORM","GLOBAL",0)
THEN
  RESPONSE #100
    Weather(RAIN)
    SetGlobal("KRSTORM","GLOBAL",1)
END

This action calls lightning from the sky against the specified target.

IF
  True()
THEN
  RESPONSE #100
    CutSceneId("DRUID12a")
    CallLightning("Orc05")
    CallLightning("Orc06")
END

This action will sequentially change the visual representation of armour the active creature is wearing. The action cycles from the lowest (none) to the highest (plate mail) armour level.

70 NIDSpecial1() does not work

This action is a holdover from the non-interactive Baldur’s Gate Demo. It is non-functional in the game.

71 NIDSpecial2() does not work
72 NIDSpecial3() does not work
73 NIDSpecial4() does not work
74 NIDSpecial5() does not work
75 NIDSpecial6() does not work
76 NIDSpecial7() does not work
77 NIDSpecial8() does not work
78 NIDSpecial9() does not work
79 NIDSpecial10() does not work
80 NIDSpecial11() does not work
81 NIDSpecial12() does not work

This action creates the specified item (resref) on the active creature. The usage parameters determine the number of items created or the number of charges on the item, depending on the item type being created. The example script is from AR0602.

IF
  Global("BG1Pantaloons","GLOBAL",0)
  PartyHasItem("MISC47")
THEN
  RESPONSE #100
    SetGlobal("BG1Pantaloons","GLOBAL",1)
    ActionOverride("Picture1",CreateItem("MISC47",0,0,0))
    Continue()
END

This action is similar to Wait(), it causes a delay in script processing. The time is measured in AI updates (which default to 15 per second)

IF
  See(NearestEnemyOf())
THEN
  RESPONSE #100
    DisplayStingHead(Myself,50712)// Attack!! Attack!!
    SmallWait(120)
    Attack(NearestEnemyOf())
END

This action instructs the active creature to face the specified direction. Directions run from 0-15 with 0 being south and moving clockwise. Negative values cause object to rotate continuously.

IF
  Global("BeholderBehavior","LOCALS",0)
  See([PC])
  HPGT(Myself,65)
THEN
  RESPONSE #100
    FaceObject([PC])
    ForceSpell([PC],BEHOLDER_CHARM_PERSON)
    Continue()
END

This action causes the active creature to walk randomly. The example script is blbear.bcs; it instructs bears to walk rather than fight if the nearest enemy is a druid.

IF
  Delay(5)
  See(NearestEnemyOf(Myself))
  Class(NearestEnemyOf(Myself),DRUID)
  NumCreatureGT([ENEMY],1)
THEN
  RESPONSE #100
    RandomWalk()
END

This action sets whether a creature can be interrupted while carrying out script actions.

IF
  See(Player2)
  !Range(Player2,4)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    MoveToObject("Player2")
    SetInterrupt (TRUE)
END

This action instructs the active creature to protect the specified creature (i.e. attack any enemies of the creature), while staying within the specified range. The example script is from IWD, 4003bsg.bcs and controls the zombies guarding Presio.(4003BSG.bcs).

IF
  True()
THEN
  RESPONSE #100
    ProtectObject("Presio",100)
END

This action instructs the active creature to leave the current area.

This action instructs the active creature to select the specified slot, and use the ability in the extended header specified by the ability parameter. The example script is from ankheg.bcs.

IF
  See(NearestEnemyOf(Myself))
  Range(NearestEnemyOf(Myself),5)
  Delay(12)
THEN
  RESPONSE #40
    SelectWeaponAbility(SLOT_WEAPON,0)
    RunAwayFrom(NearestEnemyOf(Myself),45)
    AttackReevaluate(NearestEnemyOf(Myself),15)
  RESPONSE #60
    SelectWeaponAbility(SLOT_WEAPON1,0)
    AttackReevaluate(NearestEnemyOf(Myself),15)
END

The signature of this action is not listed in the action.ids file provided with the game. This action causes the active creature to leave the area using the trigger region identified by the specified parameter. The parameter is the internal global ID of the region.

This action instructs the active creature to attack creatures with the same specific value as the target creature.

This action applies the benefits of resting (i.e. healing, restoring spells and restoring abilities) to the active creature. The action does not play the rest movie or advance game time. The example script is from cut28a.bcs.

IF
  True()
THEN
  RESPONSE #100
    CutSceneId(Player1)
    StorePartyLocations()
    FadeToColor([30.0],0)
    Wait(1)
    Rest()
    ActionOverride(Player2,Rest())
    ActionOverride(Player3,Rest())
    ActionOverride(Player4,Rest())
    ActionOverride(Player5,Rest())
    ActionOverride(Player6,Rest())
(cut short for brevity)

This action instructs the active creature to attack the target, without sounding a battlecry.

This action gives the appearance of flying - the active creature is able to pass over impassable areas. The example script is from randfly.bcs.

IF
  True()
THEN
  RESPONSE #100
    RandomFly()
END

This action is used internally by action 100 (RandomFly); it moves the active creature towards the given point for the specified amount of time.

This action sets the morale of the active creature.

This action alters the morale of the target by the specified amount. The change amount can be positive or negative. The example script is from bardsh.bcs.

IF
  AttackedBy([GOODCUTOFF],DEFAULT)
  Allegiance(Myself,NEUTRAL)
  Global("PlayerAttackedActors","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("PlayerAttackedActors","GLOBAL",1)
    MoraleInc(Myself,-5)
    Enemy()
END

This action alters the morale of the target by the specified amount. The change amount can be positive or negative.

This action instructs the active creature to attack the specified target for one round.

IF
  See(NearestEnemyOf())
THEN
  RESPONSE #100
    AttackOneRound(NearestEnemyOf())
END

This action is used to shout the specified number. The action is used in conjunction with the Heard trigger. A silenced creature cannot shout.

IF
  StateCheck(Myself,STATE_POISONED)
THEN
  RESPONSE #100
    Shout(4010)
END
IF
  Heard([GOODCUTOFF],4010)
  HaveSpell(CLERIC_SLOW_POISON)
THEN
  RESPONSE #100
    Spell(LastHeardBy(),CLERIC_SLOW_POISON)
END

This action instructs the active creature to move a certain distance from its current location; i.e. the point is relative to the creatures current location.

This action, in its first form, instructs the active creature to leave the current area, either by walking, or, if the path is blocked, by simply disappearing. In the actions second form the action functions as a combination of EscapeAreaDestroy() and MoveBetweenAreas(). The parameters are similar to MoveBetweenAreas(), in that it takes in all the same information, but unlike MoveBetweenAras(), the character will search for the nearest travel trigger, move to that, then execute his movement to the specified area. If he cannot find a travel trigger, he will execute the movement.

The action is uninterruptable; actions listed this one in a script may not execute as intended.

IF
  HPPercentLT(Myself,35)
THEN
  RESPONSE #100
    EscapeArea()
END

This action alters the specified variable, in the specified scope, by the amount indicated. The amount can be positive or negative. Variables in the local scope cannot be changed with this action.

IF
  See([EVILCUTOFF]
  !Specifics(LastSeenBy(),160)
  !Inparty(LastSeenBy())
  !Allegiance(LastSeenBy([GOODCUTOFF])
THEN
  RESPONSE #100
    ChangeSpecifics(LastSeenBy(),160)
    IncrementGlobal("KR_MONSTER_COUNTER_ALIVE","GLOBAL",1)
END

This action changes the current area. NOTE: Unlike other games, PST does not take a second string argument!

IF
  Global("MissionPackSave","GLOBAL",0)
THEN
  RESPONSE #100
    TextScreen("toscst")
    ActionOverride(Player1,LeaveAreaLUA("AR1000",[3048.831],4))
    ActionOverride(Player2,LeaveAreaLUA("AR1000",[3055.917],4))
    ActionOverride(Player3,LeaveAreaLUA("AR1000",[2990.913],4))
    ActionOverride(Player4,LeaveAreaLUA("AR1000",[2992.812],4))
    ActionOverride(Player5,LeaveAreaLUA("AR1000",[3079.737],4))
    ActionOverride(Player6,LeaveAreaLUA("AR1000",[3005.742],4))
END

This action removes the active creature from the game. No death variable is set. Global creatures like joinable NPCs, familiars and recipients of MakeGlobal are still accessible by script name and are not fully removed. The example script is from the Irenicus cutscene at the beginning of the game.

IF
  True()
THEN
  RESPONSE #100
    CutSceneId("CSCowl7")
    ForceSpell("CSIren",0)
    Wait(1)
    DestroySelf()
END

This action is used by the engine internally. An object id is expected in the in1 parameter.

This action causes the active creature to cast the specified spell at the target object. The spell need not currently be memorised by the caster, and will not be interrupted while being cast. The caster must meet the level requirements of the spell. The example script is from suelfw9.bcs.

IF
  Global("Scene2","AR2800",2)
  See([ENEMY])
  Global("Fight","LOCALS",2)
THEN
  RESPONSE #100
    IncrementGlobal("Fight","LOCALS",1)
    ForceSpell([ENEMY],WIZARD_POWER_WORD_SLEEP)
END

This action causes the active creature to cast the specified spell at the specified point ([x.y]). The spell need not currently be memorised by the caster, and will not be interrupted while being cast. The caster must meet the level requirements of the spell.

IF
  Global("AndrisBehavior","AR1009",0)
  See(NearestEnemyOf(Myself))
THEN
  RESPONSE #100
    ForceSpellPoint([2002.1554],WIZARD_DIMENSION_DOOR)
    Wait(1)
    SpellNoDec(NearestEnemyOf(Myself),WIZARD_CONFUSION)
    SetGlobal("AndrisBehavior","AR1009",1)
END

This action sets a global timer. The timer is checked by the GlobalTimerExpired trigger or GlobalTimerNotExpired trigger.

IF
  GlobalTimerExpired("Areana","GLOBAL")
  !Exists("TorLobo")
  !Dead("TorLobo")
THEN
  RESPONSE #100
    ActionOverride("Areana",DestroySelf())
    CreateCreature("TORLOB",[349.474],0)
END

This action takes a single instance of the specified item from the party (unless the item exists in a stack, in which case the entire stack is taken). Characters are checked in current party order. The item is transferred to the inventory of the active creature. If there are multiple calls to TakePartyItem() in the same block, each with the same item specified, only one call will actually remove an item (on each execution of the block). All slots are checked; inventory slots are checked in the following order

0, 2, 4, 6, 8, 10, 12, 14
1, 3, 5, 7, 9, 11, 13, 15

The example is from AR0516.bcs.

IF
  Global("ThrallOrb","GLOBAL",2)
  PartyHasItem("MISC7Y")
THEN
  RESPONSE #100
    TakePartyItem("MISC7Y")
END

This action takes a single instance of the specified item from the party (unless the item exists in a stack, in which case the entire stack is taken). The item is transferred to the inventory of the active creature. The example is from AR0516.bcs.

IF
  Global("ThrallOrb","GLOBAL",2)
  PartyHasItem("MISC7Y")
THEN
  RESPONSE #100
    TakePartyItem("MISC7Y")
END

This action causes the active creature to drop all its inventory items. The example script is from the cutscene with Mazzy fighting the ogre; cut16a.bcs.

IF
  True()
THEN
  RESPONSE #100
    CutSceneId(Player1)
    FadeToColor([20.0],0)
    Wait(1)
    ActionOverride("mazzy",DropInventory())
    Wait(2)
(cut short for brevity)

This action starts a cutscene; a cinematic sequence that removes the GUI and player control. The cutscene parameter is the script name to run. The second variant can enable condition checking (trigger evaluation, off by default) when the second parameter is set to TRUE.

The example script is from cutscene BDCUT17B.bcs and shows how they can be reused. With StartCutSceneEx("BDCUT17B",TRUE) it executes only one script block depending on the specified conditions. With StartCutSceneEx("BDCUT17B",FALSE) it will execute both blocks regardless of condition.

IF
  GlobalLT("bd_cut17b_cycle","bd1000",10)
  !NearLocation(Player1,4535,550,30)
THEN
  RESPONSE #100
    CutSceneId("bdcutid")
    IncrementGlobal("bd_cut17b_cycle","bd1000",1)
    Wait(1)
    StartCutSceneEx("bdcut17b",TRUE)
END

IF
  OR(2)
    GlobalGT("bd_cut17b_cycle","bd1000",9)
    NearLocation(Player1,4535,550,30)
THEN
  RESPONSE #100
    CutSceneId("bdcutid")
    SmallWait(10)
    SetCutSceneBreakable(FALSE)
    SetGlobal("BD_CUTSCENE_BREAKABLE","GLOBAL",0)
    SetAreaScript("",OVERRIDE)
    SmallWait(5)
    SetGlobalTimer("bd_mdd016b_timer","bd1000",TWO_ROUNDS)
    ActionOverride("bdcaelar",StartDialogNoSet(Player1))
END

This action starts a cutscene. Player control is removed, and scripts stop running. Note that actions already in the action list are not cleared without an explicit call to ClearAllActions. The example script is from are0507.bcs.

IF
  Global("AmsiHouse","GLOBAL",3)
  !Dead("amsi")
THEN
  RESPONSE #100
    ClearAllActions()
    StartCutSceneMode()
    ActionOverride("amsi",StartDialogueNoSet(Player1))
END

This action ends a cutscene, and restores the GUI and player control. The example script is from ar0800.bcs.

IF
  GlobalGT("BodhiJob","GLOBAL",0)
  Global("Movie02","GLOBAL",0)
THEN
  RESPONSE #100
    ClearAllActions()
    SetGlobal("Movie02","GLOBAL",1)
    StartCutSceneMode()
    FadeToColor([30.0],0)
    Wait(2)
    EndCutSceneMode()
    TextScreen("SCENE04")
    SmallWait(1)
    StartCutSceneMode()
    StartCutScene("Movie02a")
END

This action clears any queued actions for all creatures in the area. The example script is from ar0507.bcs.

IF
  Global("AmsiHouse","GLOBAL",3)
  !Dead("amsi")
THEN
  RESPONSE #100
    ClearAllActions()
    StartCutSceneMode()
    ActionOverride("amsi",StartDialogueNoSet(Player1))
END
124 Berserk() does not work

This action deactivates the target creature. The creature remains in the area, but is removed from play - i.e. it is invisible and cannot be interacted with.

This action activates the target creature. The creature is returned to play - i.e. it is visible and can be interacted with.

This action is used internally in a cutscene to make the object with the specified death variable perform actions. The action appears to only work from a creature script. The example script is from cut01.bcs.

IF
  True()
THEN
  RESPONSE #100
    CutSceneId(Player1)
    LeaveAreaLUAPanic("AR0700","",[2753.868],4)
    LeaveAreaLUA("AR0700","",[2753.868],4)
(cut short for brevity)

129 AnkhegHide() does not work

This action causes the active creature to turn in a random direction. The example script is from waitturn.bcs.

IF
  True()
THEN
  RESPONSE #100
    RandomTurn()
END
Note:
  • This action will never stop, (unless interrupted in specific situations), and thus never leave the action list.
  • Executes Wait() for a random amount of time, (1–40 seconds), if the creature goes off-screen.
  • Waits 1–10 seconds between each evaluation.

This action causes the target creature to die, dropping any droppable items they are carrying.

IF
  Global("KillArntra04","AR0307",1)
THEN
  RESPONSE #100
    SetGlobal("KillArntra04","AR0307",2)
    ActionOverride("arntra04",Face(10))
    Wait(1)
    ForceSpell("arntra04",CLERIC_FLAME_STRIKE)
    Wait(1)
    Kill("arntra04")
    CreateCreature("Arntra05",[3213.485],0)
END

This action plays a sound linked to the object.

IF
  Delay(2)
  HPPercentLT(Myself,35)
THEN
  RESPONSE #95
    Shout(HURT)
    Continue()
  RESPONSE #5
    VerbalConstant(Myself,HURT)
    Shout(HURT)
    Continue()
END

This action clears the action list of the specified object. The example script is from ar2400.bcs.

IF
  GlobalTimerExpired("udWaitOgreDoor","GLOBAL")
  Global("HaveOgreOpenDoor","AR2400",0)
  Global("udGithDead","AR2400",0)
  !Global("udMind","GLOBAL",30)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    SetGlobal("HaveOgreOpenDoor","AR2400",1)
    ClearActions(Player1)
    ClearActions(Player2)
    ClearActions(Player3)
    ClearActions(Player4)
    ClearActions(Player5)
    ClearActions(Player6)
    SetInterrupt(TRUE)
    StartCutSceneMode()
    StartCutScene("Cut44i")
END

This action instructs the active creature to attack the target for the specified time (ReevaluationPeriod) which is measured in AI updates (which default to 15 per second).The script will then run again, checking for other true conditions.

IF
  See([EVILCUTOFF])
  Range(LastSeenBy(),4)
  !InParty(LastSeenBy())
  !Allegiance(LastSeenBy(Myself),GOODCUTOFF)
  !Class(LastSeenBy(Myself),INNOCENT)
  InWeaponRange(LastSeenBy())
  HasWeaponEquiped()
THEN
  RESPONSE #100
    AttackReevaluate(LastSeenBy(),30)
END

This action locks the screen on the active creature, preventing the screen from being scrolled away. The action only works when executed by a creature (its own script or via ActionOverride).

IF
  CombatCounter(0)
THEN
  RESPONSE #100
    LockScroll()
END

This action unlocks the screen if it has been locked.

IF
  OR(2)
  HotKey(H)
  !CombatCounter(0)
THEN
  RESPONSE #100
    UnlockScroll()
END

This action instructs the active creature to start the specified dialog with the specified target. The dialog can be initiated from a distance and must have at least one state with all its top level conditions true else it will not initiate. The active creature has its dialog file permanently set to the file specified by the DialogFile parameter.

IF
  See([PC])
  NumTimesTalkedTo(0)
THEN
  RESPONSE #100
    StartDialog("andris",[PC])
END

This action sets the dialog file of the active creature to the specified file. SetDialogue(“”) will set the dialog file to nothing.

IF
  AttackedBy([GOODCUTOFF],DEFAULT)
  Global("KR_CHANGE_DIALOG","LOCALS",0)
THEN
  RESPONSE #100
    SetDialogue("")
    SetGlobal("KR_CHANGE_DIALOG","LOCALS",1)
END

This action creates the item specified by the resref parameter on the creature specified by the object parameter, with quantity/charges controlled by the usage parameters.

IF
  GlobalTimerExpired("dwVith","GLOBAL")
  Global("dwVithal","GLOBAL",3)
THEN
  RESPONSE #100
    CreateVisualEffectObject("SPPLANAR","udvith")
    Wait(2)
    Activate("udvith")
    GiveItemCreate("scrl8z","udvith",1,1,0)
    GiveItemCreate("scrl9g","udvith",1,1,0)
    GiveItemCreate("scrl9e","udvith",1,1,0)
    GiveItemCreate("scrl9v","udvith",1,1,0)
    GiveItemCreate("scrl9r","udvith",1,1,0)
    SetGlobal("dwVithal","GLOBAL",4)
END

This action gives the party a sum of gold corresponding to the given global variable. The gold amount is deducted from the active creature. The example script will give the party 50gp.

IF
  Global("Cash","GLOBAL",50)
THEN
  RESPONSE #100
    GivePartyGoldGlobal("Cash","GLOBAL")
END

This action is used by the engine internally. An object id is expected in the in1 parameter.

This action will open the specified door. If the door is locked the creature must possess the correct key. Some doors central to the plot doors cannot be opened. The active creature can stick on this action if it fails.

IF
  See("Door01"
  OpenState("Door01",FALSE)
  !See([GOODCUTOFF])
  !TargetUnreachable("Door01")
THEN
  RESPONSE #100
    MoveToObjectNoInterrupt("Door01")
    Unlock("Door01" )
    OpenDoor("Door01")
END

This action closes the specified door. The example script is from ar0300.bcs.

IF
  OR(2)
  Global("LyrosJob","GLOBAL",3)
  Dead("lyros")
  Exists("Rylock")
  Global("RylockLeavesHarperDoor","AR0300",0)
THEN
  RESPONSE #100
    SetGlobal("RylockLeavesHarperDoor","AR0300",1)
    CloseDoor("DOOR0308")
    Lock("DOOR0308")
    ActionOverride("Rylock",EscapeArea())
END

This action instructs the active creature to attempt to pick the lock of the specified object. This action can be used for any creature (not just thieves) though success in picking the lock depends on points in the Open Locks skill.

This action causes the active creature to change animation to the specified animation (values from animate.ids)

IF
  !InPartyAllowDead("Aerie")
  !Dead("Aerie")
  !GlobalGT("AerieTransform","GLOBAL",0)
  Global("Aerie","AR0607",0)
  Global("KalahI","AR0607",0)
THEN
  RESPONSE #100
    MoveGlobal("Ar0607","Aerie",[318.378])
    ChangeEnemyAlly("Aerie",NEUTRAL)
    SetGlobal("Aerie","AR0607",1)
    ActionOverride("Aerie",Polymorph(MAGE_FEMALE_ELF))
    ActionOverride("Aerie",SetBeenInPartyFlags())
    SetGlobal("AerieTransform","GLOBAL",2)
END
146 PolymorphEx(I:AnimationType*Animate,I:RangeModes*) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action removes one memorised indtance of the specified spell from the spellbook of the active creature. The spell can be an innate ability, a priest spell or a wizard spell, but must be listed in spell.ids.

IF
  Global("KR_ANTI_PALADIN_CHANGE","LOCALS",1)
THEN
  RESPONSE #100
    RemoveSpell(PALADIN_LAY_ON_HANDS)
    RemoveSpell(PALADIN_DETECT_EVIL)
    RemoveSpell(PALADIN_PROTECTION_FROM_EVIL)
    SetGlobal("KR_ANTI_PALADIN_CHANGE","LOCALS",2)
END
Note: Scripts can handle RES filenames with +, Dialogs and the console cannot. Same with the ~, `, ', @, $, ^, and & characters, maybe some more.
  • This action will default to a spell matching the first 7 characters in Dialogs/Console IF the 8th character isn’t valid.

This action is miscoded in the default action.ids file (the number 0 should be the capital letter O). When corrected, this action causes the active creature to attempt to bash the specified door.

This action instructs the active creature to equip the most damaging melee weapon from those available in the quickslots. Damage is calculated on the THAC0 bonus and damage - special bonuses versus creature types and elemental damages are not checked.

IF
  See([EVILCUTOFF])
THEN
  RESPONSE #100
    EquipMostDamagingMelee()
    Attack([EVILCUTOFF])
END

This action starts the specified store with the specified object.

IF
  Global("KRSTART_STORE","LOCALS",1)
THEN
  RESPONSE #100
    StartStore("Tem4802",LastTalkedToBy())
END

This action displays the strref specified by the StrRef parameter in the message window, attributing the text to the specified object.

IF
  HasItem("potn52",Myself)
  HPPercentLT((),50)
THEN
  RESPONSE #100
    UseItem("potn52",Myself)
    DisplayString(Myself,46150)
END

This action changes the IDS identifiers for the active creature to the values specified. The object parameter must be in the IDS object form (i.e [EA.GENERAL.RACE.CLASS.SPECIFIC.GENDER.ALIGN]). If parameters are missing, they will default to 0. If a symbolic object is passed, all identifiers will be cleared and the IDS identifier bytes will be filled. ChangeAIType(NearestEnemyOf(LastSeenBy(LastTalkedToBy(LastTrigger())))) would zero Allegiance, General, Race, Class, Specific, Gender, and Alignment, set spec 1 to “Myself” (the object.ids value, 1), 2 to LastTrigger, 3 to LastTalkedToBy, 4 to LastSeenBy, and 5 to NearestEnemyOf.

This action changes the EA status of the target creature to the specified value. Values are from ea.ids.

IF
  Global"KR_ENEMYALLY_CHANGE","LOCALS",0)
THEN
  RESPONSE #100
   SetGlobal"KR_ENEMYALLY_CHANGE","LOCALS",1)
    ChangeEnemyAlly(Myself,NEUTRAL)
END

This action changes the general status of the target creature to the specified value. Values are from general.ids.

IF
  Global"KR_GENERAL_CHANGE","LOCALS" ,0)
THEN
  RESPONSE #100
    SetGlobal"KR_GENERAL_CHANGE","LOCALS",1)
    ChangeGeneral(Myself,UNDEAD)
END

This action changes the race of the target creature to the specified value. Values are from race.ids.

IF
  Global"KR_RACE_CHANGE","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal"KR_RACE_CHANGE","LOCALS",1)
    ChangeRace(Myself,DRAGON)
END

This action changes the class of the target creature to the specified value. Values are from class.ids.

IF
  Global"KR_CLASS_CHANGE","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal"KR_CLASS_CHANGE","LOCALS",1)
    ChangeClass(Myself,FIGHTER)
END

This action changes the specific status of the target creature to the specified value. Values are from specific.ids. The action produces inconsistent results when used on player characters in multiplayer games. The specific value is represented by one byte, and so is limited to values 0-255. The example script assigns a script to a newly created simulacrum.

IF
  See([ALLY])
  !InParty(LastSeenBy(Myself))
  !Gender(LastSeenBy(Myself),SUMMONED)
  !General(LastSeenBy(Myself),ANIMAL)
  !General(LastSeenBy(Myself),MONSTER)
  !General(LastSeenBy(Myself),UNDEAD)
  !General(LastSeenBy (Myself),GIANTHUMANOID)
  !Race(LastSeenBy(Myself),ELEMENTAL)
  !Race(LastSeenBy(Myself),MEPHIT)
  !Race(LastSeenBy(Myself),IMP)
  !HasItem("IMOENHP1&q uot;,LastSeenBy(Myself))
  !HasItem("MINHP1",LastSeenBy(Myself))
  !Specifics(LastSeenBy(Myself),100)
THEN
  RESPONSE #100
    DisplayStringHead(LastSeenBy(Myself),26234) // 'Simulacrum'
    ActionOverride(LastSeenBy(Myself), ChangeAIScript("gbSim",DEFAULT))
    ChangeSpecifics(LastSeenBy(Myself),100)
END

This action changes the gender of the target creature to the specified value. Values are from gender.ids. The example script changes the gender of summoned creatures to neither, to bypass the 5 concurrent summoned creatures limit.

IF
  See([ALLY])
  !InParty(LastSeenBy(Myself))
  Gender(LastS eenBy(Myself),SUMMONED)
  !Specifics(LastSeenBy(Myself),3001)
THEN
  RESPONSE #100
    ChangeGender(LastSeenBy(),NEITHER)
    ChangeSpecifics(LastSeenBy(Myself), 3001)
END

This action changes the alignment of the target creature to the specified value. Values are from align.ids.

IF
  Global("KR_ALIGN_CHANGE","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("KR_ALIGN_CHANGE","LOCALS",1)
    ChangeAlignment(LastSeenBy(Myself),CHAOTIC_GOOD)
END

This action causes the active creature to cast the specified spell at the target object. The spell is applied instantly; no casting animation is played. The spell cannot be interrupted. For the RES version of the action, the spell name can not consist of only numbers, should be written in upper case and should be no more than 7 characters long. Note that for normal spellcasting the probability dice values for effects are rolled for each spell, whereas spells applied in the same scripting block by ApplySpell use a single dice value. The example script is used to mimic a contingency from mage18y.bcs.

IF
  See(NearestEnemyOf(Myself))
  Global("Prep","LOCALS",0)
THEN
  RESPONSE #100
    ApplySpell(Myself,WIZARD_STONE_SKIN)
    ApplySpell(Myself,WIZARD_SPELL_TRAP)
    ApplySpell(Myself,WIZARD_MIRROR_IMAGE)
    ApplySpell(Myself,WIZARD_SPELL_TURNING)
    ApplySpell(Myself,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)
    ApplySpell(SixthNearestEnemyOf(Myself),WIZARD_MONSTER_SUMMONING_4)
    SetGlobal("Prep","LOCALS",1)
END

This action is used to increment the chapter, and display a text screen (specified by the resref parameter - a 2DA file). The example script is from ar1803.bcs.

IF
  Dead("Davaeorn")
  Global("Chapter","GLOBAL",4)
THEN
  RESPONSE #100
    RevealAreaOnMap("AR0900")
    IncrementChapter("Chptxt5")
    AddJournalEntry(15839,USER)
END

This action sets the reputation to the specified value.

IF
  Global("KRGOODDEED","GLOBAL",0)
THEN
  RESPONSE #100
    ReputationSet(20)
    SG("KRGOODDEED",1)
END

This action alters the reputation by the specified value (which can be either negative or positive). The example script is from baldur.bcs.

IF
  InParty("Viconia")
  Global("ViconiaJoinedParty","GLOBAL",0)
THEN
  RESPONSE #100
    ReputationInc(-2)
    SetGlobal("ViconiaJoinedParty","GLOBAL",1)
END

This action gives (or takes if negative) the specified amount of experience to the party. The XP amount is distributed among all current living party members. The example script is from ar1300.bcs.

IF
  OpenState("Bridge01",TRUE)
  Global("BridgeOpen","GLOBAL",0)
  !Dead("Torgal")
THEN
  RESPONSE #100
  SetGlobal("BridgeOpen","GLOBAL",1)
  DisplayString(Myself,'The drawbridge has been lowered.')
  CreateCreature("KPCAPT03",[2400.1592],6)
  CreateCreature("KPSOLD03",[2425.1676],6)
  CreateCreature("KPSOLD04",[2371.1754],6)
  CreateCreature("KPSOLD05",[2315.1805],6)
  CreateCreature("TROLGI01",[2391.1592],0)
  CreateCreature("TROLGI02",[2282.1742],0)
  CreateCreature("KPYUAN01",[2251.1731],0)
  AddexperienceParty(29750)
(cut short for brevity)
164 AddPartyexperience(I:XP*) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action adds experience to the party, with the amount corresponding to a global variable.

IF
  Global("MyXP","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("MyXP","GLOBAL",50)
    AddExperiencePartyGlobal("MyXP","GLOBAL")
END

This action sets the number of times the active creature has been talked to (by player characters). The example script is from ar0103.bcs.

IF
  Global("BrielbaraMove","GLOBAL",1)
  !Exists("Brielbara")
  !Dead("Brielbara")
THEN
  RESPONSE #100
    CreateCreature("BRIELB",[418.376],0)
    ActionOverride("Brielbara",SetNumTimesTalkedTo(1))
END

This action is used to a play a movie (MVE file). The example script is from ar108.bcs.

IF
  Global("EnteredPalace","GLOBAL",0)
THEN
  RESPONSE #100
    StartMovie("PALACE")
    SetGlobal("EnteredPalace","GLOBAL",1)
END

This action is used to initiate banter between NPCs. The action must be added to action.ids before it can be used. The example script is from edwin.bcs.

IF
  InParty(Myself)
  Gender(Myself,FEMALE)
  InParty("Aerie")
  See("Aerie")
  !Dead("Aerie")
  !StateCheck("Aerie",STATE_SLEEPING)
  Range("Aerie",10)
  CombatCounter(0)
  !Range(SecondNearest([PC]),10)
  Global("EdwinW1","LOCALS",0)
THEN
  RESPONSE #100
    Interact("Aerie")
END

This action reveals an area on the worldmap. The action must be added to action.ids before it can be used.

IF
  Dead("Davaeorn")
THEN
  RESPONSE #100
    RevealAreaOnMap("AR13EN")
END

This action gives the specified amount of gold to the party. The active creature need not have the gold in its “money variable”. A negative amount will remove gold from the active creature. The action must be added to action.ids before it can be used.

IF
  NumTimesTalkedTo(30)
THEN
  RESPONSE #100
    SetNumTimesTalkedTo(31)
    GiveGoldForce(300)
END

This action sets the open/closed graphic of a tile in a WED file.

This action adds an entry into the journal. The entry parameter is the strref to add, the JourType parameter is ignored by the engine (it should specify the type of entry with values are from jourtype.ids). The action must be added to action.ids before it can be used. The example script is from ar0511.bcs.

IF
  Dead("JanGith1")
  Dead("JanGith2")
  Global("ThumbSeeker","GLOBAL",2)
  Global("HiddenJournal","AR0511",0)
THEN
  RESPONSE #100
    SetGlobal("HiddenJournal","AR0511",1)
    AddJournalEntry(34726,QUEST)
END

This action instructs the active creature to search for the nearest travel trigger point for the specified time (measured in second) before giving up and just disappearing. The action must be added to action.ids before it can be used.

This action instructs the active creature to move to the specified object. Once the active creature reaches the object, it will follow the target if it moves. This behaviour continues until a different action is issued or until the target creature travels between areas. The action must be added to action.ids before it can be used.

This action causes the active creature to cast the specified spell at the target object. The spell need not currently be memorised by the caster, and will not be interrupted while being cast. The spell is cast instantly (i.e. with a casting time of 0). The caster must meet the level requirements of the spell. The action must be added to action.ids before it can be used. The example script is from suelfw9.bcs.

This action changes the active creature’s selection circle to purple - making it unselectable. Creatures made unselectable stop processing scripts. The action must be added to action.ids before it can be used.

This action removes all instances of the specified item from the party. The items are placed in the inventory of the active creature. Items contained in containers (e.g. Bag of Holding) are not taken. The action must be added to action.ids before it can be used.

190 FinalSave(I:Slot*) Variants: [BG1/IWD1/IWD2] [PST] [BG2/BGEE/PSTEE]

This action saves the game in the specified save slot, with a blank area preview image and a name of “Final-Save”. The action must be added to action.ids before it can be used.

200 SetAnimState(O:Object*,I:Anim*Animstat) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action sets the animation state of the specified creature to the specified animation (from animate.ids).

201 SetGlobalTint(I:Red*,I:Green*,I:Blue*) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

N/T. Only works when run from creature scripts.

202 IncrementGlobalOnce(S:Name1*,S:Area1*,S:Name2*,S:Area2*,I:Val*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

203 IncrementKillStat(I:StatID*Killstat) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action increments the specified kill stat (1 through 49) by one.

204 FadeToBlack() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

205 FadeFromBlack() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

206 Plunder(O:Target*) does not work Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

207 SavePlace() Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action stores the current position and orientation of the active creature (into the actor structure).

208 ReturnToSavedPlace() Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action makes the active creature return to their stored position (the actor structure) - set via SavePlace().

209 SetTextColor(I:TextColor*Color) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

210 FloatMessage(O:Object*,I:StrRef*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

211 FloatMessageFixed(P:Location*,I:StrRef*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

212 FloatMessageRnd(O:Object*,S:Pool*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

213 FloatMessageFixedRnd(P:Location*,S:Pool*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

214 KillFloatMessage(O:Object*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

215 FaceObject(O:Object*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

216 FullHeal(O:Object*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

217 PermanentStatChange(O:Object*,I:StadID*Stats,I:Delta*Delta,I:Modifier*Bones) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

218 PlaySequence(I:Anim*Animstat) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action plays the specified animation sequence (from animstat.ids).

219 WaitRandom(I:MinTime*,I:MaxTime*) Variants: [IWD1/IWD2/PST] [BG1/BG2/BGEE/PSTEE]

This action is like Wait, but the duration is random within the bounds of the parameters.

220 StartRandomTimer(I:ID*,I:MinTime*,I:MinTime*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

221 DestroyPartyGold(I:Amount*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

222 DestroyPartyItem(S:Object*,I:All*Boolean) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

225 FollowCreature(O:Target*) does not work Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

226 GenerateModronMaze() Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action generates data for the Modron Maze (AR13**). The generated data is held in the GAM file.

227 GlobalBAND(S:Name*,S:Area*,I:Value*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

228 GlobalBOR(S:Name*,S:Area*,I:Value*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

229 GlobalSHR(S:Name*,S:Area*,I:Value*,I:ShiftIn*Boolean) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

230 GlobalSHL(S:Name*,S:Area*,I:Value*,I:ShiftIn*Boolean) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

231 GlobalMAX(S:Name*,S:Area*,I:Value*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

232 GlobalMIN(S:Name*,S:Area*,I:Value*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

233 GlobalSetGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

234 GlobalAddGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

235 GlobalSubGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

236 GlobalANDGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

237 GlobalORGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

238 GlobalBANDGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

239 GlobalBORGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

240 GlobalSHRGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*,I:ShiftIn*Boolean) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

241 GlobalSHLGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*,I:ShiftIn*Boolean) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

242 GlobalMAXGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

243 GlobalMINGlobal(S:Name1*,S:Area1*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

244 BitSet(S:Name*,S:Area*,I:Bit*Bits) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

245 BitClear(S:Name*,S:Area*,I:Bit*Bits) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

246 ForceAIScript(S:ScriptFile*,O:Target*,I:Level*Scrlev) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

247 ExploreMapChunk(P:Center*,I:Radius*,I:Mode*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

248 RunToPoint(P:Point*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

249 RunToPointNoRecticle(P:Point*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

250 RandomRun() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

251 RunningAttack(O:Target*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

252 RunningAttackNoSound(O:Target*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

253 RunToObject(O:Target*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

255 RunFollow(P:Point*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

256 RunToSavedLocation() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

259 Damage(O:Target*,I:Delta*Delta,I:Modifier*Bones) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

260 GlobalXOR(S:Name*,S:Area*,I:Value*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

261 GlobalXORGlobal(S:Name*,S:Area*,S:Name2*,S:Area2*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

262 ChangeColor(I:Range*Clownrge,I:Color*Clownclr) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

263 PlaySequenceTimed(I:Anim*Animstat,I:Seconds*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

264 BuyStuff(S:Item*,I:Qty*,I:Price*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

265 IncrementProficiency(O:Target*,I:SlotNum*Wprof,I:Modifier*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

266 FloatRebus(O:Target*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

267 StartSong(I:Song*Songs,P:Where*,I:How*Songflag) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

268 ChangeFaction(O:Object*,I:Value*Faction) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]
268 SetFaction(O:Object*,I:Value*Faction) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

269 ChangeTeam(O:Object*,I:Value*Team) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

See SetTeam.

269 SetTeam(O:Object*,I:Value*Team) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

270 ForceAttack(O:Object*,O:Target*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

271 ForceFacing(O:Object*,I:Dir*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

272 ChangeDialog(O:Object*,S:ResRef*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

273 SetInternal(O:Object*,I:Index*Internal,I:Value*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

274 IncInternal(O:Object*,I:Index*Internal,I:Value*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

275 PlaySequenceGlobal(S:Label*,S:Scope*,I:Anim*Animstat,I:EndAnim*Animstat) does not work Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

276 SetDoorLocked(O:Object*,I:Locked*Boolean) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

277 IncrementExtraProficiency(O:Target*,I:Modifier*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

278 ActivatePortalCursor(O:Object*,I:Value*) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action sets the “trapped” field to 1/2 (as a bitfield). If the region has a cursor type of 48, the portal cursor is shown.

279 EnablePortalTravel(O:Object*,I:Value*) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action sets the ‘trapped’ field to 1/2 (as a bitfield). If the region has a cursor type of 48, the portal cursor is shown.

280 SetSavedLocation(P:Where*,I:Face*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

281 TeleportParty(S:Area*,P:Point*,I:Face*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

282 StopMoving() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

283 SetMazeEasier() Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action modifies the difficulty of the modron maze, by altering the MazeDifficulty global variable towards 0. There are three difficulty levels, represent by 0, 1 and 2.

284 SetMazeHarder() Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action modifies the difficulty of the modron maze, by altering the MazeDifficulty global variable towards 2. There are three difficulty levels, represent by 0, 1 and 2.

285 FixEngineRoom() does not work Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

286 SetCorpseEnabled(S:Name*,I:State*) Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

This action toggles the enabled (i.e. visible) state of the specified corpse.

287 DebugOutput(S:Message*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

288 SetNamelessDeath(I:AreaNum*,P:Dest*,I:State*Animstat) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

289 SetNamelessDeathParty(P:Dest*,I:Reserved*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

290 SetNamelessDisguise(I:DisguiseNum*Disguise) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

291 SinisterPoof(S:BamResRef*,P:Location*,I:Itterations*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

292 StickySinisterPoof(S:BamResRef*,O:Object*,I:Itterations*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

293 SetNamelessClass(I:Value*Class) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

294 ForceLeaveAreaLUA(S:Area*,O:Object*,I:Xpos*,I:Ypos*,I:Facing*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

295 CreateCreatureAtFeet(S:ResRef*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

296 RestParty(I:SuggestedDream*,I:HP*,I:Renting*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

297 ResetFogOfWar() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

298 DisableSpriteDither() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

299 EnableSpriteDither() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

300 DisableFogDither() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

301 EnableFogDither() unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

302 SetNoOneOnTrigger(O:Trigger*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

303 TimedMoveToPoint(P:Point*,I:Time*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

304 ForceUseContainer(O:User*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

305 FullHealEx(O:Object*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

306 GiveExperience(O:Object*,I:Amount*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

309 QuitGame(I:Value*Movval,I:Value*Movval,I:Value*Movval) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

310 StartCutSceneEx(S:CutScene*,I:Value*) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]

311 GeneratePartyMember(P:Location*,I:Value*Specific) unknown Variants: [PST] [BG1/BG2/BGEE/IWD1/IWD2/PSTEE]