Is there a simple way to do this without making a lot of variables and ifs/while loops? Basically I have two modes in my map(4v4, FFA), but regardless of the mode I want to make it so that if no enemies exist, then the remaining(alive) players win the game.
1. The hard way, using melee win conditions. Go into data editor and add the flags prevent defeat (from all buildings) to all the unit available.
2. The easy way, using trigger, maybe withe event any unit dies. Count number of unit in unit group. Unit group: Any living unit owned player x in region: Entire map = 0. You might have to run a loop of x with all player from player group: enemy of player you want to check for
Actually the 1 is easier , just more time consuming
1. The hard way, using melee win conditions. Go into data editor and add the flags prevent defeat (from all buildings) to all the unit available.
2. The easy way, using trigger, maybe withe event any unit dies. Count number of unit in unit group. Unit group: Any living unit owned player x in region: Entire map = 0. You might have to run a loop of x with all player from player group: enemy of player you want to check for
Actually the 1 is easier , just more time consuming
This is the trigger I have.
P1DiesEventsUnit-Bunker1diesLocalVariablesConditionsActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Alliesofplayer(Killingplayer))==(ActivePlayers)ThenVariable-ModifyPlayersDefeated[(Killingplayer)]:+1General-If(Conditions)thendo(Actions)elsedo(Actions)IfPlayersDefeated[(Killingplayer)]>=(Numberofplayersin(Alliesofplayer(Triggeringplayer)))ThenUI-Display("Congratulations, your team has won ..."+"")for(Playergroup((Killingplayer)))toSubtitleareaGame-EndgameinVictoryforplayer(Killingplayer)(Showdialogs,Showscorescreen)Trigger-Stopallinstancesof(Currenttrigger)ElsePlayerGroup-Pickeachplayerin(Alliesofplayer(Killingplayer))anddo(Actions)ActionsVariable-ModifyPlayersDefeated[(Pickedplayer)]:+1General-If(Conditions)thendo(Actions)elsedo(Actions)IfPlayersDefeated[(Pickedplayer)]>=(Numberofplayersin(Alliesofplayer(Triggeringplayer)))ThenUI-Display("Congratulations, your team has won ..."+"")for(Playergroup((Pickedplayer)))toSubtitleareaGame-EndgameinVictoryforplayer(Pickedplayer)(Showdialogs,Showscorescreen)Trigger-Stopallinstancesof(Currenttrigger)ElseElseVariable-ModifyPlayersDefeated[(Killingplayer)]:+1UnitGroup-Pickeachunitin(Anyunitsin(Entiremap)ownedbyplayer(Triggeringplayer)matchingExcluded:Missile,Dead,Hidden,withatmostAnyAmount)anddo(Actions)ActionsUnit-Kill(Pickedunit)Game-EndgameinDefeatforplayer(Triggeringplayer)(Showdialogs,Showscorescreen)General-If(Conditions)thendo(Actions)elsedo(Actions)IfPlayersDefeated[(Killingplayer)]==7ThenUI-Display("Congratulations, you have won the g..."+"")for(Playergroup((Killingplayer)))toSubtitleareaGame-EndgameinVictoryforplayer(Killingplayer)(Showdialogs,Showscorescreen)Trigger-Turn(Currenttrigger)OffElse
A bit messy, sorry(and it probably might not make sense). I haven't tested with actual players yet, just CPU in lobby on BNET, and it doesn't work. I have no problems giving victory/defeat to players one by one, but the major problem for me right now is finding out how to give a specific victory for 4v4 and a different victory for FFA. FFA is actually quite simple for me to do but changing the conditions for winning in 4v4 mode is where I'm struggling right now. If it is in 4v4, I want to make sure that 4 of the enemies are dead(instead of the usual 7 in FFA), so the remaining other 4 can all win.
End game with victory.
Is there a simple way to do this without making a lot of variables and ifs/while loops? Basically I have two modes in my map(4v4, FFA), but regardless of the mode I want to make it so that if no enemies exist, then the remaining(alive) players win the game.
@rkmx52: Go
1. The hard way, using melee win conditions. Go into data editor and add the flags prevent defeat (from all buildings) to all the unit available.
2. The easy way, using trigger, maybe withe event any unit dies. Count number of unit in unit group. Unit group: Any living unit owned player x in region: Entire map = 0. You might have to run a loop of x with all player from player group: enemy of player you want to check for
Actually the 1 is easier , just more time consuming
the one use atleast :P
This is the trigger I have.
A bit messy, sorry(and it probably might not make sense). I haven't tested with actual players yet, just CPU in lobby on BNET, and it doesn't work. I have no problems giving victory/defeat to players one by one, but the major problem for me right now is finding out how to give a specific victory for 4v4 and a different victory for FFA. FFA is actually quite simple for me to do but changing the conditions for winning in 4v4 mode is where I'm struggling right now. If it is in 4v4, I want to make sure that 4 of the enemies are dead(instead of the usual 7 in FFA), so the remaining other 4 can all win.
Ok never mind, just needed to clean my code up a bit, but thanks for the feedback.