summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-04-09 16:26:10 -0300
committerJesusaves <cpntb1@ymail.com>2021-04-09 16:26:10 -0300
commitc3829e354358f9ed972cfd4642805b191ceaebb6 (patch)
treeb9b24b183ea3d1fda7681d3cefe360be008e6a89
parentb8ac7c7b4b86b0debd229ad29cec48e945b7a098 (diff)
downloadserverdata-c3829e354358f9ed972cfd4642805b191ceaebb6.tar.gz
serverdata-c3829e354358f9ed972cfd4642805b191ceaebb6.tar.bz2
serverdata-c3829e354358f9ed972cfd4642805b191ceaebb6.tar.xz
serverdata-c3829e354358f9ed972cfd4642805b191ceaebb6.zip
This should fix PC distance bug
-rwxr-xr-xnpc/functions/default_npc_checks.txt10
-rw-r--r--npc/functions/main.txt5
2 files changed, 7 insertions, 8 deletions
diff --git a/npc/functions/default_npc_checks.txt b/npc/functions/default_npc_checks.txt
index b08bb9c3..0cc6e643 100755
--- a/npc/functions/default_npc_checks.txt
+++ b/npc/functions/default_npc_checks.txt
@@ -1,16 +1,10 @@
function script PCtoNPCRange {
@npc_check = 0;
- @Nmap$ = strnpcinfo(3);
if(!@npc_distance) set @npc_distance, 4; // <== default distance
- if(@npc_distance == (1-2)) set @npc_distance, ATTACKRANGE;
+ if(@npc_distance < 0) set @npc_distance, ATTACKRANGE;
cleararray @npc_loc, 0, 3;
- setarray @npc_loc, getnpcx(), getnpcy(), @npc_distance;
- @Nx1 = (@npc_loc[0] - @npc_loc[2]);
- @Ny1 = (@npc_loc[1] - @npc_loc[2]);
- @Nx2 = (@npc_loc[0] + @npc_loc[2]);
- @Ny2 = (@npc_loc[1] + @npc_loc[2]);
- if (isin(@Nmap$, @Nx1, @Ny1, @Nx2, @Ny2))
+ if (!isin(getmap(), .x, .y, @npc_distance))
goto L_Return;
@npc_check = 1;
if(@distance_handler) goto L_Return;
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index 89b2cff7..ab7dac8e 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -555,6 +555,11 @@ function script if_then_else {
return (getarg(0) ? getarg(1) : getarg(2));
}
+function script misceffect {
+ // or SELF + something
+ return specialeffect(getarg(0), AREA, getarg(1, strnpcinfo(0));
+}
+
//////////////////////////////////////////////////////////////////////
// maptimer("<map>", <tick>, "<npc>::<event>")
function script maptimer {