Activate

From the Oblivion ConstructionSet Wiki
Revision as of 11:05, 6 April 2006 by imported>Kkuhlmann
Jump to navigation Jump to search

Syntax:

Activate ActivatorID (optional), NormalActivationFlag (optional) 

Example:

Activate player 
Activate 
Activate player, 1 

This function tells the object to perform its default activation.

If ActivatorID is omitted, the Activate command will use the calling reference's "current activator". This is very useful inside of OnActivate blocks where you want the activation to proceed normally except under certain circumstances.

If ActivatorID is included, the calling reference will perform its default activation as if activated by ActivatorID.


Object Type Activation
NPC Dialogue
Container Opens
Door Opens
Weapon, armor, etc Picks Up
Book/Scroll Reads


If NormalActivationFlag is omitted, the calling reference performs its default activation, bypassing any OnActivate script that might be on it. This is normally how you want to use Activate, since most times you are calling Activate on the object itself from inside an OnActivate block.

If the NormalActivationFlag is 1, the calling reference will be activated normally, including triggering any OnActivate script on it. Use this with care -- if you call Activate on the object itself from inside an OnActivate block you will trigger an infinite loop.

Example 1:

If you call this script on a door, the door will behave as if the player had activated it (i.e. if a load door, the player will be teleported to the door's target location).

Activate player 


Example 2:

Whatever triggered the OnActivate block will also Activate, just as if this script wasn't here.

begin OnActivate 
if MyCrazyCondition == 1 
  Activate
else 
  ; do something else 
endif 
end 


Example 3:

This script will trigger an infinite loop -- once the scripted object is activated the OnActivate block will continue to be run forever.

float infinity 
begin OnActivate 
  ; you should NEVER do this!! 
  set infinity to infinity + .1 
  message "Infinity = %.1f", infinity 
  activate player 1 
end 


Example 4:

This is the proper way to use the NormalActivationFlag

begin OnActivate 
  ; trigger some other reference when I am activated by the player 
  if IsActionRef player == 1 
     MyGate.Activate player 1 
  endif 
end