ID:146831
 
We are haveing a problem in a multy mon group battle. Only the first mon takes his turns, the other mon wont go.Any help would be greatly apreciated.









mob/New()
tempbatspell = list()
..()
mob/var/tmp
battle=1
escape=0
isturn=0
inbattle=0
XLoc
YLoc
ZLoc
mob/proc
randomencounter1(probchance as num,mob/M as mob)
var
turf
battlearea
T
music
list/monsterlist[] = new()
//targetpick
//attackerpick
//targetpick = input(src,"Who do you wish to attack?") in src.montargetlist
//attackerpick = pick(inparty)
//list/montargetlist[] = new()
//list/TurnOrder
//PlayerCount
//DeathCount
if(prob(probchance) && M.preslocation != "town")
if(M.oldlocx != M.x || M.oldlocy != M.y)
for(T in world)
if(!T.occupied)
usr << sound(null)
src.verbs -= /mob/verb/Cast
src.verbs -= /mob/verb/Item
//src.verbs -= /mob/verb/VerbList
src.verbs -= /mob/verb/Talk
src.verbs -= /mob/verb/PVP
src.verbs -= /mob/verb/masterequip
src.verbs -= /mob/verb/Search
music = 'DW4BATL.mid'
usr << sound(music,1)
battlecounter = 0
M.battlearea = T
T.occupied = 1
M.oldlocx = M.x
M.oldlocy = M.y
M.oldlocz = M.z
M.battlearea = T
M.invisibility = 1
M.oldbattlefield = 1
M.oldlocation = M.preslocation
M.preslocation = "town"
spawn(1)M.Move(M.battlearea)
M.onbattlefield = 0
M.endbattle = 0
M.inbat = 1
M.battlestr = M.strequip
M.battledef = M.defequip
M.battleagl = M.aglequip
olddef = M.defequip
oldagl = M.aglequip
M.logoutinbattle = 1
if(usr.oldlocation == "area1")
monsterlist = list("stagbeetle","blackraven","slime")
mon1 = pick(monsterlist)
if(mon1 == "slime")
mon1 = new/mob/monster/slime(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
if(mon1 == "stagbeetle")
mon1 = new/mob/monster/stagbeetle(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
if(mon1 == "blackraven")
mon1 = new/mob/monster/blackraven(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
M.montargetlist += mon1
M.groupsize += 1
var/newmon = rand(0,100)
if(newmon >= 50)
mon2 = pick(monsterlist)
if(mon2 == "slime")
mon2 = new/mob/monster/slime(locate(M.battlearea.x+2,M.battlearea.y,M.battlearea.z))
if(mon2 == "stagbeetle")
mon2 = new/mob/monster/stagbeetle(locate(M.battlearea.x+2,M.battlearea.y,M.battlearea.z))
if(mon2 == "blackraven")
mon2 = new/mob/monster/blackraven(locate(M.battlearea.x+2,M.battlearea.y,M.battlearea.z))
M.montargetlist += mon2
M.groupsize += 1
if(newmon >= 50)
mon3 = pick(monsterlist)
if(mon3 == "slime")
mon3 = new/mob/monster/slime(locate(M.battlearea.x-2,M.battlearea.y,M.battlearea.z))
if(mon3 == "stagbeetle")
mon3 = new/mob/monster/stagbeetle(locate(M.battlearea.x-2,M.battlearea.y,M.battlearea.z))
if(mon3 == "blackraven")
mon3 = new/mob/monster/blackraven(locate(M.battlearea.x-2,M.battlearea.y,M.battlearea.z))
M.montargetlist += mon3
M.groupsize += 1
/*if(usr.oldlocation == "area2")
randomnum = rand(0,6)
if (randomnum == 0)
mon = new /mob/monster/drakee(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
else if (randomnum == 1)
mon = new /mob/monster/blackraven(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
else if (randomnum == 2)
mon = new /mob/monster/redslime(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
else if (randomnum == 3)
mon = new /mob/monster/stagbeetle(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
else if (randomnum == 4)
mon = new /mob/monster/giantworm(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
else if (randomnum == 5)
mon = new /mob/monster/diverat(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
else if (randomnum == 6)
mon = new /mob/monster/elerat(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
if(usr.oldlocation == "area3")
randomnum = rand(0,7)
if (randomnum == 0)
mon = new /mob/monster/babble(locate(M.battlearea.x,M.battlearea.y,M.battlearea.z))
else if (randomnum == 1)


PS this is only like 5% of the code becoese its wat to exstensive to put in forums but you should be able to see the problem here
You haven't shown the code you're using to make monsters take their turns, which is the important thing here... but in any case, the code you've shown is WAY too long. You can make it a lot less complicated (and better, and easier to extend; adding extra monsters to battles, for example, will be easy) with a few simple changes.

Firstly, learn how to use lists. They're extremely useful. No turn-based battle system is complete without at least one.

Secondly, use loops. A for() loop, especially, would simplify this piece of code no end.