ID:270379
 
when i use the verb attack it makes runtime errors but i dont know why.
mob/proc/Attackp(mob/M in oview(1))
var/hitting = rand(1,5)
if(hitting == 3)
var/damage = round(src.Strength*2)
if(src.Strength - M.Speed+M.Defense > 1)
usr<<"<font color = blue>You hit [M] for [damage]!"
M<<"[src] hit you for [damage]!"
M.Health -= src.Strength - M.Speed+M.Defense
src.Levelup()
M.DeathCheck()
else
M<<"[src] attacks you but you block the attack!"
src<<"You attack [M] but they block your attack!"
else
M<<"[src] tries to attack you but misses!"
src<<"You try to attack [M] but you miss!"


mob/proc/DeathCheck()
if(src.Health <= 0)
src.Health = src.MaxH
view()<<"[src] wins the battle!"
src.loc=locate(1,1,1)

mob/proc/Levelup()
if(src.EXP>=src.maxEXP)
src<<"<font color = red><b>You gain a level!"
usr.EXP=0
src<<"You have gained 3 statpoints."
src.SP+=3

mob/verb/Attack()
src.Attack()

this is the runtime errors it gives:runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
verb name: Attack (/mob/verb/Attack)
usr: Dragon_Fire6564 (/mob/character/Light)
src: Dragon_Fire6564 (/mob/character/Light)
call stack:
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
...
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()
Dragon_Fire6564 (/mob/character/Light): Attack()

how do i fix this?
mob/verb/Attack()
src.Attackp()


You forgot the p, I suggest you rename your procedures.
In response to Crashed
how would i beable to make the attack verb work on objs and turfs too?
Your DeathCheck() proc is wrong. src is the victim, not the killer as well. You need to pass it an argument to tell it who the killer is.

Lummox JR