Inventory vs CustomInventory

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Inventory vs CustomInventory

Postby Curunir » Mon Nov 25, 2019 5:27 am

I have an item that is required to exit the level. I have it in Decorate like this:

Code: Select allExpand view
actor Purifier : CustomInventory 12349
{
  Inventory.PickupMessage "You got the purification device."
  Inventory.PickupSound "items/armorpickup"
  Inventory.Amount 1
  Inventory.MaxAmount 1
 
  +SOLID

  States
  {
  Spawn:
    BART A -1
    Stop
  Pickup:
   TNT1 A 0 ACS_NamedExecute("SlowMeDown", 0)
   Stop   
  }
}

There is a linedef that runs the following script that checks if the player has the item and can exit the level:
Code: Select allExpand view
script 2 (void)
{
   if (CheckInventory("Purifier") == 1)
         Exit_Normal(0);
   else
         Print(s:"You don't have the purification device.");
}


The issue is, with the item defined with CustomInventory, the "SlowMeDown" script gets called and executes, but the linedef script won't find the item on me.
If I change the item definition from CustomInventory to just Inventory, the "SlowMeDown" script doesn't work, but the linedef script DOES find the item and ends the level.

What do I do?
User avatar
Curunir
In heaven everything is fine
 
Joined: 02 Nov 2003
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: Inventory vs CustomInventory

Postby Graf Zahl » Mon Nov 25, 2019 5:34 am

A CustomInventory item never gets added to the inventory if it only has a Pickup state. If you want it added it also requires a Use state. The Use state doesn't need to do anything but it needs to be present.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Inventory vs CustomInventory

Postby Curunir » Mon Nov 25, 2019 5:40 am

Thanks a lot, Graf!

I did notice the wiki for CustomInventory says "If there is no Use state the item will be removed from the map and not be placed in the actor's inventory", but I had no idea how to define a use state for something that's never really used, didn't know it could be empty and work!

That fixed it! Thanks again!
User avatar
Curunir
In heaven everything is fine
 
Joined: 02 Nov 2003
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: ATI/AMD with Vulkan Support


Return to Mapping

Who is online

Users browsing this forum: No registered users and 0 guests