Players select unit one after another. Exp: Player 1 select marine. Then player 2 choose unit. But if there is player who is not playing. It cant give turn to next player. Here trigger code.
Edit: I notice it doesnt hide dialog anymore. Strange. It worked sometime.
EventsDialog-AnyDialogItemisusedbyPlayer1witheventtypeClickedLocalVariablesConditionsOrConditions(Useddialogitem)==MarineNappi(Useddialogitem)==MarauderNappi(Useddialogitem)==ReaperNappiActionsGeneral-Switch(Actions)dependingon(Useddialogitem)CasesGeneral-If(MarineNappi)ActionsGeneral-Repeat(Actions)30timesActionsUnit-Create1Marineforplayer(Triggeringplayer)at(CenterofPelaaja1MiniFFA)usingdefaultfacing(NoOptions)UnitGroup-Add(Lastcreatedunit)toPelaaja1GrouppiMiniFFAUI-Display((Text(Nameofplayer(Triggeringplayer))withcolor(Color((Currentplayer(Triggeringplayer)color))))+" Choose Marine.")for(Playersonteam2)toSubtitleareaUnitGroup-PickeachunitinPelaaja1GrouppiMiniFFAanddo(Actions)ActionsUnit-Pause(Pickedunit)General-If(MarauderNappi)ActionsGeneral-Repeat(Actions)15timesActionsUnit-Create1Marauderforplayer(Triggeringplayer)at(CenterofPelaaja1MiniFFA)usingdefaultfacing(NoOptions)UnitGroup-Add(Lastcreatedunit)toPelaaja1GrouppiMiniFFAUI-Display((Text(Nameofplayer(Triggeringplayer))withcolor(Color((Currentplayer(Triggeringplayer)color))))+" Choose Marauder.")for(Playersonteam2)toSubtitleareaUnitGroup-PickeachunitinPelaaja1GrouppiMiniFFAanddo(Actions)ActionsUnit-Pause(Pickedunit)General-If(ReaperNappi)ActionsGeneral-Repeat(Actions)30timesActionsUnit-Create1Reaperforplayer(Triggeringplayer)at(CenterofPelaaja1MiniFFA)usingdefaultfacing(NoOptions)UnitGroup-Add(Lastcreatedunit)toPelaaja1GrouppiMiniFFAUI-Display((Text(Nameofplayer(Triggeringplayer))withcolor(Color((Currentplayer(Triggeringplayer)color))))+" Choose Reaper.")for(Playersonteam2)toSubtitleareaUnitGroup-PickeachunitinPelaaja1GrouppiMiniFFAanddo(Actions)ActionsUnit-Pause(Pickedunit)DefaultDialog-HideYksikkovalintafor(Playergroup((Triggeringplayer)))General-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer2)==PlayingThenDialog-ShowYksikkovalintafor(Playersonteam2)UI-Display((Text(Nameofplayer2)withcolor(Color((Currentplayer2color))))+" Choose unit. Please wait.")for(Allplayers)toSubtitleareaElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer3)==PlayingThenDialog-ShowYksikkovalintafor(Playersonteam3)UI-Display((Text(Nameofplayer3)withcolor(Color((Currentplayer3color))))+" Choose unit. Please wait.")for(Allplayers)toSubtitleareaElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer4)==PlayingThenDialog-ShowYksikkovalintafor(Playersonteam4)UI-Display((Text(Nameofplayer4)withcolor(Color((Currentplayer4color))))+" Choose unit. Please wait.")for(Allplayers)toSubtitleareaElseUnitGroup-PickeachunitinPelaaja1GrouppiMiniFFAanddo(Actions)ActionsUnit-Unpause(Pickedunit)UnitGroup-PickeachunitinPelaaja2GrouppiMiniFFAanddo(Actions)ActionsUnit-Unpause(Pickedunit)UnitGroup-PickeachunitinPelaaja3GrouppiMiniFFAanddo(Actions)ActionsUnit-Unpause(Pickedunit)UnitGroup-PickeachunitinPelaaja4GrouppiMiniFFAanddo(Actions)ActionsUnit-Unpause(Pickedunit)UI-Display"Game has started!"for(Allplayers)toSubtitlearea
While your at it. I would change your global variables from having one pr player to having an array. That way you can index the array with the player number, and it will be easier to make general triggers.
Try something like this
//Init theese at map init or something
Mini FFA = No Region <Region[5]>
Grouppi Mini FFA =(Empty unit group)<Unit Group[5]>
Events
Dialog - Any Dialog Item is used by Any Player with event type Clicked <<------------- Changed to any player
Local Variables
x =0<Integer><<---------------- Added x
Conditions
Or
Conditions
(Used dialog item)== Marine Nappi
(Used dialog item)== Marauder Nappi
(Used dialog item)== Reaper Nappi
Actions
General - Switch (Actions) depending on (Used dialog item)
Cases
General - If (Marine Nappi)
Actions
General - Repeat (Actions)30 times
Actions <<-------------- Canged global variables to use arrays ------------->
Unit - Create 1 Marine for player (Triggering player) at (Center of Mini FFA[(Triggering player)]) using default facing (No Options)
Unit Group - Add (Last created unit) to Grouppi Mini FFA[(Triggering player)]
UI - Display ((Text (Name of player (Triggering player)) with color (Color((Current player (Triggering player) color))))+" Choose Marine.")for(Players on team 2) to Subtitle area <<---------- Not sure why you have team 2 here..
Unit Group - Pick each unit in Grouppi Mini FFA[(Triggering player)] and do (Actions)
Actions
Unit - Pause (Picked unit)
General - If (Marauder Nappi)
Actions
General - Repeat (Actions)15 times
Actions
Unit - Create 1 Marauder for player (Triggering player) at (Center of Mini FFA[(Triggering player)]) using default facing (No Options)
Unit Group - Add (Last created unit) to Grouppi Mini FFA[(Triggering player)]
UI - Display ((Text (Name of player (Triggering player)) with color (Color((Current player (Triggering player) color))))+" Choose Marauder.")for(Players on team 2) to Subtitle area
Unit Group - Pick each unit in Grouppi Mini FFA[(Triggering player)] and do (Actions)
Actions
Unit - Pause (Picked unit)
General - If (Reaper Nappi)
Actions
General - Repeat (Actions)30 times
Actions
Unit - Create 1 Reaper for player (Triggering player) at (Center of Mini FFA[(Triggering player)]) using default facing (No Options)
Unit Group - Add (Last created unit) to Grouppi Mini FFA[(Triggering player)]
UI - Display ((Text (Name of player (Triggering player)) with color (Color((Current player (Triggering player) color))))+" Choose Reaper.")for(Players on team 2) to Subtitle area
Unit Group - Pick each unit in Grouppi Mini FFA[(Triggering player)] and do (Actions)
Actions
Unit - Pause (Picked unit)
Dialog - Hide Yksikko valinta for(Player group((Triggering player)))<<-------------- Changed all your if then else to one if then, inside a for. ----------------->>
General - For each integer x from ((Triggering player)+1) to 4 with increment 1, do (Actions)
General - If (Conditions) then do (Actions)else do (Actions)
If
(Status of player x)== Playing
Then
Dialog - Show Yksikko valinta for(Player group(x))
UI - Display ((Text (Name of player x) with color (Color((Current player x color))))+" Choose unit. Please wait.")for(All players) to Subtitle area
General - Skip remaining actions
<<------------- Also put this inside a for, just to make it more compact ------------>
General - For each integer x from 1 to 4 with increment 1, do (Actions)
Unit Group - Pick each unit in Grouppi Mini FFA[x] and do (Actions)
Actions
Unit - Unpause (Picked unit)
UI - Display "Game has started!"for(All players) to Subtitle area
I think i dont need that one after another system. All players can choose unit sametime. Now i need it when all players is select unit. Game unpause all units. Or is it better way make timer? And how i make player win game when all others players units are dead? Game is FFA.
SBeier: You ask why i set that player team. I didnt find (Or i am blind) option specific player. So i set that player team. It work. Game is FFA
Only dialog hide dont work. So my trigger code is now.
Well that is fine, but an array really would be easier. Just need to have it be arrayName[triggering player], and have the event be any dialog item is clicked by any player. That should resolve any player skipping as well, as it won't care what the other players are doing, it will just respond to that player.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Players select unit one after another. Exp: Player 1 select marine. Then player 2 choose unit. But if there is player who is not playing. It cant give turn to next player. Here trigger code.
Edit: I notice it doesnt hide dialog anymore. Strange. It worked sometime.
I noticed that, all triggers what are in default. It doesn't run them. What wrong my triggers is? Why it doesn't run deafault triggers?
Default only runs if the requirements are not met ... its basically like (else).
Can you say, how i fix this? One way is, i move default triggers to buttons. But that mean again, i have alot wok then.
While your at it. I would change your global variables from having one pr player to having an array. That way you can index the array with the player number, and it will be easier to make general triggers.
Try something like this
I think i dont need that one after another system. All players can choose unit sametime. Now i need it when all players is select unit. Game unpause all units. Or is it better way make timer? And how i make player win game when all others players units are dead? Game is FFA.
SBeier: You ask why i set that player team. I didnt find (Or i am blind) option specific player. So i set that player team. It work. Game is FFA
Only dialog hide dont work. So my trigger code is now.
I make every player own dialog choose, because units cant spawn same region.
@PaskaTykki: Go
Well that is fine, but an array really would be easier. Just need to have it be arrayName[triggering player], and have the event be any dialog item is clicked by any player. That should resolve any player skipping as well, as it won't care what the other players are doing, it will just respond to that player.