Activate

From GECK
Jump to: navigation, search


A function included in the GECK for Fallout 3.

Description

Executes the activation event associated with the calling object. The nature of the activation event depends on the object type and two optional flags.

Syntax

[help]
[Object].Activate ActionRef:ref RunOnActivateBlockFlag:int{0, 1}

Example

Activate Player
ContainerRef.Activate
ActivatorRef.Activate Player 1 

Parameters

Parameter Value Result
ActionRef unspecified The calling reference's ActionRef will be used. If the calling reference doesn't have an ActionRef, the object won't be activated.
ActionRef specified Sets the ActionRef for the function call. Useful if you use IsActionRef or GetActionRef inside of the OnActivate block of the object.
RunOnActivateBlockFlag 0 or unspecified The object will perform its default activation, bypassing any OnActivate Block in its script.
RunOnActivateBlockFlag 1 The OnActivate block of the object will be run instead of the default activation. (Note, you must specify an ActionRef in this case)

Default Activation

If the Player is the ActionRef:

Object Type Activation
NPC Dialogue
Container Opens
Door Opens
Weapon, armor, etc Picks Up

Notes

  • Note that 'Activate Player' does NOT activate the player. It activates the calling reference and sets the player as the ActionRef (the reference that activated it).
  • There are a number of peculiarities and bugs with the Activate function:
  1. For Enabled NPCs, activating an item will force them to pick it up (even if they're unconscious). However, containers won't pick up the item.
  2. When you use the RunOnActivateBlockFlag, the script of the activated object will run immediately, meaning the next line of the activating references's script won't be processed until the entire script (including blocks other than OnActivate) finishes. If the activated script doesn't have an OnActivate block, it won't run.
  3. Calling Activate with the RunOnActivateBlockFlag set to 0 on an object which doesn't have an OnActivate block in its script, or has no script at all, will prevent that object from being activated normally ever again. For example, if Activate is called on an unscripted container, the player will no longer be able to open that container by activating it; similarly, calling Activate on unscripted NPCs prevents the player from being able to talk to them. Therefore, use RunOnActivateBlockFlag = 0 only if you know for sure the object has an OnActivate block and, for some reason, you don't want that code to run.
  4. You can use 'Activate Player 1', while an item is in an inventory, to have it run its own OnActivate block. However, you have to place the OnActivate block on the top of the script.
  5. If you add a MessageBox to the OnActivate block of a container and then issue the Activate command somewhere after the call to the MessageBox, the in-game result will be an opened inventory dialog box of the container with a MessageBox behind it without the ability to select any items in the inventory screen or be able to exit the inventory screen or be able to see the message in order to click the OK button. In other words, you will be stuck.
  6. Calling 'Activate Player 1' on a stack of items will only transport a single item to the player's inventory, and destroy all other items in the stack. For this reason, it is recommended to instead use MoveToContainer to keep the stack intact. Note that this alternate method will not be considered as stealing.
    1. This has been fixed in JIP LN NVSE v56.08.
  • If an item is moved into an actor's inventory via Activate, it will remain a valid reference until the cell is no longer loaded (for example, if the game session is ended).

See Also