So I'm trying to design a World of WarCraft style boss encounter. The players engage the boss and every 45 seconds or so a group of adds run into the arena and the player have to defeat them. My problem is this:
If the group wipes they all respawn and get to try again fresh. How do I possibly remove the adds I've spawned from the boss arena so they aren't there for when the group tries round 2, 3, 4, etc...
I've tried so many things and my head is about to fall off! Please help!
Create a new variable of type "Unit Group", which will hold all of the spawned adds.
Then, whenever you spawn an add, use the "Unit Group -> Add Unit To Unit Group" trigger with "Last Created Unit" as the unit to add them to the unit group variable.
When you want to kill them, do a "For Each Unit In Unit Group" (or Pick Each if you prefer) and kill them one by one. AFTER the loop, make sure you clear out the variable. Leaving it uncleared may not cause any issues, but better safe than sorry. =)
An easier way, if these adds share a characteristic such as unit type, would be to just Remove Unit and get all units from the entire map belonging to the enemy player (and possibly sort them by unit type)
Like this
Unit - Remove (Unit (Number of Living units in (Any units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) from (Any units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, from the game
Although this looks complicated, it is actually only
Remove Unit
Unit From Unit Group
Number Of Units In Unit Group
Units In Region Matching Condition
and then the same thing, just recreate above
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey everyone,
So I'm trying to design a World of WarCraft style boss encounter. The players engage the boss and every 45 seconds or so a group of adds run into the arena and the player have to defeat them. My problem is this:
If the group wipes they all respawn and get to try again fresh. How do I possibly remove the adds I've spawned from the boss arena so they aren't there for when the group tries round 2, 3, 4, etc...
I've tried so many things and my head is about to fall off! Please help!
@ThePontifex: Go
Create a new variable of type "Unit Group", which will hold all of the spawned adds.
Then, whenever you spawn an add, use the "Unit Group -> Add Unit To Unit Group" trigger with "Last Created Unit" as the unit to add them to the unit group variable.
When you want to kill them, do a "For Each Unit In Unit Group" (or Pick Each if you prefer) and kill them one by one. AFTER the loop, make sure you clear out the variable. Leaving it uncleared may not cause any issues, but better safe than sorry. =)
@TheFallenOne222: Go
Thanks a ton, I appreciate the help. I'll give that a try!
An easier way, if these adds share a characteristic such as unit type, would be to just Remove Unit and get all units from the entire map belonging to the enemy player (and possibly sort them by unit type)
Like this
Although this looks complicated, it is actually only
and then the same thing, just recreate above