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

checking if all units belong to 1 player?

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Seas^^

Hmm you can use the following action in your trigger:

  • Actions:
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Owner of (Picked unit)) Equal to Player 1 (Red)
          • Then - Actions
            • Your Action!
          • Else - Actions
MfG
Dr. Boom
 
Level 11
Joined
Nov 12, 2006
Messages
765
thank youu (i had a brain fart which is why i couldn't do this myself)

:) +1


edit: now i know why i diddnt do this, this trigger doesnt work. it just picks all the units, and if they are reds they will do an action for each red unit. this doesnt fix my problem. but you can keep your rep. haha.

again my problem: i want a trigger to check if all the units are owned by a single player.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Hmm but ... let me think ...

There are more Actions except the "Unit - Triggers". You said that the Player would win if he controlls all Units.

For example add in the action:
  • Actions:
    • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
Or play a victory cinematic or what ever ;)

I bet this will work

MfG
Dr. Boom
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas ;)

Hmm my english isn't good and your last sentenses doesn't make any sense for me =P

But at the beginning you said: "1 Player controls everything and their are no other units belonging to any other players"

And .... omg mom ... I think there stand Player 1 not 1 Player ...

Hmm than do another check for other Players ;)

  • Check Units
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 1 (Red)
            • Then - Actions
              • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Picked unit)) Equal to Player 2 (Blue)
                • Then - Actions
                  • Game - Victory Player 2 (Blue) (Show dialogs, Show scores)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of (Picked unit)) Equal to Player 3 (Teal)
                    • Then - Actions
                      • Game - Victory Player 3 (Teal) (Show dialogs, Show scores)
                    • Else - Actions
If you want run the trigger all the time use the Event:
  • Events:
    • Time - Every (time) seconds of game time
I hope I understand it now xD

MfG
Dr. Boom
 
Level 11
Joined
Nov 12, 2006
Messages
765
hah okay well i appreciate your help, however that trigger still wouldn't do it. it doesn't specify that the only units left are equal to just 1 player.

the trigger you posted will make it so that if their is A unit, no matter what other units are there, if their is A unit then the victory action will come up.

the trigger i want is somthing that if their is ONLY a single players units left then the action occurs.

for example:

the only units left on the map belong to player 2 blue, all the other players units have been killed.

however i believe that i have found away to do this on my own using player groups. but thanks for your attempted help anyways. mods can mark this with "ignored".
 
Level 8
Joined
Mar 12, 2008
Messages
437
It's a condition; Integer comparison - Player - Count players in player group.

Edit: It should look something like this:


(Number of players in (All players matching ((Number of units in (Units in (Playable map area) owned by (Matching player))) Greater than or equal to 1))) Equal to 1
 
Level 11
Joined
Nov 12, 2006
Messages
765
  • Conditions
    • (Number of players in (All players matching ((Number of units in (Units in (Playable map area))) Greater than or equal to 1))) Equal to 1
is that what you mean?

edit: or should i keep looking

EDIT2:
  • Conditions
    • (Number of players in (All players matching ((Number of units in (Units in (Playable map area) owned by (Picked player))) Greater than or equal to 1))) Equal to 1
thats closer to what you were saying
 
Level 11
Joined
Feb 16, 2009
Messages
760
Enough of this crap.
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to Player 1 (Red))) and do (Unit Group - Add (Matching unit) to Temp_Group[1])
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit Group - Add (Matching unit) to Temp_Group[2])
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in Temp_Group[1]) Equal to (Number of units in Temp_Group[2])
      • Then - Actions
  • Your actions
    • Else - Actions
Cmon guys
 
Level 8
Joined
Mar 12, 2008
Messages
437
Enough of this crap.
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to Player 1 (Red))) and do (Unit Group - Add (Matching unit) to Temp_Group[1])
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit Group - Add (Matching unit) to Temp_Group[2])
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in Temp_Group[1]) Equal to (Number of units in Temp_Group[2])
      • Then - Actions
  • Your actions
    • Else - Actions
Cmon guys

That's one solution, but how was my trigger crap?
 
Level 11
Joined
Nov 12, 2006
Messages
765
  • Events
    • Time - Every 2.00 seconds of game time
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to Player 1 (Red))) and do (Unit Group - Add (Matching unit) to first_temp_group)
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit Group - Add (Matching unit) to sec_temp_group)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in first_temp_group) Equal to (Number of units in sec_temp_group)
      • Then - Actions
        • Game - Display to (All players) the text: 1
      • Else - Actions
        • Game - Display to (All players) the text: 2
i started the game with me having a bunch of units and the enemy having 1 unit. the number 1 kept popping up, when i destroyed the enemy unit and became the sole player, it still only showed the number 1. also i duplicated the trigger for player blue and teal (using numbers 3/4 and 5/6) to run simultaneously. No matter what was dead and alive, 1/3/5 kept showing up (the THEN actions). what am i doing wrong?
 
Status
Not open for further replies.
Top