Home   Help Search Login Register  

Author Topic: can AI tell which direction a sound comes from  (Read 1180 times)

0 Members and 1 Guest are viewing this topic.

Offline twisted

  • Members
  • *
  • I'm a llama!
can AI tell which direction a sound comes from
« on: 08 May 2009, 18:04:42 »
hi
i cannot find command reference that determines which direction a sound is coming from.

want this so i can get AI that hear gunshots respond and perhaps move in the opposite direction or at least watch that direction. i now how to do the watch or move but not how to get that info.

rommel92 helped me get AI respond to being shot at but now i want to get them to prepare for contact instead of just responding to it.


Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: can AI tell which direction a sound comes from
« Reply #1 on: 08 May 2009, 22:19:00 »
Not sure you can tell when an AI hears something as such, but if that sound leads to them finding a new contact, their knowsAbout it will increase and/or the contact will be added to their nearTargets list.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: can AI tell which direction a sound comes from
« Reply #2 on: 09 May 2009, 12:26:09 »
Why not just use an eventhandler "fired", that checks for "close by" units that then move to the firing units position.

firing.sqf

Code: [Select]
_shooter = _this select 0;
_spotters = nearestObjects [vehicle _shooter, ["AllVehicles"], 100];

{_x doMove getpos _shooter} forEach spotters;


Change the number "100" to whatever distance you think is reasonable for hearing the shots and moving there. Higher number = more lag  :confused:

You could simply include side, group or unit checks in this script as well , so not everyone moves there. Maybe some civilian units should run away instead  ;) isServer is also recommended if in MP  :good:
« Last Edit: 10 May 2009, 10:55:00 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.