redarmy 419 Posted April 17, 2019 So iv got a scenario,iv made it so that my AI pilots in a unarmed helo will loiter at 500 or 1000 meter altitude. They are part of the sides High command ,and therefore,any enemy they spot,will become marked on the map for the side to see. Problem is ,even at an altitude of 250 meters,with spotting skills maxed out and set to combat mode for some extra awareness,they do not see the enemy rite below.The enemy in question are some NATO transport and fuel trucks(5 spread out,in open fields) and three rifle squads.If i set the pilots to fly at default height,they get shot at,and die. I cannot use set captive on them as they will be put on civilian side and therefor not relay enemy positions to rest of side. I understand theres a "knows about" command but i dont think it will work,as the enemy being spotted may be created dynamically and i therefore wouldnt be able to force he pilots to see a specific unit. Im sure theres a way to achieve getting the pilots to see enemy from a high altitude i just cant figure out how. Any advice on how to go about it? Share this post Link to post Share on other sites
sarogahtyp 1104 Posted April 17, 2019 You can reveal a specific target with reveal command Share this post Link to post Share on other sites
redarmy 419 Posted April 17, 2019 1 minute ago, sarogahtyp said: You can reveal a specific target with reveal command Thanks but as i stated ,i do not want to reveal specific targets as they will be introduced dynamically. Share this post Link to post Share on other sites
sarogahtyp 1104 Posted April 17, 2019 1 minute ago, redarmy said: Thanks but as i stated ,i do not want to reveal specific targets as they will be introduced dynamically. I think you have to... but maybe some other guy has another solution... 1 Share this post Link to post Share on other sites
Crazy_Man 36 Posted April 17, 2019 Put this in the init field of your heli : nul = this spawn { _heli = _this; _spotDistance = 2500; // change it as you wish while {alive _heli} do { {if ([side _x, side _heli] call BIS_fnc_sideIsEnemy) then {_heli reveal [_x,4]}} forEach (_heli nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], _spotDistance]); sleep 1; }; }; 1 Share this post Link to post Share on other sites
redarmy 419 Posted April 17, 2019 2 hours ago, Crazy_Man said: Put this in the init field of your heli : nul = this spawn { _heli = _this; _spotDistance = 2500; // change it as you wish while {alive _heli} do { {if ([side _x, side _heli] call BIS_fnc_sideIsEnemy) then {_heli reveal [_x,4]}} forEach (_heli nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], _spotDistance]); sleep 1; }; }; I was thinking it would needed to be done in a "cheaty" kind of way like this. But none the less it should suffice. Cheers mate Share this post Link to post Share on other sites
sarogahtyp 1104 Posted April 18, 2019 you could introduce a chance to reveal a specific enemy unit and a randomised sleep value. it would look less cheaty then. also it is possible to implement a line of sight check to get only units revealed which can bei seen by the heli Share this post Link to post Share on other sites
sarogahtyp 1104 Posted April 18, 2019 not tested but with the above written features: _d = this spawn { params ["heli"]; // modify behavior below _spotDistance = 2500; _spotChance = 20; _minSpotTime = 5; _maxSpotTime = 30; _visibility = 0.3; // modify behavior above _heliSide = side _heli; while {alive _heli} do { _helipos = getPosASL _heli; _enemies = _heli nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], _spotDistance] select { [side _x, _heliSide] call BIS_fnc_sideIsEnemy and (random 100 < _spotChance) and {([_x, "VIEW", _heli] checkVisibility [_helipos, (getPosASL _x)]) > _visibility} }; { _heli reveal [_x, 4]; } count _enemies; sleep _minSpotTime + random (_maxSpotTime - _minSpotTime); }; }; 1 Share this post Link to post Share on other sites
redarmy 419 Posted April 18, 2019 1 hour ago, sarogahtyp said: not tested but with the above written features: _d = this spawn { params ["heli"]; // modify behavior below _spotDistance = 2500; _spotChance = 20; _minSpotTime = 5; _maxSpotTime = 30; _visibility = 0.3; // modify behavior above _heliSide = side _heli; while {alive _heli} do { _helipos = getPosASL _heli; _enemies = _heli nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], _spotDistance] select { [side _x, _heliSide] call BIS_fnc_sideIsEnemy and (random 100 < _spotChance) and {([_x, "VIEW", _heli] checkVisibility [_helipos, (getPosASL _x)]) > _visibility} }; { _heli reveal [_x, 4]; } count _enemies; sleep _minSpotTime + random (_maxSpotTime - _minSpotTime); }; }; Hey thanks man,i tested it but its causing errors.I can paste it into units init if i remove the "modify above/below behaviour" but its not working when testing. Just curious but i assume this way as opposed to Crazy_man's way would cause a hit on performance considering its doing visibility checks,correct? Share this post Link to post Share on other sites
sarogahtyp 1104 Posted April 18, 2019 (edited) 31 minutes ago, redarmy said: Hey thanks man,i tested it but its causing errors.I can paste it into units init if i remove the "modify above/below behaviour" but its not working when testing. Just curious but i assume this way as opposed to Crazy_man's way would cause a hit on performance considering its doing visibility checks,correct? idk. just test it and if it has an impact then delete the visibility check condition. Next step is to modify the reveal chance by distance: _d = this spawn { params ["heli"]; // modify behavior below _minSpotDistance = 100; //below this distance _maxSpotChance is the chance for revealing _maxSpotDistance = 2500; //distance where _maxSpotChance is the chance for revealing _minSpotChance = 10; //chance to reveal far targets (_maxSpotDistance) _maxSpotChance = 80; //chance to reveal near targets (_minSpotDistance) _minSpotTime = 5; _maxSpotTime = 30; _visibility = 0.3; // modify behavior above _minSpotDistanceSqr = _minSpotDistance ^ 2; _maxSpotDistanceSqr = _maxSpotDistance ^ 2; _heliSide = side _heli; _ factor = (_maxSpotChance - _minSpotChance) / (_maxSpotDistanceSqr - _minSpotDistanceSqr); while {alive _heli} do { _helipos = getPosASL _heli; _enemies = _heli nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], _spotDistance] select { [side _x, _heliSide] call BIS_fnc_sideIsEnemy and random 100 < (_minSpotChance + ((_maxSpotDistance - (_x distanceSqr _heli)) * _factor)) and {([_x, "VIEW", _heli] checkVisibility [_helipos, (getPosASL _x)]) > _visibility} }; { _heli reveal [_x, 4]; } count _enemies; sleep _minSpotTime + random (_maxSpotTime - _minSpotTime); }; }; Now I ask who is cheating? EDIT: moved some calculations out of loops Edited April 18, 2019 by sarogahtyp Share this post Link to post Share on other sites
redarmy 419 Posted April 18, 2019 1 minute ago, sarogahtyp said: idk. just test it and if it has an impact then delete the visibility check condition. Next step is to modify the reveal chance by distance: _d = this spawn { params ["heli"]; // modify behavior below _minSpotDistance = 100; //below this distance _maxSpotChance is the chance for revealing _maxSpotDistance = 2500; //distance where _maxSpotChance is the chance for revealing _minSpotChance = 10; //chance to reveal far targets (_maxSpotDistance) _maxSpotChance = 80; //chance to reveal near targets (_minSpotDistance) _minSpotTime = 5; _maxSpotTime = 30; _visibility = 0.3; // modify behavior above _minSpotDistanceSqr = _minSpotDistance ^ 2; _maxSpotDistanceSqr = _maxSpotDistance ^ 2; _heliSide = side _heli; while {alive _heli} do { _helipos = getPosASL _heli; _enemies = _heli nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], _spotDistance] select { [side _x, _heliSide] call BIS_fnc_sideIsEnemy and random 100 < (_minSpotChance + ((_maxSpotDistance - (_x distanceSqr _heli)) * (_maxSpotChance - _minSpotChance) / (_maxSpotDistanceSqr - _minSpotDistanceSqr))) and {([_x, "VIEW", _heli] checkVisibility [_helipos, (getPosASL _x)]) > _visibility} }; { _heli reveal [_x, 4]; } count _enemies; sleep _minSpotTime + random (_maxSpotTime - _minSpotTime); }; }; Now I ask who is cheating? Haha sweet man,more authentic ,less hacks. Il put this to use. cheers Share this post Link to post Share on other sites
sarogahtyp 1104 Posted April 18, 2019 26 minutes ago, redarmy said: Hey thanks man,i tested it but its causing errors. show the errors of ur .rpt and maybe I can help to get rid of it but I can't test the code at work ;-) 27 minutes ago, redarmy said: Just curious but i assume this way as opposed to Crazy_man's way would cause a hit on performance considering its doing visibility checks,correct? those visibility checks are done only if all other conditions are met. It's done by lazy evaluation. I think this will not have a big performance impact. Share this post Link to post Share on other sites
sarogahtyp 1104 Posted April 18, 2019 Updated last code... Share this post Link to post Share on other sites
redarmy 419 Posted April 19, 2019 23 hours ago, sarogahtyp said: show the errors of ur .rpt and maybe I can help to get rid of it but I can't test the code at work 😉 those visibility checks are done only if all other conditions are met. It's done by lazy evaluation. I think this will not have a big performance impact. Cheers man i appreciate it.I think i got it figured out now. Il do some more messing with it when i get online Share this post Link to post Share on other sites