Adjusted the npctalk script command
* Now has an optional parameter of NPC name. - If supplied, it will display over that NPC's head, else it will use the attached NPC.
This commit is contained in:
parent
51ef9118a8
commit
cd5dbe28e4
@ -5984,11 +5984,13 @@ It is an approximation of official server script language's 'cmdothernpc'.
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*npctalk "<message>";
|
*npctalk "<message>"{,"<NPC name>"};
|
||||||
|
|
||||||
This command will display a message to the surrounding area as if the NPC object
|
This command will display a message to the surrounding area as if the NPC object
|
||||||
running it was a player talking - that is, above their head and in the chat
|
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.
|
window. The display name of the NPC won't get appended in front of the message.
|
||||||
|
If the <NPC name> option is given, then that NPC will display the message, else
|
||||||
|
the attached NPC will display the message.
|
||||||
|
|
||||||
// This will make everyone in the area see the NPC greet the character
|
// This will make everyone in the area see the NPC greet the character
|
||||||
// who just invoked it.
|
// who just invoked it.
|
||||||
|
@ -14280,10 +14280,14 @@ BUILDIN_FUNC(message)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
BUILDIN_FUNC(npctalk)
|
BUILDIN_FUNC(npctalk)
|
||||||
{
|
{
|
||||||
struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
|
struct npc_data* nd = NULL;
|
||||||
const char* str = script_getstr(st,2);
|
const char* str = script_getstr(st,2);
|
||||||
|
|
||||||
if (nd) {
|
if (script_hasdata(st, 3))
|
||||||
|
nd = npc_name2id(script_getstr(st, 3));
|
||||||
|
else
|
||||||
|
nd = (struct npc_data *)map_id2bl(st->oid);
|
||||||
|
if (nd != NULL) {
|
||||||
char message[256];
|
char message[256];
|
||||||
safesnprintf(message, sizeof(message), "%s", str);
|
safesnprintf(message, sizeof(message), "%s", str);
|
||||||
clif_disp_overhead(&nd->bl, message);
|
clif_disp_overhead(&nd->bl, message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user