EVENT PREWEAPONSHOOT: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Created page with "{{EventTable|1=EVENT_PREWEAPONSHOOT|2=player that executed the input|3=player->i|4=2 values}} EVENT_PREWEAPONSHOOT is a game event. This event is called when the player fires a projectile, just before the projectile has been spawned. See also EVENT_POSTWEAPONSHOOT. == Return Values == This event has two return values: :; userdef.return 0 (RETURN) :: Setting this to any non-zero value prevents spawning the projectile that is b..."
 
No edit summary
 
Line 2: Line 2:
EVENT_PREWEAPONSHOOT is a [[EDuke32 event list|game event]].
EVENT_PREWEAPONSHOOT is a [[EDuke32 event list|game event]].


This [[event]] is called when the player fires a projectile, just before the projectile has been spawned.
This [[event]] is called when the player fires a projectile in the defined weapon sequence (P_FireWeapon), just before the projectile is spawned.
 
Note that it does not trigger if [[shoot]] is run manually from the player actor.


See also [[EVENT_POSTWEAPONSHOOT]].
See also [[EVENT_POSTWEAPONSHOOT]].
Line 11: Line 13:


:; userdef.return 0 ([[RETURN]])
:; userdef.return 0 ([[RETURN]])
:: Setting this to any non-zero value prevents spawning the projectile that is being fired.
:: Setting this to any non-zero value prevents spawning the projectile, but otherwise continues execution of P_FireWeapon as normal. Note that if this is nonzero, [[EVENT_POSTWEAPONSHOOT]] will not trigger.


:; userdef.return 1
:; userdef.return 1

Latest revision as of 13:43, 7 January 2024

Event ID player# THISACTOR RETURN
EVENT_PREWEAPONSHOOT player that executed the input player->i 2 values

EVENT_PREWEAPONSHOOT is a game event.

This event is called when the player fires a projectile in the defined weapon sequence (P_FireWeapon), just before the projectile is spawned.

Note that it does not trigger if shoot is run manually from the player actor.

See also EVENT_POSTWEAPONSHOOT.

Return Values

This event has two return values:

userdef.return 0 (RETURN)
Setting this to any non-zero value prevents spawning the projectile, but otherwise continues execution of P_FireWeapon as normal. Note that if this is nonzero, EVENT_POSTWEAPONSHOOT will not trigger.
userdef.return 1
Contains the index of the projectile if they are being fired in a burst, starting from 0. For single shots, this is always 0.