SetOnHealthDamageEventHandler

From GECK
Jump to: navigation, search


A function added by the JIP NVSE Plugin.

Description

Sets/removes the specified UDF Script as a handler that will be invoked in the event the specified Actor takes Health damage.

When invoked, the script is passed with the Actor as the calling reference ("this"), and two arguments: the amount of damage taken and, if the damage resulted from being hit by another actor, the reference of that actor, otherwise (if the damage resulted from falling, for example) 0.

The amount of damage taken is a negative value.

Syntax

[help]
SetOnHealthDamageEventHandler handlerScript:ref setORremove:1/0 actorOrList:ref

Example

SetOnHealthDamageEventHandler OnHealthDamageUDF 1 SomeActor

Sets the OnHealthDamageUDF script as a handler to be invoked when SomeActor takes Health damage.

SetOnHealthDamageEventHandler OnHealthDamageUDF 0 SomeActor

Removes the OnHealthDamageUDF script as a handler of the above.

Notes

  • As the third argument, either a single reference, or a FormList of references may be passed.
  • If the damage was taken from a poison Actor Effect, the source will be the victim.
  • If taking damage from collision objects, the source will be 0.
  • This event will run on damaging an actor's Health Actor Value via DamageAV.

Handler Script

A skeleton handler script for this event:

scn	OnHealthDamageUDF

float	fDamageAmount
ref	rSourceRef
ref	rActorRef

begin Function {fDamageAmount, rSourceRef}

	set rActorRef to this

	(code)

end

See Also