Creating a Turn Based System? [GUI]

This is where all discussion of WC3 mapmaking should be held. This forum exists particularly for mapmaking needs. If you have a question on how something works or have need for some code review, this is the place to put it.
Post Reply
User avatar
Intoxicated Crayon
Keeper of the Keys
Posts: 376
Joined: Tue Jan 15, 2008 5:08 pm
Location: In a pretzel, being mustarded.

Creating a Turn Based System? [GUI]

Post by Intoxicated Crayon » Sun Aug 02, 2009 4:41 pm

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.
English should not be a prerequisite for intelligence,

Greenspawn
Keeper of the Keys
Posts: 434
Joined: Fri Jan 18, 2008 4:50 pm
Location: Massachusetts

Re: Creating a Turn Based System? [GUI]

Post by Greenspawn » Sun Aug 02, 2009 6:48 pm

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.
Math is # |e^iπ|
"I can't imagine getting hit by a giant rock and not being maimed or crippled or ruined" -Dusk

Logue: Please replace the toilet paper when you use it all. For some reason my 5 year old son believes if it's not there he does not have to wipe.

User avatar
Intoxicated Crayon
Keeper of the Keys
Posts: 376
Joined: Tue Jan 15, 2008 5:08 pm
Location: In a pretzel, being mustarded.

Re: Creating a Turn Based System? [GUI]

Post by Intoxicated Crayon » Mon Aug 03, 2009 8:23 pm

Thanks Green! :O


It works nicely and stuff like that, Imma see what I can do with this! :D
English should not be a prerequisite for intelligence,

Soul_Reaver
Revenent of the Replies
Posts: 332
Joined: Thu Feb 14, 2008 3:27 pm
Location: Hungary
Contact:

Re: Creating a Turn Based System? [GUI]

Post by Soul_Reaver » Fri Sep 11, 2009 2:07 pm

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.)

redscores
Noobite Warrior
Posts: 1
Joined: Fri Jan 01, 2010 11:32 am

Re: Creating a Turn Based System? [GUI]

Post by redscores » Sat Jan 02, 2010 7:37 pm

if you need an example for an turn-based system: http://www.hiveworkshop.com/forums/spel ... -a-114704/

Take a look at this.

Post Reply

Return to “Custom Map Creation”