SetOnActorValueChangeEventHandler

From GECK
Jump to: navigation, search


A function added by the JohnnyGuitar NVSE Plugin version 4.55.

Description

Sets/removes the specified UDF Script as a handler that will be invoked when a specified Actor Value (or any Actor Value, if the optional parameter is omitted) is changed. The event is limited to Player's actor value changes and can be further filtered using an Actor Value code.

When invoked, the script receives three arguments: Actor Value code, its previous value and its new value.

Syntax

[help]
SetOnActorValueChangeEventHandler setORremove:1/0 handlerScript:ref flag:int avCode:filter 

Or:

SetJohnnyOnActorValueChangeEventHandler setORremove:1/0 handlerScript:ref flag:int avCode:filter

Example

SetOnActorValueChangeEventHandler 1 OnHealthChangeUDF 0 16

Sets the OnHealthChangeUDF script as a handler to be invoked when player's Health changes

SetOnActorValueChangeEventHandler 0 OnHealthChangeUDF 0 16

Removes the OnHealthChangeUDF script as a handler of the above.

Handler Script

A skeleton handler script for this event:

scn OnHealthChangeUDF

int avCode
float previousValue
float newValue

begin Function {avCode, previousValue, newValue} 

	(code)

end

Notes

  • Flag argument is reserved for future use and should always be 0.
  • Changes to InventoryWeight actor value do not dispatch this event, because internally this actor value is only updated when GetActorValue is called on it. Similarly, the event does not dispatch when derived skills get increased by their associated SPECIAL, although direct increases to skills do dispatch it.
  • Prior to version 5.08, the event was being dispatched with incorrect previousValue and newValue.