Jump to content

Recommended Posts

Posted
/*==========================================
 * npctalk (sends message to surrounding area)
 * usage: npctalk "<message>"{,"<npc name>"};
 *------------------------------------------*/
BUILDIN(npctalk)
{
	struct npc_data* nd;
	const char *str = script_getstr(st,2);

	if (script_hasdata(st, 3)) {
		nd = npc->name2id(script_getstr(st, 3));
	} else {
		nd = map->id2nd(st->oid);
	}

	if (nd != NULL) {
		char name[NAME_LENGTH], message[256];
		safestrncpy(name, nd->name, sizeof(name));
		strtok(name, "#"); // discard extra name identifier if present
		safesnprintf(message, sizeof(message), "%s : %s", name, str);
		clif->disp_overhead(&nd->bl, message);
	}

	return true;
}

How about implementing this on rathena?

 

 

---------------------------------------

 
*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 will get appended in front of 
the message to complete the effect.
 
// This will make everyone in the area see the NPC greet the character
// who just invoked it.
npctalk "Hello "+strcharinfo(0)+", how are you?";
npctalk "Hello "+strcharinfo(0)+", how are you?","Another_NPC_Name";
 
---------------------------------------

 

Posted

We do have the command. However I don't think we support the additional "<npc name>" parameter.

Posted

We do have the command. However I don't think we support the additional "<npc name>" parameter.

 

 

i guess it's easier to make a dialogue for instance when there is a <npc name> parameter. 

i hope they will add this sometime :))

  • 2 months later...
Posted

can we expand our npctalk like in herc?

//from herc
*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 will get appended in front of 
the message to complete the effect.

	// This will make everyone in the area see the NPC greet the character
	// who just invoked it.
	npctalk "Hello "+strcharinfo(0)+", how are you?";
	npctalk "Hello "+strcharinfo(0)+", how are you?","Another_NPC_Name";

source : https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt

 

i think this is very useful in making instance scripts

Posted (edited)
*npctalk "<message>";

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.

    // This will make everyone in the area see the NPC greet the character

    // who just invoked it.

    npctalk "Hello "+strcharinfo(0)+", how are you?";

 

 

So simply use it like:

npctalk "MyCoolNPCName: ...";

 

Edit:

Just realized that I didn't understand the request. Sorry for that.

Edited by Jey
Posted

For further reference:

 

You can use this regular expression in Find and Replace (Regex mode) function of Notepad++ to easily convert Herc scripts.

 

Find : npctalk "(.+)",(.+);

Replace with : npctalk $2 + " :  $1";

 

There might be some calls which are not covered by this regex, such as calls with no string literals. Anyways, this should speed you up :)

  • Upvote 1
  • 2 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...