L.spelldelay=1
var/list/J[1]
var/C = 1
var/mob/enemies/M
for(M as mob in oview(5))
if (istype(M,/mob/enemies))
J[C] = M
C++
J.len++
if(J[1]!=null)
MP -= round(14*sqrt(poisonlevel),1)
M = J[1]
missile(/obj/spells/poisonbolt,usr,M)
sleep(get_dist(usr,M))
M.overlays += /obj/spells/poison
var/D = round(4+(poisonlevel/2),1)
while(D>0)
var/damage = round( rand(10*(sqrt(poisonlevel*((Intelligence/100)+1))),13*(sqrt(poisonlevel*((Intelligence/100)+1)))) , 1)
if (M.poiswk>0)
damage = round(damage*(1+(M.poiswk/100)),1)
if (M.poisres>0)
damage -= round(damage*(M.poisres/100),1)
M.HP -= damage
s_damage(M, damage, "green")
sleep(10)
DeadEnemy(M)
D--
Problem description: Whenever i use the spell, and a monster dies, i get a runtime error with anything thats under "while(D>0)" and the runtime error says "runtime error: Cannot read null.poiswk" and its not just the poiswk, i tried taking that out, and it still had the same error but with poisres and so on....