diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-23 17:54:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-23 18:01:39 +0300 |
commit | db2c1615ba8b2a679b81eec2c93d9d68e2c5edf8 (patch) | |
tree | 43fdcae29ba3d3c4300951290c284ef93bd8aa1e /src/map/script.c | |
parent | 28d7577356c78a625e2d2016068053325f5337e4 (diff) | |
download | plugin-db2c1615ba8b2a679b81eec2c93d9d68e2c5edf8.tar.gz plugin-db2c1615ba8b2a679b81eec2c93d9d68e2c5edf8.tar.bz2 plugin-db2c1615ba8b2a679b81eec2c93d9d68e2c5edf8.tar.xz plugin-db2c1615ba8b2a679b81eec2c93d9d68e2c5edf8.zip |
Impliment script command setnpcdir.
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c index ba75561..cca62c7 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -323,3 +323,35 @@ BUILDIN(getNpcDir) return true; } + +BUILDIN(setNpcDir) +{ + int newdir; + struct npc_data *nd = 0; + + if (script_hasdata(st, 3)) + { + nd = npc->name2id (script_getstr(st, 2)); + newdir = script_getnum(st, 3); + } + else if (script_hasdata(st, 2)) + { + if (!st->oid) + return false; + + nd = (struct npc_data *) map->id2bl (st->oid); + newdir = script_getnum(st, 2); + } + if (!nd) + return false; + + if (newdir < 0) + newdir = 0; + else if (newdir > 7) + newdir = 7; + + nd->dir = newdir; + npc->enable (nd->name, 1); + + return true; +} |