Index: src/map/script.c
===================================================================
--- src/map/script.c (revision 17307)
+++ src/map/script.c (working copy)
@@ -15372,17 +15372,13 @@
bl = map_id2bl(script_getnum(st,2));
if( bl == NULL )
- {
script_pushint(st, 0);
- }
- else if( script_hasdata(st,4) )
- {
+
+ if( script_hasdata(st,4) ) {
int x = script_getnum(st,3);
int y = script_getnum(st,4);
- script_pushint(st, unit_walktoxy(bl,x,y,0));// We'll use harder calculations.
- }
- else
- {
+ script_pushint(st, unit_walktoxy(bl,x,y,8));// We'll use harder calculations.
+ } else {
int map_id = script_getnum(st,3);
script_pushint(st, unit_walktobl(bl,map_id2bl(map_id),65025,1));
}
Index: src/map/unit.c
===================================================================
--- src/map/unit.c (revision 17307)
+++ src/map/unit.c (working copy)
@@ -312,6 +312,7 @@
//&1 -> 1/0 = easy/hard
//&2 -> force walking
//&4 -> Delay walking if the reason you can't walk is the canwalk delay
+//&8 -> Fix timer for script command unitwalk purposes
int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
{
struct unit_data* ud = NULL;
@@ -333,8 +334,8 @@
if( (battle_config.max_walk_path < wpd.path_len) && (bl->type != BL_NPC) )
return 0;
- if (flag&4 && DIFF_TICK(ud->canmove_tick, gettick()) > 0 &&
- DIFF_TICK(ud->canmove_tick, gettick()) < 2000)
+ if ((flag&8) || (flag&4 && DIFF_TICK(ud->canmove_tick, gettick()) > 0 &&
+ DIFF_TICK(ud->canmove_tick, gettick()) < 2000))
{ // Delay walking command. [Skotlex]
add_timer(ud->canmove_tick+1, unit_delay_walktoxy_timer, bl->id, (x<<16)|(y&0xFFFF));
return 1;