summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 94a991d06..e1d26e731 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -15594,7 +15594,7 @@ BUILDIN(npctalk)
} else {
safesnprintf(message, sizeof(message), "%s", str);
}
- clif->disp_overhead(&nd->bl, message);
+ clif->disp_overhead(&nd->bl, message, AREA_CHAT_WOC, NULL);
}
return true;
@@ -20117,12 +20117,13 @@ BUILDIN(unitstop) {
/// Makes the unit say the message
///
-/// unittalk(<unit_id>,"<message>"{, show_name});
+/// unittalk(<unit_id>,"<message>"{, show_name{, <send_target>{, <target_id>}}});
BUILDIN(unittalk) {
int unit_id;
const char* message;
- struct block_list* bl;
+ struct block_list *bl, *target_bl = NULL;
bool show_name = true;
+ enum send_target target = AREA_CHAT_WOC;
unit_id = script_getnum(st,2);
message = script_getstr(st, 3);
@@ -20131,6 +20132,14 @@ BUILDIN(unittalk) {
show_name = (script_getnum(st, 4) != 0) ? true : false;
}
+ if (script_hasdata(st, 5)) {
+ target = script_getnum(st, 5);
+ }
+
+ if (script_hasdata(st, 6)) {
+ target_bl = map->id2bl(script_getnum(st, 6));
+ }
+
bl = map->id2bl(unit_id);
if( bl != NULL ) {
struct StringBuf sbuf;
@@ -20144,7 +20153,12 @@ BUILDIN(unittalk) {
} else {
StrBuf->Printf(&sbuf, "%s", message);
}
- clif->disp_overhead(bl, StrBuf->Value(&sbuf));
+
+ if (bl->type == BL_PC && target == SELF && (target_bl == NULL || bl == target_bl)) {
+ clif->notify_playerchat(bl, StrBuf->Value(&sbuf));
+ } else {
+ clif->disp_overhead(bl, StrBuf->Value(&sbuf), target, target_bl);
+ }
StrBuf->Destroy(&sbuf);
}
@@ -24789,7 +24803,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(unitwarp,"isii"),
BUILDIN_DEF(unitattack,"iv?"),
BUILDIN_DEF(unitstop,"i"),
- BUILDIN_DEF(unittalk,"is?"),
+ BUILDIN_DEF(unittalk,"is???"),
BUILDIN_DEF(unitemote,"ii"),
BUILDIN_DEF(unitskilluseid,"ivi?"), // originally by Qamera [Celest]
BUILDIN_DEF(unitskillusepos,"iviii"), // [Celest]