mob
Login()
world<<"[src.name] has logged in"
loc = locate(/turf/start)
icon = 'tank.dmi'
..()
start_battle()
var
letter[]
A
B
C
D
player
count = 0
turn
move = "move"
mob
proc
start_battle()
var/mob/M
for(M in view())
M.count++
if(M.count==0)
M<<"You cannot play against yourself"
return 0
if(M.count==1)
M<<"You are now player one"
M.turn=1
M.move = "done"
if(M.count==2)
M<<"You are now player two"
M.turn=2
M.move = "done"
if(M.count==3)
M<<"You are now player three"
M.turn=3
M.move = "done"
if(M.count==4)
M<<"You are now player four"
M.turn=4
M.move = "done"
if(M.turn==1)
M<<"It is now your turn"
M.move=5
turf
start
turf
ground
icon = 'dirt.dmi'
mob
Move()
if(move=="done")
src<<"It it currently not your turn"
else if(move=="move") ..()
else if(move<=0)
src<<"You are out of moves, click *end turn* to end your turn."
switch(alert(src,"End turn?","END","Yes","No"))
if("Yes")
var/mob/M
M.turn="over"
for(M in view())
if(M.turn==1)
M<<"It is now your turn"
world<<"It is now [M]'s turn"
M.move=5
if(M.turn==2)
M<<"It is now your turn"
world<<"It is now [M]'s turn"
M.move=5
else
src.move--
src<<"You have [src.move] move\s left."
..()
mob
test_dummy
icon = 'tank.dmi'
New()
walk_around()
proc
walk_around()
for()
sleep(2)
walk_rand(src)
Problem description:
My turn system doesn't work properly, i'm trying to figure out a way to define player 1 2 3 and 4.That way, I can easily call on them at anytime. This is the closest I can get. Is there an easier way to define the players as letters or something so I can call on them easier? Ex:
view() << "It is now [A]'s turn!"
A.turn = 1
new/mob/proc/end_turn(A)
A.move = 5
//anyways, I hope you get the point.
What you basically want to do is to create an instance of the battle datum when you get into combat. The battle datum will then hold all variables and procs that control the battle (who is in the battle, figuring out whose turn it is, ending turns, etc)
Some skeleton code would look similar to this:
Generally, battle datums are structured this way if players are taking turns.