Skip to main content

Script ids

Conditions and commands are engine functions picked by number. These are the ones that have been identified while working on this mod - a small slice of what the engine knows, but the slice that comes up.

Conditions​

IdNameNotes
0NextThe state is finished: its sub-script ended, or there was nothing to wait for
2ElseAlways true - the fall-through rule
5TimeInUnitThreshold is seconds spent in this state
7AnimationFinished
51GotUserMessageEqualsParameter is the message number; pair with ClearUserMessage
91, 92boss hit countersUsed by boss scripts with a threshold
122dialogue busy
155distance-ishThreshold is a distance
176Used by doors
571(identical "return 0" stub)Re-pointed by the mod to free 0x12C578
572CutsceneSkippedStubbed to return 0.0 in retail. The mod makes it "player param holds Triangle"
575Triangle heldReads the pad's Triangle pressure for player param
596Vehicle tricks
639story progress
641movie playingScripts wait on NOT Cond641 after PlayMovie

Parameters and thresholds matter as much as the id: the same condition is "wait 0.3 seconds" or "wait 3 seconds" depending on the threshold, and message conditions take the message number as the parameter.

Commands​

Named by the editor library where it knows them, CmdN where it does not.

IdNameNotes
515SetAgentPacked mask/value - see Objects
DoAnim, DoSound, DoParticle
PosWarp, PosWarp2, RotWarpPlacement; only meaningful while the owning scene runs
SetFocusToPlayer, SetFocusToKey, RequestFocus, ClearFocus"Focus" is the thing the script is acting on
SendUserMessage, MessageLinkedObject, BroadcastUserMessage, ClearUserMessageTarget and message packed into one word
TriggerLinkedObjectsSwitches linked objects to their _ACTIVATED script
PlayMovie(id, x)Starts a pre-rendered movie
ToggleCutsceneCamera, CutsceneStart, CutsceneEnd, FadeoutScreen
BottomTextDisplay(index, x, y, r, g, b, 0), BottomTextClear, BottomTextShow, BottomTextHideCommand ids 603, 608, 619, 620
BossModeEnable, BossModeDamage, BossModeExitThe boss health bar
SetPlayerInput, SetPlayerMode, SwitchCharacter, UnlinkCharacters
DestroyMeRemoves the instance
SetCollisions, SetState, SetObject, SetCounter, ModifyCounter

User messages​

NumberMeaning
207"carry on" - the scene's step is done
243, 244244 is "the scene was skipped"; actors answer it by going to their end marks
87, 88, 105, 106, 156, 188Level and boss plumbing

Messages are packed with their target into a single argument word - for example 0x03FB00CF is message 207 and 0x03FB00F4 is 244 to the same target. The quickest way to get the packing right is to copy an existing command and setarg the number.

Where the tables live​

The command factory jump table is at 0x2EC530, indexed by command id; each entry allocates the command object and points it at a vtable whose slots are "read arguments", "execute" and so on. Conditions are built by BuildScriptCondition at 0x106C40, and the condition check functions live in a table around 0x2F0AB8.

All three, and every other address this wiki quotes, are collected on Addresses.