Jump to content
  • 0

Script npctalk without name


hakuren

Question


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

Hello guys

Is there any way that an npc talk without the npc name?

Edited by hakuren
Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Edit the script command in [src=trunk/src/map/script.c]

/*==========================================
* npctalk (sends message to surrounding area)
*------------------------------------------*/
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_message(&nd->bl, message);
}

return 0;
}

You could make it:

1. not announce the npc name at all

2. change 'npctalk' to accept a 2nd parameter to specify whether or not to show the NPC's name

Which do you want to do?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

The number 2 an script command npctalk2 "<message>" allow npc talk without name of the npc

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

  1. apply this diff patch:
    Index: src/map/script.c
    ===================================================================
    --- src/map/script.c	(revision 16195)
    +++ src/map/script.c	(working copy)
    @@ -12229,6 +12229,21 @@
    	return 0;
    }
    
    +BUILDIN_FUNC(npctalk2)
    +{
    +	const char* str;
    +
    +	struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
    +	str = script_getstr(st,2);
    +
    +	if(nd)
    +	{
    +		clif_message(&nd->bl, str);
    +	}
    +
    +	return 0;
    +}
    +
    // change npc walkspeed [Valaris]
    BUILDIN_FUNC(npcspeed)
    {
    @@ -16518,6 +16533,7 @@
    	BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr]
    	BUILDIN_DEF(message,"ss"), // [MouseJstr]
    	BUILDIN_DEF(npctalk,"s"), // [Valaris]
    +	BUILDIN_DEF(npctalk2,"s"),
    	BUILDIN_DEF(mobcount,"ss"),
    	BUILDIN_DEF(getlook,"i"),
    	BUILDIN_DEF(getsavepoint,"i"),
    


    http://rathena.kpaste.net/80ed0?raw

  2. save script.c
  3. recompile

Edited by Brian
fixed
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

sir i got error

src\map\script.c(12108): error C2065: 'message' : undeclared identifier

src\map\script.c(12108): warning C4047: '=' : 'int' differs in levels of indirection from 'const char *'

src\map\script.c(12112): error C2065: 'message' : undeclared identifier

src\map\script.c(12112): warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'

src\map\script.c(12112): warning C4024: 'clif_message' : different types for formal and actual parameter 2

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

hehe another error sorry to bother you sir i dont know what to do

src\map\script.c(12109): warning C4090: '=' : different 'const' qualifiers

src\map\script.c(12109): error C2106: '=' : left operand must be l-value

oops, sorry about that. I was missing a line

+	char message[256];

The beginning of that code block in trunk/src/map/script.c should look like:

BUILDIN_FUNC(npctalk2)
{
const char* str;
char message[256];

I also updated post #4 with the fix.

Edited by hakuren
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Sorry =[

I updated post #4, and this time I tested it.

poring_c01,100,100,0    script    test    910,{
   npctalk "hello";
   sleep 5000;
   npctalk2 "hello2";
}

6jge8i.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

post-631-0-06507900-1338534221_thumb.jpg

Sorry =[

I updated post #4, and this time I tested it.

poring_c01,100,100,0	script	test	910,{
npctalk "hello";
sleep 5000;
npctalk2 "hello2";
}

6jge8i.png

yeah it works now! i forgot to update the

+ struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);

+ message = script_getstr(st,2);

to

+ struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);

+ str = script_getstr(st,2);

prontera,150,150,5 script tqwe 974,{

npctalk2 "Hello";

end;

}

post-631-0-06507900-1338534221_thumb.jpg

thank you so much sir Brian

Edited by hakuren
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  251
  • Reputation:   20
  • Joined:  12/22/11
  • Last Seen:  

very nice :) ty brian

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...