diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-29 18:51:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-29 18:51:58 +0300 |
commit | 3c4e409e9080783ecc01d93aa53ddf04f6f93ff0 (patch) | |
tree | 1e41f38a02a616979ac99c11a96529e3c1bc8402 | |
parent | c4d320e72a4060408c97a0207e9b82433cec9418 (diff) | |
download | evol-hercules-3c4e409e9080783ecc01d93aa53ddf04f6f93ff0.tar.gz evol-hercules-3c4e409e9080783ecc01d93aa53ddf04f6f93ff0.tar.bz2 evol-hercules-3c4e409e9080783ecc01d93aa53ddf04f6f93ff0.tar.xz evol-hercules-3c4e409e9080783ecc01d93aa53ddf04f6f93ff0.zip |
Add script command for control npc avatar.
New script commands:
showavatar [id] - show or hide avatar.
setavatardir - set avatar direction.
setavataraction - set avatar action.
-rw-r--r-- | src/map/init.c | 3 | ||||
-rw-r--r-- | src/map/script.c | 29 | ||||
-rw-r--r-- | src/map/script.h | 3 |
3 files changed, 35 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c index acf6de5..22e7142 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -86,6 +86,9 @@ HPExport void plugin_init (void) addScriptCommand("setnpcdistance", "i", setNpcDistance); addScriptCommand("setpcsit", "*", setPcSit); addScriptCommand("getpcsit", "*", getPcSit); + addScriptCommand("showavatar", "*", showAvatar); + addScriptCommand("setavatardir", "i", setAvatarDir); + addScriptCommand("setavataraction", "i", setAvatarAction); do_init_langs(); diff --git a/src/map/script.c b/src/map/script.c index 51e5818..12902ac 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -664,3 +664,32 @@ BUILDIN(setNpcDistance) data->areaSize = script_getnum(st, 2); return true; } + +BUILDIN(showAvatar) +{ + int id = 0; + if (script_hasdata(st, 2)) + id = script_getnum(st, 2); + + send_npccommand2(script->rid2sd (st), st->oid, 6, id, 0, 0); + return true; +} + +BUILDIN(setAvatarDir) +{ + int newdir = script_getnum(st, 2); + + if (newdir < 0) + newdir = 0; + else if (newdir > 7) + newdir = 7; + + send_npccommand2(script->rid2sd (st), st->oid, 7, newdir, 0, 0); + return true; +} + +BUILDIN(setAvatarAction) +{ + send_npccommand2(script->rid2sd (st), st->oid, 8, script_getnum(st, 2), 0, 0); + return true; +} diff --git a/src/map/script.h b/src/map/script.h index 1af650f..5993e37 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -31,5 +31,8 @@ BUILDIN(setNpcSex); BUILDIN(setPcSit); BUILDIN(getPcSit); BUILDIN(setNpcDistance); +BUILDIN(showAvatar); +BUILDIN(setAvatarDir); +BUILDIN(setAvatarAction); #endif // EVOL_MAP_SCRIPT |