• 🏆 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!

[Trigger] Owner equal to any player in player group

Level 65
Joined
Dec 23, 2013
Messages
1,410
Howdy folks!

I'm working on a capture script quest which can be triggered by any player in a specific Player Group
Only problem is, the World Editor simply won't let me select "Owner of [Control Point] Equal to [Any player in Player Group (Bad Guys)]"

Here's what I've got.

Part 1 (My setup for Player Groups)
  • Alliances
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Gondor --------
      • Player Group - Add Player 10 (Light Blue) to Team_FreePeoples
      • -------- Rohan --------
      • Player Group - Add Player 23 (Emerald) to Team_FreePeoples
      • -------- Dunedain --------
      • Player Group - Add Player 11 (Dark Green) to Team_FreePeoples
      • -------- High-elves --------
      • Player Group - Add Player 8 (Pink) to Team_FreePeoples
      • -------- Wood-elves --------
      • Player Group - Add Player 3 (Teal) to Team_FreePeoples
      • -------- Dwarves --------
      • Player Group - Add Player 2 (Blue) to Team_FreePeoples
      • -------- Free Peoples AI --------
      • Player Group - Make Team_FreePeoples treat Team_FreePeoples as an Ally with shared vision
      • Player Group - Make Team_FreePeoples treat Player Group - Player 17 (Wheat) as an Ally with shared vision
      • Player Group - Make Player Group - Player 17 (Wheat) treat Team_FreePeoples as an Neutral
      • Player - Make Neutral Hostile treat Player 17 (Wheat) as an Neutral
      • Player - Make Player 17 (Wheat) treat Neutral Hostile as an Neutral
      • -------- Mordor --------
      • Player Group - Add Player 21 (Coal) to Team_Minions_of_Sauron
      • -------- Isengard --------
      • Player Group - Add Player 9 (Gray) to Team_Minions_of_Sauron
      • -------- Angmar --------
      • Player Group - Add Player 13 (Maroon) to Team_Minions_of_Sauron
      • -------- Easterlings --------
      • Player Group - Add Player 6 (Orange) to Team_Minions_of_Sauron
      • -------- Haradrim --------
      • Player Group - Add Player 1 (Red) to Team_Minions_of_Sauron
      • -------- Gundabad --------
      • Player Group - Add Player 12 (Brown) to Team_Minions_of_Sauron
      • -------- Minions of Sauron AI --------
      • Player Group - Make Team_Minions_of_Sauron treat Team_Minions_of_Sauron as an Ally with shared vision
      • Player Group - Make Team_Minions_of_Sauron treat Player Group - Player 22 (Snow) as an Ally with shared vision
      • Player Group - Make Player Group - Player 22 (Snow) treat Team_Minions_of_Sauron as an Neutral
      • Player - Make Neutral Hostile treat Player 22 (Snow) as an Neutral
      • Player - Make Player 22 (Snow) treat Neutral Hostile as an Neutral
Part 2 (The script that makes these bases invulnerable at the start of the game)
  • Angmar Bases Invulnerable
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • -------- Carn Dum --------
      • Unit Group - Add all units of (Units in Carn Dum Unlock <gen> owned by Neutral Passive) to BaseUnlockGroup
      • -------- Mount Gram --------
      • Unit Group - Add all units of (Units in Mount Gram Unlock <gen> owned by Neutral Passive) to BaseUnlockGroup
      • -------- Nan Gurth --------
      • Unit Group - Add all units of (Units in Nan Gurth Unlock <gen> owned by Neutral Passive) to BaseUnlockGroup
      • -------- Himbar --------
      • Unit Group - Add all units of (Units in Himbar Unlock <gen> owned by Neutral Passive) to BaseUnlockGroup
      • -------- Ram Duath --------
      • Unit Group - Add all units of (Units in Ram Duath Unlock <gen> owned by Neutral Passive) to BaseUnlockGroup
      • Unit Group - Pick every unit in BaseUnlockGroup and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Invulnerable
      • Unit Group - Remove all units of BaseUnlockGroup from BaseUnlockGroup.
      • Custom script: set bj_wantDestroyGroup = true
