ID:154997
 
1.How do I get player one to go first then player two?
2.How do I "Player" To move lets day 3 steps then end his turn?
I'm trying my best to do this myself because thats the best way to do it but i'm stuck on this part.
I got a little carried away, Turn Systems have always been something I have enjoyed working with.

I haven't tested the following, there could be a lot of glitches with it, but hopefully you'll get the idea:

mob
var
action_points = 3 //actions per turn you can do
Turn_Handler/TH //this is to keep track of the turn handler datum
health = 30 //health is health :)
verb
challenge_player()
set src in oview(1)
if((!usr.TH) && !(src.TH)) //if either the usr or src are not already in a turn handler datum
new/Turn_Handler(src,usr) //create a new one and pass along the challenger and challengee's names
else
usr << "You or your opponent already are in a battle!!@!@!@#!###!!!@"
end_turn() //if you're out of action points, click this verb!
if(TH.turn != src) //if its not your turn according to the Turn Handler
src << "It's not your turn to end."
return
TH.Swap_Turns() //otherwise call the Turn Handler's swap turn function
attack()
for(var/mob/m in oview(1))
if(((m.TH.a || m.TH.b) == (TH.a || TH.b)) && action_points) //if you and the person are in the same Turn Handler,\
and you have action points remaining

m.Hurt(10,src) //do damage and whatnot
TH.Swap_Turns() //call swap turns since attacks end the turn immediately
break
else
src << "You are either not in battle with [m] or you have no action points!"
break
proc
Hurt(D,attacker)
health -= D
if(health < 1)
TH.End_Game(src,attacker) //if the attack was fatal, pass the winner and loser along to the Turn Handler's End_Game proc.


Turn_Handler //A datum, something to keep track of things without the baggage of atom properties!
var
mob/turn //keep track of whose turn it is
mob/a //player's a and b, although this can also be done with lists for more flexible battles,
mob/b //but just keeping things simple here. :) 2 player.
New(A,B) //when the turn handler is created, the challenger and challengee become a and b
a = A
b = B

turn = pick(a,b) //pick randomly at first whose turn it is
world << "It is [turn]'s turn!"
a.TH = src //both players now have a Turn_Handler Attached to them!
b.TH = src

proc
Swap_Turns()
if(turn == a)
a.action_points = 0 //if it was a's turn, it is now b's turn, and to stop a from doing stuff, make their action points 0
turn = b
else
turn = a //vise versa
b.action_points = 0
world << "It is now [turn]'s turn!"
turn.action_points = 3

End_Game(mob/loser,mob/winner) //You get the point
world << "[winner] has defeated [loser]!"
loser.action_points = 3
loser.health = 30
winner.action_points = 3
winner.health = 30
del src //since the game is over, the datum ceases to exist, and both players can now do as they please, I hope.




mob
Move()
if(!TH) //if the player is not in battle, there's no need to limit movement.
..()
return
if(action_points)
action_points -- //let them move at the cost of an action point
..()
else
src << "You are out of action points. End your turn!"


Also obviously a lot of these preferences can be altered GREATLY, like movement could be a select screen, blah blah. There's just so much flexibility.

Also there are great Turn Handling libraries, just search the developer search area for them, and I'm sure there's much better examples than the above. I didn't use lists to keep track of players, already limiting the flexibility of the example above.
In response to Speedro
Speedro gave you a good example as he showed a lot and explained what it does, just be sure to read it carefully so you understand what's doing what.
In response to Truseeker
Wow, thanks for the help guys!