ID:179314
 
here's the spell...
mob/proc/Ice(mob/M as mob in oview(6))
usr<<"You get ready to cast the spell."
if(usr.MP<=10*usr.lvl)
usr <<" not enough mp!"
return
if(M.owner==usr.owner)
usr<<"You can't attack a brother!"
return
usr.overlays+=/obj/overlays/IceStart
sleep(40)
usr.overlays-=/obj/overlays/IceStart
sleep(10)
missile(/obj/Ice,usr,M.loc)
var/damage=10*usr.lvl
M.overlays+=/obj/overlays/IceEnd
sleep(10)
M.overlays-=/obj/overlays/IceEnd
M.HP-=damage
usr.MP-=10*usr.lvl
usr.xp+=rand(5,9)

and I get


this
runtime error: Cannot read null.owner.
proc name: Heal (/mob/proc/Heal)
source file: sandNE.dm,48
usr: Jon Snow (/mob/Snowmonsters/IceP)
src: Jon Snow (/mob/Snowmonsters/IceP)
call stack:
Jon Snow (/mob/Snowmonsters/IceP): Heal(null)
Jon Snow (/mob/Snowmonsters/IceP): Heal ally()

take note I haven't coded in awhile and I'm relaly rusty, could really use some help on this :)

try var/mob/M instead of just mob/M. That seems to help in some cases.

-Rcet
In response to Rcet
Also, you don't know that a mob is necessarily within it's view so you should have a check like this at the beginning.

if(!M)
usr << "No Target"
return

That makes sure there is a valid target selected to cast the spell at. Otherwise, this will crash when there isn't a valid target in range.
In response to English
ya...
that helped the errors from constantly popping up thanks man, but it sitll doesn't work...
I think it has something to do with my way of identifying one mob to be yours and not someone elses by assigning a key var to each one of them that is equal to your usr key...
for some reason it forgets which ones had your usr key over time and people were able to log in to those mobs over time...
I don't know why but that's what happened when I tested it...
also
if I hit the becomeslave() verb it worked just fine, it told you if it had your usr.key etc, but if you right clicked on a mob and clicked becomeslaves() from the list it gives you after you right click... you could become any mob.
In response to JonSnow13
Do you mean you have a var that stores the key name like this?

usr.owner = "[M.ckey]"

If you do it similar to that way you should be able to wrinkle out the problems.

If you do it like this:
usr.key = M.key
then that is a whole different story.
In response to English
wow...
I didn't know you'd want to use brackets...
why the brackets?
/me goes to look it up in the reference...
In response to JonSnow13
Incase you didn't find the answer, brackets essentially allow you to use variables in text and strings. Here's an example:
var/mob/M
M.name = "Shorty"
M.height = 4
M.owner = "[usr.ckey]"
usr << "[M.name] is [M.owner]'s slave, he is [M.height] feet tall."

This would be the output:
Shorty is jonsnow13's slave, he is 4 feet tall.
In response to English
lol I never really have used brackets before...
sigh :)
ok I'm going t ogo try all this out now haha thanks :) I'll get back to you if it works!!