diff options
author | mekolat <mekolat@users.noreply.github.com> | 2015-05-23 10:17:10 -0400 |
---|---|---|
committer | mekolat <mekolat@users.noreply.github.com> | 2015-06-20 06:49:37 -0400 |
commit | ef9eb6bde90ec1d9d175b6481935cb3bd67d6c6c (patch) | |
tree | 2deb6c5804f9dae3157848f775e9a2ed233d3db0 /src/map/script-fun.cpp | |
parent | db20d783fe41bb9b44b92461f9843a31146a5ce7 (diff) | |
download | tmwa-ef9eb6bde90ec1d9d175b6481935cb3bd67d6c6c.tar.gz tmwa-ef9eb6bde90ec1d9d175b6481935cb3bd67d6c6c.tar.bz2 tmwa-ef9eb6bde90ec1d9d175b6481935cb3bd67d6c6c.tar.xz tmwa-ef9eb6bde90ec1d9d175b6481935cb3bd67d6c6c.zip |
add clif_message_towards
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r-- | src/map/script-fun.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 0d19770..2b72fc4 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -2713,13 +2713,24 @@ void builtin_music(ScriptState *st) static void builtin_npctalk(ScriptState *st) { - dumb_ptr<npc_data> nd = map_id_is_npc(st->oid); - RString str = conv_str(st, &AARG(0)); + dumb_ptr<npc_data> nd; + RString str = conv_str(st, &AARG(1)); - if (nd) - { - clif_message(nd, str); + dumb_ptr<npc_data> nd_ = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARG(0))))); + assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT); + nd = nd_->is_script(); + + + if(HARG(2)){ + CharName player = stringish<CharName>(ZString(conv_str(st, &AARG(2)))); + dumb_ptr<map_session_data> pl_sd = map_nick2sd(player); + if (pl_sd == nullptr) + return; + clif_message_towards(pl_sd, nd, str); } + + else + clif_message(nd, str); } /*========================================== @@ -3174,7 +3185,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(npcwarp, "xys"_s, '\0'), BUILTIN(npcareawarp, "xyxyis"_s, '\0'), BUILTIN(message, "Ps"_s, '\0'), - BUILTIN(npctalk, "s"_s, '\0'), + BUILTIN(npctalk, "ss?"_s, '\0'), BUILTIN(title, "s"_s, '\0'), BUILTIN(music, "s"_s, '\0'), BUILTIN(getlook, "i"_s, 'i'), |