From ZDoom Wiki
Jump to navigation Jump to search
For more information on this article, visit the A_WeaponReady page on the Doom Wiki.


action void A_WeaponReady(int flags = 0)


A_WeaponReady is a Weapon function that allows the weapon to fire, bob, or be deselected. Normally it's called in a loop in the weapon's Ready state sequence, but it can also be called in other states to allow a player to re-fire at any point.

Note: A_WeaponReady is a somewhat unique function in that it doesn't have to be called every tic in order to function property. I.e. doing this is perfectly okay:

WEAP A 10 A_WeaponReady;

The reason for this is that as soon as the function is called, it enables a flag that will allow the weapon to fire/switch for the whole duration of the state (10 tics in the example above), and that flag will only be lifted once the state ends. (The flag itself is stored in the WeaponState field of the PlayerInfo struct of the weapon's owner).

Note: A_WeaponReady will ignore Reload, Zoom and User# keys by default. They must be enabled manually by using appropriate flags (lised below).


  • int flags
The function's default behavior can be changed by using flags listed below (multiple flags can be combined with |):
  • WRF_NOBOB: The weapon's on-screen sprites will not bob.
  • WRF_NOFIRE: The weapon will not be made ready for firing (same as WRF_NOPRIMARY|WRF_NOSECONDARY).
  • WRF_NOSWITCH: The weapon will not be made ready for deselection for the duration of this A_WeaponReady call.
  • WRF_DISABLESWITCH: Prevents from deselecting the weapon entirely until the next call to A_WeaponReady. (NOSWITCH puts deselection on hold, whereas DISABLESWITCH cancels the deselection entirely)
  • WRF_NOPRIMARY: The weapon will not be able to enter the Fire state sequence.
  • WRF_NOSECONDARY: The weapon will not be able to enter the AltFire state sequence.
  • WRF_ALLOWRELOAD: The weapon will jump to the Reload state sequence if the Reload key is currently being pressed.
  • WRF_ALLOWZOOM: The weapon will jump to the Zoom state sequence if the Zoom key is currently being pressed.
  • WRF_ALLOWUSER#: The weapon will jump to the User# state defined, where # can be a number from 1-4.


    WEAP A 1 A_WeaponReady; //Makes the weapon ready to fire

    WEPF A 4;
    WEPF B 4 A_FireProjectile('Rocket');
    WEPF C 4;
    WEPF D 4 A_WeaponReady(WRF_NOBOB|WRF_NOSWITCH); //Allows the weapon to refire, but without any weapon bobbing or switching
    WEPF E 4;
    Goto Ready;

ZScript definition

Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.
	action void A_WeaponReady(int flags = 0)
		if (!player) return;
		DoReadyWeaponToSwitch(player, !(flags & WRF_NoSwitch));
		if ((flags & WRF_NoFire) != WRF_NoFire)	
			DoReadyWeaponToFire(player.mo, !(flags & WRF_NoPrimary), !(flags & WRF_NoSecondary));

		if (!(flags & WRF_NoBob))

		player.WeaponState |= GetButtonStateFlags(flags);														
		DoReadyWeaponDisableSwitch(player, flags & WRF_DisableSwitch);