• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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

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 20
Joined
Aug 29, 2012
Messages
849
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
 
Top