Sign in to follow this  
Helly

script: npctalk no show npc name

Recommended Posts

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

Share this post


Link to post
Share on other sites
Sign in to follow this