ID:144266
 
Code:
mob/var/islocked = 0
mob.Move()
if(src.islocked)
return 0
else
return ..()



mob
proc
Battle()
sleep(10)
switch(input("What would you like to do.")in list("Attack","Run"))
if("Attack")
Attack()
// if("Item")
// Item()
// if("Ability")
// Ability()
// if("Magic")
// Magic()
if("Run")
Run()
Attack()
var/Damage=usr.Str-src.Def
var/fDamage=Damage+rand(3,19)
src.HP-=fDamage
usr<<"You attacked the [src] [fDamage] damage."
Death()
monsterattack()
var/Damage=src.Str-usr.Def
var/fDamage=Damage+rand(1,17)
usr.HP-=fDamage
usr<<"The [src] hit you [fDamage] damage."
Deathcheck()
Death()
Run(mob/Monsters/M as mob)
usr.random = rand(1,2)
if(usr.random == 1)
usr.loc =locate(usr.x,usr.y,usr.z)
usr.islocked =0
alert("You get away safely")
return
if(usr.random == 2)
usr<<"[M] blocks your path as you try to get away!"
Battle()
Death(mob/Monsters/M as mob)
if(src.HP<=0)
usr.Exp+=src.Expg
usr.gold+=src.gold
view(7) <<"You killed the [src]!"
LevelUp()
usr.islocked=0
usr.loc =locate(usr.x,usr.y,usr.z)
return
del src
del src
else
monsterattack()
Deathcheck()
if(usr.HP<=0)
usr<<"The [src] killed you."
usr.gold/=2
usr.HP=1
usr.loc=locate(1,1,1)
else
Battle()
LevelUp()
if(usr.Exp>=usr.Mexp)
usr<<"You have gained a level."
usr.race_check()
mob
proc
Bumped(O)
Bump(O)
..()
if(ismob(O))
O:Bumped(src)


/////////////////////////////////////////////NEW BATTLESYSTEM////////////////////////////////////////////////////
/*mob
proc
punch(mob/M)
if(src.stamina <=3)
tired()
else
if(src.dead == 1)
usr <<"You can't attack anything while your dead!"
if(src.doing == 1)
usr <<"You are already doing something."
if(src.doing == 0 && src.dead == 0)
src.random =rand(1,4)
if(src.random == 1)
var/Damage=usr.Str-M.Def
usr.doing =1
flick("hit",usr)
src <<"You punched [M] for [Damage] Hit Points!"
M <<"[src] is punching you for [Damage] Hit Points!"
M.HP -=Damage
src.stamina -=3
usr.Exp +=rand(1,3)
sleep(10)
usr.doing =0
LvlCheck(usr)
deathcheck(M)
monsterattack()
if(src.random == 2)
src.doing =1
flick("hit",usr)
src <<"You tried to punch [M], but missed!"
M <<"[src] tired to punch you, but missed!"
sleep(20)
usr.doing =0
monsterattack()
if(src.random == 3)
var/Damage=usr.Str-M.Def
usr.doing =1
flick("hit",usr)
src <<"You punched [M] for [Damage] Hit Points!"
M <<"[src] is punching you for [Damage] Hit Points!"
M.HP -=Damage
src.stamina -=2
usr.Exp +=rand(3,5)
sleep(10)
usr.doing =0
LvlCheck(usr)
deathcheck(M)
monsterattack()
if(src.random == 4)
src.doing =1
flick("hit",usr)
src <<"You tried to punch [M], but missed!"
M <<"[src] tired to punch you, but missed!"
sleep(20)
src.doing =0
monsterattack()

kick(mob/M)
if(src.stamina <=6)
tired()
else
if(usr.doing == 1)
usr <<"You are already doing something."
if(usr.dead == 1)
usr <<"You are dead."
if(src.doing == 0 && src.dead == 0)
src.random =rand(1,6)
if(src.random == 1)
usr.doing =1
flick("hit",usr)
src <<"You kicked [M] for [src.strength] Hit Points!"
M <<"[src] is kicking you for [src.strength] Hit Points!"
M.pl -=usr.strength
src.stamina -=5
usr.exp +=rand(1,3)
sleep(20)
usr.doing =0
level(usr)
death(M)
monsterattack()
if(src.random == 2)
usr.doing =1
flick("hit",usr)
src <<"You tried to kick [M], but missed!"
M <<"[src] tired to kick you, but missed!"
src.stamina -=2
sleep(20)
usr.doing =0
monsterattack()
if(src.random == 3)
usr.doing =1
flick("hit",usr)
src <<"You kicked [M] for [src.strength] Hit Points!"
M <<"[src] is kicking you for [src.strength] Hit Points!"
M.pl -=usr.strength
src.stamina -=3
usr.exp +=rand(1,3)
sleep(20)
usr.doing =0
level(usr)
death(M)
monsterattack()
if(src.random == 4)
usr.doing =1
flick("hit",usr)
src <<"You kicked [M] for [src.strength] Hit Points!"
M <<"[src] is kicking you for [src.strength] Hit Points!"
M.pl -=usr.strength
src.stamina -=4
usr.exp +=rand(1,3)
sleep(20)
usr.doing =0
level(usr)
death(M)
monsterattack()
if(src.random == 5)
usr.doing =1
flick("hit",usr)
src <<"You kicked [M] for [src.strength] Hit Points!"
M <<"[src] is kicking you for [src.strength] Hit Points!"
M.pl -=usr.strength
src.stamina -=3
usr.exp +=rand(1,3)
sleep(20)
usr.doing =0
level(usr)
death(M)
monsterattack()
if(src.random == 6)
usr.doing =1
flick("hit",usr)
src <<"You kicked [M] for [src.strength] Hit Points!"
M <<"[src] is kicking you for [src.strength] Hit Points!"
M.pl -=usr.strength
src.stamina -=6
usr.exp +=rand(1,3)
sleep(20)
usr.doing =0
level(usr)
death(M)
monsterattack()*/






