Difference between revisions of "OnActivate - ObjectReference"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Goggle
m (→‎Examples: Just a tiny example added.)
imported>Scrivener07
m (→‎Notes: Locked doors send this event.)
 
Line 32: Line 32:
*An actor entering furniture will send this event.  However, an actor exiting furniture will send the [[OnExitFurniture - ObjectReference|OnExitFurniture]] event instead.
*An actor entering furniture will send this event.  However, an actor exiting furniture will send the [[OnExitFurniture - ObjectReference|OnExitFurniture]] event instead.
*This event will still be received if the object reference has had its normal activation processing blocked via [[BlockActivation - ObjectReference|BlockActivation]]. It is also most likely running after the object itself has done (or ignored) it's normal activation processing. Which means, for example, that if normally the object is picked up you won't be able to manipulate it as it will have already been moved into the actor's inventory.
*This event will still be received if the object reference has had its normal activation processing blocked via [[BlockActivation - ObjectReference|BlockActivation]]. It is also most likely running after the object itself has done (or ignored) it's normal activation processing. Which means, for example, that if normally the object is picked up you won't be able to manipulate it as it will have already been moved into the actor's inventory.
*This event will still be received when attempting to open a door that is locked. Checking a door's current lock state will be needed in order to avoid premature/unwanted activations.


== See Also ==
== See Also ==

Latest revision as of 10:42, 26 August 2018

Member of: ObjectReference Script

Event called when the object reference is activated.

Syntax[edit | edit source]

Event OnActivate(ObjectReference akActionRef)

Parameters[edit | edit source]

Examples[edit | edit source]

Event OnActivate(ObjectReference akActionRef)
  Debug.Trace("Activated by " + akActionRef)
EndEvent

; Have the event run if the triggering objectreference is the player.
Event OnActivate(ObjectReference akActionRef)
   if akActionRef == Game.GetPlayer()
      ; your code here.
   endif
EndEvent

Notes[edit | edit source]

  • An actor entering furniture will send this event. However, an actor exiting furniture will send the OnExitFurniture event instead.
  • This event will still be received if the object reference has had its normal activation processing blocked via BlockActivation. It is also most likely running after the object itself has done (or ignored) it's normal activation processing. Which means, for example, that if normally the object is picked up you won't be able to manipulate it as it will have already been moved into the actor's inventory.
  • This event will still be received when attempting to open a door that is locked. Checking a door's current lock state will be needed in order to avoid premature/unwanted activations.

See Also[edit | edit source]