When I use this:
firebal
icon_state = "firebane"
movingable = 0
pixel_y = 0
density = 0
New(didby)
..()
didby = G
check()
damage(G)
proc/check()
var/check = 0
for(var/turf/T in src.loc)
if(T.density)
T = pick(T)
check = 1
if(check)
del(src)
proc/damage(mob/A)
spawn while(src)
for(var/mob/M in src.loc)
if(M == A) goto End
var/damage = 16 + A.int
M.hp -= damage
M.DeathCheck(A)
End
sleep(5)
It give me a null.int runtime error. but for some reason, when i call the same thing in bump, excpet of a for loop, it works perfectly. For example:
zap
icon_state = "zap"
density = 1
Bump(mob/M)
src.density = 1
src.icon_state =""
if(ismob(M))
M.hp -= 10 + G:int
s_damage(M,11,"red")
M.DeathCheck(G)
del(src)
If anybody could help me, it would be appreciated.
~~Dragon Lord~~
PS: In the DW series, firebal is not fireball. =P
ID:261799
![]() Jul 17 2003, 8:20 am
|
|
The reason you get an error is that you set didby=G instead of G=didby in New(). So G remains null.
Your for() loop has another problem: goto. Never use goto for simple loops. In this case, the way you used it was equivalent to using the continue statement--so use continue instead, and take out the goto. Lummox JR |
New(didby)
..()
didby = G
check()
damage(G)
You are not ensuring that G is not null. I'm not even sure where G is defined, but in any case, you probably just meant to change that third line to:
G = didby
Otherwise, there's no point in calling New() with the variable didby, if you're just going to change the value of it right away.