How to make enemy spawn enemies with an attack?

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
JtoTheB
Posts: 45
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

How to make enemy spawn enemies with an attack?

Post by JtoTheB »

I'm working on a boss fight for my mod, and I want the boss to spawn enemies on all four of his sides. I'm not entirely sure on how to do this, but if someone could help that'd be greatly appreciated.
Kovnikel
Posts: 12
Joined: Sun Aug 17, 2025 7:10 am

Re: How to make enemy spawn enemies with an attack?

Post by Kovnikel »

The pain elemental zscript seems helpful for this
https://zdoom.org/wiki/Classes:PainElemental
https://zdoom.org/wiki/A_PainAttack

the A_DualPainAttack shows how you can spawn them at specific angles.
User avatar
JtoTheB
Posts: 45
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Re: How to make enemy spawn enemies with an attack?

Post by JtoTheB »

Would it be possible to give the spawned enemies tags?
Kovnikel
Posts: 12
Joined: Sun Aug 17, 2025 7:10 am

Re: How to make enemy spawn enemies with an attack?

Post by Kovnikel »

I'm not an expert with Zscript but it is possible to track spawn actors, or you could make them spawn 4 distinct enemies that inherit from a parent actor. What exactly do you want to do with it?
TheSartremaster
Posts: 20
Joined: Thu Jun 15, 2023 1:29 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows10 / Ubuntu 22.04.3
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: How to make enemy spawn enemies with an attack?

Post by TheSartremaster »

Hi,

I think https://zdoom.org/wiki/A_SpawnItemEx is what you are looking for.
the "Item" it spawns can (afaik) be any actor. So it can spawn an enemy also.
The tid argument would also allow you to manage tags.
Post Reply

Return to “Scripting”