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. ×

script: npctalk no show npc name


Helly

Recommended Posts


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  258
  • Reputation:   54
  • Joined:  01/09/12
  • Last Seen:  

Actual rA Emu is:

/*==========================================
 * npctalk (sends message to surrounding area)
 *------------------------------------------*/
BUILDIN_FUNC(npctalk)
{
	struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
	const char* str = script_getstr(st,2);

	if (nd) {
		char message[256];
		safesnprintf(message, sizeof(message), "%s", str);
		clif_disp_overhead(&nd->bl, message);
	}
	return SCRIPT_CMD_SUCCESS;
}

In game example Kafra npc: (No show the name of npc)

Hello wold!

 

 

Old rA emu:

BUILDIN_FUNC(npctalk)
{
	const char* str;
	char name[NAME_LENGTH], message[256];

	struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
	str = script_getstr(st,2);

	if(nd)
	{
		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 0;
}

In Game example Kafra npc: (this show name of npc)

Kafra : Hello world!

 

why this? is a error?

I try adding "%s : %s" in the actual script of npctalk but not work...

Edited by Namine210
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  258
  • Reputation:   54
  • Joined:  01/09/12
  • Last Seen:  

oh ok i understand now

thank you

Link to comment
Share on other sites

×
×
  • Create New...