From c3829e354358f9ed972cfd4642805b191ceaebb6 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 9 Apr 2021 16:26:10 -0300 Subject: This should fix PC distance bug --- npc/functions/default_npc_checks.txt | 10 ++-------- npc/functions/main.txt | 5 +++++ 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("", , "::") function script maptimer { -- cgit v1.2.3-60-g2f50