Begin
Jump to navigation
Jump to 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
Blocktype | Parameters | Description |
---|---|---|
GameMode | This will be run every frame while the game is in non-menu mode. Most scripts will use this block type exclusively. | |
MenuMode | MenuType (optional) | Run every frame while the game is in menu mode. |
OnActivate | Run once when object is activated. | |
OnActorEquip | ObjectID | Run once when the scripted actor equips the specified object. |
OnActorUnequip | ObjectID | Run once when the scripted actor unequips the specified object. |
OnAdd | ContainerRefID (optional) | Run once when object is added to Container's inventory. |
OnAlarm | CrimeType, Criminal (optional) | Run once when the actor receives an alarm for the specified crime committed by Criminal (actor). |
OnAlarmVictim | CrimeType, Victim (optional) | Run once when the actor receives an alarm for the specified crime committed against Victim (actor). |
OnDeath | ActorID (optional) | Run once when actor is killed by ActorID |
OnDrop | ContainerRefID (optional) | Run once when object is dropped from Container. |
OnEquip | ActorID (optional) | Run once when object is equipped by ActorID. |
OnHit | ActorID (optional) | Run once when actor is hit by ActorID |
OnHitWith | ObjectID (optional) | Run once when actor is hit by weapon ObjectID |
OnKnockout | Run once when actor is knocked out by ActorID | |
OnLoad | Run once when object's 3D is loaded | |
OnMagicEffectHit | EffectID (optional) | Run once when the actor is hit by the specified magic effect |
OnMurder | ActorID (optional) | Run once when actor is murdered by ActorID |
OnPackageChange | PackageID | Run once when actor changes from specified package |
OnPackageDone | PackageID | Run once when actor completes specified package |
OnPackageStart | PackageID | Run once when actor starts specified package |
OnReset | Run once when scripted object's cell is reset | |
OnSell | SellerRefID (optional) | Run once when object is sold by specified seller |
OnStartCombat | TargetActorID (optional) | Run once when actor enters combat with TargetActorID |
OnTrigger | TriggeringRefID (optional) | Run once when object is triggered by colliding object |
OnTriggerActor | TriggeringRefID (optional) | Run once when object is triggered by colliding actor |
OnTriggerMob | TriggeringRefID (optional) | Run once when object is triggered by colliding mobile object (actors, arrows, magic projectiles) |
OnUnequip | ContainerRefID (optional) | Run once when object is unequipped by ActorID. |
ScriptEffectStart | Special block type used only by Magic Effect scripts | |
ScriptEffectFinish | Special block type used only by Magic Effect scripts | |
ScriptEffectUpdate | Special block type used only by Magic Effect scripts |
Note that 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