Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
I just can't find a way to make a victory condition for my needs.
Defeat condition is the following:
Defeat
Events
Unit - A unit Dies
Conditions
(Unit-type of (Dying unit)) Equal to Conjurer Librum
Actions
Game - Defeat (Owner of (Dying unit)) with the message: Defeat!
So there are 4 teams of 2 player. Every player can build the main building (Librum) at the start of the game (just once then never again). When this building dies I want the coresponding player to be defeated.
The hard part is to detect the winner. What trigger could be used, to make the last team left with their buildings, the winning one. So when every one else is defeated, they win? I really have no clue and don't find any fitting answers :I
Thank you Warseeker, appreciated! 2 things: I don't really managed to import your trigger exactly....
Defeat
Events
Unit - A unit Dies
Conditions
(Unit-type of (Dying unit)) Equal to Conjurer Librum
Actions
Set VariableSet int = (int + 1)
Game - Defeat (Owner of (Dying unit)) with the message: Defeat!
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
int Equal to 3
Then - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Conjurer Librum units owned by Player 1 (Red)) Equal to 1
Then - Actions
Game - Display to (All players) the text: Player Red Won
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Conjurer Librum units owned by Player 2 (Blue)) Equal to 1
Then - Actions
Game - Display to (All players) the text: Player Blue Won
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Conjurer Librum units owned by Player 3 (Teal)) Equal to 1
Then - Actions
Game - Display to (All players) the text: Player Teal Won
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Conjurer Librum units owned by Player 4 (Purple)) Equal to 1
Then - Actions
Game - Display to (All players) the text: Player Purple Won
Else - Actions
how did you make the "if , then, else condition" in the beginning, where it says "int Equal to 3" and then it immediatly goes over to the "else" actions?
+ does this trigger also take into account that these are always teams of 2 people (red + blue, teal+purp...etc.)?
Warseeker's trigger doesn't account for teams as it stands.
You could add the number of units alive check for both players to an if/then block then defeat both of them.
edit:
Simple Victory Loop System:
I created a basic system that reduces the number of copied code blocks required for a victory setup like this. I tested it to work but it could have bugs if made more complex. However, it should be able to help you understand loop functions to do iterative tasks.
Setup Teams
Events
Map initialization
Conditions
Actions
Set VariableSet tempInt = 1
-------- start setting teamgroup[1] to player 1 and 2 --------
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
-------- we don't use this player force here, but you could do alliance things with it: --------
Player Group - Add (Player((Integer A))) to playersTeam[tempInt]
Game - Display to (All players) the text: (Player + ((String((Integer A))) + ( added to team + (String(tempInt)))))
-------- there are bugs looping through player forces so we store the player's team number separately for looping: --------
Set VariableSet playersTeamNumber[(Integer A)] = tempInt
-------- every 2nd number, we increment the team being set up by 1 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Integer A) mod 2) Equal to 0
Then - Actions
Set VariableSet tempInt = (tempInt + 1)
Else - Actions
Simple Defeated Loop
Events
Unit - A unit Dies
Conditions
(Unit-type of (Triggering unit)) Equal to Farm
Actions
Set VariableSet tempPlayer = (Owner of (Triggering unit))
-------- farm in this example is your key building --------
For each (Integer tempInt) from 1 to 5, do (Actions)
Loop - Actions
-------- multiple loops with player forces (groups) are buggy, so we do this instead: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playersTeamNumber[(Player number of tempPlayer)] Equal to tempInt
Then - Actions
-------- if the player is defeated by not having key structure, their matching team defeated count (1 thru 5) goes up by 1 --------
Set VariableSet playersTeamDefeatedCount[tempInt] = (playersTeamDefeatedCount[tempInt] + 1)
-------- for example only: do other things with the player that lost the key structure if desired: --------
Game - Display to (All players) the text: (Player + ((Name of tempPlayer) + lost their base!))
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units in (Playable map area) owned by tempPlayer) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
-------- check if the total number of players defeated in the team is the team size (2): --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playersTeamDefeatedCount[tempInt] Equal to 2
Then - Actions
-------- if 2 players for the matching team (1 thru 5) are defeated, defeat that team (bypassing force loops): --------
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playersTeamNumber[(Integer A)] Equal to tempInt
Then - Actions
Set VariableSet tempPlayer = (Player((Integer A)))
Game - Display to (All players) the text: ((Name of tempPlayer) + was defeated!)
Game - Defeat tempPlayer with the message: Defeat!
-------- increment the total players defeated: --------
Set VariableSet playersTotalDefeated = (playersTotalDefeated + 1)
-------- for efficiency, only run when the total is eligible to get the winning players: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playersTotalDefeated Equal to 8
Then - Actions
-------- we run victory when the total players defeated is 2 less than teams x player count (2) in this example (since there are 5 teams of 2 players): --------
Trigger - Run Simple Victory Check <gen> (checking conditions)
Else - Actions
Else - Actions
Else - Actions
Else - Actions
Simple Victory Check
Events
Conditions
Actions
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
-------- since the remaining players should in theory have a structure left by default, simply loop thru them all and apply victory --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Farm units owned by (Player((Integer A)))) Greater than 0
Then - Actions
Game - Display to (All players) the text: ((Name of (Player((Integer A)))) + won!)
Game - Victory (Player((Integer A))) (Show dialogs, Show scores)
Warseeker's trigger doesn't account for teams as it stands.
You could add the number of units alive check for both players to an if/then block then defeat both of them.
edit: see attached system that reduces the number of copied code blocks required for a victory setup like this
Setup Teams
Events
Map initialization
Conditions
Actions
Set VariableSet tempInt = 1
-------- start setting teamgroup[1] to player 1 and 2 --------
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
-------- we don't use this player force here, but you could do alliance things with it: --------
Player Group - Add (Player((Integer A))) to playersTeam[tempInt]
Game - Display to (All players) the text: (Player + ((String((Integer A))) + ( added to team + (String(tempInt)))))
-------- there are bugs looping through player forces so we store the player's team number separately for looping: --------
Set VariableSet playersTeamNumber[(Integer A)] = tempInt
-------- every 2nd number, we increment the team being set up by 1 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Integer A) mod 2) Equal to 0
Then - Actions
Set VariableSet tempInt = (tempInt + 1)
Else - Actions
Simple Defeated Loop
Events
Unit - A unit Dies
Conditions
(Unit-type of (Triggering unit)) Equal to Farm
Actions
Set VariableSet tempPlayer = (Owner of (Triggering unit))
-------- farm in this example is your key building --------
For each (Integer tempInt) from 1 to 5, do (Actions)
Loop - Actions
-------- multiple loops with player forces (groups) are buggy, so we do this instead: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playersTeamNumber[(Player number of tempPlayer)] Equal to tempInt
Then - Actions
-------- if the player is defeated by not having key structure, their matching team defeated count (1 thru 5) goes up by 1 --------
Set VariableSet playersTeamDefeatedCount[tempInt] = (playersTeamDefeatedCount[tempInt] + 1)
-------- for example only: do other things with the player that lost the key structure if desired: --------
Game - Display to (All players) the text: (Player + ((Name of tempPlayer) + lost their base!))
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units in (Playable map area) owned by tempPlayer) and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
-------- check if the total number of players defeated in the team is the team size (2): --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playersTeamDefeatedCount[tempInt] Equal to 2
Then - Actions
-------- if 2 players for the matching team (1 thru 5) are defeated, defeat that team (bypassing force loops): --------
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playersTeamNumber[(Integer A)] Equal to tempInt
Then - Actions
Set VariableSet tempPlayer = (Player((Integer A)))
Game - Display to (All players) the text: ((Name of tempPlayer) + was defeated!)
Game - Defeat tempPlayer with the message: Defeat!
-------- increment the total players defeated: --------
Set VariableSet playersTotalDefeated = (playersTotalDefeated + 1)
-------- for efficiency, only run when the total is eligible to get the winning players: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
playersTotalDefeated Equal to 8
Then - Actions
-------- we run victory when the total players defeated is 2 less than teams x player count (2) in this example (since there are 5 teams of 2 players): --------
Trigger - Run Simple Victory Check <gen> (checking conditions)
Else - Actions
Else - Actions
Else - Actions
Else - Actions
Simple Victory Check
Events
Conditions
Actions
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
-------- since the remaining players should in theory have a structure left by default, simply loop thru them all and apply victory --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Farm units owned by (Player((Integer A)))) Greater than 0
Then - Actions
Game - Display to (All players) the text: ((Name of (Player((Integer A)))) + won!)
Game - Victory (Player((Integer A))) (Show dialogs, Show scores)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.