Item replacer/spawner to drop multiple items

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
DarkQuill
Posts: 110
Joined: Thu Dec 04, 2008 5:43 am
Location: Australia, MAYTE

Item replacer/spawner to drop multiple items

Post by DarkQuill »

I am trying to make a mod patch that replaces one weapon with another, however it has an accompanying inventory item thats required too. I have set up a lazy RandomSpawner to spawn the weapon replacement with a 100% chance, but want to know if there's a way to make it drop that resource at the same time. I am not sure if this is possible with RandomSpawner.
I have also tried making a second weapon entry that inherits the first with the simple "DropItem" property, but regardless of the method of the weapon appearing - map load, spawning randomspawner or spawning either the v1 or v2 directly - none will drop this additional item.

Preferably I could have it drop alongside the weapon. I am not adverse to having the weapon pickup also forcibly add the item to the players inventory too if that's how it has to be, but I am also not having any success using A_GiveInventory in the weapons inherited Pickup state.

Here's what I'm running with;
Spoiler:
Very puzzled! Any help would be super great.
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Item replacer/spawner to drop multiple items

Post by Jarewill »

RandomSpawner can only spawn one actor and the Pickup state only works with CustomInventory actors.
What you want to do is create a new actor that spawns both the weapon and the item and then disappears:

Code: Select all

ACTOR FirestormSpawner 2005
{
  States
  {
  Spawn:
    TNT1 A 0 NoDelay A_SpawnItemEx("DustFireStorm2")
    TNT1 A 0 A_SpawnItemEx("WeaponRepairKit",frandom(-16,16),frandom(-16,16))
    Stop
  }
}
User avatar
DarkQuill
Posts: 110
Joined: Thu Dec 04, 2008 5:43 am
Location: Australia, MAYTE

Re: Item replacer/spawner to drop multiple items

Post by DarkQuill »

Jarewill wrote: Wed Dec 20, 2023 6:21 am RandomSpawner can only spawn one actor and the Pickup state only works with CustomInventory actors.
What you want to do is create a new actor that spawns both the weapon and the item and then disappears:

Code: Select all

ACTOR FirestormSpawner 2005
{
  States
  {
  Spawn:
    TNT1 A 0 NoDelay A_SpawnItemEx("DustFireStorm2")
    TNT1 A 0 A_SpawnItemEx("WeaponRepairKit",frandom(-16,16),frandom(-16,16))
    Stop
  }
}
Works like a charm, thank you very much!
Post Reply

Return to “Scripting”