SetOnFireWeaponEventHandler

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 fires a round with a ranged-weapon.

  • The 3rd argument, actorOrList, is optional. Either a single reference, or a FormList of references may be passed. If omitted, the script will be invoked when ANY actor fires a weapon.

When invoked, the script is passed with the Actor as the calling reference ("this"), and a single argument: the Weapon (base form) that was fired.

Syntax

[help]
SetOnFireWeaponEventHandler handlerScript:form setORremove:1/0 actorOrList:form

Example

SetOnFireWeaponEventHandler OnFireWeaponUDF 1 SomeActor

Sets the OnFireWeaponUDF script as a handler to be invoked when SomeActor fires a weapon.

SetOnFireWeaponEventHandler OnFireWeaponUDF 0 SomeActor

Removes the OnFireWeaponUDF script as a handler of the above.

SetOnFireWeaponEventHandler OnFireWeaponUDF 1

Sets the OnFireWeaponUDF script as a handler to be invoked when ANY actor fires a weapon.

Handler Script

A skeleton handler script for this event:

scn	OnFireWeaponUDF

ref	rWeapon
ref	rActorRef

begin Function {rWeapon}

	set rActorRef to this

	(code)

end

Notes

  • Does not run if the weapon is jammed as it tries to fire. Weapon jam is controlled by the fWeaponConditionJamXX gamesettings.

Bugs

  • This event will fail to trigger on the player when god mode is enabled but still works in demigod mode.

See Also