How do I create a CustomInventory item?

Ask about ACS, DECORATE, ZScript, or any other scripting questions 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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

How do I create a CustomInventory item?

Post by Cherno »

Seems like this should be simple, but I can't get it to work. I suspect I haven't understood the underlying principle at all :3:

No matter what I do, I can't seem to pickup the item, it just stays there when I touch it. I can use +ALWAYSPICKUP and it works, but apparently isn't placed in my inventory.

Code: Select all

ACTOR CE_Dynamite : CustomInventory
{
	Radius 8
	Height 16
	Inventory.Amount 1
	Inventory.MaxAmount 10
	+INVENTORY.INVBAR
	
	States
	{
		Spawn:
		DYNA A 1
		Loop

		Pickup:
		TNT1 A 0
		Stop

		Use:
		TNT1 A 0 A_ThrowGrenade("CE_Dynamite_Active", 0, 12, 4, false)
		Stop
	}
}
I just want to be able to pick it up (if there is room), and be able to select it in my inventory bar and use it so the active dynamite is thrown. I use Doom2.wad as the base game, btw.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: How do I create a CustomInventory item?

Post by Matt »

I don't see anything wrong with this, though I haven't touched Decorate in a while.

does specifying an inventory.icon do anything?

or getting rid of the pickup state?
User avatar
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

Re: How do I create a CustomInventory item?

Post by Cherno »

Matt wrote:I don't see anything wrong with this, though I haven't touched Decorate in a while.

does specifying an inventory.icon do anything?

or getting rid of the pickup state?
Actually, deleting the Pickup state was the solution. Thanks for the tip 8-)
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: How do I create a CustomInventory item?

Post by ramon.dexter »

CustomInventory has either Use: OR Pickup:. These two states cannot be combined, since the game logic is this: the 'use:' state is intended for combination with +INVENTORY.INVBAR for items, that could be used later, while the 'Pickup:' state is intended for items that execute action on pickup - like the classic doom pickups do. Also, define a 'inventory.icon' to work properly. Without it, it will show only empty inv slot (even with number, where there could be more than one item in inventory).
And, once more, if you want the item just stay in inventory without actually doing anything (something like quest item or thing like that), define the 'use:' state with this:

Code: Select all

Use:
TNT1 A 0
Stop
Because without this, the item will not go into invbar, no matter the flag ( or it cannot be even picked up? I am not sure here.).
Post Reply

Return to “Scripting”