From 289365d08535bc626f700e9c7ac47fef5a2d3370 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 27 May 2017 11:57:52 -0400 Subject: allow to use specialeffect() on any unit, and to send to any player --- src/map/script.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/map/script.c b/src/map/script.c index 91f1d8cc9..5777ccb3e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14890,24 +14890,40 @@ BUILDIN(npcskilleffect) { *------------------------------------------*/ BUILDIN(specialeffect) { struct block_list *bl = NULL; - int type = script_getnum(st,2); - enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA; + int type = script_getnum(st, 2); + enum send_target target = AREA; - if (script_hasdata(st,4)) { - struct npc_data *nd = npc->name2id(script_getstr(st,4)); - if (nd != NULL) - bl = &nd->bl; + if (script_hasdata(st, 3)) { + target = script_getnum(st, 3); + } + + if (script_hasdata(st, 4)) { + if (script_isstringtype(st, 4)) { + struct npc_data *nd = npc->name2id(script_getstr(st, 4)); + if (nd != NULL) { + bl = &nd->bl; + } + } else { + bl = map->id2bl(script_getnum(st, 4)); + } } else { bl = map->id2bl(st->oid); } - if (bl == NULL) + if (bl == NULL) { return true; + } if (target == SELF) { - struct map_session_data *sd = script->rid2sd(st); - if (sd != NULL) + struct map_session_data *sd; + if (script_hasdata(st, 5)) { + sd = map->id2sd(script_getnum(st, 5)); + } else { + sd = script->rid2sd(st); + } + if (sd != NULL) { clif->specialeffect_single(bl, type, sd->fd); + } } else { clif->specialeffect(bl, type, target); } @@ -23579,7 +23595,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(petskillsupport,"viiii"), // [Skotlex] BUILDIN_DEF(skilleffect,"vi"), // skill effect [Celest] BUILDIN_DEF(npcskilleffect,"viii"), // npc skill effect [Valaris] - BUILDIN_DEF(specialeffect,"i??"), // npc skill effect [Valaris] + BUILDIN_DEF(specialeffect,"i???"), // npc skill effect [Valaris] BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[Valaris] BUILDIN_DEF(nude,""), // nude command [Valaris] BUILDIN_DEF(mapwarp,"ssii??"), // Added by RoVeRT -- cgit v1.2.3-70-g09d2 From 53c6feb18fb994516945901853d845cdc5e27529 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 3 Jun 2017 12:49:04 -0400 Subject: flag specialeffect2() as deprecated --- doc/script_commands.txt | 15 +++++++++------ src/map/script.c | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index c11ee29a9..a7eb55073 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -5857,13 +5857,16 @@ Example usage: *specialeffect2({, {, ""}}) + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + @ /!\ This command is deprecated @ + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + This command behaves identically to the specialeffect(), but the effect will be centered on the invoking character's sprite. - parameter will display on another Player -than the one currently attached to the script. Like with specialeffect(), -when specifying a player, must be supplied, specifying AREA -will retain the default behavior of the command. +This command is deprecated and it should not be used in new scripts, as it is +likely to be removed at a later time. Please use specialeffect instead, +ie: specialeffect(, , playerattached()) --------------------------------------- @@ -5963,7 +5966,7 @@ target in autobonus() and autobonus3()). //Grants a 1% chance of starting the state "all stats +10" for 10 seconds //when using weapon or misc attacks (both melee and ranged skills) and //shows a special effect when the bonus is active. - autobonus("{ bonus(bAllStats, 10); }", 10, 10000, BF_WEAPON|BF_MISC, "{ specialeffect2(EF_FIRESPLASHHIT); }"); + autobonus("{ bonus(bAllStats, 10); }", 10, 10000, BF_WEAPON|BF_MISC, "{ specialeffect(EF_FIRESPLASHHIT, AREA, playerattached()); }"); --------------------------------------- @@ -7766,7 +7769,7 @@ OnInit: bindatcmd("test", strnpcinfo(NPC_NAME_UNIQUE)+"::OnAtcommand"); end; OnAtcommand: - specialeffect2(EF_ANGEL2); + specialeffect(EF_ANGEL2, AREA, playerattached()); end; } diff --git a/src/map/script.c b/src/map/script.c index 5777ccb3e..7530082c1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -23596,7 +23596,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(skilleffect,"vi"), // skill effect [Celest] BUILDIN_DEF(npcskilleffect,"viii"), // npc skill effect [Valaris] BUILDIN_DEF(specialeffect,"i???"), // npc skill effect [Valaris] - BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[Valaris] + BUILDIN_DEF_DEPRECATED(specialeffect2,"i??"), // skill effect on players[Valaris] BUILDIN_DEF(nude,""), // nude command [Valaris] BUILDIN_DEF(mapwarp,"ssii??"), // Added by RoVeRT BUILDIN_DEF(atcommand,"s"), // [MouseJstr] -- cgit v1.2.3-70-g09d2 From 9913f13573d737b4c54c7cad23b77c6a940fe8f4 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 3 Jun 2017 12:52:53 -0400 Subject: flag misceffect() as deprecated --- doc/script_commands.txt | 9 +++++++-- src/map/script.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index a7eb55073..34089f767 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -7635,6 +7635,10 @@ without event labels. If specified name is not found, command does nothing. *misceffect() + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + @ /!\ This command is deprecated @ + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + This command, if run from an NPC object that has a sprite, will call up a specified effect number, centered on the NPC sprite. If the running code does not have an object ID (a 'floating' NPC) or is not running from an @@ -7643,8 +7647,9 @@ character who's RID got attached to the script, if any. For usable item scripts, this command will create an effect centered on the player using the item. -A full list of known effects is found in 'doc/effect_list.txt'. The list -of those that actually work may differ greatly between client versions. +This command is deprecated and it should not be used in new scripts, as it is +likely to be removed at a later time. Please use specialeffect instead, +ie: specialeffect(, , ) --------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 7530082c1..01bd4d9b5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -23580,7 +23580,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(getskilllist,""), BUILDIN_DEF(clearitem,""), BUILDIN_DEF(classchange,"ii?"), - BUILDIN_DEF(misceffect,"i"), + BUILDIN_DEF_DEPRECATED(misceffect,"i"), BUILDIN_DEF(playbgm,"s"), BUILDIN_DEF(playbgmall,"s?????"), BUILDIN_DEF(soundeffect,"si"), -- cgit v1.2.3-70-g09d2