Page 1 of 1

[DECORATE] Switching weapons if there's no ammo

PostPosted: Sun Jan 03, 2021 3:52 pm
by Molly Lightway
I've successfully updated the Mancubus Arm from Realm667 so that it has an alt fire. I've also written code so that if there's not enough for one type of fire the other type of fire is checked as well. All that is missing is the the weapon switching to another weapon when no ammo is available. Currently I simply use Goto Ready when this condition is met.

Relevant code:

Fire:
MARG A 0 A_JumpIfInventory("DemonBlood", 1, "RealFire") //check for regular ammo
MARG A 0 A_JumpIfInventory("HectePlasma", 1, "RealAltFire") //check for alt ammo
Goto Ready
AltFire:
MARG A 0 A_JumpIfInventory("HectePlasma", 1, "RealAltFire") //check for alt ammo
MARG A 0 A_JumpIfInventory("DemonBlood", 1, "RealFire") //check for regular ammo
Goto Ready

Note that I'm after ZDoom (not GZDoom) compatibility. You can download the weapon wad here:

https://drive.google.com/file/d/1c4Q1BY ... sp=sharing

I've tried playing with A_SelectWeapon but I haven't had much success. I'll admit that there's a lot about DECORATE I don't understand.

Re: [DECORATE] Switching weapons if there's no ammo

PostPosted: Sun Jan 03, 2021 6:48 pm
by NaturalTvventy
I made this post! I guess I forgot to log in prior.

Re: [DECORATE] Switching weapons if there's no ammo

PostPosted: Tue Jan 05, 2021 3:22 am
by Player701
Molly Lightway wrote:Note that I'm after ZDoom (not GZDoom) compatibility.

Please note that the last version of ZDoom was released in 2016. GZDoom can do everything ZDoom can and more, and it still has the software renderer. If you're having problems running GZDoom on your machine, you could make a thread in the technical issues subforum. You could also try LZDoom instead, which has most of the features available in the latest GZDoom release but should work better than GZDoom if the latter doesn't work properly (or at all) for you.

Regarding your DECORATE issue in question, you could try calling A_SelectWeapon("None", SWF_SELECTPRIORITY) before jumping to the Ready state, e.g.:

Code: Select allExpand view
Fire:
    MARG A 0 A_JumpIfInventory("DemonBlood", 1, "RealFire") //check for regular ammo
    MARG A 0 A_JumpIfInventory("HectePlasma", 1, "RealAltFire") //check for alt ammo
    TNT1 A 0 A_SelectWeapon("None", SWF_SELECTPRIORITY)
    Goto Ready

This should take care of the case when the player attempts to fire the weapon with no ammo. However, since you've set AmmoUse to 0, it will still be possible to select the weapon again when the player does not have any ammo for it. This cannot be solved in DECORATE.

I also wanted to say you look at this thread where a similar issue was discussed, but it turned out that it was you who started it. Okay, then. :P