summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmistry <Equinox1991@gmail.com>2015-08-31 14:29:41 +0800
committerEmistry <Equinox1991@gmail.com>2015-08-31 14:29:41 +0800
commit4b1fad173be8b519fc27676d26c96b0f106cee11 (patch)
treed6aedc964f74ee27ba7a1b57dd2f3ac906022b5b /src
parentd6498f81cc40784337ae93957245176318a32cfe (diff)
downloadhercules-4b1fad173be8b519fc27676d26c96b0f106cee11.tar.gz
hercules-4b1fad173be8b519fc27676d26c96b0f106cee11.tar.bz2
hercules-4b1fad173be8b519fc27676d26c96b0f106cee11.tar.xz
hercules-4b1fad173be8b519fc27676d26c96b0f106cee11.zip
npctalk support extra npc name parameter.
The command will display the message on the NPC that name specified in the parameter. Useful in quest script that required a lot of different NPC to talk at the same time. Especially instances script.
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c
index efce0b986..23cf034b8 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13806,12 +13806,20 @@ BUILDIN(message) {
/*==========================================
* npctalk (sends message to surrounding area)
+ * usage: npctalk "<message>"{,"<npc name>"};
*------------------------------------------*/
BUILDIN(npctalk)
{
- struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
+ 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 = (struct npc_data *)map->id2bl(st->oid);
+ }
+
if (nd) {
char name[NAME_LENGTH], message[256];
safestrncpy(name, nd->name, sizeof(name));
@@ -20128,7 +20136,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr]
BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr]
BUILDIN_DEF(message,"ss"), // [MouseJstr]
- BUILDIN_DEF(npctalk,"s"), // [Valaris]
+ BUILDIN_DEF(npctalk,"s?"), // [Valaris]
BUILDIN_DEF(mobcount,"ss"),
BUILDIN_DEF(getlook,"i"),
BUILDIN_DEF(getsavepoint,"i"),