EVENT CHANGEWEAPON: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
EVENT_CHANGEWEAPON is a [[EDuke32_event_list|Game Event]].
{{EventTable|1=EVENT_CHANGEWEAPON|2=player that executed the input|3=[[i|player->i]]|4=1 value}}
'''EVENT_CHANGEWEAPON''' is a [[EDuke32_event_list|Game Event]].


This [[event]] is run when the player is changing weapons.
This [[event]] is run when the player is changing weapons. Note that this event only occurs if the weapon switch succeeds -- if the player tries to select a weapon that is already equipped, this event will not trigger. If you need to know which weapon the player intended to select, use [[EVENT_SELECTWEAPON]] instead.


[[RETURN]] holds the value of the weapon the game is about to switch to. You can change the value to redirect the switch, or disable it by setting a value of -1. You can find the value of the weapon the player is currently holding in [[WEAPON]] and [[curr_weapon]].
[[RETURN]] holds the number of the weapon the game is about to switch to, see [[WEAPON]].


-1 means 'no weapon'.
Setting [[RETURN]] to -1 will prevent the weapon switch, even when running out of ammo for that weapon.
 
Setting [[RETURN]] to -2 will allow the weapon lowering animation to play, but the player will still not be allowed to actually swap out the weapon.
 
Setting [[RETURN]] to any other value has no effect. If you need to change which weapon the player switches to, use [[EVENT_SELECTWEAPON]] instead.


[[Category:Events]]
[[Category:Events]]

Latest revision as of 08:47, 5 February 2022

Event ID player# THISACTOR RETURN
EVENT_CHANGEWEAPON player that executed the input player->i 1 value

EVENT_CHANGEWEAPON is a Game Event.

This event is run when the player is changing weapons. Note that this event only occurs if the weapon switch succeeds -- if the player tries to select a weapon that is already equipped, this event will not trigger. If you need to know which weapon the player intended to select, use EVENT_SELECTWEAPON instead.

RETURN holds the number of the weapon the game is about to switch to, see WEAPON.

Setting RETURN to -1 will prevent the weapon switch, even when running out of ammo for that weapon.

Setting RETURN to -2 will allow the weapon lowering animation to play, but the player will still not be allowed to actually swap out the weapon.

Setting RETURN to any other value has no effect. If you need to change which weapon the player switches to, use EVENT_SELECTWEAPON instead.