BG1: TotS Script Triggers

0x0001 Acquired(S:ResRef*)
NT Returns true only if the current CRE obtained the specified item in the last script round.
Trigger appears to be broken?

0x0002 AttackedBy(O:Object*,I:Style*AStyles)
Returns true only if the active CRE was attacked in the style specified (not necessarily hit) or had an offensive spell cast on it by the specified object in the last script round. The style parameter is non functional - this trigger is triggered by any attack style.

0x0003 Help(O:Object*)
Returns true if the specified object shouted for help (using the Help() action?) in the last script round.

0x0004 Joins(O:Object*)
Returns true if the specified object has joined the party in the last script round. This trigger is only sent to player characters.

0x0005 Leaves(O:Object*)
Returns true if the specified object has left the party in the last script round. This trigger is only sent to player characters.

0x0006 ReceivedOrder(O:Object*,I:Order ID*)
NT

0x0007 Said(O:Object*,I:Dialog ID*)
NT

0x0008 TurnedBy(O:Object*)
NT Returns true only if the active CRE was turned by the specified priest or paladin.

0x0009 Unusable(S:ResRef*)
NT Returns true only if the specified item is unusable by the active CRE.

0x400A Alignment(O:Object*,I:Alignment*Align)
Returns true only if the alignment of the specified object matches that in the second parameter.

0x400B Allegiance(O:Object*,I:Allegience*EA)
Returns true only if the Enemy/Ally status of the specified object matches that in the second parameter.

0x400C Class(O:Object*,I:Class*Class)
Returns true only if the Class of the specified object matches that in the second parameter.

0x400D Exists(O:Object*)
NT Returns true only if the specified object exists.

0x400E General(O:Object*,I:General*General)
Returns true only if the General category of the specified object matches that in the second parameter.

0x400F Global(S:Name*,S:Area*,I:Value*)
Returns true only if the variable with name 1st parameter of type 2nd parameter has value 3rd parameter.

0x4010 HP(O:Object*,I:Hit Points*)
Returns true only if the current hitpoints of the specified object are equal to the 2nd parameter.

0x4011 HPGT(O:Object*,I:Hit Points*)
Returns true only if the current hitpoints of the specified object are greater than the 2nd parameter.

0x4012 HPLT(O:Object*,I:Hit Points*)
Returns true only if the current hitpoints of the specified object are less than the 2nd parameter.

0x4013 LOS(O:Object*,I:Range*)
Returns true only if the object specified is in the line of sight of the active CRE and within the given range. This seems to be a combination of the Range and See triggers (see below).

0x4014 Morale(O:Object*,I:Morale*)
Returns true only if the morale of the specified object is equal to the second parameter.

0x4015 MoraleGT(O:Object*,I:Morale*)
Returns true only if the morale of the specified object is greater than the second parameter.

0x4016 MoraleLT(O:Object*,I:Morale*)
Returns true only if the morale of the specified object is less than the second parameter.

0x4017 Race(O:Object*,I:Race*Race)
Returns true only if the Race of the specified object is the same as that specified by the 2nd parameter.

0x4018 Range(O:Object*,I:Range*)
Returns true only if the specified object is within distance given (in feet) of the active CRE.

0x4019 Reputation(O:Object*,I:Reputation*)
Returns true only if the reputation of the specified object is equal to the second parameter.

0x401A ReputationGT(O:Object*,I:Reputation*)
Returns true only if the reputation of the specified object is greater than the second parameter.

0x401B ReputationLT(O:Object*,I:Reputation*)
Returns true only if the reputation of the specified object is greater than the second parameter.

0x401C See(O:Object*)
Returns true only if the active CRE can see the specified object which must not be hidden or invisible.

0x401D Specifics(O:Object*,I:Specifics*Specific)
Returns true only if the specifics (as set in the CRE file or by the ChangeSpecifics action) of the specified object is equal to the 2nd parameter.

0x401E Time(I:Time*Time)
Returns true only if the period of day matches the period in the 2nd parameter (taken from Time.ids). Hours are offset by 30 minutes, e.g. Time(1) is true between 00:30 and 01:29.

0x401F TimeOfDay(I:Time Of Day*TimeODay)
As above but less specific and uses TimeODay.ids.

0x0020 HitBy(O:Object*,I:DameType*Damages)
Returns true only if the active CRE was hit by the specifed object by the specified damage type in the last script round. If the damage type is CRUSHING or 0 then this will return true for ANY damage type.
!HitBy returns true when the script is first activated (e.g. initial area load) and when hit by any damage type.

