scottb613 263 Posted August 31, 2016 Hi Folks, I have a bunch of the basic mission editing skills down using the mission editor - I'd like to expand my horizon a bit more with scripts... I'm planning an Air Assault mission - I'd like the mission to start with a FAC/Observation aircraft departing an airport to survey the intended LZ for the enemy... I'd like the aircraft to report the enemy spotted during the patrol and if the number is above a given threshold - the mission should call in an air strike guided by the FAC before the Air Assault team departs... If the count is below a threshold - the Air Assault team departs minus the air strike... I'm using DAC zones for the OPFOR with random zones defined - so even as mission creator - I'm not going to know the composition and location of the OPFOR... Does this sound possible ? I'm looking at the scripting wiki functions - to start - what function would allow the FAC to report observed enemies in a defined area ? Any other tips on the mission or what specific functions I should be looking at would be appreciated as well... Thanks... Regards, Scott Sent from my iPhone using Tapatalk Share this post Link to post Share on other sites
theend3r 83 Posted August 31, 2016 Function counting the current amount of OPFOR units in a specific distance from the aircraft: params ["_plane", "_distance"]; _units = allUnits select {side _x == east && _plane distance2D _x < _distance}; count _units Or you can do it with knowsAbout but it's not very reliable. To check the total number the aircraft has seen during the patrol, do something like //fnc_checkUnits params ["_plane", "_distance"]; _units = allUnits select {side _x == east && _plane distance2D _x < _distance}; _units //script totalUnits = []; while {some_condition} do { {totalUnits pushBackUnique _x} forEach ([plane1, 1500] call fnc_checkUnits); sleep 1; }; unitCount = count totalUnits; or slower but with the plane reporting as you wanted: //fnc_checkUnits params ["_plane", "_distance"]; _units = allUnits select {side _x == east && _plane distance2D _x < _distance}; _units //script totalUnits = []; _plane = plane1; while {some_condition} do { { if !(_x in totalUnits) then { totalUnits pushBack _x; _plane sideChat ((name _plane) + " has spotted enemy unit at " + str(getPos _x)); player reveal _x; }; } forEach ([_plane, 1500] call fnc_checkUnits); sleep 1; }; unitCount = count totalUnits; increase the sleep if performance is bad. Share this post Link to post Share on other sites
scottb613 263 Posted August 31, 2016 Hey - thanks - a big help -this gives me a place to start - while I've never written an Arma script - I do know UNIX scripting - so I can understand most of this... Regards, Scott Sent from my iPhone using Tapatalk Share this post Link to post Share on other sites