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 action in targeting blocks. This is a matter of good practice rather than necessary. The NoAction() action will never be rum since the block always returns false, but the 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 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 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. Effect of the second action variant can point to a VVC or BAM resource.
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 CreateCreature.
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],Myself)
Allegiance(Myself,NEUTRAL)
THEN
RESPONSE #100
Enemy()
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 (holding it within a container within the inventory is fine). 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
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.
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
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. 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.
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
See Spell.
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 (not in a container within the 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. Use of continue in a script block will cause the parser to treater subsequent empty response blocks as though they contained a Continue() command - this parsing can be stopped by including a NoAction() in the empty response block.
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 causes the active creature to simulate a left mouse click on the specified point.
This action causes the active creature to simulate a left mouse click on the specified target.
This action causes the active creature to simulate a right mouse click on the specified point.
This action causes the active creature to simulate a right mouse click on the specified target.
This action causes the active creature to simulate a double click with the left mouse button on the specified point.
This action causes the active creature to simulate a double click with the left mouse button on the specified target.
This action causes the active creature to simulate a double click with the right mouse button on the specified point.
This action causes the active creature to simulate a double click with the right mouse button on the specified target.
This action appears to move the view point so that the specified point is located at the top left corner of the screen when using INSTANT scroll speed. Using any other scroll speed produces unreliable results. It must be executed from an active creature.
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, causing immediate death (unless the target has the MinHP effect applied). The lightning does not always show, and if it does, it is not always in the expected location.
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.
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 act as relative directions to the current direction.
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, staying within the current area. 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 move to the specified point and marks the creature as a leader. The following example script sets Player1 walking to [3363.2954] and sets Player2 and Player3 to “follow” to [3363.2954] in a line and with minimal walking into each other. This action is not fully understood, and is not particularly reliable.
IF
HotKey(E)
THEN
RESPONSE #100
ActionOverride(Player1,Leader([3363.2954]))
ActionOverride(Player2,Follow([3363.2954]))
ActionOverride(Player3,Follow([3363.2954]))
END
This action instructs the active creature to move to the specified point following the marked Leader.
Same as MoveToPoint(P:Point*), but does not draw the target point if the creature(s) have been selected.
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 causes the active creature to cast the specified spell at the specified point ([x.y]). 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. 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. The example script is from andris.bcs.
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
See SpellPoint.
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 use an item denoted by item or slot at the specified point on the map. Ability denotes the charged ability to use. This action ignores the item’s usability flags.
See UseItemPoint.
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. Shout can be Heard() throughout the current area.
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 MoveBetweenAreas(), the character will search for the nearest enabled travel trigger, move to that, then execute his movement to the specified area. If no travel trigger is found, the creature will just 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
See EscapeArea.
This action alters the specified variable, in the specified scope, by the amount indicated. The amount can be positive or negative.
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.
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. 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. 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. 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
See ForceSpell.
See ForceSpell.
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. 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.
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
See ForceSpellPoint.
See ForceSpellPoint.
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). If an item is found in a container on an earlier player and in the inventory of a later player, both item instances may be removed. 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 the specified amount of gold from the party. If performed by a party member, the gold is transferred to that characters gold stat (in the CRE file) and re-added to the party pot when the character re-joins the party. The example script is from AR0602.bcs.
IF
Global("TakeImportItems","AR0602",0)
THEN
RESPONSE #100
SetGlobal("TakeImportItems","AR0602",1)
SetGlobal("Chapter","GLOBAL",1)
ActionOverride("Malaaq",MoveBetweenAreas("AR0601",[345.591],14))
ActionOverride("DuegarClanChief",TakeItemListPartyNum("IMPORT01",1))
ActionOverride("Shelf1",TakeItemListPartyNum("IMPORT03";,1))
SmallWait(4)
TakePartyGold(2147483647)
(cut short for brevity)
This action gives the specified amount of gold to the party. The active creature must have the gold in its “money variable”.
IF
G("KRGIVEGOLD",0)
THEN
RESPONSE #100
GivePartyGold(500)
SG("KRGIVEGOLD",1)
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
See StartCutScene.
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
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)
This action is likely called directly by the engine, and is used to give ankegs give the appearance of emerging from the ground. Calling the action from script has no effect.
This action is likely called directly by the engine, and is used to give ankegs give the appearance of burrowing into the ground. Calling the action from script has no effect.
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
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 (including ModalActions). 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. Just to give an idea, AttackOneRound() would be equivalent to AttackReevaluate() with a 100 tick reevaluation period.
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
- They die / get removed from the game
- The creature has been chasing target for the time specified by the ‘ReevaluationPeriod’ parameter
This action locks the screen on the active creature, preventing the screen from being scrolled away. The action only works from a creature script.
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
See StartDialog.
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
See SetDialog.
This action instructs the active creature to start a dialog with the target creature, from any distance. If the target is invalid, no action will be taken.
See PlayerDialog.
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 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
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
See RemoveSpell.
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. The RES action applies the spell at the lowest casting level - the casting level of the originating creature is ignored. 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
See ApplySpell.
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 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)
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 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 removes a single instance of the specified item from the active creature, unless the item exists in a stack, in which case the entire stack is removed. The example script is from ar1000.bcs.
IF
Global("CerndBaby","GLOBAL",1)
Global("CerndBabyTake","AR1000",0)
THEN
RESPONSE #100
SetGlobal("CerndBabyTake","AR1000",1)
TakePartyItem("misc8t")
DestroyItem("misc8t")
END
This action reveals an area on the worldmap, enabling travelling to it.
IF
Dead("Davaeorn")
Global("Chapter","GLOBAL",4)
THEN
RESPONSE #100
RevealAreaOnMap("AR0900")
IncrementChapter("Chptxt5")
AddJournalEntry(15839,USER)
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.
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, and the JourType is the type of entry (i.e. the location within the journal to add the entry to) - values are from jourtype.ids. 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 a ranged weapon from the weapons available in the quickslots.
IF
See([EVILCUTOFF])
!Range([EVILCUTOFF],4)
OR(28)
!HasItemEquiped("Bow01",())
!HasItemEquiped("Bow02",())
!HasItemEquiped("Bow03",())
!HasItemEquiped("Bow04",())
!HasItemEquipedReal("Bow05",())
!HasItemEquipedReal("Bow06",())
!HasItemEquipedReal("Bow07",())
!HasItemEquipedReal("Bow08",())
!HasItemEquipedReal("Bow09",())
!HasItemEquipedReal("Bow10",())
!HasItemEquipedReal("Bow11",())
!HasItemEquipedReal("Bow12",())
!HasItemEquipedReal("Bow13",())
!HasItemEquipedReal("Bow14",())
!HasItemEquipedReal("Bow15",())
!HasItemEquipedReal("Bow16",())
!HasItemEquipedReal("Bow17",())
!HasItemEquipedReal("Bow18",())
!HasItemEquipedReal("Bow19",())
!HasItemEquipedReal("Bow20",())
!HasItemEquipedReal("Bow21",())
!HasItemEquipedReal("Bow22",())
!HasItemEquipedReal("Bow23",())
!HasItemEquipedReal("Bow24",())
!HasItemEquipedReal("Bow25",())
!HasItemEquipedReal("Bow26",())
!HasItemEquipedReal("Bow98",())
!HasItemEquipedReal("Bow99",())
THEN
RESPONSE #100
EquipRanged()
AttackReevaluate([EVILCUTOFF],30)
END
This action sets the dialog for the active creature to their leave dialog.
IF
!InParty(Myself)
HPGT(Myself,0)
THEN
RESPONSE #100
SetLeavePartyDialogFile()
Dialogue(Player1)
ChangeAIScript("",DEFAULT)
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.
This action is used in conjunction with trigger region in ARE files. The action sets the activation state a trigger region (specified by the object parameter).
This action sets the interrupt state of the active creature. When set to false the creature cannot receive dialog requests or issue verbal constants. The interrupt state of a creature is not saved.
See DialogInterrupt.
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.
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. This action does not work in the script round where the active creature has died.
This action changes the active creature’s selection circle to purple and makes it unselectable. If engine_mode = 0 (default setting for BG1:EE) in engine.lua, the creature continues processing scripts while unselectable. If engine_mode = 1 (default setting for BG2:EE), the creature stops processing scripts while unselectable. For both BG1:EE and BG2:EE, you can use opcode 365 to make creatures unselectable without disabling their script processing.
This action is used in multiplayer games to ensure that players are at the same point before continuing.
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. Conditions are not checked until the time has expired.
This action adds the specified area to the top of the area script processing stack. When the player enters an area that is not in the MASTAREA.2DA the associated script is added to the bottom of the area script processing stack. When the player enters an area that is in mastarea.2da the associated script is added to the top of the area script processing stack.
This action shows the ending credits.
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.
This action changes the current area.
This action saves the game in the specified save slot.
This action causes the active creature to cast the specified spell at the target object. The spell need not be currently be memorised by the caster, and may be interrupted while being cast. The caster must meet the level requirements of the spell. The spell will not be removed from the casters memory after casting. 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.
See SpellNoDec.
This action causes the active creature to cast the specified spell at the specified point ([x.y]). 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. The spell will be removed from the casters memory. 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. The example script is from andris.bcs.
See SpellPointNoDec.
This action instructs the active creature to take the specified item from the party, if they are nearby. A range for the action cannot be specified.
This action will change the animation of the active creature to match that of the specified CRE file. If the active creature is in the party, the action will create the specified creature.
This action will lock the specified door/container.
This action will unlock the specified door/container.
This action will move the specified object to the target area, at the indicated point. The action will only work for creatures in the GAM file - i.e. NPCs or that have been added via MakeGlobal.
This action instructs the active creature to initiate dialog with the target object, using its currently assigned dialog file. This action can be used from a distance and will work whether the target creature is in sight or not. 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 the target is invalid, the active creature will initiate dialog with Player1.
This action displays a textscreen, showing text and graphics from the specified 2DA file.
This action causes the active creature to walk randomly, without pausing.
This action will highlight the specified secret door in purple, to indicate it has been detected.
This action will fade the screen. The point parameter is given in [x.y] format with the x coordinate specifying the number of AI updates (which default to 15 per second) to take to complete the fade action.
This action will unfade the screen. The point parameter is given in [x.y] format with the x coordinate specifying the number of AI updates (which default to 15 per second) to take to complete the fade action.
This action will remove a number of instances (specified by the Num parameter) of the specified item from the party. The items will be removed from players in order, for example; Player1 has 3 instances of “MYITEM” in their inventory, Player2 has 2 instance of “MYITEM,” and Player3 has 1 instance. If the action TakePartyItemNum(“MYITEM”, 4) is run, all 3 instances of “MYITEM” will be taken from Player1, and 1 instance will be taken from Player2. This leaves Player2 and Player3 each with one instance of “MYITEM.” If the last item of an item type stored in a container STO file is removed by this action, the amount becomes zero. Items with zero quantities cannot be seen in-game, cannot be removed by TakePartyItem, and will not count toward a container’s current item load. If the item to be taken is in a stack, and the stack is in a quickslot, the item will be removed, and the remaining stack will be placed in the inventory. If the inventory is full, the stack item will be dropped on the ground.
This action functions the same as Wait.
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). Conditions are not checked until the destination point is reached.
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. Conditions are not checked until the destination point is reached.
As it says, this action will activate a spawn point in an area. The Object should be the name of the spawn point as written in the ARE file.
This action is used in conjunction with spawn points in ARE files. The action sets the enabled state of a spawn point (specified by the object parameter).
This action causes an activated spawn point to spawn creatures, regardless of whether the time for spawning has expired. The Object should be the name of the spawn point as written in the ARE file.
This action acts like Shout() without the range limit.
This action is used in conjunction with animations in ARE files. The action will start the specified animation.
This action is used in conjunction with animations in ARE files. The action will stop the specified animation.
This action instructs the active creature to follow the target object, in the specified formation, taking up the specified position. The Formation parameter represents the formation type (e.g. two lines, arrowhead, single line). The position should be in the range [0,5]. The example script is from dlsctc02.bcs.
IF
!Range("DLSCTC02",12)
Global("DontFollow","DL0302",0)
THEN
RESPONSE #100
FollowObjectFormation("DLSCTC02",1,6)
RESPONSE #100
FollowObjectFormation("DLSCTC02",1,5)
RESPONSE #100
FollowObjectFormation("DLSCTC02",2,6)
RESPONSE #100
FollowObjectFormation("DLSCTC02",2,5)
END
IF
Global("FollowTheLeader","LOCALS",1)
Range("DLSCTC02",6)
Global("DontFollow","DL0302",0)
THEN
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",0)
END
IF
OR(2)
!Range("DLSCTC02",9)
Range("DLSCTC02",1)
Global("DontFollow","DL0302",0)
THEN
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",1,2)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",1,3)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",1,4)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",1,5)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",1,1)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",2,1)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",2,2)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",2,3)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",2,4)
RESPONSE #100
SetGlobal("FollowTheLeader","LOCALS",1)
FollowObjectFormation("DLSCTC02",2,5)
END
This action causes the active creature to become the players ally. The active creature does not act as a normal familiar (i.e. no HP bonus or Constitution loss on death).
- Casting a spell from a quick spell slot (needs to update the quantity)
- Changing the spell in a quick spell slot
- Using a quick item with quantity/charges
This action removes the ally flag set by AddFamiliar.
- Casting a spell from a quick spell slot (needs to update the quantity)
- Changing the spell in a quick spell slot
- Using a quick item with quantity/charges
This action pauses the game. Script processing is halted while the game is paused.
This action will change the animation of the active creature to match that of the specified CRE file. If the active creature is in the party, the action will create the specified creature. No lighting effects are played.
This action removes the items listed in the specified 2DA file from the party.
This action destroys all items on the active creature.
This action causes the active creature to give all their items to the party.
This action will move the active creature to the specified point in the indicated area, facing the appropriate direction.
This action will move the active creature to the specified point in the indicated area, facing the appropriate direction, and plays the specified graphics when the creature disappears.
This action will remove the specified number of items from the party, as listed in the specified 2DA file.
This action will create the specified creature next to the specified object. The facing of the creature is controlled by the Usage1 parameter. The second variant plays back the specified visual effect.
This action creates the specified creature on a normally impassable surface (e.g. on a wall, on water, on a roof). The second variant plays back the specified visual effect.
This action instructs the active creature to face the target object.
This action duplicates the effects of resting. Such resting is not interruptible, and functions even if enemies are nearby.
See RestParty.
This action creates the specified creature at the specified location, and plays the dimension door graphic. The creature appears after approximately 100 AI cycles (~3.5 seconds at the default of 30 frame/second).
This action will create the specified creature next to the specified object, and plays the dimension door graphic. The facing of the creature is controlled by the Usage1 parameter. The creature appears after approximately 100 AI cycles (~3.5 seconds at the default of 30 frame/second).
This action creates the specified creature just off-screen from the current viewpoint (the north/south/east/west direction is random). The facing of the creature is controlled by the Usage1 parameter.
This action moves the object creature a screen away from the specified target creature. The target object must be stored in the GAM file (i.e. NPC or added explicitly via the MakeGlobal action.
This action removes the specified strref from the quest section of the journal.
This action stores the current location of party members in the GAM file.
This action moves the party to the stored locations (previously stored with StorePartyLocations). The action clears the stored locations from the GAM file.
This action creates the specified creature just offscreen from the active creature.
This action moves the active creature to the centre of the screen. Script conditions are not checked for the specified duration (measured in seconds) or until the creature has reached the screen centre.
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. 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. This action works in the script round where the active creature has died.
IF
Die()xx
THEN
RESPONSE #100
ReallyForceSpellDead(Myself,ILLUSION_DEATH)
Wait(1)
DestroySelf()
END
This action reverses the effect of the Panic action, and may also remove other effects.
This action changes the active creature’s allegiance to ALLY (i.e. a green selection circle).
This action rests the party, but doesn’t force healing spells to be cast on injured party members.
This action is similar to StorePartyLocations() but with one object.
This action stores the location of the specified object in the named variable.
IF
Global("SavedMyPos","LOCALS",0)
THEN
RESPONSE #50
SetGlobal("SavedMyPos","LOCALS",1)
SaveObjectLocation("LOCALS","DefaultLocation",Myself)
END
This action creates the specified creature at the specified saved location.
This action sets the specified token to the specified value. Whenever the token is then used within a strref, the current value of the token will be displayed. Values assigned by this action are not saved.
This action sets the token specified by the string parameter (e.g. DAMAGER) to the name of the object specified in the object parameter. Values assigned by this action are not persisted to save games.
This action updates various tokens based on the specified object.
This action creates the specified creature and sets its animation to that of the active creature. The second variant plays back the specified visual effect.
This action hides an area on the worldmap, preventing travelling to it.
This action creates the specified creature at a location offset from the target object point.
This action is used in conjunction with containers in ARE files. The action sets the enabled state of a container (specified by the object parameter).
This action shakes the game view. The point parameter dictates how far to shake the screen along the x and y axis. The duration parameter dictates how long the shaking lasts.
This action will add the variable specified by parameter 2 onto the variable specified by parameter 1. It only works for variables in the “GLOBAL” scope. An example script is below.
IF
Global("Var1","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("Var1","GLOBAL",75) //Var1 = 75
SetGlobal("Var2","GLOBAL",25) //Var2 = 25
AddGlobals("Var1","Var2") //Var1 = 100
END
This action creates a quantity of items equal to a global variable on the active creature. The example script will create 50 arrows.
IF
Global("Arrows","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("Arrows","LOCALS",50)
CreateItemGlobal("Arrows","LOCALS","AROW01")
END
This action instructs the active creature remove the item from the area and put it in their inventory (assuming the inventory has enough room and the item exists).
This action will attempt to fill a slot in the active creature’s inventory with the appropriate item type. Using FillSlot(SLOT_WEAPON) will look for any weapon in the inventory, and move the first such item into the weapon slot. Any item already in the slot is destroyed.
This action adds the specified amount of XP onto the specified object.
This action removes the specified amount of gold from the party. DestroyGold(0) will remove all gold from current creature. Note that this action affects the gold stat of the creature (not Party Gold or MISC07 items).
This action stores a “home” location into memory for a creature. The location is not saved.
This action displays the strref specified by the StrRef parameter in the message window, without attributing the text to an object.
This action removes the specified strref from the journal, regardless of the journal section the entry is in - except the user section.
This action copies all items lying around on the ground in the current area to the specified point in the target area.
These actions work the same as their counterpart dialog actions. The only difference is that they are important enough to interrupt other dialogs already in action.
This action sets a global timer measured in seconds (of real time).
This action displays the specified string over the head on the specified object (on the game-screen). The string may also be shown in the message log, depending on options specified in baldur.ini.
IF
HPPercentLT(Myself,50)
HasItem("Potn52",Myself)
THEN
RESPONSE #100
DisplayStringHead(Myself,46150)
UseItem("Potn52",Myself)
END
This action changes the animation of the active creature to match the animation of the target object.
This action plays the specified sound from the character’s soundset.
This action plays the animation specified by the object parameter at the specified location ([x.y]). Animation preference order is applied, i.e. the engine first looks to play a VVC file of the specified name, if no such a file exists, the engine looks to play a BAM file of the specified.
This action plays the animation specified by the (mis-named) DialogFile parameter on the specified object. Animation preference order is applied, i.e. the engine first looks to play a VVC file of the specified name, if no such a file exists, the engine looks to play a BAM file of the specified.
This action removes the active creature’s current kit and adds the specified kit. Abilities from any previous kit are removed. AddKit(0) can be used to remove a creatures current kit without adding a new one. Class restrictions apply for kits. When attempting adding an invalid kit, the existing kit (if any) will be replied.
This action can be used to manually start the combat counter.
This action instructs the active creature to leave the area via the specified region.
This action instructs the target object to leave the current area, either by walking, or, if the path is blocked, by simply disappearing. 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.
This action replaces the item in second parameter with the item in first parameter. If the target does not have the item in the second parameter, the item in the first parameter will still be created in the inventory. Note that this action will not automatically equip the item that’s created.
This action adds the specified spell to the active creature. The message <creature_name> has gained a special ability: “Ability” is displayed in the message log.
This action destroys all destructible equipment on the active creature. Items flagged as indestructible (magical) will not be destroyed. The second variant will only destroy items of the specified type.
This action changes a Paladin to a Fallen Paladin.
This action changes a Ranger to a Fallen Ranger.
This action restores a Fallen Paladin to normal Paladin status. Increments Reputation to 10?
This action restores a Fallen Ranger to normal Ranger status. Increments Reputation to 10?
This action copies the base animation (i.e. no armour or colouring) of the target creature to the active creature.
This action hides the docking borders, menus, etc. on the sides of the screen.
This action restores the docking borders, menus etc. to the sides of the screen.
This action changes the name of the active creature to the specified strref.
This action sets the active creatures kit to the specified kit . Abilities from any previous kits are kept. Class restrictions apply for kits. When attempting adding an invalid kit, the existing kit (if any) will be replied.
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. Other conditions are checked during the play dead period.
This action says to jump the object in the first parameter to the object in the second parameter. The object in the first parameter does NOT have to be in the same area as the target, but must already be present in the saved game (as either an NPC or MakeGlobal()).
This action displays the specified strref over the head of the creature with the specified item. The action only checks current party members.
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 will not have its dialog file permanently set to the file specified by the DialogFile parameter. The second signature of this action is not listed in the action.ids file provided with the game. When using this signature, the third integer parameter can be used to indicate the dialog is initiated by an item (e.g. Lilarcor) - if this is the case, the item name will be used as the creature name in the feedback window.
This action creates the specified creature at the specified point and sets its animation to that of the active creature.
This action instructs the active creature to play their associated bard song.
This action instructs the active creature to move to the previously saved specified location.
IF
Global("MoveToLocation","LOCALS",0)
THEN
RESPONSE #50
SetGlobal("MoveToLocation","LOCALS",1)
MoveToSavedLocationn("DefaultLocation","LOCALS")
END
This action inflicts the specified amount of damage (of the specified type) on the target creature.
This action extends the time taken for the banter timer to expire. The banter timers are hardcoded and every time one expires an NPC’s b**.dlg is called.
This action dictates whether the banter timer can expire.
This action is used in conjunction with animations in ARE files. The action sets the enabled state of an animation (specified by the object parameter).
It is likely that the first parameter refers to a transition trigger and the second parameter refers to a door type in an area. In this manner, the trigger is activated and deactivated based on the open state of the door.
It is likely they were used for the unimplemented multiplayer deathmatch mode.
This action applies a percentage damage (of the specified damage type) to the target object.
This action acts as a shortcut for SetGlobal(). The action can only set global variables.
This action will add a map note onto the current area’s mini-map at the specified position. The position is a location on the actual area map (not the minimap).
See AddMapNote.
This action ends the demo and returns the player to the game selection screen.
It is likely to move all creatures present in the saved game that are currently in the FromArea parameter and move them to the Location in the ToArea parameter.
This action displays the specified string over the head on the specified object (on the game-screen). The text stays onscreen until the associated sound has completed playing.
This action instructs all creatures in the current area(?) ignore the following states flags for the time specified, or until a save-game reload. The creatures still have the state flags set. This action mainly seems to be used to get player characters to look like they are “paying attention” to anything that is happening around them. The following states are overridden:
- state_sleeping
- state_panic
- state_stunned
- state_helpless
- state_confused
The following states are not overridden:
- state_invisible
- state_frozen_death
- state_stone_death
- state_dead
- state_silence
- state_charmed
- state_improved invisibility
- state_mirror_image
Other states are untested.
This action modifies the probability of a daytime rest interruption (by modifying fields in the ARE file).
This action modifies the probability of a night-time rest interruption (by modifying fields in the ARE file).
This action is used in conjunction with ambient sounds in ARE files. The action sets the enabled state of an ambient sound (specified by the object parameter).
The action plays the specified song. Values are from SONGLIST.2DA.
It is likely that it will force the specified spell if the target is within range of the spell.
See ForceSpellRange.
It is likely that it will force the specified spell if the point is within range of the spell.
This action changes the specified sound reference (SndSlot) on the specified creature to the specified value. It should be noted that the biography can be changed by this action, as it is listed as a SoundSlot (EXISTANCE5).
This action dictates whether resting is allowed in the current area.
This action removes effects with a duration timing mode from the specified object, if the remaining duration is below the ticks parameter. The action appears to only work from a creature script.
This action creates the specified creature at the specified location, facing the specified direction. The creature will be created even if the searchmap is marked as impassable, or whether there are any other obstructions. The second variant plays back the specified visual effect.
This action sets the ‘BeenInParty’ flag in the CRE file of the active creature. This action also triggers appropriate dialog and script file changes (as referenced in PDIALOG.2DA).
This action returns the player to the game start screen.
This action teleports the party to the area from which the “Area Switch: Pocket Plane” effect was last used. If this effect has never been used, or the party is not in the Pocket Plane this action has no effect.
This action gives a level dependent amount of XP to the party or a single party member. The XP amount is listed in XPLIST.2DA at the intersection of the party level (column) and quest row (the mis-named parameter). The file lists the same XP value for all quests for all levels.
This will remove a map note from the current area’s mini-map at the specified position. The position is a location on the actual area map (not the minimap).
This action will add area type flags (e.g. outdoor, dungeon) to the current area. The areatype value is OR’d, so multiple values can be set. Values are from areatype.ids
This action will remove area type flags (e.g. outdoor, dungeon) to the current area. Values are from areatype.ids
This action will add area flags (e.g. save enabled, tutorial) to the current area. The area flags value is OR’d, so multiple values can be set. Values are from areaflag.ids.
This action will remove area flags (e.g. save enabled, tutorial) to the current area. The area flags value is OR’d, so multiple values can be set. Values are from areaflag.ids.
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 name will not appear as the dialog attribution.
This action sets the specified token to the given variable (in the specified scope). The example script will display 100 over the head of the active creature.
IF
Global("Value","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("Value","GLOBAL",100)
SetTokenGlobal("Value","GLOBAL","PPOINTS")
DisplayStringHead(Myself,63037) //63037 is <PPOINTS> for me
END
This action adds the active creature to the GAM file. Note: Calling this action multiple times on the same creature will add multiple entries of the creature to the GAM file.
This action causes the active creature to cast the specified spell at the target point. 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. 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.
See SetCutSceneLite.
This action starts a cutscene. Player control is removed, though all scripts keep 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.
This action instructs the active creature to play the swing weapon animation once. Note that some objects do not have this animation.
This action is used in conjunction with animations in ARE files. The action will start the specified animation sequence.
This action changes the palette (BMP file) of the specified animation object.
This action displays the specified string over the head on the specified object (on the game-screen) even if the target is dead.
This action moves the party to ToB, changes the worldmap, and switches scripts and dialogs to the X25 versions.
This action will immediately set the weather to raining, over the current overlay (rather than taking several seconds to darken the area before starting to rain).
This action instructs the active creature to perform the specified animation sequence. Values are from seq.ids.
This action displays the specified string over the head on the specified object (on the game-screen), without displaying it in the message log.
This action modifies the probability of a travel encounter (by modifying fields in the WMP file) between the specified areas.
This action instructs the engine to use the specified column of WISH.2DA, randomly select 5 choices (rows; count appears hardcoded) and set the appropriate globals for those spells. Once the maximum “wish choices” have been selected, the dialog continues and casts the selected spell.
From a dialog:
IF ~CheckStatGT(LastTalkedToBy,17,WIS)~ THEN DO ~SetupWish(4,1)~ GOTO 8
IF ~Global("WishPower01","GLOBAL",1)~ THEN REPLY #72526 /* ~'Breach' on everyone in the area, including the party.~ */
DO ~ActionOverride(LastTalkedToBy,ForceSpellRES("spwish26",Myself)) ApplySpell(Myself,POOF_GONE)~ EXIT
The key is the Global("WishPower**","GLOBAL",1)
. The highest is “WishPower37”, and the highest number in the WISH.2DA is also 37. There are a total of 46 SPWISH**.SPL files, but 9 are unused:
- SPWISH01 STR Bonus +1
- SPWISH02 INT Bonus +1
- SPWISH03 DEX Bonus +1
- SPWISH04 CON Bonus +1
- SPWISH05 WIS Bonus +1
- SPWISH06 CHA Bonus +1
- SPWISH07 Restoration
- SPWISH09 Globe of Blades
- SPWISH15 Gain 10,000 Gold (Party)
Looking at the spells that have a “WishPower**” next to them, this list can be derived (sorted by Wisdom level (E=enemies, P=party, C=caster A=All)):
Low (9-) Medium (10-14) High (15-17) Ultra (18+)
Heal E Heal E Heal E TS & IA (X2) P
Improved Haste E Improved Haste E Improved Haste E Improved Haste E
Dark Planetar E Silenced A Dark Planetar E Lose 10,000 gp P
Level Drain P Level Drain P WIS (3) P Level Drain P
Hit Points -50% C Hit Points -50% C TS & IA (X2) P Hit Points -50% C
Hit Points -15% P Haste A Hit Points -15% P Mass Raise Dead P
Lose Spells C Lose Spells C Lose Spells C WIS (3) P
STR (3) P STR (3) P STR (3) P Haste A
CON (3) P CON (3) P Stats (25) P Stats (25) P
DEX (3) P DEX (3) P DEX (3) P Rest & Remem. P
INT (3) P INT (3) P Silenced A Bad Luck A
Slowed P Slowed P Rest & Remem. P Meteor Swarm C
Restoration P Restoration P Improved Haste P Restoration P
Gr. Deathblow P Gr. Deathblow P Gr. Deathblow P Gr. Deathblow P
Hardiness P Hardiness P Breach E Hardiness P
Create Wand C Create Wand C Create Wand C Create Wand C
Create Potion C Create Potion C Create Potion C Create Potion C
Breach A Breach A Breach A Improved Haste P
Wing Buffet A Wing Buffet A Wing Buffet A Breach E
Heal A Heal A Heal A Heal A
STR (18) A STR (18) A STR (18) A STR (18) A
Miscast Magic A Miscast Magic A Miscast Magic A Miscast Magic A
Magic Resist A Magic Resist A Magic Resist A Magic Resist A
Abi-Dalzim's A Abi-Dalzim's A Abi-Dalzim's A Abi-Dalzim's A
Intoxicated A Intoxicated A Intoxicated A Intoxicated A
Bad Luck A Bad Luck A Bad Luck A
/ Breach E Stats (25) P \
OR < > OR
\ Rest & Remem. P Mass Raise Dead P /
See SetupWish.
This action changes the current area. The active creature will move to the specified entry point (from ENTRIES.2DA) before travelling. The action appears to only work from a creature script.
This action changes the current area. The creature moves to the destination point (from ENTRIES.2DA) before travelling (the point parameter is unused).
This action changes the script specified by the scriptslot parameter to the script specified by the script parameter, for the current area.
This action advances the game-time by the amount specified by the Time parameter.
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.
This action causes the active creature to run away from the specified creature, for the specified time, without leaving the current area.
This action changes the item specified by the OldItem parameter into the item specified by the NewItem parameter, retaining the charges/flags of OldItem.
This action will force the party into the selected area on their next worldmap travel. Only one ForceRandomEncounter can be in play at a time so subsequent use will clear the previous one. It will also be cleared once the party arrives in the designated area.
This action teleports the active creature to the object specified by the Target parameter.
Changes the script runner’s current area’s music slot to the given song number.
Changes both buy and sell markup values for the specified store.
Displays a floating message over a point in the script runner’s current area.
Removes up to “count” instances of the specified item from the store.
This action adds “count” instances of an item to the specified store. You can also specify the item flags (such as IDENTIFIED or STOLEN).
A random number “count D size + Plus” will be assigned to the variable.
See SetGlobalRandom.
Removes all ground piles from the area. (Ground piles are containers with type = 4).
Custom game over event, with the specific string displayed.
Changes the current worldmap to another .wmp. The old worldmap(s) will still be saved. You can have multiple number of worldmaps.
Similar to Wait(x), but waits at least MinTime and at most MaxTime (seconds).
Similar to StartTimer, but with MinTime-MaxTime range.
Changes the base stat of the referenced creature. Not all stats are modifiable, even if they are in stats.ids. Some are recalculated by the engine (like Lore).
This action reinitializes important default values and resource references based on definitions from campaign.2da, such as world scripts, save folder name or starting area. Campaign refers to the name defined in the first column of that table. It is currently used to switch from BGEE to the Siege of Dragonspear campaign.
This action can be used to set flags of an area on the worlmap that control visibility or accessibility. Flags are taken from wmpflag.ids.
This action can be used to clear flags of an area on the worlmap that control visibility or accessibility. Flags are taken from wmpflag.ids.
This action behaves like DisplayStringNoName, except that it also works in dialogues. It displays the strref specified by the StrRef parameter in the message window, without attributing the text to an object.
This action sets a global timer to a random value within the range of Min and Max specified by the 3rd and 4th parameter. Both parameters accept symbolic values from gtimes.ids. The timer is checked by the GlobalTimerExpired() and GlobalTimerNotExpired() triggers.
This action will export all exportable characters of the party into the “Characters” folder of the game. “Name” specifies the prefix for each exported character, which is expanded by the character’s party slot number. This action creates both .CHR and .BIO files.
This action removes all items from slots of the given type from the target. The items are placed in the inventory of the active creature.
This action removes all gold from the target and stores the amount in the specified variable.
This action adds the amount of gold specified by the given variable to the target.
This action adds the active creature to the GAM file. In contrast to MakeGlobal() calling this action multiple times on the same creature will only update the existing entry of the creature in the GAM file.
See AddXPWorth.
This action puts the item specified by the Item parameter in the slot specified by the Slot parameter of the creature specified by the Object parameter in the style specified by the Equip/UnEquip parameter.
Code snippet:
IF
True()
THEN
RESPONSE #100
XEquipItem("HAMM01",Protagonist,SLOT_WEAPON1,EQUIP) // War Hammer
END
This action controls whether a cutscene can be skipped by pressing ESC. When set to TRUE the cutscene can be interrupted. Set to FALSE to prevent the cutscene from being interrupted. When properly prepared the skipped cutscene can be detected and completed in a safe manner.
Code snippet of the opening cutscene in BG2EE - SoA (NEWGAME.BCS):
IF
True()
THEN
RESPONSE #100
CutSceneId("CSJon")
SetAreaScript("cutskip2",OVERRIDE)
SetGlobal("BD_CUTSCENE_BREAKABLE","GLOBAL",1)
SetCutSceneBreakable(TRUE)
CreateCreatureEffect("M05PCSPY","",[3374.3068],S)
// more script actions...
SetCutSceneBreakable(FALSE)
SetGlobal("BD_CUTSCENE_BREAKABLE","GLOBAL",0)
SetAreaScript("",OVERRIDE)
ActionOverride("Imoen",EndCutSceneMode())
ActionOverride("Imoen",Dialogue(Player1))
DestroySelf()
END
SetAreaScript("cutskip2",OVERRIDE)
defines a “failsafe” script to execute when the cutscene is interrupted. The OVERRIDE slot ensures that it has precedence over the default area script. SetGlobal("BD_CUTSCENE_BREAKABLE","GLOBAL",1)
is used to identify the cutscene that has been interrupted (if the failsafe script handles more than one cutscene).
This action displays the string specified by the StrRef parameter over the head of the given object on the game-screen, but not in the message log.
This action sets or resets specific item flags, such as “IDENTIFIED” or “STOLEN”. Setting the third parameter to TRUE sets the bit, setting it to FALSE clears the bit.
Example from Siege of Dragonspear (BDINTRO.BCS):
IF
Global("SOD_fromimport","GLOBAL",0)
!HasItemEquiped("ring05",Player1) // Sandthief's Ring
InMyArea("safana") // Safana
THEN
RESPONSE #100
CutSceneId(Player1)
GiveItemCreate("ring05","safana",7,0,0) // Sandthief's Ring
ActionOverride("safana",SetItemFlags("ring05",IDENTIFIED,TRUE)) // Sandthief's Ring
XEquipItem("ring05","safana",SLOT_RING_RIGHT,EQUIP) // Sandthief's Ring
END
This action activates or deactivates all creature scripts of the given target depending on the second parameter.
Moves the content of Container1 into Container2. You can prefix each container with an area code, separated by asterisks, to move containers over different maps. The script action can be successfully executed on any map.
Example from Siege of Dragonspear (BD0103.BCS):
IF
Global("BD_Imoen_Items","GLOBAL",1)
GlobalLT("BD_PLOT","GLOBAL",51)
THEN
RESPONSE #100
SetGlobal("BD_Imoen_Items","GLOBAL",2)
MoveContainerContents("BD0120*Imoen_import_eq","BD0103*Imoen_equipment")
END
This action can be used to set one or more individual bits in the specified variable.
This action can be used to clear one or more individual bits in the specified variable.
This action can be used to set zoom to 100%. When set to TRUE zoom factor is locked at 100% and can not be changed by user input. Setting it to FALSE restores the original zoom factor. The zoom lock state is not saved.
This action alters the second variable by the amount indicated by ‘Val’ only if the first variable evaluates to 0. The amount can be positive or negative. After a successful call the first variable is set to 1. The second action variant combines variable scope and name into a single string. Scope is followed directly by the variable name, e.g. “GLOBALvar1” or “MYAREAvar2”. Variables in the local scope can only be changed with this action if they already exist.