ID:2411501
 
(See the best response by Nadrew.)
Code:
mob/Monsters
var/mob/Target
enemy
icon = 'enemy.dmi'
icon_state = "enemy"
Level = 1
Str = 10
Def = 5
Maxlife = 50
Exp = 5
Gold = 1
step_size = 15
Bump(mob/M,)
if(M.client)
M.Hurtme(src.Str)


Problem description:just trying to make monsters inflict damage when they bump into a mob but im getting a runtime error when they bump into walls i believe:

runtime error: undefined variable /turf/wall/var/client
proc name: Bump (/mob/Monsters/enemy/Bump)
usr: (src)
src: the enemy (/mob/Monsters/enemy)
src.loc: the tunnelfloor (22,40,1) (/turf/tunnelfloor)
call stack:
the enemy (/mob/Monsters/enemy): Bump(the wall (22,39,1) (/turf/wall))
the enemy (/mob/Monsters/enemy): Move(the tunnelfloor (22,40,1) (/turf/tunnelfloor), 2, 0, -13)
the enemy (/mob/Monsters/enemy): Wander()
the enemy (/mob/Monsters/enemy): New(the tunnelfloor (22,41,1) (/turf/tunnelfloor))



Best response
Just because you define the argument as a mob doesn't mean it'll only trigger for mobs. That's just a compile-time thing so you can cast a variable to a specific type.

You'll want to check the variable using a runtime method like istype() or ismob()

Bump(mob/M)
if(ismob(M) && M.client)
// Do stuff