Weapon flag: WEAPON.ALT_USES_AMMO1

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Weapon flag: WEAPON.ALT_USES_AMMO1

Post by wildweasel »

My usual method of programming weapons with reloading is to use Ammo2 as the "reserve" ammo and Ammo1 as the "loaded" ammo. However, with weapons that have altfires that use the same ammo type as the primary, this turns into a bit of a roundabout hack, since I either need to make the altfire specifically check Ammo1 and then take the proper amount (remembering to set TIF_NOTAKEINFINITE), or else just set Ammo1 and Ammo2 to the same thing and make an exception in SBARINFO to make it show the reserve ammo over top of the Ammo2 counter.

Basically, I'd like a cleaner way to do this.
User avatar
NeuralStunner
 
 
Posts: 12325
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Weapon flag: WEAPON.ALT_USES_AMMO1

Post by NeuralStunner »

What you could do: Set AmmoUse2 to 0, add WEAPON.ALT_USES_BOTH. Though I'm guessing you'd like to be able to set AmmoUse2 to a different number, so the AltFire will use the same ammo but a different amount.

Personally I'm content to do the ammo taking with A_TakeInventory. :shrug:
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Weapon flag: WEAPON.ALT_USES_AMMO1

Post by wildweasel »

Yeah...specifically I was needing this for ww-nazis-v2's flamethrower, which takes 10 fuel units to shoot a fireball but only 1 per projectile for the usual burst. Ah well...
Post Reply

Return to “Feature Suggestions [GZDoom]”