diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 49bae2d921..60fd044798 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -6596,13 +6596,14 @@ Returns true if the command was executed on the other NPC successfully, false if --------------------------------------- -*npctalk ""{,"",""}; +*npctalk ""{,"",{,}}; This command will display a message as if the NPC object running it was a player talking - that is, above their head and in the chat window. The display name of the NPC won't get appended in front of the message. If the option is given and not empty, then that NPC will display the message, -else the attached NPC will display the message. +else the attached NPC will display the message, +the color format is in RGB (0xRRGGBB). The color is White by default. Target for : - bc_all : Broadcast message is sent server-wide (only in the chat window). diff --git a/src/map/script.cpp b/src/map/script.cpp index 8b5ebd683e..7ff47a67fd 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -15048,12 +15048,16 @@ BUILDIN_FUNC(npctalk) { struct npc_data* nd = NULL; const char* str = script_getstr(st,2); + int color = 0xFFFFFF; if (script_hasdata(st, 3) && strlen(script_getstr(st,3)) > 0) nd = npc_name2id(script_getstr(st, 3)); else nd = (struct npc_data *)map_id2bl(st->oid); + if (script_hasdata(st, 5)) + color = script_getnum(st, 5); + if (nd != NULL) { send_target target = AREA; char message[CHAT_SIZE_MAX]; @@ -15069,12 +15073,12 @@ BUILDIN_FUNC(npctalk) } safesnprintf(message, sizeof(message), "%s", str); if (target != SELF) - clif_messagecolor(&nd->bl, color_table[COLOR_WHITE], message, false, target); + clif_messagecolor(&nd->bl, color, message, true, target); else { TBL_PC *sd = map_id2sd(st->rid); if (sd == NULL) return SCRIPT_CMD_FAILURE; - clif_messagecolor_target(&nd->bl, color_table[COLOR_WHITE], message, false, target, sd); + clif_messagecolor_target(&nd->bl, color, message, true, target, sd); } } return SCRIPT_CMD_SUCCESS; @@ -24950,7 +24954,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr] BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr] BUILDIN_DEF(message,"ss"), // [MouseJstr] - BUILDIN_DEF(npctalk,"s??"), // [Valaris] + BUILDIN_DEF(npctalk,"s???"), // [Valaris] BUILDIN_DEF(chatmes,"s?"), // [Jey] BUILDIN_DEF(mobcount,"ss"), BUILDIN_DEF(getlook,"i?"),