0x0021 HotKey(I:Key*HotKey)
Returns true only if the specified key was pressed in the last script round. Hotkeys defined in keymap.ini take precedence over hotkeys expected by this trigger.

0x0022 TimerExpired(I:ID*)
Returns true only if the local timer with the specified ID has expired. This action does not work as a state or response trigger in dialogs.

0x4023 True()
Always returns true.

0x0024 Trigger(I:TriggerNum*)
Used as a form of script communication, in conjunction with the SendTrigger() action. Seems to have the same range as GiveOrder, and affects only one creature at once. The LastTrigger object does not get set after receiving a trigger.

0x0025 Die()
Returns true if the active CRE has died in the last script round.
NB. When a block returns true to this trigger, this will be the final block executed in the script, unless it is Continue'd

0x0026 TargetUnreachable(O:Object*)
NT Returns true only if the object specified cannot be reached by normal walking by the active CRE.

0x4027 Delay(I:Delay*)
Delays the next check of the block of triggers where this trigger is, by the number of seconds specified. This value is not stored when the game is saved.

0x4028 NumCreature(O:Object*,I:Number*)
Returns true only if the number of creatures of the type specified in sight of the active CRE are equal to the 2nd parameter.

0x4029 NumCreatureLT(O:Object*,I:Number*)
As above except for less than.

0x402A NumCreatureGT(O:Object*,I:Number*)
As above except for greater than.

0x402B ActionListEmpty()
Returns true only if the active CRE has no actions waiting to be performed, i.e. is idle.

0x402C HPPercent(O:Object*,I:Hit Points*)
See HP(O:Object*,I:Hit Points*) except this is for a percentage.

0x402D HPPercentLT(O:Object*,I:Hit Points*)
See HPLT(O:Object*,I:Hit Points*) except this is for a percentage.

0x402E HPPercentGT(O:Object*,I:Hit Points*)
See HPGT(O:Object*,I:Hit Points*) except this is for a percentage.

0x002F Heard(O:Object*,I:ID*SHOUTIDS)
Returns true only if the active CRE was within 30 feet of the specified object and the specified object shouted the specified number (which does not HAVE to be in SHOUTIDS.ids) in the last script round.

0x4030 False()
Never returns true, i.e. is always false. A block of triggers containing this will never return true regardless of the other triggers in the block. The corresponding actions will never take place.

0x4031 HaveSpell(I:Spell*Spell)
Returns true only if the active CRE has the specified spell memorised.

0x4032 HaveAnySpells()
Returns true if the active CRE has at least one spell memorised.

0x0033 BecameVisible()
NT Returns true only if the active CRE turned visible in the last script round.

0x4034 GlobalGT(S:Name*,S:Area*,I:Value*)
See Global(S:Name*,S:Area*,I:Value*) except the variable must be greater than the value specified to be true.

0x4035 GlobalLT(S:Name*,S:Area*,I:Value*)
As above except for less than.

0x0036 OnCreation()
Returns true if the script is processed for the first time this session, e.g. when a creature is created (for CRE scripts) or when the player enters an area (for ARE scripts).

0x4037 StateCheck(O:Object*,I:State*State)
Returns true only if the specified object is in the state specified.

0x4038 NotStateCheck(O:Object*,I:State*State)
Exact opposite of above.

0x4039 NumTimesTalkedTo(I:Num*)
Returns true only if the player's party has spoken to the active CRE the exact number of times specified.
NB. NumTimesTalkedTo seems to increment when a PCinitiates conversion with an NPC, or an NPC initiates conversation with a PC. NumTimesTalkedTo does not seem to increment for force-talks, interactions, interjections and self-talking.

0x403A NumTimesTalkedToGT(I:Num*)
Returns true only if the player's party has spoken to the active CRE more than the number of times specified.

0x403B NumTimesTalkedToLT(I:Num*)
Returns true only if the player's party has spoken to the active CRE less than the number of times specified.

0x403C Reaction(O:Object*,I:Value*Reaction)
Returns true only if the reaction of the object specified (on the friendly-hostile scale) to the player was as specified.
NB. Reaction = 10 + rmodchr + rmodrep (see rmodchr.2da and rmodrep.2da).

0x403D ReactionGT(O:Object*,I:Value*Reaction)
Returns true if the reaction of the object specified (on the friendly-hostile scale) to the player was greater than specified.
NB. Reaction = 10 + rmodchr + rmodrep (see rmodchr.2da and rmodrep.2da).

0x403E ReactionLT(O:Object*,I:Value*Reaction)
Returns true if the reaction of the object specified (on the friendly-hostile scale) to the player was lower than specified.
NB. Reaction = 10 + rmodchr + rmodrep (see rmodchr.2da and rmodrep.2da).

