diff options
author | Asheraf <acheraf1998@gmail.com> | 2019-05-26 08:19:59 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-02-09 20:52:57 +0100 |
commit | 89408e2401a3019c8cb1de0dab9f7e754c4dbfb4 (patch) | |
tree | 7f3c791463c85c2fa255832315951837b420b4b4 | |
parent | 28ae3af5455447a379320a83a32658e6e2c154b3 (diff) | |
download | hercules-89408e2401a3019c8cb1de0dab9f7e754c4dbfb4.tar.gz hercules-89408e2401a3019c8cb1de0dab9f7e754c4dbfb4.tar.bz2 hercules-89408e2401a3019c8cb1de0dab9f7e754c4dbfb4.tar.xz hercules-89408e2401a3019c8cb1de0dab9f7e754c4dbfb4.zip |
Add new script commands cloakonnpc/cloakoffnpc
-rw-r--r-- | doc/script_commands.txt | 12 | ||||
-rw-r--r-- | src/map/script.c | 52 |
2 files changed, 64 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 244de4c0c..b8f856877 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -7041,6 +7041,18 @@ NPCs talking while hidden then revealing... you can wonder around =P). --------------------------------------- +*cloakonnpc("<NPC object name>"{, <account_id>}) +*cloakoffnpc("<NPC object name>"{, <account_id>}) + +These commands are used to apply the cloaking effect on npcs +this is a visual effect only and it does NOT stop the player +from interacting with the npc. + +If an account_id is specified then the effect will only display to the given id, +otherwise it's displayed to the entire npc area. + +--------------------------------------- + *doevent("<NPC object name>::<event label>") This command will start a new execution thread in a specified NPC object diff --git a/src/map/script.c b/src/map/script.c index 1d5919d3b..557550be2 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12489,6 +12489,56 @@ static BUILDIN(hideonnpc) npc->enable(str,4); return true; } +/*========================================== + *------------------------------------------*/ +static BUILDIN(cloakonnpc) +{ + struct npc_data *nd = npc->name2id(script_getstr(st, 2)); + if (nd == NULL) { + ShowError("buildin_cloakonnpc: invalid npc name '%s'.\n", script_getstr(st, 2)); + return false; + } + + if (script_hasdata(st, 3)) { + struct map_session_data *sd = map->id2sd(script_getnum(st, 3)); + if (sd == NULL) + return false; + + uint32 val = nd->option; + nd->option |= OPTION_CLOAK; + clif->changeoption_target(&nd->bl, &sd->bl, SELF); + nd->option = val; + } else { + nd->option |= OPTION_CLOAK; + clif->changeoption(&nd->bl); + } + return true; +} +/*========================================== + *------------------------------------------*/ +static BUILDIN(cloakoffnpc) +{ + struct npc_data *nd = npc->name2id(script_getstr(st, 2)); + if (nd == NULL) { + ShowError("buildin_cloakoffnpc: invalid npc name '%s'.\n", script_getstr(st, 2)); + return false; + } + + if (script_hasdata(st, 3)) { + struct map_session_data *sd = map->id2sd(script_getnum(st, 3)); + if (sd == NULL) + return false; + + uint32 val = nd->option; + nd->option &= ~OPTION_CLOAK; + clif->changeoption_target(&nd->bl, &sd->bl, SELF); + nd->option = val; + } else { + nd->option &= ~OPTION_CLOAK; + clif->changeoption(&nd->bl); + } + return true; +} /* Starts a status effect on the target unit or on the attached player. * @@ -26672,6 +26722,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(disablenpc,"s"), BUILDIN_DEF(hideoffnpc,"s"), BUILDIN_DEF(hideonnpc,"s"), + BUILDIN_DEF(cloakonnpc,"s?"), + BUILDIN_DEF(cloakoffnpc,"s?"), BUILDIN_DEF(sc_start,"iii???"), BUILDIN_DEF2(sc_start,"sc_start2","iiii???"), BUILDIN_DEF2(sc_start,"sc_start4","iiiiii???"), |