[Fixed] [r4025] CustomInventory Behavior

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

[r4025] CustomInventory Behavior

Postby FishyClockwork » Mon Jan 14, 2013 5:55 pm

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 allExpand view
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?
User avatar
FishyClockwork
 
Joined: 23 Feb 2011

Re: [r4025] CustomInventory Behavior

Postby Blzut3 » Wed Jan 16, 2013 7:11 am

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 by default. You could try using 'Spawn: stop' or if necessary 'Spawn: TNT1 A 0 stop' to make the item disappear after being spawned.
Blzut3
Pronounced: B-l-zut
 
 
 
Joined: 24 Nov 2004
Github ID: Blzut3
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: [r4025] CustomInventory Behavior

Postby FishyClockwork » Wed Jan 16, 2013 7:57 am

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 FishyClockwork on Wed Jan 16, 2013 3:04 pm, edited 1 time in total.
User avatar
FishyClockwork
 
Joined: 23 Feb 2011

Re: [r4025] CustomInventory Behavior

Postby Graf Zahl » Wed Jan 16, 2013 11:40 am

No, if an item successfully executes the drop state it should not spawn. That'd make this state useless.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests