From 4b1fad173be8b519fc27676d26c96b0f106cee11 Mon Sep 17 00:00:00 2001 From: Emistry Date: Mon, 31 Aug 2015 14:29:41 +0800 Subject: 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. --- src/map/script.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/map') 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 ""{,""}; *------------------------------------------*/ 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"), -- cgit v1.2.3-70-g09d2