Trouble with powerup giver giving multiple power-up types.

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!)
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Trouble with powerup giver giving multiple power-up types.

Post by Amuscaria »

Trying to make a power-up that gives the Speed, HighJump, and DoubleFiringSpeed power-ups at the same time, but only the DoubleFiringSpeed is given despite the Pickup state giving the other 2. Not sure why it's not working.

Code: Select all

actor ChronoSpeed : PowerupGiver //used for ChronoSphere
{
  powerup.type "Speed"
  powerup.duration 1050
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  states
  {
  Spawn:
    TNT1 A 1 Bright
    loop
  }
}

actor ChronoJump : PowerupGiver //used for ChronoSphere
{
  powerup.type "HighJump"
  powerup.duration 1050
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  states
  {
  Spawn:
    TNT1 A 1 Bright
    loop
  }
}

actor ChronoSphere : PowerupGiver 5215
{
  inventory.pickupmessage "Speedy!"
  inventory.pickupsound "misc/p_pkup"
  powerup.color "Cyan" 0.15
  powerup.type "DoubleFiringSpeed"
  powerup.duration 1050
  +COUNTITEM
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  states
  {
  Spawn:
    TIME ABCD 6 Bright
    loop
  Pickup:
	TIME A 0 Bright A_GiveInventory("ChronoSpeed",1)
	TIME A 0 Bright A_GiveInventory("ChronoJump",1)
	stop
  }
}
Last edited by Amuscaria on Thu Dec 21, 2017 12:57 pm, edited 1 time in total.
User avatar
phantombeta
Posts: 2119
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Trouble with powerup giver giving multiple power-up type

Post by phantombeta »

You need to inherit from CustomInventory to use the Pickup and Use states.
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Trouble with powerup giver giving multiple power-up type

Post by Amuscaria »

Nvm. Problem fixed. I had to inherit from CustomInventory instead of PowerUpGiver.

Return to “Scripting”