diff options
-rw-r--r-- | src/map/init.c | 1 | ||||
-rw-r--r-- | src/map/script.c | 16 | ||||
-rw-r--r-- | src/map/script.h | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c index e4c395c..acf6de5 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -83,6 +83,7 @@ HPExport void plugin_init (void) addScriptCommand("getmapmask", "s", getMapMask); addScriptCommand("getnpcclass", "*", getNpcClass); addScriptCommand("setnpcsex", "*", setNpcSex); + addScriptCommand("setnpcdistance", "i", setNpcDistance); addScriptCommand("setpcsit", "*", setPcSit); addScriptCommand("getpcsit", "*", getPcSit); diff --git a/src/map/script.c b/src/map/script.c index e7a3df4..51e5818 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24,8 +24,10 @@ #include "map/scriptdefines.h" #include "map/send.h" #include "map/data/mapd.h" +#include "map/data/npcd.h" #include "map/data/session.h" #include "map/struct/mapdext.h" +#include "map/struct/npcdext.h" #include "map/struct/sessionext.h" #include "map/utils/formatutils.h" @@ -648,3 +650,17 @@ BUILDIN(getPcSit) script_pushint(st, pc_issit (sd)); return true; } + +BUILDIN(setNpcDistance) +{ + struct npc_data *nd = (struct npc_data *) map->id2bl (st->oid); + if (!nd) + return false; + + struct NpcdExt *data = npcd_get(nd); + if (!data) + return false; + + data->areaSize = script_getnum(st, 2); + return true; +} diff --git a/src/map/script.h b/src/map/script.h index 88a0e1b..1af650f 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -30,5 +30,6 @@ BUILDIN(getNpcClass); BUILDIN(setNpcSex); BUILDIN(setPcSit); BUILDIN(getPcSit); +BUILDIN(setNpcDistance); #endif // EVOL_MAP_SCRIPT |