mob
// proc
// LvlCheck()
// if(usr.Exp>=usr.Mexp)
// usr<<"<I><B><small>You gained a level!"
// usr.race_check()
proc
race_check()
if(src.class == "Warrior")
src.level+=1
src.MHP+=rand(7,24)
src.HP=usr.MHP
src.Str+=rand(7,28)
src.Def+=rand(7,27)
src.Expg*=2
src.Exp=0
src.Mexp +=rand(6,21)
if(src.class == "Cleric")
src.level+=1
src.MHP+=rand(11,27)
src.HP=usr.MHP
src.MMP+=rand(3,7)
src.MP=usr.MMP
src.Str+=rand(4,15)
src.Def+=rand(4,23)
src.Expg*=2
src.Exp=0
src.Mexp +=rand(7,22)
if(src.class == "Magician")
src.level+=1
src.MHP+=rand(11,27)
src.HP=usr.MHP
src.MMP+=rand(6,21)
src.MP=usr.MMP
src.Str+=rand(2,11)
src.Def+=rand(3,19)
src.Expg*=2
src.Exp=0
src.Mexp +=rand(8,23)
proc
deathcheck()
if(usr.HP <=0)
usr <<"You have died! You will now remain in spirt form untill you revive yourself. For mone info on spirit form view the help page."
usr.icon_state ="spirit"
usr.HP=0
usr.loc=locate(1,1,1)


Problem description:
When someone dies with my battle system they get caught in in inf loop and keep dying. Example:


runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
proc name: monsterattack (/mob/proc/monsterattack)
usr: Nick (/mob/You/warrior)
src: Earth Elemental (/mob/Monsters/Earth_Elemental)
call stack:
Earth Elemental (/mob/Monsters/Earth_Elemental): monsterattack()
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): monsterattack()
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): monsterattack()
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): monsterattack()
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): monsterattack()
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
...
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): Death(null)
Earth Elemental (/mob/Monsters/Earth_Elemental): Battle()
Nick (/mob/You/warrior): Bump(Earth Elemental (/mob/Monsters/Earth_Elemental))
You attacked the Earth Elemental -182 damage.
The Earth Elemental hit you 230 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 229 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 231 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 234 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 228 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 219 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 220 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 231 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 232 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 222 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 226 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 230 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 219 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 224 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 218 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 221 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 221 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 219 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 221 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 228 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 219 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 220 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 229 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 229 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 224 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 227 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 223 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 230 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 223 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 218 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 223 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 234 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 226 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 234 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 229 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 229 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 230 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 226 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 229 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 223 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 231 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 232 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 219 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 219 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 222 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 232 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 219 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 226 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 225 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 224 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 234 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 231 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 232 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 224 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 219 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 226 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 230 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 224 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 228 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 225 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 231 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 225 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 224 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 227 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 218 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 218 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 221 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 224 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 232 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 232 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 234 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 226 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 223 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 230 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 221 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 223 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 229 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 233 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 226 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 221 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 223 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 225 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 232 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 226 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 227 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 232 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 227 damage.
The Earth Elemental killed you.
The Earth Elemental hit you 228 damage.
The Earth Elemental killed you.
Replace the 'usr's in procs with something more suitable. That might fix it. Until you do that, digging through that massive pile of code to figure it out is pointless.
In response to Jp
i just fixed it. I accendly had the wrong proc() in place of another one.
In response to Animekid09
I would still suggest removing 'usr' and replacing it with something appropriate, or you'll be running into some very interesting bugs later on.
In response to Jp
what could i replace usr w/?
In response to Animekid09
Depends on context. In some places, it should be src, in other places, there should be an argument to the procedure.