Skip to content

Commit

Permalink
Adjusted the npctalk script command
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
aleos89 committed Aug 29, 2016
1 parent 51ef911 commit cd5dbe2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion doc/script_commands.txt
Expand Up @@ -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
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 <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
// who just invoked it.
Expand Down
8 changes: 6 additions & 2 deletions src/map/script.c
Expand Up @@ -14280,10 +14280,14 @@ BUILDIN_FUNC(message)
*------------------------------------------*/
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);

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];
safesnprintf(message, sizeof(message), "%s", str);
clif_disp_overhead(&nd->bl, message);
Expand Down

1 comment on commit cd5dbe2

@iubantot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at last after being rejected for so many times <3 heart heart ill be releasing some instance scripts!

Please sign in to comment.