• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

simplifying a trigger

Status
Not open for further replies.

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
I would like to make a trigger that when the player hits 10/20/etc kills he wins the game. I made one but I had to set it 1 by one, like, If Player 1 has heroes killed 10/20/etc then victory him, pause all units, etc. If players 2 has heroes killed 10/20 etc then vic, pause units, etc. But isn't there an easy way ? Like using arrays for each player ? I want to simplify this system because right now I use 5 Triggers to do only one thing :s
 
Level 25
Joined
May 11, 2007
Messages
4,651
  • Player kills a unit
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Killing unit)) Not equal to (Owner of (Triggering unit))
      • ((Owner of (Killing unit)) is an enemy of (Owner of (Triggering unit))) Equal to True
    • Actions
      • -------- PlayerKills is an integer Array --------
      • -------- playerNr is an integer --------
      • -------- tempInt is an integer --------
      • Set playerNr = (Player number of (Owner of (Killing unit)))
      • Set PlayerKills[playerNr] = (PlayerKills[playerNr] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerKills[playerNr] Greater than or equal to 25
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Game - Display to (All players) the text: ((Name of (Player(playerNr))) + wins!)
          • -------- Player(playerNr) wins! --------
          • Game - Victory (Player(playerNr)) (Show dialogs, Show scores)
          • -------- Defeat all the other players --------
          • For each (Integer tempInt) from 1 to 12, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • tempInt Not equal to playerNr
                • Then - Actions
                  • Game - Defeat (Player(tempInt)) with the message: You lost!
                • Else - Actions
        • Else - Actions
 

Attachments

  • DzPlayerWin.w3x
    25.2 KB · Views: 34
Level 24
Joined
Aug 1, 2013
Messages
4,657
How can you be the owner of a unit but still be an enemy of that same unit?
Aka, the first condition is pretty useless if you already have the second.

The second condition can also be "Killing unit belongs to an enemy of Owner of triggering unit".

Allies of the winner will also lose...
 
  • Like
Reactions: hdm

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
Well I was going to open a thread about that. This is Free For All, you're right, no ally. Soon there will be Thread about Team Battle kills. Thx both ophyou
 
Status
Not open for further replies.
Top