summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-09-02 20:23:46 -0300
committerJesusaves <cpntb1@ymail.com>2020-09-02 20:23:46 -0300
commit509db24d2aebea63162bd3699275015f1c92cb7a (patch)
tree18faa61479e1979c0aa6808cd7c0d6ce59093ddc
parent981c4a67825790a2fb2e1bf22242c6efe4e65967 (diff)
downloadplugin-509db24d2aebea63162bd3699275015f1c92cb7a.tar.gz
plugin-509db24d2aebea63162bd3699275015f1c92cb7a.tar.bz2
plugin-509db24d2aebea63162bd3699275015f1c92cb7a.tar.xz
plugin-509db24d2aebea63162bd3699275015f1c92cb7a.zip
Accept optional param - NPC NAME - on npcwalkto() script function
-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)
{