hakuren Posted June 1, 2012 Group: Members Topic Count: 120 Topics Per Day: 0.03 Content Count: 295 Reputation: 6 Joined: 12/02/11 Last Seen: November 6, 2023 Share Posted June 1, 2012 (edited) Hello guys Is there any way that an npc talk without the npc name? Edited June 1, 2012 by hakuren Quote Link to comment Share on other sites More sharing options...
Brian Posted June 1, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted June 1, 2012 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? Quote Link to comment Share on other sites More sharing options...
hakuren Posted June 1, 2012 Group: Members Topic Count: 120 Topics Per Day: 0.03 Content Count: 295 Reputation: 6 Joined: 12/02/11 Last Seen: November 6, 2023 Author Share Posted June 1, 2012 The number 2 an script command npctalk2 "<message>" allow npc talk without name of the npc Quote Link to comment Share on other sites More sharing options...
Brian Posted June 1, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted June 1, 2012 (edited) 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 save script.c recompile Edited June 1, 2012 by Brian fixed Quote Link to comment Share on other sites More sharing options...
hakuren Posted June 1, 2012 Group: Members Topic Count: 120 Topics Per Day: 0.03 Content Count: 295 Reputation: 6 Joined: 12/02/11 Last Seen: November 6, 2023 Author Share Posted June 1, 2012 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 Quote Link to comment Share on other sites More sharing options...
hakuren Posted June 1, 2012 Group: Members Topic Count: 120 Topics Per Day: 0.03 Content Count: 295 Reputation: 6 Joined: 12/02/11 Last Seen: November 6, 2023 Author Share Posted June 1, 2012 (edited) 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 June 1, 2012 by hakuren Quote Link to comment Share on other sites More sharing options...
Brian Posted June 1, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted June 1, 2012 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"; } Quote Link to comment Share on other sites More sharing options...
hakuren Posted June 1, 2012 Group: Members Topic Count: 120 Topics Per Day: 0.03 Content Count: 295 Reputation: 6 Joined: 12/02/11 Last Seen: November 6, 2023 Author Share Posted June 1, 2012 (edited) 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"; } 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; } thank you so much sir Brian Edited June 1, 2012 by hakuren Quote Link to comment Share on other sites More sharing options...
java Posted June 14, 2012 Group: Members Topic Count: 25 Topics Per Day: 0.01 Content Count: 251 Reputation: 20 Joined: 12/22/11 Last Seen: July 23, 2023 Share Posted June 14, 2012 very nice ty brian Quote Link to comment Share on other sites More sharing options...
Question
hakuren
Hello guys
Is there any way that an npc talk without the npc name?
Edited by hakurenLink to comment
Share on other sites
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.