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!
Hi, well you have to use unit gruops variales for this i think, or maybe there are other things but i dnt have access to the editor right now.
if u create varaibles like uni group(x) = all units owned by player x
-for the defeat
Events
Every 1 second of the game
conditions
all unit in (unit group(x)) are dead equal to true
actions
player x defeat
for vicroty
Events
every 1 second of the game
conditions
and (multiple conditions)
all units in (unit gruop(x)) are dead equal to true
all units in (unit gruop(y)) are dead equal to true
eccc
actions
player z victory
As i said this could be the worst possible way to do it, i just dnt remember any other way, maybe i'll post again with triggers (when i can use WE)
Hello! I've made one as I told you, and I hope it works for you.
WL Initialization
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Custom script: local integer teams = 1
-------- Since the function GetTeams() does not return the correct value - it's returning the number of players ... --------
-------- ...I had to make the following in order to count the teams properly --------
Custom script: local boolean different
Set WinLose_TeamsNum = 0
For each (Integer WinLose_Loop) from 0 to 11, do (Actions)
Loop - Actions
Custom script: set udg_WinLose_Player = Player(udg_WinLose_Loop)
Custom script: set different = true
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WinLose_Player slot status) Equal to Is playing
Or - Any (Conditions) are true
Conditions
(Count structures controlled by WinLose_Player (Include incomplete structures)) Greater than 0
(Count non-structure units controlled by WinLose_Player (Exclude incomplete units)) Greater than 0
Then - Actions
-------- Keep in mind that WinLose_AvailableTeams[x] is set to -1 by default in the variable editor. --------
For each (Integer WinLose_Counter) from 0 to WinLose_TeamsNum, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Team number of WinLose_Player) Equal to WinLose_AvailableTeams[WinLose_Counter]
Then - Actions
Custom script: set different = false
Else - Actions
Custom script: if different then
Set WinLose_AvailableTeams[WinLose_TeamsNum] = (Team number of WinLose_Player)
Set WinLose_TeamsNum = (WinLose_TeamsNum + 1)
Custom script: endif
Else - Actions
Custom script: loop
Custom script: exitwhen teams > udg_WinLose_TeamsNum
Custom script: set udg_WinLose_Teams[teams] = CreateForce()
Custom script: set udg_WinLose_IsTeamDefeated[teams] = false // safety first
Custom script: set teams = teams + 1
Custom script: endloop
For each (Integer WinLose_Loop) from 0 to 11, do (Actions)
Loop - Actions
Custom script: set udg_WinLose_Player = Player(udg_WinLose_Loop)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WinLose_Player slot status) Equal to Is playing
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Count structures controlled by WinLose_Player (Include incomplete structures)) Equal to 0
(Count non-structure units controlled by WinLose_Player (Exclude incomplete units)) Equal to 0
Then - Actions
-------- Defeat players that don't own anything --------
Player Group - Add WinLose_Player to WinLose_Team
Else - Actions
-------- This player has, at least, a unit. --------
Player Group - Add WinLose_Player to WinLose_Teams[(Team number of WinLose_Player)]
Else - Actions
-------- If a player is not playing, choose here whatever you want to do with their units - If they have any, of course. --------
-------- For example: Change ownership of the units to Neutral Victim (It does not attack anyone, but it's considered as enemy by other players) --------
-------- I'm not sure about players who leave the game when the map is loading. --------
-------- Better safe than sorry --------
Trigger - Turn on WL Unit Dies <gen>
Trigger - Turn on WL Player Leaves <gen>
-------- Our friendly WAIT function, as usual --------
Wait 2.00 seconds
-------- Check if there's only one team playing. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WinLose_TeamsNum Equal to 1
Then - 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) slot status) Equal to Is playing
Then - Actions
Game - Victory (Picked player) (Show dialogs, Skip scores)
Else - Actions
-------- This player probably left the game when the map was loading --------
Skip remaining actions
Else - Actions
-------- Defeat players who have no units --------
Player Group - Pick every player in WinLose_Team and do (Actions)
Loop - Actions
Game - Defeat (Picked player) with the message: You have no units.
Player Group - Remove all players from WinLose_Team
WL Unit Dies
Events
Unit - A unit Dies
Conditions
(Triggering player) Not equal to Neutral Victim
((Triggering player) slot status) Equal to Is playing
Actions
Custom script: local integer teamsLeft
Set WinLose_Player = (Triggering player)
Set WinLose_Counter = (Team number of WinLose_Player)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Count structures controlled by WinLose_Player (Include incomplete structures)) Equal to 0
(Count non-structure units controlled by WinLose_Player (Exclude incomplete units)) Equal to 0
Then - Actions
-------- The player has no units nor structures. Defeat them! --------
Game - Defeat WinLose_Player with the message: Defeat!
Player Group - Remove WinLose_Player from WinLose_Teams[WinLose_Counter]
-------- Now check if that player group is empty --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of players in WinLose_Teams[WinLose_Counter]) Equal to 0
Then - Actions
Set WinLose_IsTeamDefeated[WinLose_Counter] = True
-------- All players from this team were defeated. Check if there's still any unit left and make them belong to neutral victim player. --------
Player Group - Remove all players from WinLose_Team
Player Group - Pick every player in WinLose_Team and do (Actions)
Loop - Actions
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Loop - Actions
Unit - Change ownership of (Picked unit) to Neutral Victim and Retain color
-------- Then, check if all the other teams were defeated, and apply victory to the remaining players. --------
Custom script: set teamsLeft = 0
For each (Integer WinLose_Loop) from 0 to (WinLose_TeamsNum - 1), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WinLose_IsTeamDefeated[WinLose_Loop] Equal to False
Then - Actions
Custom script: set teamsLeft = teamsLeft + 1
Set WinLose_RemainingTeam = WinLose_Loop
Else - Actions
Custom script: if teamsLeft == 1 then
-------- There's currently one team left. Make it victorious! --------
Player Group - Pick every player in WinLose_Teams[WinLose_RemainingTeam] and do (Actions)
Loop - Actions
Game - Victory (Picked player) (Show dialogs, Show scores)
Custom script: endif
Else - Actions
Else - Actions
I don't know whether you have the "create unknown variables automatically" enabled, but here I go:
In order to copy and paste these triggers into your map with ease, it would be a good idea to have the option checked: Automatically create unknown variables while pasting trigger data
File -> Preferences...
EDIT: I fixed a very small mistake that I left in the "WL Initialization" trigger.
EDIT 2: I forgot to tell you when copying and pasting the trigger data from the attached map below, you need to modify the WinLose_AvailableTeams variable by setting its initial value to -1, and its array size to 12. Otherwise, it won't work properly (you'll always be victorious).
Hello! I've made one as I told you, and I hope it works for you.
WL Initialization
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Custom script: local integer teams = 1
-------- Since the function GetTeams() does not return the correct value - it's returning the number of players ... --------
-------- ...I had to make the following in order to count the teams properly --------
Custom script: local boolean different
Set WinLose_TeamsNum = 0
For each (Integer WinLose_Loop) from 0 to 11, do (Actions)
Loop - Actions
Custom script: set udg_WinLose_Player = Player(udg_WinLose_Loop)
Custom script: set different = true
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WinLose_Player slot status) Equal to Is playing
Or - Any (Conditions) are true
Conditions
(Count structures controlled by WinLose_Player (Include incomplete structures)) Greater than 0
(Count non-structure units controlled by WinLose_Player (Exclude incomplete units)) Greater than 0
Then - Actions
-------- Keep in mind that WinLose_AvailableTeams[x] is set to -1 by default in the variable editor. --------
For each (Integer WinLose_Counter) from 0 to WinLose_TeamsNum, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Team number of WinLose_Player) Equal to WinLose_AvailableTeams[WinLose_Counter]
Then - Actions
Custom script: set different = false
Else - Actions
Custom script: if different then
Set WinLose_AvailableTeams[WinLose_TeamsNum] = (Team number of WinLose_Player)
Set WinLose_TeamsNum = (WinLose_TeamsNum + 1)
Custom script: endif
Else - Actions
Custom script: loop
Custom script: exitwhen teams > udg_WinLose_TeamsNum
Custom script: set udg_WinLose_Teams[teams] = CreateForce()
Custom script: set udg_WinLose_IsTeamDefeated[teams] = false // safety first
Custom script: set teams = teams + 1
Custom script: endloop
For each (Integer WinLose_Loop) from 0 to 11, do (Actions)
Loop - Actions
Custom script: set udg_WinLose_Player = Player(udg_WinLose_Loop)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(WinLose_Player slot status) Equal to Is playing
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Count structures controlled by WinLose_Player (Include incomplete structures)) Equal to 0
(Count non-structure units controlled by WinLose_Player (Exclude incomplete units)) Equal to 0
Then - Actions
-------- Defeat players that don't own anything --------
Player Group - Add WinLose_Player to WinLose_Team
Else - Actions
-------- This player has, at least, a unit. --------
Player Group - Add WinLose_Player to WinLose_Teams[(Team number of WinLose_Player)]
Else - Actions
-------- If a player is not playing, choose here whatever you want to do with their units - If they have any, of course. --------
-------- For example: Change ownership of the units to Neutral Victim (It does not attack anyone, but it's considered as enemy by other players) --------
-------- I'm not sure about players who leave the game when the map is loading. --------
-------- Better safe than sorry --------
Trigger - Turn on WL Unit Dies <gen>
Trigger - Turn on WL Player Leaves <gen>
-------- Our friendly WAIT function, as usual --------
Wait 2.00 seconds
-------- Check if there's only one team playing. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WinLose_TeamsNum Equal to 1
Then - 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) slot status) Equal to Is playing
Then - Actions
Game - Victory (Picked player) (Show dialogs, Skip scores)
Else - Actions
-------- This player probably left the game when the map was loading --------
Skip remaining actions
Else - Actions
-------- Defeat players who have no units --------
Player Group - Pick every player in WinLose_Team and do (Actions)
Loop - Actions
Game - Defeat (Picked player) with the message: You have no units.
Player Group - Remove all players from WinLose_Team
WL Unit Dies
Events
Unit - A unit Dies
Conditions
(Triggering player) Not equal to Neutral Victim
((Triggering player) slot status) Equal to Is playing
Actions
Custom script: local integer teamsLeft
Set WinLose_Player = (Triggering player)
Set WinLose_Counter = (Team number of WinLose_Player)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Count structures controlled by WinLose_Player (Include incomplete structures)) Equal to 0
(Count non-structure units controlled by WinLose_Player (Exclude incomplete units)) Equal to 0
Then - Actions
-------- The player has no units nor structures. Defeat them! --------
Game - Defeat WinLose_Player with the message: Defeat!
Player Group - Remove WinLose_Player from WinLose_Teams[WinLose_Counter]
-------- Now check if that player group is empty --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of players in WinLose_Teams[WinLose_Counter]) Equal to 0
Then - Actions
Set WinLose_IsTeamDefeated[WinLose_Counter] = True
-------- All players from this team were defeated. Check if there's still any unit left and make them belong to neutral victim player. --------
Player Group - Remove all players from WinLose_Team
Player Group - Pick every player in WinLose_Team and do (Actions)
Loop - Actions
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Loop - Actions
Unit - Change ownership of (Picked unit) to Neutral Victim and Retain color
-------- Then, check if all the other teams were defeated, and apply victory to the remaining players. --------
Custom script: set teamsLeft = 0
For each (Integer WinLose_Loop) from 0 to (WinLose_TeamsNum - 1), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WinLose_IsTeamDefeated[WinLose_Loop] Equal to False
Then - Actions
Custom script: set teamsLeft = teamsLeft + 1
Set WinLose_RemainingTeam = WinLose_Loop
Else - Actions
Custom script: if teamsLeft == 1 then
-------- There's currently one team left. Make it victorious! --------
Player Group - Pick every player in WinLose_Teams[WinLose_RemainingTeam] and do (Actions)
Loop - Actions
Game - Victory (Picked player) (Show dialogs, Show scores)
Custom script: endif
Else - Actions
Else - Actions
I don't know whether you have the "create unknown variables automatically" enabled, but here I go:
In order to copy and paste these triggers into your map with ease, it would be a good idea to have the option checked: Automatically create unknown variables while pasting trigger data
File -> Preferences...
EDIT: I fixed a very small mistake that I left in the "WL Initialization" trigger.
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.