ID:145216
 
Code: Another game, another Side-Scroller AI gone bad. But I actually knew what to do, but with the same results.
        Bump(mob/M)
if(istype(M,/obj))
return
else if(istype(M,/turf))
return
else if(istype(M,/area))
return
else if(!M.client)
if(src.dir == WEST)
src.dir = EAST
if(src.dir == EAST)
src.dir = WEST
else
Attack(src)


Problem description: Thinks the turf the AI bumps into is a Mob, yet it goes through all the checks.

Omfg. Wait, let me put this in a more mature line. Zomfg.

mob/Bump(var/atom/movable/a)
if(ismob(a))
var/mob/M=a
...


In response to Mysame
Problem is more extensive then you think.

        Bump(var/atom/movable/a)
if(ismob(a))
var/mob/M=a
if(!M.client)
if(src.dir == WEST)
src.dir = EAST
if(src.dir == EAST)
src.dir = WEST
else
Attack(src)


runtime error: undefined variable /turf/Ground/var/client
proc name: AImovement (/mob/proc/AImovement)
source file: AI.dm,14
usr: First (/mob/Enemy/First)
src: First (/mob/Enemy/First)
call stack:
First (/mob/Enemy/First): AImovement()
First (/mob/Enemy/First): AImovement()
First (/mob/Enemy/First): AImovement()
First (/mob/Enemy/First): New(Underground (7,3,1) (/turf/Underground))

Line 14 being the mob in question's path.

mob
Enemy
First //<<<<


AImovement don't concern this problem as it worked before, in the same problems that this time faces.
In response to RedlineM203
You probably have other mob/Bump()'s out there. If that's not the case, I'm clueless.
In response to Mysame
Thats the only one in the whole code.
In response to RedlineM203
I just added a Bump() debug in one of my test projects with that code, worked fine.

That is a MOB bump, is it not? Because from the looks of it it's indented (SP? :( ) 2 times.
In response to Mysame
SP is correct from what I know.


Yes it is, and it was in the code it came from. The only difference is that works and this don't.