ID:148325
 
I've got an object method for my barmaid mob. The plan is that she spawns behind the bar and wander()s until someone callMaid()'s her, when she moves to stand next to the caller.

Now the on-topic part of this post. ;)

I've run into the problem where, using the *_towards functions, the barmaid will keep walking into anything between her and the customer mob. I have an idea for a "smarter" moveto() proc, but I want to make sure there isn't any error-checking in step. From my understanding, it works as such if rewritten in DM

proc myWalk_towards(target as mob){
//assume .loc is a property to return
//a named list of ("X"=x coord, "Y"=y coord)
var mylocx=src.loc("X")
var targlocx=target.loc("X")
var mylocy=src.loc("Y")
var targlocy=target.loc("Y")


// get X/Y difference.
var xdiff = mylocx - targlocx
var ydiff = mylocy - targlocy

if (abs(xdiff) > (abs(ydiff))
if (xdiff > 0)
src.south()
if (xdiff < 0)
src.north()

if (abs(ydiff) > abs(xdiff))
if (ydiff > 0)
src.west()
if (ydiff < 0)
src.east()


Is there anything else to the walk_towards() function
Use walk_to().
In response to Garthor
Walk_to() will find itself a clear path? I'll give that a shot, thanks.


Damn, here I thought I was gonna get a chance for some code-fu. ;)
In response to Geminidomino
Well I suppose you could if you really wanted to, but walk_to() will find most simple paths around objects.
In response to Jotdaniel
Looks like I'm gonna have to. Apparently its not smart enough for this layout.


B - barmaid
X - Bar
P - Player
W - Wall


WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW       


XXX
XXX
<-B-> XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


P


The barmaid just walks back and forth.

This is gonna be interesting. What I'm thinking is to set the area behind the bar as a different area than the rest of the floor and use that to lay the opening steps of the path.
In response to Geminidomino
In response to Geminidomino
Geminidomino wrote:
B - barmaid
X - Bar
P - Player
W - Wall


> WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW       
> Y Z
>
> XXX
> XXX
> <-B-> XXX
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
>
> P
>
>

or you could set it to goto Y, then Z then P
Its a way around it but you should think of using Deadrons or figuring out OFD's over at digitalbyond