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

[Solved] How to activate a trigger after killing a specific number of units?

Status
Not open for further replies.
Level 5
Joined
Aug 16, 2018
Messages
39
Hello, I'm not new to making Warcraft 3 maps, but I don't spend a lot of time making maps so I still don't know what I'm doing, I'm trying to activate this trigger, I want two forest trolls to die, and than activate this trigger so that a few more spawn, I know it's weird but I don't want them to spawn simultaneously, this works but not properly, it activates after killing one troll even though I set it to activate after killing 2, did I use the wrong trigger or something?
1690404094585.png
 
Level 30
Joined
Aug 29, 2012
Messages
1,383
For things like that you need to use a variable to make things much easier, create one like this

1690408208315.png


Integer means you will be able to store an information in the form of a number inside this variable. Then you increment it every time the unit dies, and check when it has the value you want

  • Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Forest Troll
    • Actions
      • Set VariableSet Number = (Number + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Number Equal to 2
        • Then - Actions
          • -------- The rest of your actions here --------
        • Else - Actions
 
Level 5
Joined
Aug 16, 2018
Messages
39
For things like that you need to use a variable to make things much easier, create one like this

View attachment 441793

Integer means you will be able to store an information in the form of a number inside this variable. Then you increment it every time the unit dies, and check when it has the value you want

  • Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Forest Troll
    • Actions
      • Set VariableSet Number = (Number + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Number Equal to 2
        • Then - Actions
          • -------- The rest of your actions here --------
        • Else - Actions
Thank you for replying, I've never used variable before, so i don't really know how they work, my issue now is I don't know how to set the variable in the trigger, thanks for the help.
 
Level 5
Joined
Aug 16, 2018
Messages
39
It doesn't seem to be working, my variable doesn't look the same like yours, what am I supposed to do to fix it?
  • Troll Spawner one
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Forest Troll
    • Actions
      • Set Number = 1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Number Equal to 2
        • Then - Actions
          • Game - Display to (All players) the text: I see you can fend ...
        • Else - Actions
          • Do nothing
 
Status
Not open for further replies.
Top