ID:263366
 
Code:
    Down_Sprayer
icon = 'turf.dmi'
icon_state = "spraydown"
objs = 1
New()
. = ..()
spawn()
Wander()
proc/Wander()
if(src.built == 1)
var/obj/a = new/obj/spell/spray/(src.loc)
var/b = SOUTH
var/c
while(a)
c = get_step(a,b)
for(var/mob/M in c)
step(M,SOUTH)
del(a)
for(var/obj/K in c)
if(K.opacity)
del(a)
step(a,b)
a.dmg -= 15
sleep(2)
if(!a.dmg)
del(a)
var/I = rand(20,60)
spawn(I)
Wander()


Problem description:
runtime error: Cannot read null.dmg
proc name: Wander (/obj/Build/Down_Sprayer/proc/Wander)
usr: Rick (/mob/characters/p2)
src: Down Sprayer (/obj/Build/Down_Sprayer)
call stack:
Down Sprayer (/obj/Build/Down_Sprayer): Wander()
Down Sprayer (/obj/Build/Down_Sprayer): Wander()

The sprayer shoots the water spray projectile out. It works fine untill it hits me. It does the desired effect but doesnt shoot out anymore.

Please help me if you can.

You're trying to use a after deleting it; hence the error.

Lummox JR
In response to Lummox JR
Thank you! I added an if(a) and now it works.
In response to Rky_nick
Rky_nick wrote:
Thank you! I added an if(a) and now it works.

While that can't hurt, that's not the real fix to your problem. The real fix is that you need to get rid of that spawn() call in Bump().

Lummox JR
In response to Lummox JR
What Bump()?
In response to Rky_nick
I think LJR got this thread mixed up with the one previous to it [link]

- GhostAnime
In response to GhostAnime
GhostAnime wrote:
I think LJR got this thread mixed up with the one previous to it [link]

Whoops. Yep, I did. What threw me off was the similar cause of the runtime error.

Lummox JR
In response to Lummox JR
Yeah, I thought it was the same thread until I reread the parent topic of this thread >_>

- GhostAnime