Range attack, locate to target, runtime error in Developer Help
|
|
This is an attack that is supposed to:
Check if there is a dense spot - y1 of the target, if not locate myself there, and do the damage. Instead I get an error about null.y
Here is the code(credit to actionlock snippet):
mob verb Chidori() if(ActionLock("Chidori", 600)) usr << "<B>Cooldown: [actionlock["Chidori"]] 1/10 seconds left.)" return else var/mob/M flick(src,"chidori") sleep(35) if(enemy == M&&M.dir == NORTH&&!density in M.y - 1&&M in view(src,11)) src.dir = NORTH src.loc = M.y - 1 if(src.rfx > M.rfx) flick(src,"hit") M.stamina-=950 + (src.rfx * 2) M.wounds-=rand(5,13) view(2,src) << "<font color=cyan>A direct hit!" else if(src.rfx < M.rfx) flick(src,"hit") M.stamina-=850 + (src.rfx * 2) view(2,src) << "<font color=cyan>Electricity damage."
mob/var enemy enemy_marker client/DblClick(mob/M) if(istype(M))
del usr.enemy_marker usr.enemy = M usr << usr.enemy_marker if(usr.information == 0) usr << "Targetting [M]" else if(usr.information == 1) usr << "Targetting [M], Stamina = [M.stamina]/[M.maxstamina], Chakra = [M.chakra]/[M.maxchakra]" else if(usr.information == 2) usr << "Targetting [M], Stamina = [M.stamina]/[M.maxstamina], Chakra = [M.chakra]/[M.maxchakra], Wounds = [M.wounds]"
|
Edit-Thanks! I'll fix this. Never thought about where ! would be in ooo.
|
Also, I'd like to point out that your if() statement has some major issues. First, "M.y-1" is a number, not a turf. Second, "density in X" is not going to tell you if X is dense. To find if you could step onto a turf, use X.Enter(src). Third (actually this is minor if you fix the other errors), order of operations puts ! before in, so if(!X in Y) becomes if((!X) in Y) instead of if(!(X in Y)).