Difference between revisions of "OnActivate"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>JOG
(Moved to "Category: Blocktypes")
imported>JOG
Line 4: Line 4:
This block will be run once when the scripted reference is activated.
This block will be run once when the scripted reference is activated.


Activating the scripted reference will cause the "Activated Bit" to be set. So multiple calls to Activate a single reference in immediate succession will result in a single run through the OnActivate block.
'''Notes:'''
*This block runs when the object was activated in the last frame. When an object is activated several times within the same frame (e.g. by a script using [[Activate]]) the game will ignore all activations but the last one. (I.e. the ActionRef will always be the one of the last activating object.)


Note that this will prevent normal activation of the object. To use the object's default activation you must call [[Activate]] on it. If you want to do something specific depending on what activated the object, use [[IsActionRef]] inside the OnActivate block.  
*Using OnActivate will prevent normal activation of the object. To use the object's default activation you must call [[Activate]] on it. If you want to do something specific depending on what activated the object, use [[IsActionRef]] inside the OnActivate block.  


Note that the activator type of object has NO default activation.  
*The activator type of object has NO default activation.
 
*Locked doors, containers and books are activated a second time automatically when you open the lock or take the book. To find out when a door was unlocked, for example, you can wait for '''[[GetLocked]] == 0''' in the OnActivate-block.


==See Also==  
==See Also==  
[[Begin]]<br>
[[Begin]]
[[IsActionRef]]  
 
[[IsActionRef]]
[[GetActionRef]]
[[GetActionRef]]


[[Category: Blocktypes]]
[[Category: Blocktypes]]

Revision as of 07:58, 21 July 2006

Syntax:

 begin OnActivate 

This block will be run once when the scripted reference is activated.

Notes:

  • This block runs when the object was activated in the last frame. When an object is activated several times within the same frame (e.g. by a script using Activate) the game will ignore all activations but the last one. (I.e. the ActionRef will always be the one of the last activating object.)
  • Using OnActivate will prevent normal activation of the object. To use the object's default activation you must call Activate on it. If you want to do something specific depending on what activated the object, use IsActionRef inside the OnActivate block.
  • The activator type of object has NO default activation.
  • Locked doors, containers and books are activated a second time automatically when you open the lock or take the book. To find out when a door was unlocked, for example, you can wait for GetLocked == 0 in the OnActivate-block.

See Also

Begin

IsActionRef

GetActionRef