PDA

View Full Version : move options


Chompy
10-22-2006, 03:17 PM
Anyone could tell me the options for move command?
can't find them on the wiki :confused:

Gambet
10-22-2006, 04:54 PM
move(dx,dy,time,options);

The value of "options" would be something like this:
(0,1,2)+(0,4)+(0,8)+(0,16);

This moves the npc without needing you to update the
position of the npc 'manually' by changing x and y. - Moves the NPC the specified distance over the specified time, with some lame options.
- cachingmode:
- 0: previous movements will be finished immediatelly
- 1: movements will be cached, the previous movements
will only be finished when the cache is too large
(distance to go >5);
this caching can be used on server-side npcs to
make the movement look like non-laggy even when
there are little delays sometimes
- 2: the movement will just be appended to the movement
list; you can add up to 100 movements
- blockcheck: add 4 to the options when you want the
npc to stop when there is a wall blocking the npc
- informmewhendone: if you add 8 to the options then the
script will be called with a 'movementfinished' flag
when the the npc has stopped walking; catch this event
with
if (movementfinished) {...}
if you want to do something when the npc has stopped
(e.g. walking in a different direction)
- applydirection: add 16 to the options if you want the
game to automatically set the direction of the npc
depending on the movement direction (can be good
when using movement caching)



^^

Chompy
10-22-2006, 05:03 PM
Thanks :D ^^

Hmm, when I apply 8 to the cache, how to call the
if (movementfinished){...}?
function onMovementfinished() {...}?

and, anyone know hwo to calculate the speed to go to one distance,
like if I add 2 to the time, it will use 2 secs to the gived coords,
is it possible to make it use the same speed to an coordinate?

and again Gambet, Thanks ^^

Admins
10-25-2006, 12:10 AM
onMovementfinished() should work yes.
When you have dx, dy, tilespersecond:

dist = (dx^2 + dy^2)^0.5;
move(dx, dy, dist/tilespersecond, flags);


BTW body island ?

KuJi
10-25-2006, 12:12 AM
What are the flags? =?

Chompy
10-25-2006, 06:22 PM
onMovementfinished() should work yes.
When you have dx, dy, tilespersecond:

dist = (dx^2 + dy^2)^0.5;
move(dx, dy, dist/tilespersecond, flags);


BTW body island ?


Thanks, and.. uhm :blush:

Chompy
10-25-2006, 09:59 PM
Sorry too double post, but I just made an
baddy with this stuff with like 0.03218 % lag :D

First working baddy I've made :D