• 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.

[Trigger] Last unit dies, Start another trigger

Status
Not open for further replies.
Level 3
Joined
May 30, 2008
Messages
32
Ok I have this unit that spawn in a region then they stop after 25 sec. How do I make a trigger that detect if all spawn are dead so they can start another trigger.


It spawn 200 unit of two type, then after all 200 are dead I would like it to make the trigger notice that they are all dead then they activate the other trigger.


PS. I have the trigger wrote down and I wanna copy and paste them how do I do it. I forgot it been awhile since I came back.
 
Level 2
Joined
Feb 22, 2009
Messages
24
Spawn Trigger: Spawn the units with a loop and get them into an unit-group:

for int A till (wanted count) do
Spawn Unit;
AddUnit to (Unit-Group);
endfor
Activate Trigger2;


Trigger 2: needs an integer created...

Event: when unit dies; (condition maybe unit of Player of the spawns)

//first remove the unit, when it is out of that group
pick every unit in (Unit Group) and do
if dying unit == picked unit ? Remove Unit from (Unit Group) : do nothing;
endpick;

//Then count the actual Units
Pick every unit in (Unit Group) and do
set YourInt = YourInt+1;
endpick

if YourInt = 0 then StartNextTrigger; //all dead...no unit in the group anymore

---
I think its the smartest solution for the GUI...But it may causes lags, cause there are many relative big useless loops...
 
Level 10
Joined
Apr 13, 2005
Messages
630
Ok I have this unit that spawn in a region then they stop after 25 sec. How do I make a trigger that detect if all spawn are dead so they can start another trigger.


It spawn 200 unit of two type, then after all 200 are dead I would like it to make the trigger notice that they are all dead then they activate the other trigger.


PS. I have the trigger wrote down and I wanna copy and paste them how do I do it. I forgot it been awhile since I came back.

Lol do paste a trigger use (trigger)(/trigger) *replace the ( with [ so it works* anyway why not do a unit check. Here ill do a quick trigger for you
  • Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Footman) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is dead) Equal to True
        • Then - Actions
          • Trigger - Turn on (This trigger)
        • Else - Actions
Just replace the player with another to make it work for multiple players. if you dont need player just change the unitgroup pick up every unit thing.
 
Level 11
Joined
Feb 16, 2009
Messages
760
I find this really strange, because in deathdoorway's trigger who is the triggering unit?
I'd do it like this:
1. Make as many real variables as players called Spawned units P**
2. Whenever a unit is spawned use this action(just paste it after spawn trigger):Set SpawnunitsP1 = (SpawnunitsP1 + 1.00)
NOTE: use: Set SpawnunitsP1 = 25Set SpawnunitsP1 = 25 if you spawn 25 units at once

Then use the following triggers:
Example.jpg
 
Level 3
Joined
May 30, 2008
Messages
32
Alright here what im doing i'm making a game that similar like Ultima Online. It has a champ spawn that u have to kill a bunch of monster to spawn out a boss. so I just started them yesterday and did this

  • Slime
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Slime for Player 12 (Brown) at (Random point in Spawn a <gen>) facing Default building facing degrees
      • Unit - Create 1 Slime for Player 12 (Brown) at (Random point in Spawn a <gen>) facing Default building facing degrees
      • Unit - Create 1 Slime for Player 12 (Brown) at (Random point in Spawn a <gen>) facing Default building facing degrees
      • Unit - Create 1 Rat for Player 12 (Brown) at (Random point in Spawn a <gen>) facing Default building facing degrees
      • Unit - Create 1 Rat for Player 12 (Brown) at (Random point in Spawn a <gen>) facing Default building facing degrees
      • Wait 40.00 seconds
      • Trigger - Turn off (This trigger)


ok after it spawn all that monster I want all to be killed then it spawn another level of mob. by activated another trigger similar like this. According to my caculation there will be 31 level of spawn. That is just the first level then all dies then it make another level then all dies another and so on.

40 sec time 4 is 200 and trigger is turn off at 40 sec soo then player gotta kill all of them for it to activate another trigger.
 
Last edited:
Level 3
Joined
May 30, 2008
Messages
32
I find this really strange, because in deathdoorway's trigger who is the triggering unit?
I'd do it like this:
1. Make as many real variables as players called Spawned units P**
2. Whenever a unit is spawned use this action(just paste it after spawn trigger):Set SpawnunitsP1 = (SpawnunitsP1 + 1.00)
NOTE: use: Set SpawnunitsP1 = 25Set SpawnunitsP1 = 25 if you spawn 25 units at once

Then use the following triggers:
Example.jpg

Ok i'm a lil confuse with ur instruction but I post more detail maby u can help out better. the Varibles u told me to make. in Viarable edit do I click unit? or what. cause I can't seem to make it say this.
  • (SpawnunitsP1 + 1.00)[/COLOR]
 
Level 3
Joined
May 30, 2008
Messages
32
Ok I think I got it! it gave me massive headace and 1 cap thrown on my bed, but it work here what I did it confusing as crap and gonna require like 100 trigger to support that. Thank u M4Stsh *give u reputation*

  • Slime dies
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • (Number of living Slime units owned by Player 12 (Brown)) Equal to 0
    • Actions
      • Trigger - Turn on Golm <gen>
      • Wait 1.00 seconds
      • Trigger - Turn on Golm dies <gen>
      • Wait 1.00 seconds
      • Trigger - Turn off (This trigger)
 
Status
Not open for further replies.
Top