You could use
A_JumpIfInventory, but what you're attempting will not work properly in DECORATE without gross hacks. This is because when you press any of the fire buttons, the engine checks if the weapon has enough ammo for the corresponding fire mode (normal/alt), and if it doesn't, the weapon will not jump to its Fire/AltFire state but will get deselected instead.
The one way to avoid this problem without using advanced features is to set
+WEAPON.AMMO_OPTIONAL /
+WEAPON.ALT_AMMO_OPTIONAL to bypass ammo checks on the engine side. You will then have to manually check that you have enough ammo before firing, this can also be done via A_JumpIfInventory. However, you will lose the auto-switching functionality (though you could also try to hack it in via A_JumpIfInventory and
A_SelectWeapon), and it will also be possible to switch to your weapon even when you don't have enough ammo for it, regardless of the gameplay options. Unfortunately, there is no way to mitigate the latter issue in DECORATE.
- Code: Select all • Expand view
AltFire:
MARG A 0 A_JumpIfInventory("YourAmmoType", 1, "RealAltFire") // <-- Replace YourAmmoType with the actual name of your ammo type class
Goto Fire
RealAltFire:
// TODO: Your alt fire code here
Goto Ready