SetJohnnyOnDyingEventHandler
From GECK
A function added by the JohnnyGuitar NVSE Plugin.
Description
Sets/removes the specified UDF Script as a handler that will be invoked when a specified Actor (or any Actor) is killed. Formlists are also accepted as filters. Compared to vanilla OnDeath event, this will fire instantly, while vanilla fires when fDyingTimer seconds elapses. Filtering uses Actor base forms, not references (if a reference is specified, its base form is used for filtering). When invoked, the script is passed with a single argument: Actor that was killed.
Syntax
SetJohnnyOnDyingEventHandler setORremove:1/0 handlerScript:ref flag:int actor:filter
Or:
SetOnDyingEventHandler setORremove:1/0 handlerScript:ref flag:int actor:filter
Example
SetJohnnyOnDyingEventHandler 1 OnDyingUDF 0 rActor
Sets the OnDyingUDF script as a handler to be invoked when rActor is killed.
SetJohnnyOnDyingEventHandler 0 OnDyingUDF 0 rActor
Removes the OnDyingUDF script as a handler of the above.
Handler Script
A skeleton handler script for this event:
scn OnDyingUDF ref rActor ref rKiller begin Function {rActor} set rKiller to rActor.GetKiller ... end
Notes
- Event must be registered in GameMode block (not MenuMode 4) as it is flushed every game load. This also means GetGameRestarted is NOT a viable option to set this event for the session. Instead consider using GetGameLoaded to (re)set the event handler.
- Flag argument is reserved for future use and should always be 0.