Trying to make a reusable inventory item
Trying to make a reusable inventory item
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.
"For the world is hollow, and I have touched the sky."
- madcat
- Forum Regular
- Posts: 361
- Joined: Mon Jul 08, 2013 7:16 pm
- Location: Czech republic
- Clan Tag: [Sun]
Re: Trying to make a reusable inventory item
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
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.
"For the world is hollow, and I have touched the sky."
-
- Retired Staff / Community Team Member
- Posts: 2569
- Joined: Sat Jun 02, 2012 2:44 am
Re: Trying to make a reusable inventory item
Add a "fail", which will stop the inventory item from being consumed.
- madcat
- Forum Regular
- Posts: 361
- Joined: Mon Jul 08, 2013 7:16 pm
- Location: Czech republic
- Clan Tag: [Sun]
Re: Trying to make a reusable inventory item
or just use a_giveinventory("theitemitself") in the item
Re: Trying to make a reusable inventory item
I thought I had it figured out, but Zandronum fails, giving the following error message:
Line 37 is the very last line in this code excerpt.
This is bizarre. Why is it expecting a number there?
Code: Select all
Execution could not continue.
Script error, "opweapons2_b1.pk3:pickups.dec" line 37:
SC_GetNumber: Bad numeric constant "}".
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
}
}
"For the world is hollow, and I have touched the sky."
- madcat
- Forum Regular
- Posts: 361
- Joined: Mon Jul 08, 2013 7:16 pm
- Location: Czech republic
- Clan Tag: [Sun]
Re: Trying to make a reusable inventory item
I see what the problem is
Your last state should look like this:
NotYet:
TNT1 A 4
fail
Your last state should look like this:
NotYet:
TNT1 A 4
fail
Re: Trying to make a reusable inventory item
Yeah, somebody in the DoomWorld forums pointed that out too, and when I added a frame there, it works. Thanks again!
"For the world is hollow, and I have touched the sky."