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 <Atemo@users.noreply.github.com>
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Sader Fawall 2020-01-18 04:22:49 +02:00 committed by Aleos
parent bf9a3b47fe
commit fc1c05aee9
2 changed files with 9 additions and 5 deletions

View File

@ -6814,7 +6814,7 @@ as soon as the progress bar activates.
// //
--------------------------------------- ---------------------------------------
*announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}; *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>{,<char_id>}}}}}};
This command will broadcast a message to all or most players, similar to This command will broadcast a message to all or most players, similar to
@kami/@kamib GM commands. @kami/@kamib GM commands.
@ -6830,11 +6830,12 @@ Target flags:
- bc_all: Broadcast message is sent server-wide (default). - 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_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_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. You cannot use more than one target flag.
Source flags: 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 - 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 (useful when a player is not attached or the message should be sent to those
nearby the NPC). 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. // 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; 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 "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}}; *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};

View File

@ -11162,7 +11162,7 @@ BUILDIN_FUNC(announce)
}else{ }else{
struct map_session_data* sd; struct map_session_data* sd;
if( script_rid2sd(sd) ) if(script_charid2sd(9, sd))
bl = &sd->bl; bl = &sd->bl;
else else
bl = NULL; 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(attachnpctimer,"?"), // attached the player id to the npc timer [Celest]
BUILDIN_DEF(detachnpctimer,"?"), // detached the player id from 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(playerattached,""), // returns id of the current attached player. [Skotlex]
BUILDIN_DEF(announce,"si?????"), BUILDIN_DEF(announce,"si??????"),
BUILDIN_DEF(mapannounce,"ssi?????"), BUILDIN_DEF(mapannounce,"ssi?????"),
BUILDIN_DEF(areaannounce,"siiiisi?????"), BUILDIN_DEF(areaannounce,"siiiisi?????"),
BUILDIN_DEF(getusers,"i"), BUILDIN_DEF(getusers,"i"),