ID:264976
 
Code:
atom
proc
Bumped()
mob
Bump(atom/obstacle)
obstacle.Bumped()

mob
Enemies
XP=0
LIVE=0
PLIVE=0
player=0
var/mob/Player/M
New()
. = ..()
spawn()
Wander()
// XP0()
// proc
// XP0()
// src.XP=0
// spawn(1)
// XP0(src)
proc/Wander()
while(src)
if(M in oview(5)) //if a Player comes in 5 steps pf him
step_towards(src,M) //Chase him!
for(M in oview(1)) //here you can define some stuff
break //if you want your NPC to shoot make it so
for(M in oview(2)) //these are saying if the Player is within 1,2,3,4 blocks do nothing
break
for(M in oview(3))
break
else
step_rand(src) //if no NPC is 5 blocks or less away walk around
sleep(10) //stop for 1 second
for(M in oview(4)) //.......
break
sleep(5)
spawn(5)
Wander()//Wonder again...
Bump(mob/Player/M, mob/Player/Allies/M)
if(M.player == 1) //If the NPC bumps you
// if(!istype(M))
MFight(M)//Fight You!
else
Wander()


Problem description:
i keep gettin runtime errors and proc problems.
_______________________________________________
runtime error: Cannot read null.player
proc name: Bump (/mob/Enemies/Bump)
When you kill the enemy do you delete it from the map?
Lets fix up some stuff when you define Bump() to call Bumped():

1) You did not pass an argument of who bumped in to the obstable, which you will quite possibly need in the near future.

2) You did not define the parent procedure (..()). That means if you overwrite Bump(), it may cause problems for you by not doing what you wanted - simply because you told it to stop continuing

obstacle.Bumped(src)
..()


Not on to Bump() you defined under /mob/Enemies.
Look up Bump in the DM, notice anything? It only has one argument. Not just that but it returns any object that bumped in to it (no filtering). You can define it as Bump(mob/Enemy/M) but that does not mean M is actually a /mob/Enemy, it could be an /obj. Use istype(M) to check if it is /mob/Enemy (or whatever the variable pathway is).

The reason why you go that error is simply because you did not checked if M existed, which could be verified through istype() as well.