Difference between revisions of "OnActivate"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Quetzilla
m (Fixing haama's suggestion)
imported>Quetzilla
m (list order)
Line 19: Line 19:


==See Also==  
==See Also==  
*[[Crashes#Activating_a_Container_.28including_NPC.29|Activating a Container (including NPCs)]] (CTD related to '''Activate'''/'''OnActivate''')
*[[Begin]]
*[[Begin]]
*[[IsActionRef]]
*[[IsActionRef]]
*[[GetActionRef]]
*[[GetActionRef]]
*[[Crashes#Activating_a_Container_.28including_NPC.29|Activating a Container (including NPCs)]] (CTD related to '''Activate'''/'''OnActivate''')


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

Revision as of 16:29, 6 August 2008

Syntax:

 begin OnActivate 

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

Notes

  • 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 or GetActionRef inside the OnActivate block. They won't return the correct ActionRef in any other 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.
  • Clicking on items in inventory that can be equipped causes the onEquip block to run instead of the onActivate block.
    • However, you can make an item run it's own onActivate block in the inventory menu (MenuMode 1008, MenuMode, onEquip, etc.) with Activate player, 1.
  • If you create an object and activate it in the same frame, its OnActivate block may not run. See PlaceAtMe more info.

See Also