summaryrefslogtreecommitdiff
path: root/src/emap
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap')
-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)
{