Where my erro? I want the NPC only run if the player is a minimum 3 cells away. But regardless of the distance he always call the function.
- script Ore Mine:
remine 844,{
.@number = 1;
getmapxy .@map1$, .@x1, .@y1, 0;
getmapxy .@map2$, .@x2, .@y2, 0;
set h_run$, strnpcinfo(0);
if ( .@map1$ == .@map2$ && distance(.@x1,.@y1,.@x2,.@y2) <= 3 ) {
if ( h_run$ == strnpcinfo(0) ) { callfunc("StartMining",.@number); set h_run$, ""; }
}
else { mes "Far Away"; close;}
}
- script Ore Mine:
.@number = 1;
getmapxy .@map1$, .@x1, .@y1, 0;
getmapxy .@map2$, .@x2, .@y2, 0;
set h_run$, strnpcinfo(0);
if ( .@map1$ == .@map2$ && distance(.@x1,.@y1,.@x2,.@y2) <= 3 ) {
if ( h_run$ == strnpcinfo(0) ) { callfunc("StartMining",.@number); set h_run$, ""; }
}
else { mes "Far Away"; close;}
}