Part 3 (The part that I'm struggling with)
  • Angmar Reborn Finish
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Owner of Nan Gurth (Angmar) 0165 <gen>) Equal to Player 13 (Maroon)
    • Actions
      • Trigger - Turn off (This trigger)
      • Custom script: if GetLocalPlayer() == Player(12) then
      • Sound - Play QuestCompleted <gen>
      • Sound - Destroy (Last played sound)
      • Custom script: endif
      • Unit Group - Add all units of (Units in Carn Dum Unlock <gen> owned by Neutral Passive) to BaseUnlockGroup
      • Unit Group - Pick every unit in BaseUnlockGroup and do (Actions)
        • Loop - Actions
          • Unit - Change ownership of (Picked unit) to Player 13 (Maroon) and Change color
          • Unit - Make (Picked unit) Vulnerable
      • Unit Group - Remove all units of (Units in Ram Duath Unlock <gen> owned by Neutral Passive) from BaseUnlockGroup.
      • Game - Display to Player Group - Player 13 (Maroon) for 10.00 seconds the text: |cffffc800QUEST COM...
      • Player - Set the current research level of Quest Completed: Angmar Reborn (Angmar 1) to 1 for Player 13 (Maroon)
      • Wait 5.00 seconds
      • Game - Display to Player Group - Player 13 (Maroon) for 10.00 seconds the text: |cff9bc8ffNEW HERO ...
I would like to make it so that Part 3 will trigger if any player in [Minions_of_Sauron] captures Nan Gurth, not just [Player 13 (Maroon)].
I thought I could just double-click the owner and change it to "Player Group: Minions_of_Sauron", but there is no such option, and I don't know how to add the PlayerGroup to a Variable (or if that's even how that works)

I'd be thrilled for any kind of help with this, I don't want to have to stack 6 "Or" conditions for every one of these Control Point unlocks.
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,745
It's a Boolean Comparison called "Player Is In Player Group". It's just like the one that checks if a Unit is in a Unit Group.
  • Conditions
    • ((Owner of ControlPoint) is in BadGuysGroup) Equal to True
Alternatively, you can use a Boolean array and Player Numbers to store data for each Player:
  • Set Variable Player_Has_Control_Point[Player number of (Some player)] = True
A boolean is always False by default so you can reliably check it's status to know who has a Control Point.
  • Conditions
    • Player_Has_Control_Point[Player number of (Triggering player)] Equal to True
 
Level 65
Joined
Dec 23, 2013
Messages
1,410
It's a Boolean Comparison called "Player Is In Player Group". It's just like the one that checks if a Unit is in a Unit Group.
  • Conditions
    • ((Owner of ControlPoint) is in BadGuysGroup) Equal to True
Alternatively, you can use a Boolean array and Player Numbers to store data for each Player:
  • Set Variable Player_Has_Control_Point[Player number of (Some player)] = True
A boolean is always False by default so you can reliably check it's status to know who has a Control Point.
  • Conditions
    • Player_Has_Control_Point[Player number of (Triggering player)] Equal to True
IT WORKED!
Pizza's on me dude, thanks for the assistance!

  • Angmar Reborn Finish
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Owner of Nan Gurth (Angmar) 0165 <gen>) is in Team_Minions_of_Sauron.) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Custom script: if GetLocalPlayer() == Player(12) then
      • Sound - Play QuestCompleted <gen>
      • Sound - Destroy (Last played sound)
      • Custom script: endif
      • Unit Group - Add all units of (Units in Carn Dum Unlock <gen> owned by Neutral Passive) to BaseUnlockGroup
      • Unit Group - Pick every unit in BaseUnlockGroup and do (Actions)
        • Loop - Actions
          • Unit - Change ownership of (Picked unit) to Player 13 (Maroon) and Change color
          • Unit - Make (Picked unit) Vulnerable
      • Unit Group - Remove all units of (Units in Ram Duath Unlock <gen> owned by Neutral Passive) from BaseUnlockGroup.
      • Game - Display to Player Group - Player 13 (Maroon) for 10.00 seconds the text: |cffffc800QUEST COM...
      • Player - Set the current research level of Quest Completed: Angmar Reborn (Angmar 1) to 1 for Player 13 (Maroon)
      • Wait 5.00 seconds
      • Game - Display to Player Group - Player 13 (Maroon) for 10.00 seconds the text: |cff9bc8ffNEW HERO ...
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,745
Glad it worked!

One little thing I noticed in your current trigger which I see a lot of people mistakenly doing:
  • And - All (Conditions) are true
^ This is unnecessary in your trigger and will hardly ever be used in GUI. All conditions need to be true by default so using this is redundant. The only time And is useful is when you're using Or to create a combination of Conditions like this:

If Condition A is True
OR
Condition B AND C are True

Here our Conditions will always be met if Condition A is true. If A isn't true, then our Conditions will be met if BOTH Condition B and C are true. If only B or
only C are true, it'll fail, since the AND is telling the game that both need to be True. AND is used to pair Conditions together.


Also, your usage of GetLocalPlayer() and Play Sound looks like it's going to cause a desync. As far as I understand, you need to modify the sound file played locally, so that an empty sound is played for everyone (as if nothing happened) while the local player gets the real sound. I could be wrong though.
 
Top