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

How to Victory/Defeat when kill Boss.

Status
Not open for further replies.
Level 3
Joined
Jan 7, 2023
Messages
12
Hi guys.

Thanks for everyone's help, I tried and it didn't work.
I want to create a trigger Victory/Defeat when kill Boss.

The game consists of 2 teams.
Players 1 2 3 4 belong to team 1.
Player 5 6 7 8 belongs to team 2.

When team 1 kills the boss first, team 1 Victory, team 2 Defeat
when team 2 kills the boss first, team 2 Victory, team 1 Defeat

Also: help me with this case.
I want the Boss to stand in the area. when going out will automatically re-enter the area.

Thank you
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
First look into placing your Players into Player Group variables:
  • Setup Teams
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • 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) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
              • (Player number of (Picked player)) Less than 5
            • Then - Actions
              • Player Group - Add (Picked player) to PG_TeamOne
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked player) controller) Equal to User
                  • ((Picked player) slot status) Equal to Is playing
                  • (Player number of (Picked player)) Less than 9
                • Then - Actions
                  • Player Group - Add (Picked player) to PG_TeamTwo
                • Else - Actions
Now you can reference these Player Group variables throughout the rest of your triggers (assuming they happen after 0.10 seconds has passed).

For example, you can use them in your Boss Dies trigger:
  • Boss Dies Victory Trigger
    • Events
      • Unit - BigBadBoss 0001 <gen> Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Killing unit)) is in TeamOne) Equal to True
        • Then - Actions
          • -------- TeamOne won the game: --------
          • Player Group - Pick every player in TeamOne and do (Actions)
            • Loop - Actions
              • Game - Victory (Picked player) (Show dialogs, Show scores)
          • Player Group - Pick every player in TeamTwo and do (Actions)
            • Loop - Actions
              • Game - Defeat (Picked player) with the message: Defeat!
        • Else - Actions
          • -------- TeamTwo won the game: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Killing unit)) is in TeamTwo) Equal to True
            • Then - Actions
              • Player Group - Pick every player in TeamTwo and do (Actions)
                • Loop - Actions
                  • Game - Victory (Picked player) (Show dialogs, Show scores)
              • Player Group - Pick every player in TeamOne and do (Actions)
                • Loop - Actions
                  • Game - Defeat (Picked player) with the message: Defeat!
            • Else - Actions
For the Boss leaving trigger, you can use a Region to detect when the Boss leaves the area:
  • Boss Leaves Area
    • Events
      • Unit - A unit leaves BossRegion 000 <gen>
    • Conditions
      • (Triggering unit) Equal to BigBadBoss 0001 <gen>
    • Actions
      • Unit - Order (Triggering unit) to Move To (Center of BossRegion 000 <gen>)
      • Unit - Make (Triggering unit) Invulnerable
      • Wait 4.00 game-time seconds
      • Unit - Make (Triggering unit) Vulnerable
I'm also making the Boss invulnerable for 4.00 seconds so that Players can't abuse this too much. Obviously you can adjust it to work how you'd like.

Note that it's not always safe to use Event Responses after a Wait action. (Triggering unit) is one that always works, but that's not always the case. Anyway, in this situation we could just reference the BigBadBoss directly instead. Also, if your Boss isn't pre-placed on the map then you should store them in a Unit variable after Creating them, this way you can easily reference them in your other triggers.
 
Last edited:
Status
Not open for further replies.
Top