Jump to content
The forums will be going offline for an extended maintenance period at 1400hrs GMT on 19th June 2025. The number of hours for this downtime is intentionally not advertised due to the nature of these upgrades. ×

npctalk script command like in herc


iubantot

Recommended Posts


  • Group:  Members
  • Topic Count:  118
  • Topics Per Day:  0.03
  • Content Count:  314
  • Reputation:   35
  • Joined:  10/15/12
  • Last Seen:  

/*==========================================
 * 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";
 
---------------------------------------

 

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  588
  • Reputation:   439
  • Joined:  01/26/16
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  118
  • Topics Per Day:  0.03
  • Content Count:  314
  • Reputation:   35
  • Joined:  10/15/12
  • Last Seen:  

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 :))

Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  118
  • Topics Per Day:  0.03
  • Content Count:  314
  • Reputation:   35
  • Joined:  10/15/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   73
  • Joined:  10/20/12
  • Last Seen:  

*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
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  588
  • Reputation:   439
  • Joined:  01/26/16
  • Last Seen:  

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
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Developer
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  547
  • Reputation:   270
  • Joined:  11/08/11
  • Last Seen:  

Implemented in cd5dbe2

Link to comment
Share on other sites

×
×
  • Create New...