ID:267976
 
Hi, when i run my game in dreamseeker i get a bunch of runtime errors and they say

proc name: Bump (/mob/monsters/bones/Bump)
runtime error: undefined variable /turf/wall/var/player
(This happens for all monsters this is just one of the errors)

heres the code
/mob/monsters
bones
icon = 'Monster.dmi'
icon_state = "bones"
gold = 3
HP = 10
MHP = 10
player = 0
Str = 2
Expg = 2
level = 2
monster = 1
PK = 1
NPC = 0
New()
. = ..()
spawn()
Wander()
proc/Wander(var/mob/You/P)
while(src)
if(P in oview(5))
step_towards(src,P)
for(P in oview(1))
break
for(P in oview(2))
break
for(P in oview(3))
break
for(P in oview(4))
break
else
step_rand(src)
sleep(5)
for(P in oview(5))
break
sleep(5)
spawn(5)
Wander()
Bump(mob/M)
if(M.player == 1)
Fight(M)
else
return
proc/Fight()
for(var/mob/E in get_step(usr,usr.dir))
var/damage = src.Str
E.HP -= damage
E << "[src] attacks you for [damage] damage!!"
src<<"You attack [E] for [damage] damage!!"
UserDcheck(E)



can anyone give me a tip of what i did wrong?
Vash_616 wrote:
Hi, when i run my game in dreamseeker i get a bunch of runtime errors and they say

proc name: Bump (/mob/monsters/bones/Bump)
runtime error: undefined variable /turf/wall/var/player
(This happens for all monsters this is just one of the errors)

heres the code
> /mob/monsters
> bones
> icon = 'Monster.dmi'
> icon_state = "bones"
> gold = 3
> HP = 10
> MHP = 10
> player = 0
> Str = 2
> Expg = 2
> level = 2
> monster = 1
> PK = 1
> NPC = 0
> New()
> . = ..()
> spawn()
> Wander()
> proc/Wander(var/mob/You/P)
> while(src)
> if(P in oview(5))
> step_towards(src,P)
> for(P in oview(1))
> break
> for(P in oview(2))
> break
> for(P in oview(3))
> break
> for(P in oview(4))
> break
> else
> step_rand(src)
> sleep(5)
> for(P in oview(5))
> break
> sleep(5)
> spawn(5)
> Wander()
Okay...this looks alright...

> Bump(mob/M)
> if(M.player == 1)
> Fight(M)
> else
> return
The error is caused by the monster. As you can see, Bump(mob/M) needs an MOB to continue. However, the monster bumps into an TURF. In order to fix, use...
<dm>
Bump(atom/M)
if(istype(M,/mob) && M.client)) //if(M == /mob) && if(M.player-controls-it)
Fight(M)
else
return


proc/Fight()
for(var/mob/E in get_step(usr,usr.dir))
var/damage = src.Str
E.HP -= damage
E << "[src] attacks you for [damage] damage!!"
src<<"You attack [E] for [damage] damage!!"
UserDcheck(E)</DM>


can anyone give me a tip of what i did wrong?

Done! This *should* make it work. Too sleepy to work....must.........find......bed.....................zzz...
Vash_616 wrote:
can anyone give me a tip of what i did wrong?

No put usr in proc. Ungh.

Lummox JR