Page 1 of 1

Pickup Bug

Posted: Sat Jan 14, 2006 17:46
by Boingo the Clown
I was play testing DeiMWolf, and I noticed this peculiar bug with the treasure pickups I had created.

All pickups work fine when first starting the game, but after the game has been playing a while, some of the pickups quit working. That is to say, they no longer disappear when run over, and they can no longer count towards the items found count.

AFADooMer was kind enough to let me try the beta version of his Wolf3D project, and I found the same thing while tryin it out. The problem was even more pronounced, due to the fact his mod awards points. When the treasures stopped being picked up, they still continued to give points. I rolled the score counter over multiple times during my test run.

Since this happens with both mods, I have decided that it must be a bug within GZDooM itself, rather than a mistake in the mods.

Posted: Sat Jan 14, 2006 17:54
by Graf Zahl
Maybe. Can you send me the mod so I can check what is happening?

Re: Pickup Bug

Posted: Sat Jan 14, 2006 18:09
by AFADoomer
Boingo the Clown wrote: AFADooMer was kind enough to let me try the beta version of his Wolf3D project, and I found the same thing while tryin it out. The problem was even more pronounced, due to the fact his mod awards points. When the treasures stopped being picked up, they still continued to give points. I rolled the score counter over multiple times during my test run.
Which map/location? I've played through a good chunk in one sitting and never had problems.

[edit] OK, I think I've found the problem...
In the case of my treasure code, the pickup script gets run even though you've reached the max pickup amount... But the item doesn't disappear, so it gets run continuously.

Example:

Code: Select all

ACTOR Cross : CustomInventory 21052
{
	+COUNTITEM
	+AUTOACTIVATE
	Inventory.DefMaxAmount
	Inventory.PickupSound "pickups/cross"
	Inventory.PickupMessage "Cross"
	States
	{
	Spawn:
		TREA A -1
		Loop
	Pickup:
		TREA A 0 ACS_ExecuteAlways(700, 0, 100)
		Stop
	}
}
This can be fixed by raising the max amount, of course... But I don't think it should exibit the current behavior of running the pickup frames over and over again...

On a possibly related note, this script causes a crash (see attached):

Code: Select all

ACTOR BlueKey : CustomInventory 21044
{
	+AUTOACTIVATE
	Inventory.Amount 1
	Inventory.PickupSound "pickups/key"
	Inventory.PickupMessage "Blue Key"
	States
	{
	Spawn:
		KEYS B -1
		Loop
	Pickup:
		KEYS B 0 A_GiveInventory("BlueCard", 1)
	}
}
It worked fine when I was inheriting from 'Inventory' before the code was changed.

Posted: Sat Jan 14, 2006 19:31
by Boingo the Clown
Here is an example of one of my treasures. The others are the same, except for the sprites.
ACTOR Chalice1 : Inventory 6082
{
+COUNTITEM
+AUTOACTIVATE
Inventory.DefMaxAmount
Inventory.PickupSound "CHALICE"
Inventory.PickupMessage "Picked up a Chalice"
scale 0.16
States
{
Spawn:
PTN2 A -1
Loop
}
}
If what AFADooMer is true, and it is from reaching a preset maxium, is it possible to increase this maximum, or perhaps to reset the amounts to 0 at the beginning of each level?

Posted: Sat Jan 14, 2006 19:36
by TheDarkArchon
AFADoomer:

Code: Select all

ACTOR BlueKey : CustomInventory 21044
{
   +AUTOACTIVATE
   Inventory.Amount 1
   Inventory.PickupSound "pickups/key"
   Inventory.PickupMessage "Blue Key"
   States
   {
   Spawn:
      KEYS B -1
      Loop
   Pickup:
      KEYS B 0 A_GiveInventory("BlueCard", 1)
      Stop
   }
}
You forgot to stop the pickup state.

Boingo: He's correct. The predefined maximum is 25, IIRC. To increase this, use "Inventory.MaxAmount (number)" instead of "Inventory.DefMaxAmount".

Posted: Sat Jan 14, 2006 19:51
by Boingo the Clown
TheDarkArchon wrote:Boingo: He's correct. The predefined maximum is 25, IIRC. To increase this, use "Inventory.MaxAmount (number)" instead of "Inventory.DefMaxAmount".
So if I change it to something like:

Inventory.MaxAmount (2048)

That would fix the problem?

Posted: Sat Jan 14, 2006 19:58
by AFADoomer
Ah. Thanks.

For the Pickup state, the final 'Stop' needs to be 'Fail' in order to stop the infinite-pickup problem on all of these.

So this is our bug, not a bug in GZDoom.

Is there any way to have an item allowed to be picked up an infinite number of times, other than setting the max amount to a huge number?

i.e.
Inventory.MaxAmount 4096

Posted: Sat Jan 14, 2006 22:06
by Boingo the Clown
I changed my decorate lump from
ACTOR Chalice1 : Inventory 6082
{
+COUNTITEM
+AUTOACTIVATE
Inventory.DefMaxAmount
Inventory.PickupSound "CHALICE"
Inventory.PickupMessage "Picked up a Chalice"
scale 0.16
States
{
Spawn:
PTN2 A -1
Loop
}
}
to
ACTOR Chalice1 : Inventory 6082
{
+COUNTITEM
+AUTOACTIVATE
Inventory.Amount 0
Inventory.PickupSound "CHALICE"
Inventory.PickupMessage "Picked up a Chalice"
scale 0.16
States
{
Spawn:
PTN2 A -1
Loop
}
}
That appears to have fixed the problem.

Sorry for the false alarm.

Posted: Sat Jan 14, 2006 22:22
by Graf Zahl
Exactly. Setting the max amount to 0 makes it not go into the inventory and in combination with +AUTOACTIVATE is the intended way to create pickup items like Doom's that get used immediately.