SetOnProjectileImpactEventHandler

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 an instance of the specified Projectile form hits an object (including terrain).

When invoked, the script is passed with the Projectile reference as the calling reference ("this"), and no arguments.

  • Additional data on the projectile reference may be retrieved via a set of functions (see below).

Syntax

[help]
SetOnProjectileImpactEventHandler handlerScript:form setORremove:1/0 projectileOrList:form

Example

SetOnProjectileImpactEventHandler OnProjectileImpactUDF 1 308BulletProjectile

Sets the OnProjectileImpactUDF script as a handler to be invoked when an instance of 308BulletProjectile hits an object.

SetOnProjectileImpactEventHandler OnProjectileImpactUDF 0 308BulletProjectile

Removes the OnProjectileImpactUDF script as a handler of the above.

Notes

Handler Script

A skeleton handler script for this event:

scn	OnProjectileImpactUDF

ref	rProjectileRef
ref	rProjectileBase

; OPTIONAL
ref	rImpactRef
ref	rWeapon
ref	rAttacker

; OPTIONAL
float	fPosX
float	fPosY
float	fPosZ

begin Function {}

	set rProjectileRef to this
	set rProjectileBase to GetBaseObject

	; OPTIONAL - Additional data
	set rImpactRef to GetProjectileRefImpactRef
	set rWeapon to GetProjectileRefWeapon
	set rAttacker to GetProjectileRefSource

	; OPTIONAL - Impact 3D position
	set fPosX to GetPos X
	set fPosY to GetPos Y
	set fPosZ to GetPos Z

	(code)

end

See Also