area
bat_loc
var/inuse=0
New()
bat_loc_list+=src
mob
var
ox
oy
oz
trys=0
gauge=0
is_turn=0
defending=0
in_bat=0
var/bat_loc_list=list()
turf
bat_area_one
Entered()
if(usr.in_bat==0)
if(prob(25))
start:
for(var/area/bat_loc/BL in bat_loc_list)
if(BL.inuse==1)
bat_loc_list-=BL
if(bat_loc_list==null)
return
else
goto start
else
usr.ox=usr.x
usr.oy=usr.y
usr.oz=usr.z
usr.loc=BL
BL.inuse=1
usr.locked=1
usr.dir=WEST
var/mob/Monster
Monster=new/mob/Enemy/Sage
Monster.loc=locate(usr.x-4,usr.y,usr.z)
Monster.dir=EAST
usr.in_bat=1
usr.Initiate_Battle(Monster)
return
if(usr.in_bat==1)
return
mob
proc
Initiate_Battle(mob/Monster)
if(src.Agi>=Monster.Agi+1)
src<<"You Start"
src.Person_Battle(Monster)
if(Monster.Agi>=src.Agi+1)
src<<"Enemy Start"
Monster.Enemy_Battle(src)
return
Person_Battle(mob/Monster)
if(src.defending==1)
src.Def-=src.Def
src.Mdef-=src.Mdef
src.defending=0
src.x-=1
src.choice=input("What would you like to do?","Battle")in list("Attack","Defend","Run")
if(src.choice=="Attack")
src.x-=1
sleep(5)
src.x+=1
var/damage
damage = src.Atk-Monster.Def
src<<"You attack [Monster] for [damage]!"
Monster.Hp-=damage
if(Monster.Hp<=0)
src<<"Monster has been killed!"
del(Monster)
for(var/area/bat_loc/BL in view())
BL.inuse=0
src.x=src.ox
src.y=src.oy
src.z=src.oz
src.locked=0
src.in_bat=0
return
else
sleep(10)
Monster.Enemy_Battle(src)
return
if(src.choice=="Defend")
src.Def+=src.Def
src.Mdef+=src.Mdef
src.defending=1
src.x+=1
src<<"You are Defending for a turn."
sleep(10)
Monster.Enemy_Battle(src)
return
if(src.choice=="Run")
src.dir=EAST
src.x+=1
sleep(5)
src.dir=WEST
src.x-=1
src<<"Run Command Isnt In, You Just Gave Up Your Turn."
sleep(10)
Monster.Enemy_Battle(src)
return
else
src.choice=input("What would you like to do?","Battle")in list("Attack","Defend","Run")
if(src.choice=="Attack")
src.x-=1
sleep(5)
src.x+=1
var/damage
damage = src.Atk-Monster.Def
src<<"You attack [Monster] for [damage]!"
Monster.Hp-=damage
if(Monster.Hp<=0)
src<<"Monster has been killed!"
del(Monster)
for(var/area/bat_loc/BL in view())
BL.inuse=0
src.x=src.ox
src.y=src.oy
src.z=src.oz
src.locked=0
return
else
sleep(10)
Monster.Enemy_Battle(src)
return
if(src.choice=="Defend")
src.Def+=src.Def
src.Mdef+=src.Mdef
src.defending=1
src.x+=1
src<<"You are Defending for a turn."
sleep(10)
Monster.Enemy_Battle(src)
return
if(src.choice=="Run")
src.dir=EAST
src.x+=1
sleep(5)
src.dir=WEST
src.x-=1
src<<"Run Command Isnt In, You Just Gave Up Your Turn."
sleep(10)
Monster.Enemy_Battle(src)
return
Enemy_Battle(mob/Monster)
if(src.M_Type=="Magic")
src.x+=1
sleep(5)
src.x-=1
var/damage
damage = src.Matk - Monster.Mdef
Monster<<"[src] [src.M_S_Desc] for [damage]!"
Monster.Hp-=damage
if(Monster.Hp<=0)
Monster<<"You have been killed!"
del(src)
Monster.locked=0
Monster.x=Monster.ox
Monster.y=Monster.oy
Monster.z=Monster.oz
Monster.in_bat=0
return
else
sleep(10)
Monster.Person_Battle(src)
return
if(src.M_Type=="Attack")
sleep(10)
Monster.Person_Battle(src)
return
Problem description: okay my problem is that the code above will let me kill the monster that is put in the battle and it'll put me where im supposed to be, but if i get killed inbattle (im running the new byond) a error thing pops up and im not ejected from battle
the error is this:
runtime error: Cannot read null.Agi
proc name: Initiate Battle (/mob/proc/Initiate_Battle)
usr: V (/mob)
src: V (/mob)
call stack:
V (/mob): Initiate Battle(null)
the bat area one (2,5,1) (/turf/bat_area_one): Entered(V (/mob), the bat area one (2,6,1) (/turf/bat_area_one))
if anyone is able to help me out thank you, but if not ill probably have to tear through my battle system and rip everything out untill it works properly.
Cap'n Lummox JR