ID:178787
 
I have a slight problem with my turfs. I'm trying to call my battle proc from the turf, but I get an undefined proc error when I compile. I know that it's because the proc is in a mob group. How can I get around this??? I don't want to use the Move() proc, since it calls before you enter the square. I want the battle to be called once you enter a square of turf, not before it. Any help is appreciated.

-----------
turf
icon = 'turfs.dmi'
battlegrass
icon_state = "grass"
Entered()
var/probchance=25
randomencounter1(probchance,src)

mob/proc
randomencounter1(probchance as num,mob/M as mob)
var
turf
battlearea
T
..
Rubius wrote:
I have a slight problem with my turfs. I'm trying to call my battle proc from the turf, but I get an undefined proc error when I compile. I know that it's because the proc is in a mob group. How can I get around this??? I don't want to use the Move() proc, since it calls before you enter the square. I want the battle to be called once you enter a square of turf, not before it. Any help is appreciated.

-----------
turf
icon = 'turfs.dmi'
battlegrass
icon_state = "grass"
Entered()
var/probchance=25
randomencounter1(probchance,src)

mob/proc
randomencounter1(probchance as num,mob/M as mob)
var
turf
battlearea
T
..

Luckily, Entered can give you a reference to your mob, so do this:

Entered(mob/who)
var/probchance=25
who.randomencounter1(probchance)

I'm not sure what your second parameter is for (mob/M). What are you trying to pass in there?
In response to Skysaw
I'm trying to pass the mob itself, the player.
In response to Rubius
Rubius wrote:
I'm trying to pass the mob itself, the player.

Since the proc was owned by a mob, it's hardly necessary to pass that same mob into it. Just use src in that case. In my version, use who.
In response to Skysaw
I tested it, and it works. Thanks for the help.