diff options
Diffstat (limited to 'npc/functions')
-rw-r--r-- | npc/functions/util.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 953b5f21f..1558fb4b7 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -120,3 +120,19 @@ function script nard_time { return INT_MAX; } +// Determines if player is still in range. +// eg. +// if (reachable(.x, .y, .distance)) { +function script reachable { + .@x=getarg(0); + .@y=getarg(1); + .@z=getarg(2); + getmapxy(.@mp$, .@xp, .@yp, 0); + + if (distance(.@x, .@y, .@xp, .@yp) <= .@z) + return 1; + else + return 0; +} + + |