Ok well, I'm trying to explain my setup here - it works perfectly, but every once in a while it fails - and I have absolutely no idea why it would do that:
I need to check if all units in a specific unitgroup are dead - if so, the player with the remaining units wins the match. So first, I put all my units into unitgroups:
Okay nice. I spawn my units in said regions, the players are starting to fight against each other - and the following trigger watches over what is going on to determine who won the match:
Player1_LosesEventsUnit-AnyUnitdiesLocalVariablesConditions((Triggeringunit)isinRegion_MindTheGap)==true(NumberofLivingunitsinMDG_Player1_Unitgroup)==0ActionsGeneral-Wait1.0RealTimeseconds------- PLAYER 2 WINS THE MATCHSound-PlayModUtilityVoiceModUtilityVoice00081for(Enemiesofplayer1)(at100.0%volume,skipthefirst0.0seconds)UI-Display"YOU HAVE WON THE MATCH"for(Enemiesofplayer1)toDirectivearea------- PLAYER 1 LOSES THE MATCHSound-PlayModUtilityVoiceModUtilityVoice00073for(Enemiesofplayer2)(at100.0%volume,skipthefirst0.0seconds)UI-Display"YOU HAVE LOST THE MATCH"for(Enemiesofplayer2)toDirectivearea------- Get rid of all remaining unitsGeneral-Wait4.0RealTimesecondsUnitGroup-PickeachunitinMDG_Player2_Unitgroupanddo(Actions)ActionsUnit-Remove(Pickedunit)fromthegameSound-PlayUI_ScrollButtonSelectfor(Allplayers)(at100.0%volume,skipthefirst0.0seconds)General-Wait0.3RealTimesecondsUnitGroup-RemoveallunitsfromMDG_Player2_UnitgroupUnitGroup-RemoveallunitsfromMDG_Player1_UnitgroupCinematics-FadeOutover1.0secondsusingcolor(0%,0%,0%)and0.0%transparency(Normalstyle,Waituntilitfinishes)Cinematics-FadeInover1.0secondsusingcolor(0%,0%,0%)and0.0%transparency(Normalstyle,Don't Wait until it finishes)Trigger-Runreset(CheckConditions,Don't Wait until it finishes)
Same code for Player2 btw (only reversed). This works PERFECTLY ... however sometimes in say 1 out of 20 tries, this fails - and no winner/loser is being determined. The game is stuck... but to make this even more curious - if the surviving player kills one of his own units (if he has more than one left), the trigger seems to resume and he wins the game just like he should have in the first place.
Does anybody get this? Is there any type of "security" measure you would put into this to prevent something like that from happening? Or did I get something wrong in my trigger?
try disabling your MDG_HOST_UnitsToUnitgroup and MDG_GUEST_UnitsToUnitgroup triggers when a match starts.
if during the match player 2's unit enters player 1's region, then the unit of player 2 gets added to the group of player 1.
Ok well, I'm trying to explain my setup here - it works perfectly, but every once in a while it fails - and I have absolutely no idea why it would do that:
I need to check if all units in a specific unitgroup are dead - if so, the player with the remaining units wins the match. So first, I put all my units into unitgroups:
Player1
And Player 2:
Okay nice. I spawn my units in said regions, the players are starting to fight against each other - and the following trigger watches over what is going on to determine who won the match:
Same code for Player2 btw (only reversed). This works PERFECTLY ... however sometimes in say 1 out of 20 tries, this fails - and no winner/loser is being determined. The game is stuck... but to make this even more curious - if the surviving player kills one of his own units (if he has more than one left), the trigger seems to resume and he wins the game just like he should have in the first place.
Does anybody get this? Is there any type of "security" measure you would put into this to prevent something like that from happening? Or did I get something wrong in my trigger?
@Namsom: Go
try disabling your MDG_HOST_UnitsToUnitgroup and MDG_GUEST_UnitsToUnitgroup triggers when a match starts.
if during the match player 2's unit enters player 1's region, then the unit of player 2 gets added to the group of player 1.
@Helral: Go
Hmm, but that's why I set up conditions:
So even if in this case a unit owned by player 1 enters "MDG_UnitGroup_Player02", it wouldn't get added because of the condition, no?