GetObjectHeard(object, object)

From NWN Lexicon
Jump to: navigation, search

Determines if an object can hear another object.

int GetObjectHeard(
    object oTarget,
    object oSource = OBJECT_SELF


The object that may be heard.
The object that is doing the listening (Default: OBJECT_SELF)


Determines whether oSource hears oTarget. Returns TRUE if oSource hears oTarget, FALSE otherwise. If oTarget is a placeable object, this function always returns FALSE.


Only creatures are valid for oTarget and oSource. If any other type is put into either, it will always return FALSE. Creatures maintain perception lists (which usually, but not always, when changing trigger the OnPerception event).

You can be heard but not see (check with GetObjectSeen) such as when stealthed, EffectInvisibility or EffectEthereal (both of which do not stop noise) and so forth. You may also be seen but not heard, such as when under the effect of EffectSilence. If one object hears another, it doesn't mean the object hears them back.

Hearing range is lower than sight range - see ranges.2da. It also can reach around corners, so LineOfSightObject may not be true.

It may be useful to use in the OnPerception event to test if, even if a creature is no longer seen, it might still be heard (so still in the area/available to move towards).



See Also


GetObjectSeen LineOfSightObject

events: OnPerception Event

 author: Tom Cassiotis, editor: Jasperre, additional contributor(s): Jasperre