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

A trigger that make everyone outside of region loses?

Status
Not open for further replies.
Level 6
Joined
Jul 12, 2017
Messages
139
Just like the topic, to make you see the big picture, a chopper will take that hero unit to safe zone which guarantee the owner a win while players outside who did not make it within time limit will get defeat screen.

I think using hero unit as condition will be easier since there might be leftover units of that players outside, but I can't seem to make it work so I'm here to ask for help.

Thank you in advance.
 
Level 39
Joined
Feb 27, 2007
Messages
5,012
The first thing you'll need is a player group that contains all of the players that could win/lose. If you really want to be lazy you could use All Players but that will grab any NPCs and computer players in the map as well. The simplest way to make the player group (which you can do whenever) is:
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked player) slot status) Equal to Is playing
          • ((Picked player) controller) Equal to User
        • Then - Actions
          • Player Group - Add (Picked player) to PLAYING_HUMANS
        • Else - Actions
Then when the chopper takes off you simply move some players from that group into another (if they have a hero in the zone), victory the players in that new group, and defeat everyone left in the old group.
  • Custom script: set bj_wantDestroyGroup = true //this preemtively cleans a unit group leak that's about to happen in the next line
  • Unit Group - Pick every unit in (Units in CHOPPER REGION <gen> matching (((Matching Unit) is a Hero) equal to True)) and do (Actions)
    • Loop - Actions
      • Player Group - Remove (Owner of (Picked unit)) from PLAYING_HUMANS
      • Player Group - Add (Owner of (Picked Unit)) to WINNING_HUMANS
  • Player Group - Pick every player in PLAYING_HUMANS and do (Actions)
    • Loop - Actions
      • Game - Defeat (Picked player) with the message: GET TO DA CHOPPA!
  • Player Group - Pick every player in WINNING_HUMANS and do (Actions)
    • Loop - Actions
      • Game - Victory (Picked player) (Show dialogs, Show scores)
If this is the end of the game, then you don't need to do anything else. If it's not (and this just ends a minigame or one round or whatever) and you don't actually want to victory/defeat, then you'll need to put all the players in WINNING_HUMANS back into PLAYING_HUMANS so it works properly the next time this trigger is run.
 
Level 6
Joined
Jul 12, 2017
Messages
139
The first thing you'll need is a player group that contains all of the players that could win/lose. If you really want to be lazy you could use All Players but that will grab any NPCs and computer players in the map as well. The simplest way to make the player group (which you can do whenever) is:
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked player) slot status) Equal to Is playing
          • ((Picked player) controller) Equal to User
        • Then - Actions
          • Player Group - Add (Picked player) to PLAYING_HUMANS
        • Else - Actions
Then when the chopper takes off you simply move some players from that group into another (if they have a hero in the zone), victory the players in that new group, and defeat everyone left in the old group.
  • Custom script: set bj_wantDestroyGroup = true //this preemtively cleans a unit group leak that's about to happen in the next line
  • Unit Group - Pick every unit in (Units in CHOPPER REGION <gen> matching (((Matching Unit) is a Hero) equal to True)) and do (Actions)
    • Loop - Actions
      • Player Group - Remove (Owner of (Picked unit)) from PLAYING_HUMANS
      • Player Group - Add (Owner of (Picked Unit)) to WINNING_HUMANS
  • Player Group - Pick every player in PLAYING_HUMANS and do (Actions)
    • Loop - Actions
      • Game - Defeat (Picked player) with the message: GET TO DA CHOPPA!
  • Player Group - Pick every player in WINNING_HUMANS and do (Actions)
    • Loop - Actions
      • Game - Victory (Picked player) (Show dialogs, Show scores)
If this is the end of the game, then you don't need to do anything else. If it's not (and this just ends a minigame or one round or whatever) and you don't actually want to victory/defeat, then you'll need to put all the players in WINNING_HUMANS back into PLAYING_HUMANS so it works properly the next time this trigger is run.
That is a solid way to do it and it works nicely as well. Thank you so much!
 
Status
Not open for further replies.
Top