Page 1 of 1

1.0.29 (possibly earlier) Ammo Amount oddity with ID(K)FA

Posted: Thu Nov 29, 2007 1:41
by Enjay
I was playing an old mod of mine and found a minor problem with Ammo amounts. This only relates to when you are cheating, and I have cured the problem for my mod, but I'm mentioning it here in case there are some implications that I am unaware of because it is a change from how (G)Zdoom used to handle this situation.

My old ammo definition looked like this:

[spoiler]

Code: Select all

ACTOR NJSpecialAmmo1 : Ammo 22093
{
   Inventory.PickupMessage "Picked up a small special ammo pod"
   Inventory.Amount 4
   inventory.maxamount 40
   Inventory.PickupSound "misc/ammo_pkup"
   Ammo.BackpackAmount 0
   Mass 5
   +Floorclip
   States
      {
      Spawn:
         NJAM B -1 BRIGHT
      LOOP
      }
}
[/spoiler]

This worked perfectly well in older versions that I tried the mod with. However, with 1.0.29, when I typed IDFA, I got the weapon that used this item but the inventory for the ammo was set to 0 for both the amount carried and the max amount that can be carried (and grey in the alt-HUD rather than green). From that point on, GZdoom assumed that I had a full set of ammo of that type, and wouldn't let me pick up any ammo or weapons that used that ammo type but also wouldn't let me use the weapons because I didn't have any ammo for them.

Not sure where the problem was, I set the backpack amount to 8 and when I typed IDFA, I got 8 ammo and could use the associated weapon, but, according to the HUD, I had 8 out of 0 ammo items and the display was still grey.

It wasn't until I checked some of the predefined ammo definitions that I noticed that they had an Ammo.BackpackMaxAmount value defined and my one didn't. Defining one allows the ammo and weapons to work properly. (ie an editing fix exists.)

When not cheating - ie getting the weapon or ammo in game by picking them up - everything worked as expected with the old code (as far as I can tell). It was just the cheat that effectively locked me out of my weapons - mind you, I just realised that I never tried picking up a backpack to see what it would do - so that may cause a problem. :?:

Like I said, it's maybe not an issue because it only seems to apply to cheating and there is a fix, and maybe I was just doing it wrong to start with, but it is a change from old behaviour. The old behaviour was either to simply double the normal inventory.maxamount when you picked up a backpack if a BackpackMaxAmount hadn't been defined, or it just left it at the default (I forget which). Whatever it did, it wasn't to set the inventory amount to 0 and prevent you using the weapons or picking up the ammo.

There you go, "fix" or dispose of as a non-issue as you see fit. ;)

Posted: Thu Nov 29, 2007 9:32
by Graf Zahl
Known bug, already fixed.

Posted: Thu Nov 29, 2007 14:58
by TheDarkArchon
The problem is the backpack amount. Set it to the same value as Inventory.MaxAmount in the meantime. (See http://forum.drdteam.org/viewtopic.php?t=2886)

Posted: Thu Nov 29, 2007 15:16
by Enjay
I'd managed to get to that solution myself already, but thanks for the suggestion. :)