Activate - ObjectReference
Revision as of 12:52, 15 February 2021 by imported>Scrivener07 (→Notes)
Member of: ObjectReference Script
Activates this item with the specified reference as the activator.
Syntax[edit | edit source]
bool Function Activate(ObjectReference akActivator, bool abDefaultProcessingOnly = false) native
Parameters[edit | edit source]
- akActivator: Who will activate this object.
- abDefaultProcessingOnly: If true, no OnActivate event will be sent to any scripts and the object will ignore the blocked flag.
- Default: False
Return Value[edit | edit source]
True if default activation processing was performed (and succeeded). Will return false if activation was blocked, or the activation failed for some other reason.
Examples[edit | edit source]
; Have the player 'activate' the door
NeatDoor.Activate(Game.GetPlayer())
; Have the player 'activate' the door, bypassing any blocked activation and NOT sending an event to any script
NeatDoor.Activate(Game.GetPlayer(), true)
Notes[edit | edit source]
- If the object reference has had activation processing blocked, this will still send the OnActivate event to scripts attached to the object, but will ignore normal processing (i.e. picking up the object, opening the door, etc). Unless, of course, you have the abDefaultProcessingOnly parameter set to true, in which case no event is sent, and the block flag is ignored.
- In order for this function to work on containers, you must call Utility.wait() before the activate call. The wait has to be at least 1s.
Known Issues[edit | edit source]
When called on a stack of items dropped by the player, Activate() will return only one item from the stack.