ID:160600
 
mob/verb/Battle()
var/list/CHOICE = list("Cancel")
for(var/mob/M in view(usr.loc, 5))
if(M != usr)
CHOICE.Add(M)
var/choice = input("Who do you want to fight?") in CHOICE
if(choice == "Cancel")
return

for(var/mob/M in view(usr.loc, 5))
if(M == choice)
if(!M.battling)
switch(alert(M, "Do you wish to fight [usr]?", "Fight?", "Yes", "No"))
if("Yes")
battle(usr, M)
else
return
else
usr << "[M] is already in a battle."

mob/proc/battle(mob/A, mob/B)
var/list/QUEUE[8]
var/turn = 1
QUEUE[1] = A
QUEUE[2] = B

attack:
if(QUEUE[1+(turn-1)] != null)
world << "[1+(turn-1)]"
attackChoice(QUEUE[1+(turn-1)], QUEUE)
turn ++
sleep(10)
goto attack
else
turn = 1
goto attack


Everything works, yadayada. But I was wondering how should I make people lose health when their attacked. I was thinking a for(var/mob/M in view()) etc, but there's probably a better way using the QUEUE list. Thanks.
It depends on how your battle system is supposed to work, first of all. Are the mobs in QUEUE the attackees or the attackers?

Also, goto is a bad programming practice. You would be better of with a while() or for() loop.
In response to Jeff8500
Both. QUEUE is a list of all the players in the battle.

attackChoice(QUEUE[1+(turn-1)], QUEUE)