cavey1
name = "Beholder"
icon = 'NPC.dmi'
icon_state = "beholder"
Health = 100
Mhealth = 100
exp = 200
player = 0
var/mob/P
New()
. = ..()
spawn()
Wander()
proc/Wander()
while(src)
if(P in oview(5)) //if a Player comes in 5 steps of him
step_towards(src,P) //Chase him!
for(P in oview(1))
Fight(P)
break //if you want your NPC to shoot make it so
for(P in oview(2))
Fight(P) //these are saying if the Player is within 1,2,3,4 blocks do nothing
break
for(P in oview(3))
Fight(P)
break
for(P in oview(4))
break
else
step_rand(src) //if no NPC is 5 blocks or less away walk around
sleep(10) //stop for 1 second
for(P in oview(5))
break
sleep(5)
spawn(5)
Wander()
Bump(mob/M)
if(M.player == 1)
Fight(M)
else
return
proc/Fight(mob/M)
if(usr.wait == 0)
var/damage = rand(1,15)
M.Health -= damage
M << "[src] shoots a magical beam at you for [damage] damage!"
src<<"You attack [M] for [damage] damage!"
Dcheck(M)
usr.wait = 1
spawn(10)
usr.wait = 0
I get 1 runtime error, many times, it seems like I get 1 runtime error for every time one of thse moves on the map. I get the error:
runtime error: Cannot read null.Mhealth
proc name: Dcheck (/mob/proc/Dcheck)
usr: Vampire Bat (/mob/HIM/cavey2)
src: Vampire Bat (/mob/HIM/cavey2)
call stack:
Beholder (/mob/HIM/cavey1): Dcheck(null)
Beholder (/mob/HIM/cavey1): Fight(null)
Beholder (/mob/HIM/cavey1): Wander()
Beholder (/mob/HIM/cavey1): New(the cave (835,146,1) (/turf/cave))
with the coordinates and name of critter changed slightly or not at all in each error. They come, like, 5 per second...
What on earth does it mean?
--Vito