summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-09-03 00:09:37 +0000
committerJesusaves <cpntb1@ymail.com>2020-09-03 00:09:37 +0000
commit7fc3f47e2660ae5b88a4dcdc1c1ca2e6f41ecd9e (patch)
tree18faa61479e1979c0aa6808cd7c0d6ce59093ddc
parent981c4a67825790a2fb2e1bf22242c6efe4e65967 (diff)
parent509db24d2aebea63162bd3699275015f1c92cb7a (diff)
downloadplugin-7fc3f47e2660ae5b88a4dcdc1c1ca2e6f41ecd9e.tar.gz
plugin-7fc3f47e2660ae5b88a4dcdc1c1ca2e6f41ecd9e.tar.bz2
plugin-7fc3f47e2660ae5b88a4dcdc1c1ca2e6f41ecd9e.tar.xz
plugin-7fc3f47e2660ae5b88a4dcdc1c1ca2e6f41ecd9e.zip
Merge branch 'jesusalva/walktofix' into 'master'
Extends npcwalkto() to accept optional NPC name See merge request evol/evol-hercules!28
-rw-r--r--src/emap/init.c2
-rw-r--r--src/emap/script_buildins.c14
2 files changed, 14 insertions, 2 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index b663268..f2e781a 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -156,7 +156,7 @@ HPExport void plugin_init (void)
addScriptCommand("setnpcdir", "*", setNpcDir);
addScriptCommand("npcsit", "*", npcSit);
addScriptCommand("npcstand", "*", npcStand);
- addScriptCommand("npcwalkto", "ii", npcWalkTo);
+ addScriptCommand("npcwalkto", "ii?", npcWalkTo);
addScriptCommand("rif", "is*", rif);
addScriptCommand("setmapmask", "si", setMapMask);
addScriptCommand("sendmapmask", "i*", sendMapMask);
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 553e8b1..85e81b2 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -1463,11 +1463,23 @@ BUILDIN(npcStand)
BUILDIN(npcWalkTo)
{
- struct npc_data *nd = map->id2nd(st->oid);
+ struct npc_data *nd = NULL;
int x = 0, y = 0;
x = script_getnum(st, 2);
y = script_getnum(st, 3);
+ if (script_hasdata(st, 4) && script_isstringtype(st, 4))
+ {
+ nd = npc->name2id(script_getstr(st, 4));
+ }
+ else if (script_hasdata(st, 4))
+ {
+ nd = map->id2nd(script_getnum(st, 4));
+ }
+ else
+ {
+ nd = map->id2nd(st->oid);
+ }
if (nd)
{