ID:168291
 
How do I control everything a NPC hears. Say if I say "Hi" and the NPC is in the range, how can I control everything it hears. Can I use Topic(), if so how?
You can't using Topic, because Topic() is used to control stuff you click in a BYOND game.

If you want to control what they hear when you use the output operator (<<) then you can't, but you can keep track of something you call yourself. A way to do this is to define a proc for atoms to hear something.

proc
output(atom/A, t, mob/B = usr)
A.hear(t, B)


atom
proc/hear(t, mob/M) // M is the potential "hearer"
src << t
src.hreact(t, M)
proc/hreact(t, mob/M)

mob
verb/say(t as text)
for(var/mob/M in view(src))
output(M, t, src)

obj/npc
hreact(t, mob/M)
if(cKey(t) == "hello")
for(var/mob/A in view(src))
A.hear("Hi, [M.name]", src)


This is a small example on how you can do a "hearing" system. It might not be the best system I can think of now, since it's late at night, so you can build off of this.

~~> Unknown Person
In response to Unknown Person
Thx alot.