• 🏆 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 can i create a custom victory condition

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
And what would this victory condition be?
The action is simply this:
  • Game - Victory Player 1 (Red) (Show dialogs, Show scores)
You might have already figured that one out, but you didn't give any information on that.

It would be extremely helpful if, next time you post, you give all the information you need in the first post.
It will speed up the process and people don't have to waste time creating/reading useless posts (like this one).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
1. You should not defeat people before a winner is decided. They may wish to stay and chat and should not be denied the right to do so.
2. You keep track on the number of teams remaining. When a team loses (all members drop or all buildings destroyed) you decrement the counter by 1. If the number reaches 1 (as the game master is not a team you should count) you win the remaining team and defeat all other teams.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
please tell me how to trigger my method.
2. You keep track on the number of teams remaining. When a team loses (all members drop or all buildings destroyed) you decrement the counter by 1. If the number reaches 1 (as the game master is not a team you should count) you win the remaining team and defeat all other teams.
Anyway, this should work:
  • -------- ============== --------
  • -------- - A Player Loses - --------
  • -------- ============== --------
  • -------- Temporary integer to make things easier --------
  • Set TempInt = PlayerTeam[(Player number of (Triggering player))]
  • -------- Decrement amount of players in team --------
  • Set TeamPlayerAmount[TempInt] = (TeamPlayerAmount[TempInt] - 1)
  • -------- Check if team has been defeated --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TeamPlayerAmount[TempInt] Equal to 0
    • Then - Actions
      • -------- Remove lost team from the list --------
      • Player Group - Pick every player in Team[TeamsLeft] and do (Actions)
        • Loop - Actions
          • Player Group - Add (Picked player) to Team[TempInt]
          • Set PlayerTeam[(Player number of (Picked player))] = TempInt
      • Set TeamPlayerAmount[TempInt] = TeamPlayerAmount[TeamsLeft]
      • Custom script: call DestroyForce( udg_Team[udg_TeamsLeft] )
      • -------- Decrement amount of teams left --------
      • Set TeamsLeft = (TeamsLeft - 1)
    • Else - Actions
  • -------- Check how many teams are left --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TeamsLeft Equal to 2
    • Then - Actions
      • -------- Victory to the remaining 2 teams --------
      • Player Group - Pick every player in Team[1] and do (Actions)
        • Loop - Actions
          • Game - Victory (Picked player) (Show dialogs, Show scores)
      • Player Group - Pick every player in Team[2] and do (Actions)
        • Loop - Actions
          • Game - Victory (Picked player) (Show dialogs, Show scores)
    • Else - Actions
There are easier ways to do this, but this should be foolproof and completely automatic.
I've done it this way because you can just copy it, and it will work (if the setup is correct).

The variables:
  • Team: player group array (*)
  • PlayerTeam: integer array
  • TeamPlayerAmount: integer array
  • TeamsLeft: integer
  • TempInt: integer (optional)

The setup:
  • "TeamsLeft" should be set to the current amount of teams in the map (here, 5).
  • "PlayerTeam[X]" should be set to the team player X is in (so if Yellow is in team 3, then PlayerTeam[5] should be set to 3).
  • "TeamPlayerAmount[X]" should be set to the amount of players in team X (so if there are 2 players in team 1, then TeamPlayerAmount[1] should be set to 2).

(*) if you're not going to create new player groups at the start, then the array for the player group variable should be incremented (here, it should be set to 5).
Only if you're not creating new player groups!
 
Status
Not open for further replies.
Top