ID:263360
 
Code:
            if(usr.curspell == 2 && usr.mp >= 3)
usr.mp -= 3
var/a = new/obj/spell/fbolt/(usr.loc)
var/b = get_dir(a,o)
var/c
var/Io
atk
c = get_step(a,b)
for(var/mob/M in c)
Io += 1
M.hp -= a:dmg
if(M.hp <= 0)
if(M.monster == 1)
del(M)
else
M.loc = locate(1,1,1)
view() << "[M] died!"
var/I = new/obj/spell/fire()
M.overlays += I
M.afterfire()
for(var/mob/g in oview(1,M))
var/D = new/obj/spell/fire()
g.overlays += D
g.hp -= a:dmg
g.afterfire()
if(g.hp <= 0)
if(g.monster == 1)
del(g)
else
g.loc = locate(1,1,1)
view() << "[g] died!"
del(a)
if(Io > 0)
del(a)
step(a,b)
a:dmg -= 2
sleep(2)
if(a:dmg == null|| a:dmg == 0)
del(a)
goto atk


Problem description:
runtime error: Cannot read null.overlays
proc name: Click (/client/Click)
usr: Rky_nick (/mob/player)
src: Rky_nick (/client)
call stack:
Rky_nick (/client): Click(the grass (2,9,1) (/turf/grass), the grass (2,9,1) (/turf/grass))
after a shot of firebolt the second justs sit next to the monster and does nothing with this error. I dont care if my system is ineffiecient, so stop screaming at me unless the uneffieciency is the problem.

Your code has numerous problems. Assuming this is a verb and thus usr would be okay, you're still very heavily abusing the : operator and goto. There's zero point in using : in something like usr:contents, since usr.contents is perfectly valid and also safe. For other vars like a, you should be giving those vars the right type so you don't have to use : at all. Don't use this.

Don't use goto either. It has its uses but you should be using while() or something instead.

Also, I noticed this line:
if(a:dmg == null|| a:dmg == 0)

The : abuse aside, this is drastically wrong. The dmg var has already been established as a number because you used a:dmg-=2 above, so it's not null. This should be if(a.dmg<=0) instead.

For other checks like if(M.monster==1), you need to ditch the ==1. Similarly you're using ==0 in places you shouldn't. When a var is either true or false, you use if(M.monster) or if(!M.monster). This form is both simpler and more robust.

Lummox JR
In response to Lummox JR
can someone tell me how to fix the undefined varible errors in this line with a.dmg?
if(!a.dmg)
a is a new object, and yes, for the love of god dmg is defined.
Lummox thanks for the help in... making my code smaller and more effiecient... or something like that...

but serousily, I have no idea how to fix : abuse aside from saying screw it and formating my harddrive and smashing my moniter with a freaking hammer.
In response to Rky_nick
Okay, lets see how you defined the variable:
var/a = new/obj/spell/fbolt/(usr.loc)


I am willing to bet that the damage variable is set as <code>obj/var/dmg</code>. See something wrong yet? No? Well, even though you defined the instance of 'a' as an object, the variable 'a' itself is thought as a null-path variable.. meaning that any atom variables will not work. How to fix that? Define the path:
var/obj/a = new/obj/spell/fbolt/(usr.loc)


But wait, what if the variable is in a specific spot like obj/spell or obj/spell/fbolt? Simple, define that path:
var/obj/spell/a = new/obj/spell/fbolt/(usr.loc)

//Or better yet:

var/obj/spell/fbolt/a = new/obj/spell/fbolt/(usr.loc)

//Or even better:

var/obj/spell/fbolt/a = new(usr.loc) //this is the samething as 'var/obj/spell/fbolt/a = new/obj/spell/fbolt/(usr.loc)' just shorter


So if you define the variable path in which the variable is located, you can use . without getting errors (um, typecasting was it called? I forgot)

- GhostAnime
In response to GhostAnime
Thank you! now the errors are gone. But the problem still remains, the firebolt doesnt work on the second usage agaisnt the same group of enemies
In response to Rky_nick
Is the blast at the map edge? Did it bump into something and didn't delete? Anything else that may be worth noting in which we can help narrow the cause?

- GhostAnime
In response to GhostAnime
heres what happens:
it fires. bumps into enemy group. group goes up in flames. fire deletes. i try it again, it bumps into same group and sits there doing nothing.