• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

"Boss Fight" Trigger

Status
Not open for further replies.
Level 4
Joined
Nov 3, 2015
Messages
46
To set the groundwork here, you're supposed to go into this encampment and slay all of the enemy minions before the boss (formerly a neutral hero with invulnerability) becomes hostile to players.

So, in steps:
1 - Kill all enemy minions
2 - Boss speaks
3 - Boss starts attacking
4 - Boss drops loot on death

I already have a region set up that covers the area where the enemy minions and buildings are. Now all that's needed is an efficient trigger that counts all of them and signals when all of them are dead.
 
Level 42
Joined
Feb 27, 2007
Messages
5,298
You'll need to add them to a Unit Group and then use a periodic timer event with a condition that detects when all of the "Unit Group" units are dead.
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set CREEP_GROUP = Units in YourRegion <gen> matching (((Matching Unit) is a structure equal to false) and (Owner of (Matching Unit) equal to <Player that owns them>)) //might not need the matching condition, not sure of your setup
  • Events
    • Unit - A Unit dies
  • Conditions
    • (Triggering Unit) is in CREEP_GROUP equal to true
  • Actions
    • Unit - Remove (Triggering Unit) from CREEP_GROUP
  • Events
    • Time - Every 5.00 seconds of Game-time
  • Conditions
    • (Number of Units in CREEP_GROUP) equal to 0
  • Actions
    • Trigger - Turn off (this trigger)
    • Trigger - Turn off TheSecondTriggerInThisPost <gen>
    • Custom script: call DestroyGroup(udg_CREEP_GROUP) //change the name here to match the name of your group variable.
    • -------- do your boss stuff here --------
You can set the items the boss should drop by double-clicking it on the map and editing there. Should be a field to edit for that.
 
Level 12
Joined
Nov 3, 2013
Messages
989
Why not just check if the number of units in the creep group is 0 at the same as you remove the units from the group? A periodic event seems completely redundant to me.

Even if there's going to be more units added during the game or something (maybe some adds spawning during the fight against the minions, or maybe some of these units have summoning abilities, which haven't been mentioned), they should just be added to the group when created/summoned.

  • Unit - A Unit dies
  • Conditions
    • (Triggering Unit) is in CREEP_GROUP equal to true
  • Actions
    • Unit - Remove (Triggering Unit) from CREEP_GROUP
    • if (Number of Units in CREEP_GROUP) equal to 0
      • then do
        • Custom script: call DestroyGroup(udg_CREEP_GROUP)
        • -------- do your boss stuff here --------
      • else do
        • nothing
So basically, just do as pyro says, but move the boss stuff to the 2nd trigger. If there's going to be more units added to the pre-boss-fight during the game, make a 3rd trigger for that. (unless you already have one, in that case, just add the units to the unit group when you create them)
 
Status
Not open for further replies.
Top