This action can be used to do nothing - many characters walk around randomly or stand in one place doing nothing:
IF
True()
THEN
RESPONSE #50
RandomWalk()
RESPONSE #50
NoAction()
END
NoAction()
is also commonly used as a hanging (dummy) action in targeting blocks. This is a matter of good practice rather than necessary. The NoAction()
action will never be run since the block always returns false, but having an action in the scripting block allows scripting programs to accurately check for errors.
IF
See(NearestEnemyOf(Myself))
False()
THEN
RESPONSE #100
NoAction()
END
This action can be used to control another creature. A creature referenced as the result of SetTokenObject() is not a valid target for the ActionOverride() action. The following is from the Irenicus cutscene after leaving his abode in chapter 1.
IF
True()
THEN
RESPONSE #100
CutSceneId(Player1)
Wait(1)
FadeToColor([20.0],0)
Wait(2)
JumpToPoint([869.340])
MoveViewPoint([909.346],INSTANT)
ActionOverride(Player2,JumpToPoint([825.370]))
ActionOverride(Player3,JumpToPoint([886.384]))
ActionOverride(Player4,JumpToPoint([952.386]))
ActionOverride(Player5,JumpToPoint([987.362]))
ActionOverride(Player6,JumpToPoint([1005.404]))
Face(10)
ActionOverride(Player2,Face(10))
ActionOverride(Player3,Face(10))
ActionOverride(Player4,Face(8))
ActionOverride(Player5,Face(6))
ActionOverride(Player6,Face(6))
ActionOverride("Anomen",JumpToPoint([909.346]))
ActionOverride("Anomen",Face(10))
Wait(1)
FadeFromColor([20.0],0)
Wait(2)
ActionOverride("Anomen",StartDialogueNoSet(Player1))
END
This action is used to set waypoints for a creature to move between; it is commonly used from area scripts to script barmaids moving in a route around the bar. The point parameter represents the X and Y coordinates of the waypoint to add.
IF
Global("KRNEWWAY","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("KRNEWWAY","GLOBAL",1)
AddWayPoint([100.200])
AddWayPoint([200.300])
END
The following script, showing how to move to waypoints preset in the area file, is taken from the barmaid at the Copper Coronet.
IF
Detect([PC])
Allegiance(Myself,NEUTRAL)
Global("quest1","LOCALS",0)
THEN
RESPONSE #100
MoveToObject("Way3")
ActionOverride("DRUNK2",DisplayStringHead(Myself,4592)
Wait(1)
DisplayStringHead(Myself,4604)
Wait(2)
MoveToObject("Way4")
Wait(1)
MoveToObject("Way3")
DisplayStringHead(Myself,4611)
Wait(2)
SetGlobal("quest1","LOCALS",1)
END
This action instructs the active creature to continually attack the target, i.e. the active creature will not switch targets until its target is dead.
IF
See([EVILCUTOFF])
Class(LastSeenBy(),MAGE_ALL)
!InParty(LastSeenBy())
THEN
RESPONSE #100
Attack(LastSeenBy())
END
This action instructs the active creature to backstab the specified target. Note that some creatures (notably dragons and golems) are immune to being backstabbed, that not all weapons are valid to backstab with, and that the active creature must be hidden to make a successful backstab. This action causes the game to crash. As long as the correct conditions are met, the first attack of a hidden creature will count as a backstab attack.
IF
See(NearestEnemyOf())
Range(NearestEnemyOf(),4)
!Race(NearestEnemyOf(),DRAGON)
!Race(NearestEnemyOf(),GOLEM)
!InParty(NearestEnemyOf(Myself))
OR(2)
StateCheck(Myself,STATE_INVISIBLE)
StateCheck(Myself,STATE_IMPROVEDINVISIBLITY)
THEN
RESPONSE #100
Attack(NearestEnemyOf())
END
Here we have a different description, because we can.
IF
Global("CopperGuards","GLOBAL",1)
THEN
RESPONSE #100
CreateCreature("ccguard1",[2338.412],14)
CreateCreature("ccguard2",[2318.457],14)
CreateCreature("ccguard1",[2749.793],6)
END
This action is used to create a creature - either an NPC, a neutral creature or an enemy. NewObject is the filename of the creature to create, Location is the coordinates to create the creature at ([x.y] format) and direction being the direction the creature is facing (0-15, 0 being south and the facing values increasing as the character turns clockwise). Note that a coordinate of [-1.-1] will create the creature next to the active creature.
This script is from the area script for the Copper Coronet (AR0406) and creates extra guards when the Player is discovered in the off limits area.
IF
Global("CopperGuards","GLOBAL",1)
THEN
RESPONSE #100
CreateCreature("ccguard1",[2338.412],14)
CreateCreature("ccguard2",[2318.457],14)
CreateCreature("ccguard1",[2749.793],6)
CreateCreature("ccguard2",[2791.831],6)
CreateCreature("ccguard1",[1981.762],14)
CreateCreature("ccguard1",[1286.1500],14)
END
See Dialogue.
This action instructs the active creature to initiate dialog with the target creature. Dialog will not be initiated if the creature using this action has been assigned a dialog that has all top level conditions returning false.
IF
GlobalTimerExpired("Yeslick","GLOBAL")
Global("FLOODED","GLOBAL",0)
THEN
RESPONSE #100
Dialogue([PC])
END
This action instructs the active creature to drop the specified item at the specified location (relative to the active creature). The active creature must have the item to be dropped. Note that a coordinate of [-1.-1] will drop the item next to the active creature.
IF
Clicked([ANYONE])
Range(LastTrigger,12)
THEN
RESPONSE #100
DropItem("SCRL1B",[345.1210])
END
This action is used to change the allegiance of the active creature to enemy (making them hostile to the PC). This example script, from a peasant, will turn the creature hostile if it is attacked.
IF
AttackedBy([GOODCUTOFF],DEFAULT)
Allegiance(Myself,NEUTRAL)
THEN
RESPONSE #100
Enemy()
END
This action instructs the active creature to equip the specified item. The item needs to be in one of the creatures quickslots.
IF
HasItem("Sw1h01",Myself)
!HasItemEquipedReal("Sw1h01",Myself)
THEN
RESPONSE #100
Equip("Sw1h01",Myself)
END
This action instructs the active creature to enter Detect Traps modal state. This action can be used for any creature (not just thieves) though success in detecting traps is dependent on points in the Find Traps skill.
IF
ActionListEmpty()
!Exists([EVILCUTOFF])
!ModalState( Myself,DETECTTRAPS)
OR(2)
!StateCheck(Myself,STATE_INVISIBLE)
!StateChe ck(Myself,STATE_IMPROVEDINVISIBILITY)
THEN
RESPONSE #100
FindTraps()
END
IF
See([ANYONE])
!HasItem("Sw1h01",Myself)
HasItem("Sw1h01",LastSeenBy ())
THEN
RESPONSE #100
MoveToObject(LastSeenBy())
GetItem("Sw1h01",LastSeenBy())
END
This action instructs the active creature to give the specified item (parameter 1) to the specified target (parameter 2). The active creature must possess the item to pass it. The sample script makes uses of modified IDS files (action, instant, trigger and svtiobj) though such modification are not necessary to use the GiveItem action itself.
IF
HPPercentLT(Myself,40)
!HasItem("potn52",Myself)
THEN
RESPONSE #100
GlobalShout(3015)
SetGlobal("KRNEEDITEM","GLOBAL",1)
END
IF
Heard([GOODCUTOFF],3015)
HasItem("potn52",Myself)
HPPercentGT(Myself,40)
Global("KRNEEDITEM","GLOBAL",1)
THEN
RESPONSE #100
MoveToObject(LastHeardBy())
GiveItem("potn52",LastHeardBy())
SetGlobal("KRNEEDITEM","GLOBAL",0)
END
This action is used in conjunction with the ReceivedOrder trigger, and works in a similar way to a global shout. The action passes a numeric order to the specified creature. Only one creature at a time responds to an order, and creatures to not detect their own orders.
IF
See([EVILCUTOFF])
OR(3)
Class(Myself,FIGHTER_ALL)
Class(Myself,RANGER_ALL)
Class(Myse lf,PALADIN_ALL)
THEN
RESPONSE #100
GiveOrder([PC.0.0.THIEF_ALL],100)
END
IF
ReceivedOrder(Myself,100)
Class(Myself,THIEF_ALL)
THEN
RESPONSE #100
RunAwayFrom([EVILCUTOFF],120)
Hide()
END
This action acts similar to shout, but does not accept values. The range of the Help action is slightly larger than the default visual radius of NPCs.
IF
HitBy([ANYONE],CRUSHING)
THEN
RESPONSE #50
Help()
Attack(NearestEnemyOf(Myself))
RESPONSE #50
RunAwayFrom(NearestEnemyOf(Myself),75)
END
IF
Help([0.0.GIBBERLING])
THEN
RESPONSE #100
Attack(NearestEnemyOf(LastHelp(Myself)))
END
IF
See(NearestEnemyOf(Myself))
THEN
RESPONSE #100
Help()
AttackReevaluate(NearestEnemyOf(Myself),30)
END
This action instructs the active creature to attempt to Hide in Shadows. This action can be used for any creature (not just thieves) though success in hiding is dependent on points in the Stealth skill. A hidden creature is treated as STATE_INVISIBLE.
IF
!See([EVILCUTOFF])
OR(2)
!StateCheck(Myself,STATE_INVISIBLE)
!StateCheck(Myself,STATE_IMPROVEDINVISIBLITY)
THEN
RESPONSE #100
Hide()
END
This action adds the active creature to the party. If the party is currently full the ‘select party members’ dialog is shown. JoinParty clears the ActionQueue of the active creature.
IF
See([PC])
Global("KRJOINPARTY","GLOBAL",0)
THEN
RESPONSE #100
JoinParty()
END
This action causes the active creature to leave the party. This action calls DropInventory() as part of its execution.
IF
HappinessLT(Myself,-299)
THEN
RESPONSE #100
ChangeAIScript("",DEFAULT)
SetLeavePartyDialogFile()
LeaveParty()
EscapeArea()
END
This action instructs the active creature to move to the specified object. The action does not update the current position of the actor, saved in ARE files. The example script shows the creature moving towards the nearest enemy.
IF
See(NearestEnemyOf())
!Range(NearestEnemyOf(),4)
THEN
RESPONSE #100
MoveToObject(NearestEnemyOf())
END
This action causes the active creature to move to the specified coordinates. The action will update the position of creatures as stored in ARE files (first by setting the coordinates of the destination point, then by setting the coordinates of the current point once the destination is reached).
IF
True()
THEN
RESPONSE #100
MoveToPoint([526.1193])
Wait(3)
RandomWalk()
Wait(5)
RandomWalk()
END
This action causes the active creature to move randomly around the screen.
IF
HPPercentLT(Myself,15)
THEN
RESPONSE #100
Panic()
END
This action instructs the active creature to attempt to pickpocket the target. This action can be used for any creature (not just thieves) though success in pick pocketing is dependent on points in the Pickpocket skill. Note that a failed pickpocket attempt is treated as an attack, hence the Attacked() trigger will return true if a pickpocket attempt is failed.
IF
See([ANYONE])
OR(2)
Class(Myself,THIEF_ALL)
Class(Myself,BARD_ALL)
THEN
RESPONSE #100
PickPockets([ANYONE])
END
This action will cause the active creature to play the specified sound. Both WAV and WAVC files can be played by the action. Sound is played through the sound effects channel. Volume fades if the viewport is moved further away from the active creature.
IF
True()
THEN
RESPONSE #100
PlaySound("CAS_M06")
END
This action causes the active creature to guard the specified point, staying within the specified range.
IF
True()
THEN
RESPONSE #100
ProtectPoint([1738.543],10)
END
This action causes the active creature to attempt to disarm the specified trap. This action can be used for any creature (not just thieves) though success in disarming is dependent on points in the Disarm Trap skill.
IF
See("Trap01")
Class(Myself,THIEF_ALL)
THEN
RESPONSE #100
RemoveTraps("Trap01")
END
This action causes the active creature to run away from the specified creature, for the specified time. The time parameter is measured in AI updates, which default to 15 updates per second. Occasionally, fleeing creatures stop to attack another creature.
IF
HPPercentLT(Myself,30)
THEN
RESPONSE #100
RunAwayFrom(LastAttackerOf(Myself),180)
END
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
RES
filenames with +
, Dialogs and the console cannot. Same with the ~
, `
, '
, @
, $
, ^
, and &
characters, maybe some more.
- This action will default to a spell matching the first 7 characters in Dialogs/Console IF the 8th character isn’t valid.
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). This action is most often used to allow use of potions and wands. The item to be used must exist in the active creature’s inventory (though it need not be equipped).
IF
HPPercentLT(Myself,50)
HasItem("potn52",Myself)
THEN
RESPONSE #100
DisplayStringHead(Myself,46150) //quaffs a potion
UseItem("potn52",Myself)
Continue()
END
See UseItem.
This action instructs the script parser to continue looking for actions in the active creatures action list. This is mainly included in scripts for efficiency. Continue should also be appended to any script blocks added to the top of existing scripts, to ensure correct functioning of any blocks which include the OnCreation trigger. Continue may prevent actions being completed until the script parser has finished its execution cycle. Continue() must be the last command in an action list to function correctly.
IF
See(NearestEnemyOf())
!InParty(NearestEnemyOf())
THEN
RESPONSE #100
AttackOneRound(NearestEnemyOf())
Continue()
END
This action instructs the active creature to play the swing weapon animation. Note that some objects do not have this animation.
IF
True()
THEN
RESPONSE #100
Swing()
END
This action instructs the active creature to play the recoil animation. Note that some objects do not have this animation.
IF
TookDamage()
THEN
RESPONSE #100
Recoil()
END
This action instructs the active creature to “play dead”, i.e. to lay on the ground, for the specified interval (measured in AI updates per second (AI updates default to 15 per second). If used on a PC, the player can override the action by issuing a standard move command.
IF
HPPercentLT(Myself,30)
THEN
RESPONSE #100
PlayDead(240)
END
This action can used to make the active creature follow the creature specified by the leader parameter, maintain a relative position determined by the offset parameter.
IF
CombatCounter(0)
Allegiance(Myself,NEUTRAL)
THEN
RESPONSE #100
Formation("QSLMAGE1",[-2.-5])
END
This action instantly moves the active creature to the specified point.
IF
True()
THEN
RESPONSE #100
ClearAllActions()
FadeToColor([20.0],0)
MoveViewPoint([1738.543],INSTANT)
JumpToPoint([1738.543])
Wait(1)
CreateVisualEffectObject("SPCLOUD1",Player1)
Wait(1)
CreateVisualEffectObject("SPFLESHS",Player1)
END
This action scrolls the view point (i.e. the area of the current map being displayed onscreen) to the target point ([x.y] at the specified speed. Speeds are taken from scroll.ids (VERY_FAST is equivalent to normal walking speed).
This action scrolls the view point (i.e. the area of the current map being displayed onscreen) to the target object ([x.y] at the specified speed. Speeds are taken from scroll.ids (VERY_FAST is equivalent to normal walking speed). The example script is from a cutscene; CUT03C.bcs.
IF
True()
THEN
RESPONSE #100
CutSceneId(Player1)
FadeToColor([20.0],0)
Wait(1)
ActionOverride("SPY406",DestroySelf())
MoveViewObject(Myself,INSTANT)
Wait(1)
FadeFromColor([20.0],0)
ActionOverride("cpchick1",DestroySelf())
ActionOverride("cpchick2",DestroySelf())
Wait(1)
ActionOverride("Surly",StartDialogueNoSet(Player1))
END
This action changes the assigned script file for the active creature. The new script name is specified in the scriptfile parameter. The level parameter dictates the script level to change - values are from scrlev.ids. Scripts can be set for any scriptable object (container, creature, door etc.), but are not persisted.
IF
See([EVILCUTOFF.0.DOG])
THEN
RESPONSE #100
ChangeAIScript("DOGFIGHT",DEFAULT)
END
This action starts a timer local to the active creature. The timer is measured in seconds, and the timer value is not saved in save games. The timer is checked with the TimerExpired trigger.
IF
Global("KRDEAD","LOCALS",0 )
Dead("Shadra01")
THEN
RESPONSE #100
StartTimer("SPAWNMON",12)
SetGlobal("KRDEAD","LOCALS",1)
END
IF
Timer Expired("SPAWNMON")
Global("KRDEAD","LOCALS",1)
THEN
RESPONSE #100
CreateCreature("Grothgar",[700.700],0)
END
This action is used as a form of script communication, in conjunction with the Trigger() trigger. The action has the same range as GiveOrder and affects only one creature at a time. Note that the LastTrigger() object does not get set after receiving a trigger.
This action causes a delay in script processing. The time is measured in seconds.
IF
See(Player1)
See(Player6)
THEN
RESPONSE #100
MoveToObject(Player1)
Wait(2)
MoveToObject(Player6)
Wait(4)
END
This action resets the fog of war for the area the active creature is in.
IF
True()
THEN
RESPONSE #100
UndoExplore()
END
This action removes the fog of war for the area the active creature is in.
IF
True()
THEN
RESPONSE #100
Explore()
END
This action changes the time of day. The time parameter is taken from time.ids, though a direct number can be specified. The example script is from when Irenicus leaves his dungeon.
IF
Global("AmaWaukeen","GLOBAL",1)
THEN
RESPONSE #100
DayNight(MIDNIGHT)
SetGlobal("AmaWaukeen","GLOBAL",2)
FadeToColor([20.0],0)
CreateCreature("shthass1",[877.898],7)
StartCutSceneMode()
StartCutScene("cut24a")
END
This action changes the weather. The action only works in outdoors areas that have weather enabled in the ARE file. Values for the weather parameter are from weather.ids. Note that the fog weather type does not work.
IF
Global("KRSTORM","GLOBAL",0)
THEN
RESPONSE #100
Weather(RAIN)
SetGlobal("KRSTORM","GLOBAL",1)
END
This action calls lightning from the sky against the specified target.
IF
True()
THEN
RESPONSE #100
CutSceneId("DRUID12a")
CallLightning("Orc05")
CallLightning("Orc06")
END
This action will sequentially change the visual representation of armour the active creature is wearing. The action cycles from the lowest (none) to the highest (plate mail) armour level.
This action is a holdover from the non-interactive Baldur’s Gate Demo. It is non-functional in the game.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
See NIDSpecial1.
This action creates the specified item (resref) on the active creature. The usage parameters determine the number of items created or the number of charges on the item, depending on the item type being created. The example script is from AR0602.
IF
Global("BG1Pantaloons","GLOBAL",0)
PartyHasItem("MISC47")
THEN
RESPONSE #100
SetGlobal("BG1Pantaloons","GLOBAL",1)
ActionOverride("Picture1",CreateItem("MISC47",0,0,0))
Continue()
END
This action is similar to Wait(), it causes a delay in script processing. The time is measured in AI updates (which default to 15 per second)
IF
See(NearestEnemyOf())
THEN
RESPONSE #100
DisplayStingHead(Myself,50712)// Attack!! Attack!!
SmallWait(120)
Attack(NearestEnemyOf())
END
This action instructs the active creature to face the specified direction. Directions run from 0-15 with 0 being south and moving clockwise. Negative values cause object to rotate continuously.
IF
Global("BeholderBehavior","LOCALS",0)
See([PC])
HPGT(Myself,65)
THEN
RESPONSE #100
FaceObject([PC])
ForceSpell([PC],BEHOLDER_CHARM_PERSON)
Continue()
END
This action causes the active creature to walk randomly. The example script is blbear.bcs; it instructs bears to walk rather than fight if the nearest enemy is a druid.
IF
Delay(5)
See(NearestEnemyOf(Myself))
Class(NearestEnemyOf(Myself),DRUID)
NumCreatureGT([ENEMY],1)
THEN
RESPONSE #100
RandomWalk()
END
This action sets whether a creature can be interrupted while carrying out script actions.
IF
See(Player2)
!Range(Player2,4)
THEN
RESPONSE #100
SetInterrupt(FALSE)
MoveToObject("Player2")
SetInterrupt (TRUE)
END
This action instructs the active creature to protect the specified creature (i.e. attack any enemies of the creature), while staying within the specified range. The example script is from IWD, 4003bsg.bcs and controls the zombies guarding Presio.(4003BSG.bcs).
IF
True()
THEN
RESPONSE #100
ProtectObject("Presio",100)
END
This action instructs the active creature to leave the current area.
This action instructs the active creature to select the specified slot, and use the ability in the extended header specified by the ability parameter. The example script is from ankheg.bcs.
IF
See(NearestEnemyOf(Myself))
Range(NearestEnemyOf(Myself),5)
Delay(12)
THEN
RESPONSE #40
SelectWeaponAbility(SLOT_WEAPON,0)
RunAwayFrom(NearestEnemyOf(Myself),45)
AttackReevaluate(NearestEnemyOf(Myself),15)
RESPONSE #60
SelectWeaponAbility(SLOT_WEAPON1,0)
AttackReevaluate(NearestEnemyOf(Myself),15)
END
The signature of this action is not listed in the action.ids file provided with the game. This action causes the active creature to leave the area using the trigger region identified by the specified parameter. The parameter is the internal global ID of the region.
This action instructs the active creature to attack creatures with the same specific value as the target creature.
This action 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
RES
filenames with +
, Dialogs and the console cannot. Same with the ~
, `
, '
, @
, $
, ^
, and &
characters, maybe some more.
- This action will default to a spell matching the first 7 characters in Dialogs/Console IF the 8th character isn’t valid.
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 attack the target, without sounding a battlecry.
This action gives the appearance of flying - the active creature is able to pass over impassable areas. The example script is from randfly.bcs.
IF
True()
THEN
RESPONSE #100
RandomFly()
END
This action is used internally by action 100 (RandomFly); it moves the active creature towards the given point for the specified amount of time.
This action sets the morale of the active creature.
This action alters the morale of the target by the specified amount. The change amount can be positive or negative. The example script is from bardsh.bcs.
IF
AttackedBy([GOODCUTOFF],DEFAULT)
Allegiance(Myself,NEUTRAL)
Global("PlayerAttackedActors","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("PlayerAttackedActors","GLOBAL",1)
MoraleInc(Myself,-5)
Enemy()
END
This action alters the morale of the target by the specified amount. The change amount can be positive or negative.
This action instructs the active creature to attack the specified target for one round.
IF
See(NearestEnemyOf())
THEN
RESPONSE #100
AttackOneRound(NearestEnemyOf())
END
This action is used to shout the specified number. The action is used in conjunction with the Heard trigger. A silenced creature cannot shout.
IF
StateCheck(Myself,STATE_POISONED)
THEN
RESPONSE #100
Shout(4010)
END
IF
Heard([GOODCUTOFF],4010)
HaveSpell(CLERIC_SLOW_POISON)
THEN
RESPONSE #100
Spell(LastHeardBy(),CLERIC_SLOW_POISON)
END
This action instructs the active creature to move a certain distance from its current location; i.e. the point is relative to the creatures current location.
This action, in its first form, instructs the active creature to leave the current area, either by walking, or, if the path is blocked, by simply disappearing. In the actions second form the action functions as a combination of EscapeAreaDestroy() and MoveBetweenAreas(). The parameters are similar to MoveBetweenAreas(), in that it takes in all the same information, but unlike MoveBetweenAras(), the character will search for the nearest travel trigger, move to that, then execute his movement to the specified area. If he cannot find a travel trigger, he will execute the movement.
The action is uninterruptable; actions listed this one in a script may not execute as intended.
IF
HPPercentLT(Myself,35)
THEN
RESPONSE #100
EscapeArea()
END
See EscapeArea.
This action alters the specified variable, in the specified scope, by the amount indicated. The amount can be positive or negative. Variables in the local scope cannot be changed with this action.
IF
See([EVILCUTOFF]
!Specifics(LastSeenBy(),160)
!Inparty(LastSeenBy())
!Allegiance(LastSeenBy([GOODCUTOFF])
THEN
RESPONSE #100
ChangeSpecifics(LastSeenBy(),160)
IncrementGlobal("KR_MONSTER_COUNTER_ALIVE","GLOBAL",1)
END
This action changes the current area. Parchment is the MOS image to use in the area transition loading screen. Only EE games support IDS symbols for Face
.
IF
Global("MissionPackSave","GLOBAL",0)
THEN
RESPONSE #100
TextScreen("toscst")
ActionOverride(Player1,LeaveAreaLUA("AR1000","",[3048.831],4))
ActionOverride(Player2,LeaveAreaLUA("AR1000","",[3055.917],4))
ActionOverride(Player3,LeaveAreaLUA("AR1000","",[2990.913],4))
ActionOverride(Player4,LeaveAreaLUA("AR1000","",[2992.812],4))
ActionOverride(Player5,LeaveAreaLUA("AR1000","",[3079.737],4))
ActionOverride(Player6,LeaveAreaLUA("AR1000","",[3005.742],4))
END
This action removes the active creature from the game. No death variable is set. Global creatures like
joinable NPCs, familiars and recipients of MakeGlobal
are still accessible by script name and are not
fully removed. The example script is from the Irenicus cutscene at the beginning of the game.
IF
True()
THEN
RESPONSE #100
CutSceneId("CSCowl7")
ForceSpell("CSIren",0)
Wait(1)
DestroySelf()
END
This action is used by the engine internally. An object id is expected in the in1 parameter.
This action causes the active creature to cast the specified spell at the target object. The spell need not currently be memorised by the caster, and will not be interrupted while being cast. The caster must meet the level requirements of the spell. 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
- Scripts can handle
RES
filenames with+
, Dialogs and the console cannot. Same with the~
,`
,'
,@
,$
,^
, and&
characters, maybe some more.- This action will default to a spell matching the first 7 characters in Dialogs/Console IF the 8th character isn’t valid.
- If
CastingLevel = 0
, then the action will use Caster Level.
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
- Scripts can handle
RES
filenames with+
, Dialogs and the console cannot. Same with the~
,`
,'
,@
,$
,^
, and&
characters, maybe some more.- This action will default to a spell matching the first 7 characters in Dialogs/Console IF the 8th character isn’t valid.
- If
CastingLevel = 0
, then the action will use Caster Level.
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). 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
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 will never stop, (unless interrupted in specific situations), and thus never leave the action list.
- Executes Wait() for a random amount of time, (1–40 seconds), if the creature goes off-screen.
- Waits 1–10 seconds between each evaluation.
This action causes the target creature to die, dropping any droppable items they are carrying.
IF
Global("KillArntra04","AR0307",1)
THEN
RESPONSE #100
SetGlobal("KillArntra04","AR0307",2)
ActionOverride("arntra04",Face(10))
Wait(1)
ForceSpell("arntra04",CLERIC_FLAME_STRIKE)
Wait(1)
Kill("arntra04")
CreateCreature("Arntra05",[3213.485],0)
END
This action plays a sound linked to the object.
IF
Delay(2)
HPPercentLT(Myself,35)
THEN
RESPONSE #95
Shout(HURT)
Continue()
RESPONSE #5
VerbalConstant(Myself,HURT)
Shout(HURT)
Continue()
END
This action clears the action list of the specified object. The example script is from ar2400.bcs.
IF
GlobalTimerExpired("udWaitOgreDoor","GLOBAL")
Global("HaveOgreOpenDoor","AR2400",0)
Global("udGithDead","AR2400",0)
!Global("udMind","GLOBAL",30)
THEN
RESPONSE #100
SetInterrupt(FALSE)
SetGlobal("HaveOgreOpenDoor","AR2400",1)
ClearActions(Player1)
ClearActions(Player2)
ClearActions(Player3)
ClearActions(Player4)
ClearActions(Player5)
ClearActions(Player6)
SetInterrupt(TRUE)
StartCutSceneMode()
StartCutScene("Cut44i")
END
This action instructs the active creature to attack the target for the specified time (ReevaluationPeriod) which is measured in AI updates (which default to 15 per second).The script will then run again, checking for other true conditions.
IF
See([EVILCUTOFF])
Range(LastSeenBy(),4)
!InParty(LastSeenBy())
!Allegiance(LastSeenBy(Myself),GOODCUTOFF)
!Class(LastSeenBy(Myself),INNOCENT)
InWeaponRange(LastSeenBy())
HasWeaponEquiped()
THEN
RESPONSE #100
AttackReevaluate(LastSeenBy(),30)
END
This action locks the screen on the active creature, preventing the screen from being scrolled away. The action only works when executed by a creature (its own script or via ActionOverride
).
IF
CombatCounter(0)
THEN
RESPONSE #100
LockScroll()
END
This action unlocks the screen if it has been locked.
IF
OR(2)
HotKey(H)
!CombatCounter(0)
THEN
RESPONSE #100
UnlockScroll()
END
This action instructs the active creature to start the specified dialog with the specified target. The dialog can be initiated from a distance and must have at least one state with all its top level conditions true else it will not initiate. The active creature has its dialog file permanently set to the file specified by the DialogFile parameter.
IF
See([PC])
NumTimesTalkedTo(0)
THEN
RESPONSE #100
StartDialog("andris",[PC])
END
This action sets the dialog file of the active creature to the specified file. SetDialogue(“”) will set the dialog file to nothing.
IF
AttackedBy([GOODCUTOFF],DEFAULT)
Global("KR_CHANGE_DIALOG","LOCALS",0)
THEN
RESPONSE #100
SetDialogue("")
SetGlobal("KR_CHANGE_DIALOG","LOCALS",1)
END
This action creates the item specified by the resref parameter on the creature specified by the object parameter, with quantity/charges controlled by the usage parameters.
IF
GlobalTimerExpired("dwVith","GLOBAL")
Global("dwVithal","GLOBAL",3)
THEN
RESPONSE #100
CreateVisualEffectObject("SPPLANAR","udvith")
Wait(2)
Activate("udvith")
GiveItemCreate("scrl8z","udvith",1,1,0)
GiveItemCreate("scrl9g","udvith",1,1,0)
GiveItemCreate("scrl9e","udvith",1,1,0)
GiveItemCreate("scrl9v","udvith",1,1,0)
GiveItemCreate("scrl9r","udvith",1,1,0)
SetGlobal("dwVithal","GLOBAL",4)
END
This action gives the party a sum of gold corresponding to the given global variable. The gold amount is deducted from the active creature. The example script will give the party 50gp.
IF
Global("Cash","GLOBAL",50)
THEN
RESPONSE #100
GivePartyGoldGlobal("Cash","GLOBAL")
END
This action is used by the engine internally. An object id is expected in the in1 parameter.
This action will open the specified door. If the door is locked the creature must possess the correct key. Some doors central to the plot doors cannot be opened. The active creature can stick on this action if it fails.
IF
See("Door01"
OpenState("Door01",FALSE)
!See([GOODCUTOFF])
!TargetUnreachable("Door01")
THEN
RESPONSE #100
MoveToObjectNoInterrupt("Door01")
Unlock("Door01" )
OpenDoor("Door01")
END
This action closes the specified door. The example script is from ar0300.bcs.
IF
OR(2)
Global("LyrosJob","GLOBAL",3)
Dead("lyros")
Exists("Rylock")
Global("RylockLeavesHarperDoor","AR0300",0)
THEN
RESPONSE #100
SetGlobal("RylockLeavesHarperDoor","AR0300",1)
CloseDoor("DOOR0308")
Lock("DOOR0308")
ActionOverride("Rylock",EscapeArea())
END
This action instructs the active creature to attempt to pick the lock of the specified object. This action can be used for any creature (not just thieves) though success in picking the lock depends on points in the Open Locks
skill.
This action causes the active creature to change animation to the specified animation (values from animate.ids)
IF
!InPartyAllowDead("Aerie")
!Dead("Aerie")
!GlobalGT("AerieTransform","GLOBAL",0)
Global("Aerie","AR0607",0)
Global("KalahI","AR0607",0)
THEN
RESPONSE #100
MoveGlobal("Ar0607","Aerie",[318.378])
ChangeEnemyAlly("Aerie",NEUTRAL)
SetGlobal("Aerie","AR0607",1)
ActionOverride("Aerie",Polymorph(MAGE_FEMALE_ELF))
ActionOverride("Aerie",SetBeenInPartyFlags())
SetGlobal("AerieTransform","GLOBAL",2)
END
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
RES
filenames with +
, Dialogs and the console cannot. Same with the ~
, `
, '
, @
, $
, ^
, and &
characters, maybe some more.
- This action will default to a spell matching the first 7 characters in Dialogs/Console IF the 8th character isn’t valid.
This action is miscoded in the default action.ids file (the number 0 should be the capital letter O). When corrected, this action causes the active creature to attempt to bash the specified door.
This action instructs the active creature to equip the most damaging melee weapon from those available in the quickslots. Damage is calculated on the THAC0 bonus and damage - special bonuses versus creature types and elemental damages are not checked.
IF
See([EVILCUTOFF])
THEN
RESPONSE #100
EquipMostDamagingMelee()
Attack([EVILCUTOFF])
END
This action starts the specified store with the specified object.
IF
Global("KRSTART_STORE","LOCALS",1)
THEN
RESPONSE #100
StartStore("Tem4802",LastTalkedToBy())
END
This action displays the strref specified by the StrRef parameter in the message window, attributing the text to the specified object.
IF
HasItem("potn52",Myself)
HPPercentLT((),50)
THEN
RESPONSE #100
UseItem("potn52",Myself)
DisplayString(Myself,46150)
END
This action changes the EA status of the target creature to the specified value. Values are from ea.ids.
IF
Global"KR_ENEMYALLY_CHANGE","LOCALS",0)
THEN
RESPONSE #100
SetGlobal"KR_ENEMYALLY_CHANGE","LOCALS",1)
ChangeEnemyAlly(Myself,NEUTRAL)
END
This action changes the general status of the target creature to the specified value. Values are from general.ids.
IF
Global"KR_GENERAL_CHANGE","LOCALS" ,0)
THEN
RESPONSE #100
SetGlobal"KR_GENERAL_CHANGE","LOCALS",1)
ChangeGeneral(Myself,UNDEAD)
END
This action changes the race of the target creature to the specified value. Values are from race.ids.
IF
Global"KR_RACE_CHANGE","LOCALS",0)
THEN
RESPONSE #100
SetGlobal"KR_RACE_CHANGE","LOCALS",1)
ChangeRace(Myself,DRAGON)
END
This action changes the class of the target creature to the specified value. Values are from class.ids.
IF
Global"KR_CLASS_CHANGE","LOCALS",0)
THEN
RESPONSE #100
SetGlobal"KR_CLASS_CHANGE","LOCALS",1)
ChangeClass(Myself,FIGHTER)
END
This action changes the specific status of the target creature to the specified value. Values are from specific.ids. The action produces inconsistent results when used on player characters in multiplayer games. The specific value is represented by one byte, and so is limited to values 0-255. The example script assigns a script to a newly created simulacrum.
IF
See([ALLY])
!InParty(LastSeenBy(Myself))
!Gender(LastSeenBy(Myself),SUMMONED)
!General(LastSeenBy(Myself),ANIMAL)
!General(LastSeenBy(Myself),MONSTER)
!General(LastSeenBy(Myself),UNDEAD)
!General(LastSeenBy (Myself),GIANTHUMANOID)
!Race(LastSeenBy(Myself),ELEMENTAL)
!Race(LastSeenBy(Myself),MEPHIT)
!Race(LastSeenBy(Myself),IMP)
!HasItem("IMOENHP1&q uot;,LastSeenBy(Myself))
!HasItem("MINHP1",LastSeenBy(Myself))
!Specifics(LastSeenBy(Myself),100)
THEN
RESPONSE #100
DisplayStringHead(LastSeenBy(Myself),26234) // 'Simulacrum'
ActionOverride(LastSeenBy(Myself), ChangeAIScript("gbSim",DEFAULT))
ChangeSpecifics(LastSeenBy(Myself),100)
END
This action changes the gender of the target creature to the specified value. Values are from gender.ids. The example script changes the gender of summoned creatures to neither, to bypass the 5 concurrent summoned creatures limit.
IF
See([ALLY])
!InParty(LastSeenBy(Myself))
Gender(LastS eenBy(Myself),SUMMONED)
!Specifics(LastSeenBy(Myself),3001)
THEN
RESPONSE #100
ChangeGender(LastSeenBy(),NEITHER)
ChangeSpecifics(LastSeenBy(Myself), 3001)
END
This action changes the alignment of the target creature to the specified value. Values are from align.ids.
IF
Global("KR_ALIGN_CHANGE","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("KR_ALIGN_CHANGE","LOCALS",1)
ChangeAlignment(LastSeenBy(Myself),CHAOTIC_GOOD)
END
This action causes the active creature to cast the specified spell at the target object. The spell is applied instantly; no casting animation is played. The spell cannot be interrupted. For the RES version of the action, the spell name can not consist of only numbers, should be written in upper case and should be no more than 7 characters long. Note that for normal spellcasting the probability dice values for effects are rolled for each spell, whereas spells applied in the same scripting block by ApplySpell use a single dice value. The example script is used to mimic a contingency from mage18y.bcs.
IF
See(NearestEnemyOf(Myself))
Global("Prep","LOCALS",0)
THEN
RESPONSE #100
ApplySpell(Myself,WIZARD_STONE_SKIN)
ApplySpell(Myself,WIZARD_SPELL_TRAP)
ApplySpell(Myself,WIZARD_MIRROR_IMAGE)
ApplySpell(Myself,WIZARD_SPELL_TURNING)
ApplySpell(Myself,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)
ApplySpell(SixthNearestEnemyOf(Myself),WIZARD_MONSTER_SUMMONING_4)
SetGlobal("Prep","LOCALS",1)
END
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 (or takes if negative) the specified amount of experience to the party. The XP amount is distributed among all current living party members. The example script is from ar1300.bcs.
IF
OpenState("Bridge01",TRUE)
Global("BridgeOpen","GLOBAL",0)
!Dead("Torgal")
THEN
RESPONSE #100
SetGlobal("BridgeOpen","GLOBAL",1)
DisplayString(Myself,'The drawbridge has been lowered.')
CreateCreature("KPCAPT03",[2400.1592],6)
CreateCreature("KPSOLD03",[2425.1676],6)
CreateCreature("KPSOLD04",[2371.1754],6)
CreateCreature("KPSOLD05",[2315.1805],6)
CreateCreature("TROLGI01",[2391.1592],0)
CreateCreature("TROLGI02",[2282.1742],0)
CreateCreature("KPYUAN01",[2251.1731],0)
AddexperienceParty(29750)
(cut short for brevity)
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.
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. The example script is from suelfw9.bcs.
This action changes the active creature’s selection circle to purple - making it unselectable. Creatures made unselectable stop processing scripts.
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 starts playing a music track. The slot parameter refers to the music slots contained in the ARE header - values are from musics.ids. The flags parameter indicates how the music should be played - values are from mflags.ids.
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 multiplayer-only action changes the current area. Parchment is the MOS image to use in the area transition loading screen. Only EE games support IDS symbols for Face
.
This action saves the current game state with a save name of “Final Save”.
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. 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"
.
RES
filenames with +
, Dialogs and the console cannot. Same with the ~
, `
, '
, @
, $
, ^
, and &
characters, maybe some more.
- This action will default to a spell matching the first 7 characters in Dialogs/Console IF the 8th character isn’t valid.
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.
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.
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.
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 is like Wait, but the duration is random within the bounds of the parameters.
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.
This action sets the saved location of the active creature to the creature’s current location. The location is saved in the CRE file.
This action instructs the active creature to jump to its saved location (as set by SetSavedLocation()).
IF
!NearSavedLocation(7)
THEN
RESPONSE #100
ReturnToSavedLocation()
END
This action sets the specified internal variable of the target object to the specified value. Each creature has five internal variables (indexed from 0 to 4) stored in the CRE file. Internals are work in a similar way to LOCAL variables.
This action alters the specified internal variable for the target creature by the amount indicated. The amount can be positive or negative.
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 icewind*.ini.
This action alters the specified stat on the target object, in accordance with the specified value and modifier. Values for Stats are from stats.ids. Values for StatMod are from statmod.ids.
This action sets the saved location of the active creature to the specified location and direction. The location is saved in the CRE file.
IF
!BitGlobal(":CREATURE_STATE_VAR","LOCALS",512,AND)
GlobalGT("MIREK_QUEST","GLOBAL",3)
THEN
RESPONSE #100
SetSavedLocationPoint(2084,1714,SE)
SetStartPos([2084.1714])
BitGlobal(":CREATURE_STATE_VAR","LOCALS",512,OR)
Continue()
END
This action causes the active creature to drop all its inventory items (except those marked undroppable?).
Like ChangeAIScript
this action changes the script file for the active scriptable object (container, creature, door etc.). It does not take a script level parameter, but changes the currently active script.
This action instructs the active creature to equip the best weapon (from those available in the quickslots) for attacking the target object. If the target creature is within the specified range the most damaging melee weapon is equipped, whereas if the creature is beyond the specified range the most damaging ranged weapon is equipped.
IF
See(NearestEnemyOf(Myself))
!Allegiance(NearestEnemyOf(Myself),PC)
THEN
RESPONSE #100
Shout(ATTACKING)
SetBestWeapon(NearestEnemyOf(Myself),6)
AttackReevaluate(NearestEnemyOf(Myself),105)
END
This action sets the maximum dialog range (used by Dialogue() and DialogueNoSet()), i.e. the actions will work if the creature targetted by those actions is within this distance.
IF
NumTimesTalkedTo(0)
See([PC])
!Allegiance(Myself,ENEMY)
!Dead(Myself)
THEN
RESPONSE #100
SetDialogueRange(75)
Dialogue([PC])
END
This action rests the party until all PCs are fully healed. Healing Spells are cast by the party at the start of each rest period except the first.
This action sets the visual range of the creature to the specified value. Values greater than 23 still work on party members, but can cause line-of-sight issues with the fog of war. If the player character uses a value of 0 or 1, no other NPCs will be rendered as the fog of war will cover everything.
This action displays the message specified by the strref paramater.
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 saves the game using the specified description.
This action instructs the active creature to play the specified bard song. Values are from bardsong.ids.
IF
ActionListEmpty()
CheckStatGT(Myself,2,LEVEL)
OR(2)
!Global("grCurrentSongPlaying","LOCALS",1)
!ModalState(Myself,BATTLESONG)
OR(6)
StateCheck(Player1,STATE_PANIC)
StateCheck(Player2,STATE_PANIC)
StateCheck(Player3,STATE_PANIC)
StateCheck(Player4,STATE_PANIC)
StateCheck(Player5,STATE_PANIC)
StateCheck(Player6,STATE_PANIC)
THEN
RESPONSE #100
SetGlobal("grCurrentSongPlaying","LOCALS",1)
PlayBardSong(THE_TALE_OF_CURRAN_STRONGHEART)
END
This action instructs the active creature to turn the indicated amount from its current orientation (i.e. the action acts as a relative Face() action).
This action sets the Critical Path flag on the specified objects to the specified value. The game ends if a creature with the Critical Path flag set is killed.
This action is like SmallWait, but the duration is random within the bounds of the parameters.
This action toggles weather the party is allowed to rest in the current area.
This action removes any invisibility effects and aborts the hiding in shadows modal action.
This action instructs the target object to (un)equip the specified item in the indicated slot. The example script instructs the active creature to equip “theItem” in the fist weapon slot.
IF
Global("iiEquipped","GLOBAL",0)
THEN
RESPONSE #100
XEquipItem("theItem",Myself,SLOT_WEAPON,TRUE)
SetGlobal("iiEquipped","GLOBAL",1)
END
This action changes the markups in the store. BuyMarkup refers to the markup paid when buying from the store, SellMarkup the opposite, while AdditionalMarkup is the depreciation rate, which is relevant when selling the same item several times.
This action sets the specified teambit to the specified value. Each area has up to 32 global variables (Team_0, Team_1 etc). Actors are assigned to groups represented by these variables by this action. The group variables can then be used as a form of communication - when one member of a team sees an enemy, the entire team will converge upon the enemy.
Adds a Wait action to the queue for the current object, equal to the exact casting time of the spell, i.e. the script writing need not worry about time spent inactive due to failed/cancelled spells. If the parameter is 0 a Wait action equal to the casting time of the previous cast spell is added to the queue.
This action sets/clears bits in creature flags (CRE file, offset 0x10) for the specified object.
This action is used for spell validation (e.g. only casting Call Lightning in an outdoor area). Flag values are from splcast.ids.
This action copies the current or maximum HP (as specified by HPFlags) of the active creature to the target object.
This action waits for the target object to complete the indicated animation sequence, if the sequence is underway.
This action sets the area music. The SetSlot parameter links to the area music slot and the With parameter refers to a MUS file.
This action sets/clear the area flags held at 0xc in the ARE file for the current area.