ID:179225
 
I'm having some trouble calling a mob/proc from within an obj/verb (compiler says proc is undefined). However, the compiler also complains if I try to prototype the proc at the top of the file (duplicate definition!).

I have another generic proc (defined above my mob section)which calls a mob/proc with no problem, so I'm guessing there is really never a need for prototyping.

Anyway, here's the one causing the problem:

obj/tile/verb/place_tile()
set src in usr
src.loc = usr.loc
usr.men_check()

mob/player/proc/men_check()


Any suggestions?

obj/tile/verb/place_tile()
set src in usr
src.loc = usr.loc
usr.men_check()

mob/player/proc/men_check()

It looks like the problem is that the compiler doesn't know that usr is of type mob/player . You can change your code around like this:

obj/tile/verb/place_tile()
set src in usr
src.loc = usr.loc
usr.men_check()

mob/proc/men_check() //Proc becomes generic mob proc

This is pretty safe, and will always work. But if you don't want all mobs to have men_check (and I don't know if you do or not..), you can try instead:

obj/tile/verb/place_tile()
set src in usr
src.loc = usr.loc
mob/player/M = usr
M.men_check()

mob/player/proc/men_check()

Which is only safe if you're certain usr will of type player.

-AbyssDragon
In response to AbyssDragon
Thanks!