Begin

From GECK
Jump to: navigation, search

All script commands, except for variable declarations, must be inside a begin-end block. Each time the script runs, each block will be evaluated to see if it is valid. If not, the script inside the block will not be run.

Example:

 begin GameMode
ID Blocktype Parameters Description
0 GameMode This will be run every frame while the game is in non-menu mode. Most scripts will use this block type exclusively.
1 MenuMode MenuType (optional) Run every frame while the game is in menu mode.
2 OnActivate Run once when object is activated.
3 OnAdd ContainerRefID (optional) Run once when object is added to Container's inventory.
4 OnEquip ActorID (optional) Run once when object is equipped by ActorID.
5 OnUnequip ContainerRefID (optional) Run once when object is unequipped by ActorID.
6 OnDrop ContainerRefID (optional) Run once when object is dropped from Container.
7 SayToDone TopicID (optional) Run once when actor finishes saying a line of dialogue.
8 OnHit ActorID (optional) Run once when actor is hit by ActorID
9 OnHitWith ObjectID (optional) Run once when actor is hit by weapon ObjectID
10 OnDeath ActorID (optional) Run once when actor is killed by ActorID
11 OnMurder ActorID (optional) Run once when actor is murdered by ActorID
12 OnCombatEnd Run once when actor drops out of combat.
13 Function { Arguments (optional) } Special block type used only by User Defined Function scripts (NVSE only)
15 OnPackageStart PackageID Run once when actor starts specified package
16 OnPackageDone PackageID Run once when actor completes specified package
17 ScriptEffectStart Special block type used only by Magic Effect scripts
18 ScriptEffectFinish Special block type used only by Magic Effect scripts
19 ScriptEffectUpdate Special block type used only by Magic Effect scripts
20 OnPackageChange PackageID Run once when actor changes from specified package
21 OnLoad Run once when object's 3D is loaded
22 OnMagicEffectHit EffectID (optional) Run once when the actor is hit by the specified magic effect
23 OnSell SellerRefID (optional) Run once when object is sold by specified seller
24 OnTrigger Run each frame something is triggering the object
25 OnStartCombat TargetActorID (optional) Run once when actor enters combat with TargetActorID
26 OnTriggerEnter TriggeringRefID (optional) Run once when reference enters the trigger object
27 OnTriggerLeave TriggeringRefID (optional) Run once when reference leaves the trigger object
28 OnActorEquip ObjectID Run once when the scripted actor equips the specified object.
29 OnActorUnequip ObjectID Run once when the scripted actor unequips the specified object.
30 OnReset Run once when scripted object's cell is reset
31 OnOpen Run once when the scripted container is opened.
32 OnClose Run once when the scripted container is closed.
33 OnGrab Run once when the scripted object is grabbed by the player
34 OnRelease Run once when the scripted object is released from player grab
35 OnDestructionStageChange
36 OnFire Run once when the scripted weapon is fired (New Vegas only)
37 OnNPCActivate Run once when object is activated by an NPC (Untested; New Vegas only)

Notes

For parameterized blocks, you can have several of the same block type using different parameters. For example, this script is valid:

 begin OnAdd
    ; some script
    ; this will run every time this object is added to someone's inventory
 end
 begin OnAdd player
  ; some script
  ; this will run every time this object is added to the player's inventory.
  ; Note that the unparameterized OnAdd block will ALSO be run in this case.
 end
 begin OnAdd MysteriousChest
  ; some script
  ; this will run every time this object is added to the MysteriousChest's inventory.
  ; Note that the unparameterized OnAdd block will ALSO be run in this case.
 end