OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: twisted 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.
-
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.
-
Why not just use an eventhandler "fired", that checks for "close by" units that then move to the firing units position.
firing.sqf
_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: