• 🏆 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] Win conditions

Status
Not open for further replies.
Level 4
Joined
Apr 22, 2020
Messages
53
I tried to manage myself on this but it's really harder than I thought.

It's a map for 1v1 or 2v2 or 3v3. You lose when you have no more units.
(Except 1 invulnerable and the starting point, so you lose when you have 2 units left)

I achieve to make a Defeat trigger :


But I don't know how I can make a working trigger for winning, including number of allies...

I tried to copy a solution found in a thread... but I have to admit I don't understand the half of it...

  • WinLose Initialisation
    • Evénements
    • Conditions
    • Actions
      • Set WinLose_Index = 1
      • For each (Integer A) from 1 to 10, do (Actions)
        • Boucle - Actions
          • Groupe joueur - Add (Player((Integer A))) to WinLose_PlayerGroup[WinLose_Index]
          • Set WinLose_TeamNumber[(Integer A)] = WinLose_Index
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • ((Integer A) mod 3) Egal à 0
            • Alors - Actions
              • Set WinLose_Index = (WinLose_Index + 1)
            • Sinon - Actions

  • Simple Defeat Loop
    • Evénements
      • Unité - A unit Meurt
    • Conditions
      • (Number of units in (Units owned by (Owner of (Triggering unit)))) Egal à 2
    • Actions
      • Set WinLose_Player = (Owner of (Triggering unit))
      • For each (Integer WinLose_Index) from 1 to 2, do (Actions)
        • Boucle - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • WinLose_TeamNumber[(Player number of WinLose_Player)] Egal à WinLose_Index
            • Alors - Actions
              • Set WinLose_TeamDefeatedCount[WinLose_Index] = (WinLose_TeamDefeatedCount[WinLose_Index] + 1)
            • Sinon - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • WinLose_TeamDefeatedCount[WinLose_Index] Egal à 3
            • Alors - Actions
              • For each (Integer A) from 1 to 10, do (Actions)
                • Boucle - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • Si - Conditions
                      • WinLose_TeamNumber[(Integer A)] Egal à WinLose_Index
                    • Alors - Actions
                      • Set WinLose_Player = (Player((Integer A)))
                      • Partie - Display to (All players) the text: ((Name of WinLose_Player) + was defeated!)
                      • Partie - Defeat WinLose_Player with the message: Defeat!
                      • Set WinLose_TotalDefeated = (WinLose_TotalDefeated + 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • Si - Conditions
                          • WinLose_TotalDefeated Egal à 3
                        • Alors - Actions
                          • Déclencheur - Run Simple Victory Check <gen> (checking conditions)
                        • Sinon - Actions
                    • Sinon - Actions
            • Sinon - Actions

  • Simple Victory Check
    • Evénements
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Boucle - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • (Number of units in (Units owned by (Player((Integer A))))) Supérieur à 2
            • Alors - Actions
              • Partie - Display to (All players) the text: ((Name of (Player((Integer A)))) + won!)
              • Partie - Victory (Player((Integer A))) (Montrer dialogs, Montrer scores)
              • Set WinLose_Index = (WinLose_Index + 1)
            • Sinon - Actions

I've try to adapt it to my map, so there must be some mistakes...
 
Last edited:
Level 14
Joined
Feb 7, 2020
Messages
387
1) This function . .
  • Trigger - Turn on Simple Victory Check(checking conditions)
. . should be:
  • Trigger - Run Simple Victory Check <gen> (checking conditions)
2) In the initialization: there's no code in there to determine if it's 1v1, 2v2, etc. You could have the host declare the mode with another system or dialog box, then change the mod() value to the selected team size (1, 2, or 3) before running the teams setup.

3) In Simple Defeat Loop, you are referencing Triggering Player. This is not registered in unit events. You want to use Owner of Unit (Triggering Unit).

Lastly, I'd post triggers as text when you seek help so we can better interact with them.

For future searches, the system in question is here: Victory/Defeat condition problem.
 
Last edited:
Level 4
Joined
Apr 22, 2020
Messages
53
I've made your modifications 1) and 3). I edited my first post with your recommandations to put my triggers as text (modifications included).

You're the one I copied, so that's cool you saw my thread, it couldn't be a better person lol

I have question for your 2) point. What do you mean by host declare the mode ? You mean, I have to make a system at start where the host set the mod of the game ? I don't know how to do that... :(
There is no way to set this automatically at start ?

Then you saw what I've changed between your original post and mine. As I said, I don't really understand the all trigger, so it's hard to me to figure out what I have to change exactly to adapt it to a 3v3, 2v2 or 1v1
 
Level 14
Joined
Feb 7, 2020
Messages
387
  • ((Integer A) mod 3) Egal à 0
This is the modulus value to change to determine team size. It's just a math function for terser code. This is getting the remainder of the integer passed in. So if the integer is at 3, then the function is '3/3' which equals 0 (so it's true in this condition whenever the current player number is divisible by 3, and passes).

Whatever you want the team size to be requires the remainder be 0 to increment the team number variable we increase by 1. So, if you want teams of 2, the mod value of '3' needs to be changed to '2' (so the function becomes '2/2' equal to 0 when checking the current player number).

This can be done by storing the current value of '3' as an integer variable called "TeamSize" or something similar. The point with 2) is that currently there is no functionality driving how teams are set up. It will always be 3v3 right now. You would want to make the integer "TeamSize" be whatever mode is currently desired (1v1, 2v2, 3v3). This can be done with an init trigger checking number of players in the game, or by the host setting up teams at the start. Or, leave it at '3' and always have a 3v3 game.
 
Level 4
Joined
Apr 22, 2020
Messages
53
Yes this is how it looks now but doesn't work in a 3v3. I set computer in all slots, is it still working with that ?

I share you the triggers again, maybe I forget or misunderstood something :

  • WinLose Initialisation
    • Evenements
    • Conditions
    • Actions
      • Set WinLose_Index = 1
      • For each (Integer A) from 1 to 10, do (Actions)
        • Boucle - Actions
          • Groupe joueur - Add (Player((Integer A))) to WinLose_PlayerGroup[WinLose_Index]
          • Set WinLose_TeamNumber[(Integer A)] = WinLose_Index
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • ((Integer A) mod 3) Egal à 0
            • Alors - Actions
              • Set WinLose_Index = (WinLose_Index + 1)
            • Sinon - Actions

  • Simple Defeat Loop
    • Evenements
      • Unit - A unit Meurt
    • Conditions
      • (Number of units in (Units owned by (Owner of (Triggering unit)))) Egal à 2
    • Actions
      • Set WinLose_Player = (Owner of (Triggering unit))
      • For each (Integer WinLose_Index) from 1 to 2, do (Actions)
        • Boucle - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • WinLose_TeamNumber[(Player number of WinLose_Player)] Egal à WinLose_Index
            • Alors - Actions
              • Set WinLose_TeamDefeatedCount[WinLose_Index] = (WinLose_TeamDefeatedCount[WinLose_Index] + 1)
            • Sinon - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • WinLose_TeamDefeatedCount[WinLose_Index] Egal à 3
            • Alors - Actions
              • For each (Integer A) from 1 to 10, do (Actions)
                • Boucle - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • Si - Conditions
                      • WinLose_TeamNumber[(Integer A)] Egal à WinLose_Index
                    • Alors - Actions
                      • Set WinLose_Player = (Player((Integer A)))
                      • Partie - Display to (All players) the text: ((Name of WinLose_Player) + was defeated!)
                      • Partie - Defeat WinLose_Player with the message: Defeat!
                      • Set WinLose_TotalDefeated = (WinLose_TotalDefeated + 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • Si - Conditions
                          • WinLose_TotalDefeated Egal à 3
                        • Alors - Actions
                          • Trigger - Run Simple Victory Check <gen> (checking conditions)
                        • Sinon - Actions
                    • Sinon - Actions
            • Sinon - Actions

  • Simple Victory Check
    • Evenements
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Boucle - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • (Number of units in (Units owned by (Player((Integer A))))) Superieur à 2
            • Alors - Actions
              • Partie - Display to (All players) the text: ((Name of (Player((Integer A)))) + won!)
              • Partie - Victory (Player((Integer A))) (Montrer dialogs, Montrer scores)
              • Set WinLose_Index = (WinLose_Index + 1)
            • Sinon - Actions
 
Level 4
Joined
Apr 22, 2020
Messages
53
Ok I tried another trigger I found, and it works. :)

I post my triggers here. Tell me if you see any mistake. Thanks !

  • Team Initialisation
    • Evénements
      • Map initialization
    • Conditions
    • Actions
      • Set Team1 = Team1
      • Set Team2 = Team2
      • Groupe joueur - Add Joueur 1 (Rouge) to Team1
      • Groupe joueur - Add Joueur 2 (Bleu) to Team1
      • Groupe joueur - Add Joueur 3 (Cyan) to Team1
      • Groupe joueur - Add Joueur 4 (Pourpre) to Team2
      • Groupe joueur - Add Joueur 5 (Jaune) to Team2
      • Groupe joueur - Add Joueur 6 (Orange) to Team2
  • Remove Player
    • Evénements
      • Unité - A unit Meurt
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Number of units in (Units owned by (Owner of (Triggering unit)))) Egal à 2
        • Alors - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • (Owner of (Triggering unit)) Egal à (Random player from Team1)
            • Alors - Actions
              • Groupe joueur - Remove (Owner of (Triggering unit)) from Team1
              • Déclencheur - Run Victory Check <gen> (checking conditions)
            • Sinon - Actions
              • Groupe joueur - Remove (Owner of (Triggering unit)) from Team2
              • Déclencheur - Run Victory Check <gen> (checking conditions)
        • Sinon - Actions
  • Victory Check
    • Evénements
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Number of players in Team1) Egal à 0
        • Alors - Actions
          • Groupe joueur - Pick every player in Team1 and do (Actions)
            • Boucle - Actions
              • Partie - Defeat (Picked player) with the message: Defeat!
          • Groupe joueur - Pick every player in Team2 and do (Actions)
            • Boucle - Actions
              • Partie - Victory (Picked player) (Montrer dialogs, Montrer scores)
        • Sinon - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • (Number of players in Team2) Egal à 0
            • Alors - Actions
              • Groupe joueur - Pick every player in Team2 and do (Actions)
                • Boucle - Actions
                  • Partie - Defeat (Picked player) with the message: Defeat!
              • Groupe joueur - Pick every player in Team1 and do (Actions)
                • Boucle - Actions
                  • Partie - Victory (Picked player) (Montrer dialogs, Montrer scores)
            • Sinon - Actions
 
Level 4
Joined
Apr 22, 2020
Messages
53
EDITED : Ok, I found the problem myself. My defeat condition wasn't working... Problem Solved !


I'm back here because my win/lose conditions didn't work correctly. I really don't know why... I heard about bug in playergroup count so I tried to do quite the same thing with only integer.

So I tried to do this : (Forces are set)

(Joue = Play)

  • Team Initialisation Copier
    • Evénements
      • Map initialization
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 1 (Rouge) slot status) Egal à Joue
        • Alors - Actions
          • Set Team1_Index = (Team1_Index + 1)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 2 (Bleu) slot status) Egal à Joue
        • Alors - Actions
          • Set Team1_Index = (Team1_Index + 1)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 3 (Cyan) slot status) Egal à Joue
        • Alors - Actions
          • Set Team1_Index = (Team1_Index + 1)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 1 (Rouge) slot status) Egal à Joue
          • (Joueur 2 (Bleu) slot status) Egal à Joue
        • Alors - Actions
          • Set Team1_Index = (Team1_Index + 2)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 1 (Rouge) slot status) Egal à Joue
          • (Joueur 3 (Cyan) slot status) Egal à Joue
        • Alors - Actions
          • Set Team1_Index = (Team1_Index + 2)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 2 (Bleu) slot status) Egal à Joue
          • (Joueur 3 (Cyan) slot status) Egal à Joue
        • Alors - Actions
          • Set Team1_Index = (Team1_Index + 2)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 1 (Rouge) slot status) Egal à Joue
          • (Joueur 2 (Bleu) slot status) Egal à Joue
          • (Joueur 3 (Cyan) slot status) Egal à Joue
        • Alors - Actions
          • Set Team1_Index = (Team1_Index + 3)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 4 (Pourpre) slot status) Egal à Joue
        • Alors - Actions
          • Set Team2_Index = (Team2_Index + 1)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 5 (Jaune) slot status) Egal à Joue
        • Alors - Actions
          • Set Team2_Index = (Team2_Index + 1)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 6 (Orange) slot status) Egal à Joue
        • Alors - Actions
          • Set Team2_Index = (Team2_Index + 1)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 4 (Pourpre) slot status) Egal à Joue
          • (Joueur 5 (Jaune) slot status) Egal à Joue
        • Alors - Actions
          • Set Team2_Index = (Team2_Index + 2)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 4 (Pourpre) slot status) Egal à Joue
          • (Joueur 6 (Orange) slot status) Egal à Joue
        • Alors - Actions
          • Set Team2_Index = (Team2_Index + 2)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 5 (Jaune) slot status) Egal à Joue
          • (Joueur 6 (Orange) slot status) Egal à Joue
        • Alors - Actions
          • Set Team2_Index = (Team2_Index + 2)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Joueur 4 (Pourpre) slot status) Egal à Joue
          • (Joueur 5 (Jaune) slot status) Egal à Joue
          • (Joueur 6 (Orange) slot status) Egal à Joue
        • Alors - Actions
          • Set Team2_Index = (Team2_Index + 3)
        • Sinon - Actions
  • Remove Player
    • Evénements
      • Unité - A unit Meurt
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (Number of units in (Units owned by (Owner of (Triggering unit)))) Egal à 2
        • Alors - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Owner of (Triggering unit)) Egal à Joueur 1 (Rouge)
                  • (Owner of (Triggering unit)) Egal à Joueur 2 (Bleu)
                  • (Owner of (Triggering unit)) Egal à Joueur 3 (Cyan)
            • Alors - Actions
              • Set Team1_Index = (Team1_Index - 1)
              • Déclencheur - Run Victory Check <gen> (checking conditions)
            • Sinon - Actions
              • Set Team2_Index = (Team2_Index - 1)
              • Déclencheur - Run Victory Check <gen> (checking conditions)
        • Sinon - Actions
  • Victory Check
    • Evénements
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • Team1_Index Egal à 0
        • Alors - Actions
          • Partie - Defeat Joueur 1 (Rouge) with the message: Defeat!
          • Partie - Defeat Joueur 2 (Bleu) with the message: Defeat!
          • Partie - Defeat Joueur 3 (Cyan) with the message: Defeat!
          • Partie - Victory Joueur 4 (Pourpre) (Montrer dialogs, Montrer scores)
          • Partie - Victory Joueur 5 (Jaune) (Montrer dialogs, Montrer scores)
          • Partie - Victory Joueur 6 (Orange) (Montrer dialogs, Montrer scores)
        • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • Team2_Index Egal à 0
        • Alors - Actions
          • Partie - Victory Joueur 1 (Rouge) (Montrer dialogs, Montrer scores)
          • Partie - Victory Joueur 2 (Bleu) (Montrer dialogs, Montrer scores)
          • Partie - Victory Joueur 3 (Cyan) (Montrer dialogs, Montrer scores)
          • Partie - Defeat Joueur 4 (Pourpre) with the message: Defeat!
          • Partie - Defeat Joueur 5 (Jaune) with the message: Defeat!
          • Partie - Defeat Joueur 6 (Orange) with the message: Defeat!
        • Sinon - Actions

But I don't understand why this doesn't work ...
 
Last edited:
Status
Not open for further replies.
Top