• 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] heyyy i need help

Status
Not open for further replies.
Level 16
Joined
Jul 21, 2008
Messages
1,121
This will help you, I'm sure :)

  • -------- Place all players in 2 separate player group variables --------
  • -------- Put it in your initialization trigger --------
  • Player Group - Add Player 1 (Red) to PlayerGroup1
  • Player Group - Add Player 2 (Blue) to PlayerGroup1
  • Player Group - Add Player 3 (Teal) to PlayerGroup2
  • Player Group - Add Player 4 (Purple) to PlayerGroup2
  • Victory
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to King
    • Actions
      • -------- We will check whos king died --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) is in PlayerGroup1) Equal to True
        • Then - Actions
          • -------- Defeating whole PlayerGroup1 --------
          • Player Group - Pick every player in PlayerGroup1 and do (Actions)
            • Loop - Actions
              • Game - Defeat (Picked player) with the message: Defeat!
        • Else - Actions
      • -------- Now, if King is in PlayerGroup2, we will defeat his group --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) is in PlayerGroup2) Equal to True
        • Then - Actions
          • -------- Defeating whole PlayerGroup2 --------
          • Player Group - Pick every player in PlayerGroup2 and do (Actions)
            • Loop - Actions
              • Game - Defeat (Picked player) with the message: Defeat!
        • Else - Actions
 
Level 8
Joined
Sep 13, 2006
Messages
431
I would think that the second if-then is superfluous. If you have only two teams, you might as well do this:

  • Victory
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to King
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) is in PlayerGroup1) Equal to True
        • Then - Actions
          • Player Group - Pick every player in PlayerGroup1 and do (Actions)
            • Loop - Actions
              • Game - Defeat (Picked player) with the message: Defeat!
        • Else - Actions
          • Player Group - Pick every player in PlayerGroup2 and do (Actions)
            • Loop - Actions
              • Game - Defeat (Picked player) with the message: Defeat!
Alternatively, if you wanted to use two or more teams, you can use a kinda confusing bit of math to accomplish the same task as above, without all the if-thens. Not sure how quickly this trigger would run, but for an event that is initiated so infrequently as this, it shouldn't be a problem.


  • Actions
    • Player Group - Pick every player in PlayerGroup[(1 + (Integer(((Real(((Player number of (Owner of (Triggering unit))) - 1))) / NumberOfPlayersPerTeam))))] and do (Actions)
      • Loop - Actions
        • Game - Defeat (Picked player) with the message: Defeat!
I'll do my best to explain the math. This takes the player number, subtracts 1, and then divides by the number of players in a team. This is then converted to an integer, which, when increased by 1, gives the team number.

For example, for 3-player teams, we'll denote player 2's team.
Player number (2) --> Subtract 1 =1 --> Divide by Number of Players per team (3) = 1/3 = 0.333 --> Convert to integer = 0 --> Add 1 = 1 = Team Number.

Anyway, I hope this helps you out...
 
Status
Not open for further replies.
Top