OnFire
From GECK
This block will run when the scripted Weapon is fired.
The implicit calling reference is a temporary reference representing the weapon being fired. As such, RemoveMe and other functions can be used without having to specify a calling reference for them.
To get the actor firing the weapon, use GetContainer.
Contents
Syntax
begin OnFire
Example
begin OnFire print "My Weapon - OnFire!" ref rGetSelf = GetSelf ref rGetSelfAlt = GetSelfAlt printvar rGetSelf, rGetSelfAlt ref rContainer = GetContainer printvar rContainer RemoveMe end
GetSelf will always return a null reference, since the implicit calling reference is not persistent. As such, GetSelfAlt can be used as an alternative.
Notes
- Does not work with melee weapons.
- Will trigger for thrown weapons, such as spears and grenades. Also triggers when placing a mine.
- Triggers upon a projectile leaving the barrel of the gun and not when pulling the trigger of the gun or when dry firing a weapon with no ammo.