Page 1 of 1

Creating a Turn Based System? [GUI]

Posted: Sun Aug 02, 2009 4:41 pm
by Intoxicated Crayon
I was wondering, if I wanted to set up a Turn Based System for a campaign and it's in GUI, what would I need to have?


Let's say, a random encounter occurs, run some triggers and then it examines integers units have; The one with highest 'speed' integer attacks first and such. Essentially what would I need? Booleans that decide whose turn it is and all that kind of stuff. But... It'd probably be easier in JASS amiright?


And if it is easier, how would you make a multiboard menu for combat and everything like that?



All help is appreciated xD.

Re: Creating a Turn Based System? [GUI]

Posted: Sun Aug 02, 2009 6:48 pm
by Greenspawn
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Current_Players_Turn Greater than or equal to 13
Then - Actions
Set Current_Players_Turn = 1
Else - Actions
Wait until (Players_Turn_End[Current_Players_Turn] Equal to True), checking every 0.10 seconds
Set Players_Turn_End[Current_Players_Turn] = False
Set Current_Players_Turn = (Current_Players_Turn + 1)
Trigger - Run (This trigger) (ignoring conditions)

(this is for a map with 12 players)
Run the above on map initialization

variables needed:
Players_Turn_End - Boolean Array with size = number of players and initial value = false
Current_Players_Turn - Integer with initial value = 0

to have a player end a turn using a trigger, have this command in the script in the ending trigger:

Set Players_Turn_End[Current_Players_Turn] = True


and to decide who attacks first or anything like that, you would need values stored as reals or integers that are stored to each specific unit.

Re: Creating a Turn Based System? [GUI]

Posted: Mon Aug 03, 2009 8:23 pm
by Intoxicated Crayon
Thanks Green! :O


It works nicely and stuff like that, Imma see what I can do with this! :D

Re: Creating a Turn Based System? [GUI]

Posted: Fri Sep 11, 2009 2:07 pm
by Soul_Reaver
I wouldn't use waits or periodic checks.
There is almost always another way to get stuff done. Waits, periodic check, even timers should only be used if nothing else is available. (Because these lag the games like crazy.)

Re: Creating a Turn Based System? [GUI]

Posted: Sat Jan 02, 2010 7:37 pm
by redscores
if you need an example for an turn-based system: http://www.hiveworkshop.com/forums/spel ... -a-114704/

Take a look at this.