ShowOff:OnPreActivate
An event handler added by the ShowOff NVSE Plugin version 1.50.
Description
This event runs right before an object in the world is activated, by any actor.
The activated reference is passed as the calling reference.
- GetSelfAlt is recommended instead of GetSelf, since it will otherwise return a null form if the activated form is non-persistent clutter.
Two UDF args are passed: first the activator actor reference, then a boolean indicating if activation has not been prevented by a handler that was previously called on the same frame.
If the function returns false (0) via SetFunctionValue, then activation is prevented.
- Since multiple handlers can be set for the event, it only takes a minimum of 1 handler to return false for activation to be prevented.
- If SetFunctionValue is NOT called, or if it is set with a non-zero value, then the handler will not prevent activation.
Does NOT run for calls to the Activate script function, only regular activation.
Runs before the OnActivate block runs (but after the OnActivate event).
Syntax
Use SetEventHandler / SetEventHandlerAlt with the event name "ShowOff:OnPreActivate".
Handler Script
A skeleton handler script for this event:
scn OnPreActivateUDF ref rActivator ref rActivated short bIsActivationNotPrevented begin Function { rActivator, bIsActivationNotPrevented } let rActivated := GetSelfAlt printvar rActivated printvar rActivator printvar bIsActivationNotPrevented ; SetFunctionValue 0 ;prevent the object from being activated. SetFunctionValue 1 print "OnPreActivateUDF >> RAN!" end
Example
SetEventHandlerAlt "ShowOff:OnPreActivate" OnPreActivateUDF
Will run whenever anything is activated by anyone.
- Due to using SetEventHandlerAlt, the above handler will be flushed on load.
SetEventHandlerAlt "ShowOff:OnPreActivate" OnPreActivateUDF 0::SunnyREF 1::Player 2::1
Will only run if the calling reference (activated) is SunnyREF, and if activator is the Player, and if activation hasn't already been prevented by another handler.