ID:272740
Jan 8 2009, 5:43 pm
|
|
I was wondering, if you were to use walk_to() to get something to go somewhere, how could you get it to stop once it's reached its destination? I know how to get it to stop, I just don't know how to do it once it's reached its destination.
|
In response to Mizukouken Ketsu
|
|
Well, I've found something in the DM Reference for what I needed, thanks to you pushing me there. Although I will say that for what I want to do, I need to use walk_to and not walk_towards. Thanks anyway =).
|
In response to Mizukouken Ketsu
|
|
Mizukouken Ketsu wrote:
walk_towards() I find to be better than walk_to() because walk_to() doesn't take into account density [...] walk_towards() will make the mob stop if it hits something dense along the way to the destination. That's not correct. The only difference between those procs is as described by the DM Reference, and it is also implied by the procs' names: walk_towards() causes the movable to continuously move towards, in the direction of, the destination, whereas walk_to() makes the movable calculate a path to the destination; this takes obstacles into account and attempts to move around them using a basic, built-in path pathfinding algorithm. Both function types will keep on continuing to try to move even after bumping AFAIK, though a pathfinding one will attempt to avoid bumping in the first place. walk_towards() might appear to stop moving after bumping something, but that's just because it's blocked and can't move further; it's still continuously trying to move in the direction of the target, just keeping on Bump()ing the same obstacle as it can't move past. And as for making it stop, it will do that automatically with both. That's right; the Min arg decides at which distance from the destination the moving stops. By default it is 0, meaning it will stop once it has reached the same tile as the destination. If you're using something like walk_towards(Mob1,Mob2) though, you may want to have Min be something like 1, since chances are both mobs are dense so it couldn't reach the same tile normally, and you may want the mob to stop once next to the destination mob. You can also manually abort any walking function at any time, by calling something like walk(ref,0). |
And as for making it stop, it will do that automatically with both. If you read the Reference/F1 on the two functions, they both have a "target" arg, which is their "destination" argument for your case...
Format:
walk_to(Ref,Trg,Min=0,Lag=0)
Args:
Ref: A mob or obj.
Trg: An object on the map.
Min: The minimum distance between Ref and Trg before movement halts.
Lag: Delay in world 1/10 seconds between movement.
-----------------
Format:
walk_towards(Ref,Trg,Lag=0)
Args:
Ref: A mob or obj.
Trg: An object on the map.
Lag: Delay in 1/10 seconds between movement.