ID:157353
 
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))
// spawn(8)
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)//anyone who double clicks a mob
if(istype(M))//if the mob variable is a mob

del usr.enemy_marker//delete image before it comes up
usr.enemy = M//your enemy is the mob
// usr.enemy_marker = image('outline.dmi', M)//set the image
usr << usr.enemy_marker//output it only to person who targeted
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.
You define M right there and never put a value into it. Something which you do not put a value into is going to be null. Therefore, when you attempt to access its variables, you will get a null.variable error. It's equivalent to me asking you how tall she is.

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)).