0x403F GlobalTimerExact(S:Name*,S:Area*)
NT

0x4040 GlobalTimerExpired(S:Name*,S:Area*)
Returns true only if the timer with the name specified and of the type in the 2nd parameter has run and expired.

0x4041 GlobalTimerNotExpired(S:Name*,S:Area*)
Returns true only if the timer with the name specified and of the type in the 2nd parameter is still running. Note that if we use !GlobalTimerNotExpired (S:Name*,S:Area*) this will return true if the timer has never been set OR if it has already expired- very useful...most useful of all the GlobalTimer triggers :) .

0x4042 PartyHasItem(S:Item*)
Returns true if any of the party members have the specified item in their inventory. This trigger also checks with container items (e.g. Bags of Holding).

0x4043 InParty(O:Object*)
Returns true only if the specifed object is in the player's party.

0x4044 CheckStat(O:Object*,I:Value*,I:StatNum*Stats)
Returns true only if the specified object has the statistic in the 3rd parameter at the value of the 2nd parameter.

0x4045 CheckStatGT(O:Object*,I:Value*,I:StatNum*Stats)
Returns true only if the specified object has the statistic in the 3rd parameter greater than the value of the 2nd parameter.

0x4046 CheckStatLT(O:Object*,I:Value*,I:StatNum*Stats)
Returns true only if the specified object has the statistic in the 3rd parameter less than the value of the 2nd parameter.

0x4047 RandomNum(I:Range*,I:Value*)
Generates a random number between 1 and Range. Returns true only if the random number equals the 2nd parameter.

0x4048 RandomNumGT(I:Range*,I:Value*)
NT As above except returns true only if the random number is greater than the 2nd parameter.

0x4049 RandomNumLT(I:Range*,I:Value*)
NT As above except returns true only if the random number is less than the 2nd parameter.

0x004A Died(O:Object*)
Returns true only if the specifed object died in the last script round.

0x004B Killed(O:Object*)
NT Returns true if the active CRE killed the specified object in the last script round.

0x004C Entered(O:Object*)
Only for trigger regions in areas. Returns true only if the specified object entered the trigger region in the last script round.

0x404D Gender(O:Object*,I:Sex*Gender)
Returns true only if the gender of the specified object is that given in the 2nd parameter.

0x404E PartyGold(I:Amount*)
Returns true only if the player's party has the amount of gold specified in the 2nd parameter.

0x404F PartyGoldGT(I:Amount*)
Returns true only if the player's party has more gold than specified in the 2nd parameter.

0x4050 PartyGoldLT(I:Amount*)
Returns true only if the player's party has less gold than specified in the 2nd parameter.

0x4051 Dead(S:Name*)
Returns only true if the creature with the specified script name has its death variable set to 1. Not every form of death sets this, but most do. So it's an almost complete test for death. The creature must have existed for this to be true. Note that SPRITE_IS_DEAD variables are not set if the creaure is killed by a neutral creature.

0x0052 Opened(O:Object*)
Only for door scripts. Returns true only if the specified object opened the active door in the last script round.

0x0053 Closed(O:Object*)
Only for door scripts. Returns true only if the specified object closed the active door in the last script round.

0x0054 Detected(O:Object*)
Only for trap scripts. Returns true only if the specified object detected this trap in the last script round.

0x0055 Reset(O:Object*)
NT Only for trap scripts? Returns true only if this trap or trigger was reset in the last script round by the object specified.

0x0056 Disarmed(O:Object*)
Only for trap/trigger region scripts. Returns true only if the specified object disarmed this trap in the last script round.

0x0057 Unlocked(O:Object*)
Only for door scripts - returns true only if this door was unlocked by the specified object in the last script round.
Appears to be broken.

0x4058 OutOfAmmo()
NT Returns true only if the active CRE has no ammunition for the current ranged weapon.

0x4059 NumTimesInteracted(I:NPC*NPC,I:Num*)
NT Returns true only if the specified NPC has interacted with the party a number of times equal to the 2nd parameter.

0x405A NumTimesInteractedGT(I:NPC*NPC,I:Num*)
NT Returns true only if the specified NPC has interacted with the party a number of times greater than the 2nd parameter.

0x405B NumTimesInteractedLT(I:NPC*NPC,I:Num*)
NT Returns true only if the specified NPC has interacted with the party a number of times less than the 2nd parameter.

0x005C BreakingPoint()
NT Returns true only if the active CRE is at its morale breaking point.

0x005D PickPocketFailed(O:Object*)
Seems to be broken. Not used in any existing scripts.

