I've tried to fix it for a long time. Here's the code
mob/proc
//starts the random battle
Rbattle(mob/Enemy,mob/Enemy2,mob/Enemy3)
var/turf/Map
for (var/turf/BattleGrounds/BatLoc in world)
var/Taken=0
for (var/atom/A in BatLoc)
if(A.density==1){Taken=1}
if(!Taken){Map=BatLoc}
if (!Map){return}
usr.XLoc=usr.x
usr.YLoc=usr.y
usr.ZLoc=usr.z
usr.inbattle=1
usr.south=0
usr.Move(Map)
usr.dir=WEST
usr.icon_state="battle"
usr<<"You are under attack!
To attack hit Numpad 5 with numlock off."
usr.client.lazy_eye = 5
src.client.eye=locate(x-4,y-2,z)
usr<<sound("FF1battl.mid",1)
textonscreenbackground(10,2,14,5)
textonscreenTEXT(11,14.5,5,3.3," Attack")
textonscreenTEXT(11,14.5,4,3.3," Run")
textonscreenbackground(4,2,9.5,5)
if(Enemy!=null&&Enemy2!=null&&Enemy3!=null)
textonscreenTEXT(4,13.5,5,3.3," [Enemy.bname]")
textonscreenTEXT(4,13.5,4,3.3," [Enemy2.bname]")
textonscreenTEXT(4,13.5,3,3.3," [Enemy3.bname]")
else
if(Enemy!=null&&Enemy2!=null)
textonscreenTEXT(4,13.5,5,3.3," [Enemy.bname]")
textonscreenTEXT(4,13.5,4,3.3," [Enemy2.bname]")
else
if(Enemy!=null&&Enemy3!=null)
textonscreenTEXT(4,13.5,5,3.3," [Enemy.bname]")
textonscreenTEXT(4,13.5,4,3.3," [Enemy3.bname]")
else
if(Enemy2!=null&&Enemy3!=null)
textonscreenTEXT(4,13.5,5,3.3," [Enemy2.bname]")
textonscreenTEXT(4,13.5,4,3.3," [Enemy3.bname]")
else
if(Enemy!=null)
textonscreenTEXT(4,13.5,5,3.3," [Enemy.bname]")
else
if(Enemy2!=null)
textonscreenTEXT(4,13.5,5,3.3," [Enemy2.bname]")
else
if(Enemy3!=null)
textonscreenTEXT(4,13.5,5,3.3," [Enemy3.bname]")
new/obj/menu/Curser(usr.client)
if(Enemy!=null)Enemy.Move(locate(usr.x-6,usr.y,usr.z))
if(Enemy2!=null)Enemy2.Move(locate(usr.x-6,usr.y-1,usr.z))
if(Enemy3!=null)Enemy3.Move(locate(usr.x-6,usr.y-2,usr.z))
var/list/WhichTurn=new()
var/list/ppl=new()
for(var/mob/Aa in world)ppl+=Aa
var/nextturn,PlayerOrder
do
for (var/aa=0;aa<=length(ppl);aa++)
PlayerOrder=0
for(var/mob/ppp in ppl)
if (ppp.Agility>PlayerOrder){nextturn=ppp;PlayerOrder=ppp.Agi lity}
else if (ppp.Agility==PlayerOrder)nextturn=ppp
WhichTurn+=nextturn
ppl-=nextturn
while (length(ppl)>0)
do
for(var/mob/pp in WhichTurn)
if (pp.Health>0)
if (pp.client)
if(usr.inbattle==1){pp<<"It is now your turn!";pp.Turn=1}
else return
while(pp.Turn)sleep(5)
else{pp.MonsterAttack()}
while(1)
heres the runtime error.
Infinite loop suspected--switching proc to background.
If it is not an infinite loop, either do 'set background=1' or set world.loop_checks=0.
proc name: Rbattle (/mob/proc/Rbattle)
source file: Random Combat.dm,61
usr: Kale (/mob/player/Fighter)
src: Kale (/mob/player/Fighter)
call stack:
Kale (/mob/player/Fighter): Rbattle(Ballistic Scorpion (/mob/monsters/Monster2), Ballistic Scorpion2 (/mob/monsters/Monster4), Scorpion (/mob/monsters/Monster))
Battle Grass (33,2,2) (/turf/Battle_Grass): Enter(Kale (/mob/player/Fighter))
Kale (/mob/player/Fighter): Move(Battle Grass (33,2,2) (/turf/Battle_Grass), 4)
Cloudiroth (/client): East()
can you fix it or give me any help, and is there anything else you might need to fix it.</<sound>
ID:147926
Sep 27 2003, 3:35 am
|
|
In response to Lummox JR
|
|
I changed all the usr's in the procs to src but that made no difference.
|
Lummox JR