[r4025] CustomInventory Behavior

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
User avatar
Fishytza
Posts: 786
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

[r4025] CustomInventory Behavior

Post by Fishytza »

Today I've discovered something odd. According to the wiki:
ZDoom wiki wrote:"Classes:CustomInventory" article
....
If the item is being dropped by a monster the Drop state sequence will be executed and the item will never be spawned. This is mostly there for special actions that can be taken by Strife conversation scripts. For regular monster death actions there are better and more flexible way to achieve the same.
The part in italic is a lie. The item will be spawned in addition to running the 'Drop' state.
Here's an example:

Code: Select all

Actor TestPickup : CustomInventory
{
	Inventory.PickupMessage "Is this really supposed to happen?"
	States
	{
	Drop:
		TNT1 A 0 A_GiveInventory("Shotgun", 1, AAPTR_PLAYER1)
		TNT1 A 0 A_GiveInventory("Megasphere", 1, AAPTR_PLAYER1)
		Stop
	Pickup:
		TNT1 A 0 A_GiveInventory("Shotgun", 1)
		Stop
	Spawn:
		SHOT A -1
		Stop
	}
}

Actor TestImp : DoomImp
{
	DropItem "TestPickup"
}

Actor TestPickup2 : CustomInventory
{
	States
	{
	Drop:
		TNT1 A 0 A_GiveInventory("Shotgun", 1, AAPTR_PLAYER1)
		TNT1 A 0 A_GiveInventory("Megasphere", 1, AAPTR_PLAYER1)
		Stop
	}
}

Actor TestImp2 : DoomImp
{
	DropItem "TestPickup2"
}
Spawn 'TestImp', kill it and player1 (you) will get a shotgun and a megasphere, but the item will still spawn and you can even pick it up for another shotgun.

Now spawn and kill 'TestImp2' then aim your crosshair around the dead imp (usually the legs), drop the console and type 'info'. It may take a couple of tries but eventually it will say that 'TestPickup2' is there. You can't pick it up.

You may be asking "Why the heck would you define a 'Spawn', 'Pickup' and/or a 'Use' state if you're using 'Drop' for some special effects and whatnot?". Well, I can't exactly justify why, but I have to ask why keep the actor around if it has 'Drop' defined but not the other states?
Blzut3
 
 
Posts: 3167
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [r4025] CustomInventory Behavior

Post by Blzut3 »

I can't comment on what the actual intended behavior is supposed to be, but I don't see any reason why the Drop state should prevent the item from being spawned.

One thing to keep in mind is that all actors have a Spawn state [wiki=Classes:Actor]by default[/wiki]. You could try using 'Spawn: stop' or if necessary 'Spawn: TNT1 A 0 stop' to make the item disappear after being spawned.
User avatar
Fishytza
Posts: 786
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: [r4025] CustomInventory Behavior

Post by Fishytza »

Well, if this is intended behavior then by all means mark this as [Not a bug] and update the wiki. I have already found a solution similar to what you suggested, Blzut3, but thanks anyway.

Guess I don't have to feel bad about my 'hacky' solution being hacky, eh? EDIT: Nevermind.
Last edited by Fishytza on Wed Jan 16, 2013 3:04 pm, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49146
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [r4025] CustomInventory Behavior

Post by Graf Zahl »

No, if an item successfully executes the drop state it should not spawn. That'd make this state useless.

Return to “Closed Bugs [GZDoom]”