prontera,148,191,5 script test_walk 100,{ end; OnInit: getmapxy .@map$, .@x, .@y, 1; callfunc "npcwalk", 100, // npc speed .@x, .@y, // starting point 148, 183, // 1st waypoint 156, 187, // 2nd waypoint 156, 179, // 3rd waypoint 164, 191, // 4th waypoint 164, 183; // 5th waypoint } function script npcwalk { npcspeed getarg(0); .@cnt = ( getargcount() -1 ) -2; while (1) { for ( .@i = 0; .@i < .@cnt; .@i += 2 ) { // announce ( .@i /2 ) +". I'm going to walk to ("+( .@i +3 )+")"+ getarg( .@i +3 ) +" ("+( .@i +4 )+")"+ getarg( .@i +4 ) +"["+ distance( getarg( .@i +1 ), getarg( .@i +2 ), getarg( .@i +3 ), getarg( .@i +4 ) ) * getarg(0) +"]", 0; npcwalkto getarg( .@i +3 ), getarg( .@i +4 ); // sleep distance( getarg( .@i +1 ), getarg( .@i +2 ), getarg( .@i +3 ), getarg( .@i +4 ) ) * getarg(0); sleep callfunc( "radius_distance", getarg( .@i +1 ), getarg( .@i +2 ), getarg( .@i +3 ), getarg( .@i +4 ) ) * getarg(0) + 200; } // announce ( .@i /2 ) +". I'm going to walk to (1)"+ getarg(1) +" (2)"+ getarg(2) +"["+ distance( getarg(1), getarg(2), getarg( getargcount() -2 ), getarg( getargcount() -1 ) ) * getarg(0) +"]", 0; npcwalkto getarg(1), getarg(2); // sleep distance( getarg(1), getarg(2), getarg( getargcount() -2 ), getarg( getargcount() -1 ) ) * getarg(0); sleep callfunc( "radius_distance", getarg(1), getarg(2), getarg( getargcount() -2 ), getarg( getargcount() -1 ) ) * getarg(0) + 200; } } function script radius_distance { .@x = callfunc( "F_abs", getarg(0)-getarg(2) ); .@y = callfunc( "F_abs", getarg(1)-getarg(3) ); .@min = ( .@x < .@y )? .@x : .@y; .@max = ( .@x > .@y )? .@x : .@y; if ( !.@min ) return .@max; return ( ( ( .@max << 8 ) + ( .@max << 3 ) - ( .@max << 4 ) - ( .@max << 1 ) + ( .@min << 7 ) - ( .@min << 5 ) + ( .@min << 3 ) - ( .@min << 1 ) ) >> 8 ); } function script F_abs { return sqrt( pow( getarg(0), 2 ) ); }