0x005E StealFailed(O:Object*)
For shopkeepers. Returns true if the specified object failed to steal from the shop in the last script round.

0x005F DisarmFailed(O:Object*)
NT Not used in any existing scripts.

0x0060 PickLockFailed(O:Object*)
NT Not used in any existing scripts.

0x4061 HasItem(S:ResRef*,O:Object*)
Returns true only if the specified object has the specified item in its inventory. This trigger also checks with container items (e.g. Bags of Holding).

0x4062 InteractingWith(O:Object*)
NT Returns true only if the active CRE is interacting (dialogue?) with the specified object.

0x4063 InWeaponRange(O:Object*)
Returns true only if the specified object is within the range of the active CRE's currently equipped weapon.

0x4064 HasWeaponEquiped(O:Object*)
Returns true only if the specified object has a weapon in a quickslot.

0x4065 Happiness(O:Object*,I:Amount*Happy)
NT Returns true only if the specified object has the specified happiness value.

0x4066 HappinessGT(O:Object*,I:Amount*Happy)
NT Returns true only if the specified object has greater than the specified happiness value.

0x4067 HappinessLT(O:Object*,I:Amount*Happy)
NT Returns true only if the specified object has less than the specified happiness value.

0x4068 TimeGT(I:Time*Time)
Returns true only if the current time is greater than that specified. Hours are offset by 30 minutes, e.g. TimeGT(1) is true between 01:30 and 02:29.

0x4069 TimeLT(I:Time*Time)
Returns true only if the current time is less than that specified. Hours are offset by 30 minutes, e.g. TimeLT(1) is true between 23:30 and 00:29.

0x406A NumInParty(I:Num*)
Returns true only if the number of party members (dead ones also count) is equal to the number specified.

0x406B NumInPartyGT(I:Num*)
Returns true only if the number of party members (dead ones also count) is greater than the number specified.

0x406C NumInPartyLT(I:Num*)
Returns true only if the number of party members (dead ones also count) is less than the number specified.

0x406D UnselectableVariable(I:Num*)
NT

0x406E UnselectableVariableGT(I:Num*)
NT

0x406F UnselectableVariableLT(I:Num*)
NT

0x0070 Clicked(O:Object*)
Only for trigger regions. Returns true if the specified object clicked on the trigger region running this script.

0x4039 NumberOfTimesTalkedTo(I:Num*)
Returns true only if the number of times the party has spoken to this creature is equal to the number specified.

0x4071 NumDead(S:Name*,I:Num*)
Returns true only if the number of creatures with script name "Name" that have been killed is equal to the 2nd parameter.

0x4072 NumDeadGT(S:Name*,I:Num*)
Returns true only if the number of creatures with script name "Name" that have been killed is greater than the 2nd parameter.

0x4073 NumDeadLT(S:Name*,I:Num*)
Returns true only if the number of creatures with script name "Name" that have been killed is less than the 2nd parameter.

0x4074 Detect(O:Object*)
Returns true if the the specified object is detected by the active CRE in any way (hearing or sight). Neither Move Silently and Hide in Shadows prevent creatures being detected via Detect(). Detect ignores Protection from Creature type effects for static objects.

0x4075 Contains(S:ResRef*,O:Object*)
Returns true only if the item specified in parameter 1 is in the container specified in parameter 2.

0x4076 OpenState(O:Object*,I:Open*BOOLEAN)
NT Returns true only if the open state of the specified door matches the state specified in the 2nd parameter.

0x4077 NumItems(S:ResRef*,O:Object*,I:Num*)
Returns true only if the specified object has the number of items in the 3rd parameter of the type specified in the 1st parameter in its inventory.

0x4078 NumItemsGT(S:ResRef*,O:Object*,I:Num*)
Returns true only if the specified object has more than the number of items in the 3rd parameter of the type specified in the 1st parameter in its inventory.

0x4079 NumItemsLT(S:ResRef*,O:Object*,I:Num*)
Returns true only if the specified object has fewer than the number of items in the 3rd parameter of the type specified in the 1st parameter in its inventory.

0x407A NumItemsParty(S:ResRef*,I:Num*)
Returns true only if the party has a total number of items of the type specified equal to the 2nd parameter.

0x407B NumItemsPartyGT(S:ResRef*,I:Num*)
Returns true only if the party has a total number of items of the type specified greater than the 2nd parameter.

0x407C NumItemsPartyLT(S:ResRef*,I:Num*)
Returns true only if the party has a total number of items of the type specified less than the 2nd parameter.

0x407D IsOverMe(O:Object*)
Only for trigger regions. Returns true only if the specified object is over the trigger running the script.