SetOnProcessLevelChangeEventHandler

From GECK
Jump to: navigation, search


A function added by the JohnnyGuitar NVSE Plugin.

Description

Sets/removes the specified UDF Script as an event handler that will be executed when processing level of an actor changes.

When invoked, the script receives three arguments: Actor reference, old processing level and new processing level.

The following optional filters are accepted:
1. NPC reference/base form/formlist of references/formlist of baseforms;
2. New processing level.

Syntax

[help]
SetOnProcessLevelChangeEventHandler setORremove:1/0 handlerScript:ref flag:int NPC:filter newLevel:filter

Example

SetOnProcessLevelChangeEventHandler 1 OnProcessChangeUDF 0 SunnyREF 0

Sets the OnProcessChangeUDF script as a handler to be executed when SunnyREF's processing level changes to High.

SetOnProcessLevelChangeEventHandler 0 OnProcessChangeUDF 0 SunnyREF 0

Removes the OnProcessChangeUDF script as a handler of the above.

Handler Script

A skeleton handler script for this event:

scn OnProcessChangeUDF

ref rActor
int iOldLevel
int iNewLevel

begin Function {rActor, iOldLevel, iNewLevel} 

...

end

Notes

  • Event must be registered in GameMode block (not MenuMode 4), because it's reset 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.