Page 1 of 1
Trying to make a reusable inventory item
Posted: Sat Nov 05, 2016 6:56 am
by Empyre
I am trying to make an inventory item that can be used an unlimited number of times, but with a cool-down time. Can this be done with DECORATE, and if so, how? I was unable to find the answer in Zoom's wiki.
Re: Trying to make a reusable inventory item
Posted: Sat Nov 05, 2016 12:32 pm
by madcat
Yes, that is possible. Make the item give the player a powerup that does nothing, but has a certain duration. And make the item not do anything if the player has the powerup still active (a_jumpifinventory)
Re: Trying to make a reusable inventory item
Posted: Sat Nov 05, 2016 3:49 pm
by Empyre
Thanks, that is a simple and elegant solution to the cool-down, but how do I make the item not disappear from the inventory when used? The answer is probably so obvious that you assumed I already know it, but I don't.
Re: Trying to make a reusable inventory item
Posted: Sat Nov 05, 2016 6:03 pm
by Catastrophe
Add a "fail", which will stop the inventory item from being consumed.
Re: Trying to make a reusable inventory item
Posted: Sat Nov 05, 2016 9:12 pm
by madcat
or just use a_giveinventory("theitemitself") in the item
Re: Trying to make a reusable inventory item
Posted: Sat Nov 05, 2016 11:58 pm
by Empyre
I thought I had it figured out, but Zandronum fails, giving the following error message:
Code: Select all
Execution could not continue.
Script error, "opweapons2_b1.pk3:pickups.dec" line 37:
SC_GetNumber: Bad numeric constant "}".
Line 37 is the very last line in this code excerpt.
Code: Select all
ACTOR PowerGhostLauncherTimer : PowerTargeter
{
Powerup.Duration 20
-INVENTORY.HUBPOWER
States
{
Targeter:
Stop
}
}
ACTOR GhostLauncherTimer : PowerupGiver
{
Inventory.MaxAmount 0
Powerup.Type "GhostLauncherTimer"
+Inventory.AutoActivate
}
ACTOR GhostLauncher : CustomInventory
{
Inventory.MaxAmount 1
+Inventory.INVBAR
Translation "Ice"
RenderStyle "Add"
Alpha 0.65
Inventory.Icon "SKULA1"
States
{
Use:
TNT1 A 0 A_JumpIfInventory ("GhostLauncherTimer", 1, "NotYet")
TNT1 A 0 A_GiveInventory ("GhostLauncherTimer", 1)
TNT1 A 0 A_FireCustomMissile("OPGhost1",0,1,0,0,0,0)
// Pass-through
NotYet:
fail
}
}
This is bizarre. Why is it expecting a number there?
Re: Trying to make a reusable inventory item
Posted: Sun Nov 06, 2016 6:37 am
by madcat
I see what the problem is
Your last state should look like this:
NotYet:
TNT1 A 4
fail
Re: Trying to make a reusable inventory item
Posted: Sun Nov 06, 2016 6:41 am
by Empyre
Yeah, somebody in the DoomWorld forums pointed that out too, and when I added a frame there, it works. Thanks again!