ID:145477
 
Code:
mob
var
owner
command = 2
itemn
item
grow
nhealth
npc
bear
icon = 'npc.dmi'
icon_state = "bear"
density = 1
nhealth = 50
New()
if(command == 2)
spawn(20)
step_rand(src)
New()
if(command == 4)
spawn(10)
for(var/mob/M in oview(6))
if(M in oview(6))
step_towards(src,M)
sleep(20)
New()
if(M in oview(5))
step_towards(src,M)
sleep(20)
New()
if(M in oview(4))
step_towards(src,M)
sleep(20)
New()
if(M in oview(3))
step_towards(src,M)
sleep(20)
New()
if(M in oview(2))
step_towards(src,M)
sleep(20)
New()
if(M in oview(1))
Attack()
sleep(20)
New()

Click()
if(src in oview(5))
if(usr.job == 10)
if(usr.hold == 11)
var/ran2 = rand(0,100)
if(ran2 < 3)
for(var/obj/O in usr)
if(O.suffix == "Equiped")
O.damage += 1
if(O.damage >= 100)
alert("You're tool got destroyed")
usr.hold = 0
usr.weight -= O.weight
usr.takeitem(O,usr.contents)
var/ran = rand(0,70)
if(ran <30)
missile(/obj/arrow, usr, src)
sleep(10)
var/dam = rand(1,15)
src.nhealth -= dam
src.command = 4
usr << "You did the bear [dam] damage"
else
usr << "You tried to shoot but where to nervous"
proc
Attack(mob/M in oview(1))
if(M.client)
var/dam=rand(1,14)
M.health -= dam
M << "You lost [dam]"
M.Deathcheck()
mob
proc
Deathcheck()
if(src.client)
if(src.health < 1)
for(var/obj/O in src)
del(O)
if(usr.gender == MALE)
usr.icon = 'dead.dmi'
usr.job = 9
usr.Move(locate(6,9,2))
usr.maxweight = 100
usr.density = 1
usr << "You died"
world <<"<center><font color=green>[usr] has died."
else
usr.icon = 'Fdead.dmi'
usr.job = 9
usr.Move(locate(6,9,2))
usr.maxweight = 100
usr.density = 1
usr << "You died."
world <<"<center><font color=green>[usr] has died."
else
if(src.nhealth <1)
new /obj/food/meat(src.loc)
del(src)
sleep(1200)
var/lo1 = rand(20,160)
var/lo2 = rand(20,200)
new/mob/npc/bear(lo1,lo2)


Problem description:

runtime error: Cannot read null.client
proc name: Attack (/mob/npc/bear/proc/Attack)
usr: the bear (/mob/npc/bear)
src: the bear (/mob/npc/bear)
call stack:
the bear (/mob/npc/bear): Attack(null)
the bear (/mob/npc/bear): New()

I get that error and the bear sometimes jumps 3 spots ahead while i gave it sleep
In your attack() proc, put an if statement first; this one:
if(M) <-- So if there's an M..
Also, don't use usr in procs...
And, about the jumping tiles ahead, Be sure you don't have any loops running..
> mob
> var
> owner
> command = 2
> itemn
> item
> grow
> nhealth
> npc
> bear
> icon = 'npc.dmi'
> icon_state = "bear"
> density = 1
> nhealth = 50
> New()
> ..()
spawn() AI()
proc/AI()
if(command == 2)
> step_rand(src)
> if(command == 4)
> sleep(10)
> for(var/mob/M in oview(6))
> if(!(M in oview(1))) //If they are not within one tile of the bear
> step_towards(src,M) //Step towards them
> else //If they are
> Attack(M) //Attack them (Notice the "M" inbetween the "()")
>
> spawn(20) AI()
>
> Click()
> if(src in oview(5))
> if(usr.job == 10)
> if(usr.hold == 11)
> if(rand(0,100) < 3)
> for(var/obj/O in usr)
> if(O.suffix == "Equiped")
> O.damage += 1
> if(O.damage >= 100)
> alert("You're tool got destroyed")
> usr.hold = 0
> usr.weight -= O.weight
> usr.takeitem(O,usr.contents)
> if(rand(0,7) < 3)
> missile(/obj/arrow, usr, src)
> sleep(10)
> var/dam = rand(1,15)
> src.nhealth -= dam
> src.command = 4
> usr << "You did the bear [dam] damage"
> else
> usr << "You tried to shoot but where to nervous"
> proc
> Attack(mob/M)
> if(M.client)
> var/dam=rand(1,14)
> M.health -= dam
> M << "You lost [dam]"
> M.Deathcheck(src)
> mob
> proc
> Deathcheck(mob/Killer)
> if(src.client)
> if(src.health < 1)
> for(var/obj/O in src)
> del(O)
> if(gender == MALE)
> icon = 'dead.dmi'
>
> else
> icon = 'Fdead.dmi'
> job = 9
> Move(locate(6,9,2))
> maxweight = 100
> density = 1
> src << "You died"
> world <<"<center><font color=green>[src] has died."
> else
> if(src.nhealth <1)
> new /obj/food/meat(src.loc)
> del(src)
> sleep(1200)
> var/lo1 = rand(20,160)
> var/lo2 = rand(20,200)
> new/mob/npc/bear(lo1,lo2)


You forgot to pass the "M" that your attack proc was expecting. I also shortened and fixed up some other stuff. For example, I don't think it's safe to be calling New() over and over.

[Edit]
Also, your respawn code will not work, because when src is deleted, the proc will end before reaching those lines.
In response to DarkCampainger (#2)
You fixed 'things' except for the most wrong and fierce (exagerating..) error, the usr abuse. :|
In response to Mysame (#3)
Actually, I was in the process of fixing that while you posted >_>
In response to Mysame (#3)
Yeah, there is a lot of usr abuse in the Deathcheck proc, and not enough arguments. Other than the code being able to be shortened down quite a bit, there is not too many more errors that I noticed.