From fc1c05aee992f467477c487a89e18120ec72d08d Mon Sep 17 00:00:00 2001 From: Sader Fawall Date: Sat, 18 Jan 2020 04:22:49 +0200 Subject: [PATCH] Announce Accept Char id (#4203) Adjusted script command announce to accept charID * Fixes #3901. * Script command announce will now accept a character ID to display locally. Thanks to @sader1992! Co-authored-by: Atemo Co-authored-by: Lemongrass3110 --- doc/script_commands.txt | 10 +++++++--- src/map/script.cpp | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 83deab0f5f..ba014be835 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -6814,7 +6814,7 @@ as soon as the progress bar activates. // --------------------------------------- -*announce "",{,{,{,{,{,}}}}}; +*announce "",{,{,{,{,{,{,}}}}}}; This command will broadcast a message to all or most players, similar to @kami/@kamib GM commands. @@ -6830,11 +6830,12 @@ Target flags: - bc_all: Broadcast message is sent server-wide (default). - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below). - bc_area: Message is sent to players in the vicinity of the source. -- bc_self: Message is sent only to current player. +- bc_self: Message is sent only to current player , if the source flag is bc_pc it also can + be used to send the Message to the character id if it's provided. You cannot use more than one target flag. Source flags: -- bc_pc: Broadcast source is the attached player (default). +- bc_pc: Broadcast source is the attached player or the character id if it's provided (default). - bc_npc: Broadcast source is the NPC, not the player attached to the script (useful when a player is not attached or the message should be sent to those nearby the NPC). @@ -6871,6 +6872,9 @@ but it can be used instead in NPCs to "preview" an announce. // This will be shown on everyones screen that is in sight of the NPC. announce "This is my message just for you people here",bc_npc|bc_area; + // This will be a private message to the player with character id 150000 + announce "This is my message just for char id 150000",bc_self,0xFFF618,FW_NORMAL,12,0,0,150000; + --------------------------------------- *mapannounce "","",{,{,{,{,{,}}}}}}; diff --git a/src/map/script.cpp b/src/map/script.cpp index 7a5dcf2c98..6ef7bb2937 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -11162,7 +11162,7 @@ BUILDIN_FUNC(announce) }else{ struct map_session_data* sd; - if( script_rid2sd(sd) ) + if(script_charid2sd(9, sd)) bl = &sd->bl; else bl = NULL; @@ -24705,7 +24705,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(attachnpctimer,"?"), // attached the player id to the npc timer [Celest] BUILDIN_DEF(detachnpctimer,"?"), // detached the player id from the npc timer [Celest] BUILDIN_DEF(playerattached,""), // returns id of the current attached player. [Skotlex] - BUILDIN_DEF(announce,"si?????"), + BUILDIN_DEF(announce,"si??????"), BUILDIN_DEF(mapannounce,"ssi?????"), BUILDIN_DEF(areaannounce,"siiiisi?????"), BUILDIN_DEF(getusers,"i"),