David Rain 0 Posted January 10, 2018 I'm trying to make a map mission and need a helicopter loop to make it seem that the base is very active. My goal is for it to 1. take off 2 Fly away 3 Fly back 4 Land. Then for it all to repeat repeat What ever help I get I am very thankful Share this post Link to post Share on other sites
Naiss 28 Posted January 11, 2018 You can always place down the helis in the editor and just select where you want it to fly with a "MOVE" Share this post Link to post Share on other sites
mrcurry 496 Posted January 11, 2018 If you are okay with the chopper using the same directions every time: 1.Give helo a move waypoint away from base. 2. Optional: setup some more waypoints 3. Give it a land waypoint at the helipad. (also make sure you place helipad). 4. Place a cycle waypoint at the first move waypoint. The 2 should automatically link up. The key here is the cycle waypoint. Read more about how it can be used on the Biki. If you want it to fly in a random direction every time you are gonna have to employ some scripting... Oh the horror! Just kidding. Let me know if it's needed and I (or anyone of the other lovely chaps and chapettes on this forum) will provide a script for ya. Cheerio Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted January 11, 2018 I quickly threw this one together: GOM_fnc_ambientHelipad = { //parameters: //_landingpad: does not have to be a landingpad, but an object where the chopper will try to land //_minspawndistance: the chopper will spawn this distance away from the pad //_timeonground: how many seconds on average the chopper will idle after landing, before departing again //_timeToNextChopper: how many seconds on average it will take for the next chopper to spawn, after the last one departed from the pad //_loop: spawns choppers all the time params [["_side",west],["_landingPad",objnull],["_minspawndistance",10000],["_timeonground",90],["_timeToNextChopper",90],["_loop",true],["_debug",true]]; //this is needed to not have choppers spawn at once during mission start sleep round random 180; _sideID = _side call BIS_fnc_sideID; _validChoppers = (format ["getNumber (_x >> 'transportSoldier') >= 2 AND getNumber (_x >> 'side') == %1 AND configname _x isKindof 'Helicopter' AND getnumber (_x >> 'scope') >= 2",_sideID] configClasses (configFile >> "CfgVehicles")); _rndChopper = configName (selectRandom _validChoppers); _chopper = createVehicle [_rndChopper,[0,0,800],[],0,"FLY"]; createVehicleCrew _chopper; if (_debug) then { systemchat format ["Created %1",_rndChopper] }; _rndPos = _landingPad getRelPos [_minspawndistance,random 360]; //make chopper spawn at least 200m above ground or water if (surfaceIsWater _rndPos) then { _rndPos set [2,((_rndPos select 2) + 200)]; _chopper setPosASL _rndPos; if (_debug) then { systemchat format ["Spawnposition on land",_rndChopper] }; } else { _rndPos set [2,200]; if (_debug) then { systemchat format ["Spawnposition on water",_rndChopper] }; _chopper setPosASL _rndPos; }; group driver _chopper move getposatl _landingpad; if (_debug) then { systemchat format ["Moving to %1",_landingpad] }; waituntil {unitReady driver _chopper OR !alive driver _chopper OR !alive _chopper}; if (!alive driver _chopper or !alive _chopper) exitWith { if (_debug) then {systemchat format ["Chopper destroyed",_rndChopper]}; }; dostop _chopper; _chopper land "LAND"; if (_debug) then { systemchat format ["%1 arrived at %2, landing.",_rndChopper,_landingpad] }; waituntil {getposatl _chopper select 2 < 1 AND (alive driver _chopper OR alive _chopper)}; if (!alive driver _chopper or !alive _chopper) exitWith { if (_debug) then { systemchat format ["Chopper destroyed",_rndChopper] }; }; if (_debug) then { systemchat format ["%1 touched down at %2.",_rndChopper,_landingpad] }; _waittime = round random [_timeonground / 2, _timeonground, _timeonground * 2]; if (_debug) then { systemchat format ["%1 waiting for %2 seconds at %3.",_rndChopper,_waittime,_landingpad] }; sleep _waittime; if (_debug) then { systemchat format ["%1 preparing for departure, starting engines.",_rndChopper] }; //start engine and wait for a few seconds to be more authentic _chopper engineOn true; sleep random [20,30,60]; _bearing = round random 360; _rndDeparture = _chopper getRelPos [20000,_bearing]; _chopper dofollow leader group _chopper; group driver _chopper move _rndDeparture; if (_debug) then { systemchat format ["%1 departing from %2, bearing %3.",_rndChopper,_landingpad,_bearing] }; if (_loop) then { _newChopper = _this spawn { _delay = round random [_delay / 2,_delay,_delay * 2]; _this spawn GOM_fnc_ambientHelipad; }; }; waituntil {_chopper distance2d _rndDeparture < 500}; {deletevehicle _x} forEach [_chopper] + crew _chopper; }; //params to use _side = west; _spawndistance = 500; _timeonground = 120; _timeToNextChopper = 90; _loop = true; _debug = true; { _ambient = [_side,_x,_spawndistance,_timeonground,_timeToNextChopper,_loop,_debug] spawn GOM_fnc_ambientHelipad; } forEach [pad1,pad2,pad3,pad4,pad5,pad6]; Make sure you call this only once for each pad. As a demo place 6 pads properly spaced out, name them pad1-pad6, put the above in the init.sqf and watch. Will spawn choppers for placed landing pads, with proper time intervals inbetween. Random choppers of a side that are able to transport more than 2 people (to filter out uavs etc) will approach the landing pads, when arrived they will land, stay a certain amount of time (randomized) on ground, power up the engines and depart in a random direction and finally will be deleted. After a chopper departed from a pad the function will wait a few seconds and spawn another chopper for the pad. Enjoy. Cheers 7 2 Share this post Link to post Share on other sites
johnnyboy 3793 Posted January 11, 2018 10 hours ago, Grumpy Old Man said: I quickly threw this one together: Wow. How long did that take you Grump? Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted January 12, 2018 2 hours ago, johnnyboy said: Wow. How long did that take you Grump? Roughly 20 minutes with a few testruns included. Cheers 2 Share this post Link to post Share on other sites
Jnr4817 215 Posted January 12, 2018 I use this and it works well. http://www.armaholic.com/page.php?id=29209 Ambient helicopters by skullfox https://bitbucket.org/Skullfox/ambient-helicopters Ive changed a few lines of code to add a searchlight and position lights. Spoiler /* * Ambient helicopters by Skullfox * http://www.armaholic.com/page.php?id=29210 * https://bitbucket.org/Skullfox/ambient-helicopters */ zp_heliInit = { //extend this array with new helis _heliArray = ["C_Heli_Light_01_civil_F"]; //extend this array with A1 & A2 helipads _heliPadClasses = ["Land_HelipadSquare_F","Land_HelipadRescue_F","Land_HelipadCivil_F"]; _y = 0; _heliPads= nearestObjects[position server,_heliPadClasses,500000]; { _m = createMarker [str position _x, position _x]; _m setMarkerType "mil_flag"; _m setMarkerText format["Helipad - %1",_y]; _y = _y + 1; } foreach _heliPads; _c = count _helipads; _numbers = floor( _c / 2 ); _linkedHelipads = []; for [{_i=0}, {_i< _numbers}, {_i=_i+1}] do { _index = _i; _helipadStart = _helipads select _index; _indexEnd = _index + _numbers; _helipadEnd = _helipads select _indexEnd; _linkedHelipads pushBack [_helipadStart,_helipadEnd]; }; _y = 0; { _start = _x select 0; _end = _x select 1; _class = [_heliArray] call zp_selectHeliCiv; _veh = _class createVehicle position _start; _veh setVariable ["zp_heliVars",[_start,_end,_class,_y],true]; [_veh]spawn{ _veh = _this select 0; while{true}do{ sleep 5; if(damage _veh > 0.3)exitWith { [_veh] call zp_resetHeli; }; }; }; createVehicleCrew _veh; if(zp_heliDev)then{ _m = createMarker [str position _start, position _start]; _m setMarkerType "mil_flag"; _m setMarkerText format["Helipad - %1 start",_y]; _r = str floor(((position _veh) select 0)); _v = createMarker [_r, position _veh]; _veh setVariable ["zp_heliDevMarker",[_r],true]; _v setMarkerType "n_air"; _v setMarkerColor "ColorGreen"; _v setMarkerText format["Heli - %1 start",_y]; [_v,_veh] call zp_addMarkerToHeli; _m = createMarker [str position _end, position _end]; _m setMarkerType "mil_flag"; _m setMarkerText format["Helipad - %1 end",_y]; }; _y = _y + 1; [_veh,_start,_end,_y] call zp_startHeliTour; } foreach _linkedHelipads; }; zp_addMarkerToHeli = { _v = _this select 0; _veh = _this select 1; [_v,_veh] spawn { _v = _this select 0; _veh = _this select 1; while{alive _veh} do { _v setMarkerPos getpos _veh; sleep 10; }; }; }; zp_startHeliTour = { _vehicle = _this select 0; _startPad = _this select 1; _endPad = _this select 2; _id = _this select 3; sleep random(30); _vehicle domove getPos _endPad; _vehicle flyinheight 120; _vehicle disableAi "TARGET"; _vehicle disableAi "AUTOTARGET"; _vehicle enableAttack false; _vehicle setCombatMode "BLUE"; _vehicle setBehaviour "CARELESS"; [_endPad,_vehicle,_id,_startPad] spawn { _endPad = _this select 0; _vehicle = _this select 1; _id = _this select 2; _c = true; _startPad = _this select 3; _d = driver _vehicle; while{alive _vehicle AND _c} do { sleep 5; _meters = _vehicle distance _endpad; if(_meters < 200)then{ _c = false; dostop _vehicle; _vehicle land "LAND"; [_vehicle,_startPad,_endPad,_id] call zp_launchTime; }; }; }; }; zp_launchTime = { _vehicle = _this select 0; _startpad = _this select 1; _endPad = _this select 2; _id = _this select 3; _timeoutBase = 240; _timeOutAdditional = floor (random 300); _timeout = _timeoutBase + _timeOutAdditional; _vehicle setfuel 1; sleep _timeout; if(_vehicle distance _endPad < 50 )then{ [_vehicle,_endPad,_startpad,_id] call zp_startHeliTour; }else{ [_vehicle,_startPad,_endPad,_id] call zp_startHeliTour; }; }; zp_selectHeliCiv = { _heliArray = _this select 0; _c = count _heliArray; _i = floor( random _c ); _class = _heliArray select _i; _class }; zp_resetHeli = { _veh = _this select 0; _vehOld = _veh; _vars = _veh getVariable "zp_heliVars"; _start = _vars select 0; _end = _vars select 1; _class = _vars select 2; _id = _vars select 3; if(zp_heliDev)then{ _varsmarker = _vehOld getVariable "zp_heliDevMarker"; _m = _varsmarker select 0; _m setMarkerColor "ColorRed"; _m setMarkerType "hd_destroy"; }; { deleteVehicle _x } forEach (crew _veh); deleteVehicle _veh; _veh = _class createVehicle position _start; createVehicleCrew _veh; _veh setVariable ["zp_heliVars",[_start,_end,_class,_id],true]; [_veh]spawn{ _veh = _this select 0; while{true}do{ sleep 5; if(damage _veh > 0.3)exitWith { [_veh] call zp_resetHeli; }; }; }; sleep 5; if(zp_heliDev)then{ _r = str floor(((position _veh) select 0)); _v = createMarker [_r, position _veh]; _v setMarkerColor "ColorGreen"; _v setMarkerText format["Heli - %1 start",_id]; [_v,_veh] call zp_addMarkerToHeli; _veh setVariable ["zp_heliDevMarker",[_r],true]; }; [_veh,_start,_end,_id] call zp_startHeliTour; }; when i get back home all post the changes. Depending on how may helipads there are natively and you added the performance hit isnt bad and it definely adds some ambience to the map. reed 1 Share this post Link to post Share on other sites
Jnr4817 215 Posted January 13, 2018 I added this to turn searchlight and collision lights on. Spoiler _vehicle spawn { while {alive _this} do { player action ["lightOn",_this]; sleep 0.001};}; _vehicle setCollisionLight true; 1 Share this post Link to post Share on other sites
pierremgi 4853 Posted January 13, 2018 @Jnr4817 You can avoid that, just setting the behavior of the helicopter's group to CARELESS. This way you save CPU time for other script. 1 Share this post Link to post Share on other sites
Jnr4817 215 Posted January 13, 2018 Excellent, Thank you @pierremgi quick question. Will using _vehicle flyInHeightASL selectRandom [25,50,100,150,200]; or _vehicle flyInHeight selectRandom [25,50,100,150,200]; allow the helicopter to choose these different heights to fly in. Allowing some variety in the flight path of each aircraft. Ive tested but it doesn't seem to work and it hasn't given me any errors. Reed Thanks again Share this post Link to post Share on other sites
pierremgi 4853 Posted January 13, 2018 Just refer to the BIKI syntax. flyInHeight will follow the terrain, flyInHeightASL needs 3 parameters along with behaviour (so, 3 selectRandom). This command will be overridden for preventing some ground collision, anyway. Share this post Link to post Share on other sites
goko-- 147 Posted January 14, 2018 On 12/01/2018 at 3:30 AM, Grumpy Old Man said: Roughly 20 minutes with a few testruns included. Cheers Hello GOP not exactly about this thread but... can you help me understand how to make DE's magazine throw MP compatible --> I tried many things, but no matter what onEachFrame there cannot be made MP compatible Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted January 14, 2018 Did you try contacting @dreadedentity via PM? I see you already tried to contact him via steam. Changing an existing script without being the author would probably take more time than to write it from scratch. Cheers Share this post Link to post Share on other sites
Jnr4817 215 Posted January 15, 2018 On 1/12/2018 at 9:51 PM, pierremgi said: @Jnr4817 You can avoid that, just setting the behavior of the helicopter's group to CARELESS. This way you save CPU time for other script. I tried just using careless only and none of the aircraft would turn there "lighton". so I added this back in _vehicle spawn { while {alive _this} do { player action ["lightOn",_this]; sleep 0.001};}; and all of the aircraft except the hellcat will turn its searchlight on. How can i get the AI co-pilot to turn the search light on with this script. I've tried adding this under the "lighton" with no affect on hellcat _vehicle spawn { while {alive _this} do { player action ["SearchlightOn",_this]; sleep 0.001};}; How can target the copilot of the hellcat specifically? Thanks Share this post Link to post Share on other sites
pierremgi 4853 Posted January 15, 2018 3 hours ago, Jnr4817 said: I tried just using careless only and none of the aircraft would turn there "lighton". ??? It works fine for me in Vanilla Arma. Perhaps mods or script overriding the behavior or a misunderstanding about lights. Here lights = collision lights. and it's consistent with the BIKI documentation. copilot is in turret [0] Share this post Link to post Share on other sites
Jnr4817 215 Posted January 15, 2018 12 hours ago, pierremgi said: ??? It works fine for me in Vanilla Arma. Perhaps mods or script overriding the behavior or a misunderstanding about lights. Here lights = collision lights. and it's consistent with the BIKI documentation. copilot is in turret [0] Roger, Careless= collision lights (totally missed that and makes since, after testing) so I don't need this code as you stated _vehicle setCollisionLight true; _vehicle spawn { while {alive _this} do { player action ["lightOn",_this]; sleep 0.001};}; = searchlight of all aircraft except the hellcat(from my testing) how do I get this to turn the turrent light on using searchlighton from the biki with this code? From some reason it is not making the copilot turn on the search light on in the hellcat. _vehicle spawn { while {alive _this} do { player action ["searchlightOn",_this]; sleep 0.001};}; I don't think {player action []} is working on the copilot and I am not sure how to call the copilot position Thanks again for any help Share this post Link to post Share on other sites
pierremgi 4853 Posted January 15, 2018 if your Hellcat is full Ai, then this vehicle and its crew is on server (except if you passed it on headless client). you need to use _vehicle turretUnit [0] for the hellcat's gunner.And use searchLightOn action for what you need. You will be disappointed with the poor intensity of this searchlight, you can even fail to see it sometimes. See this topic. Share this post Link to post Share on other sites
Jnr4817 215 Posted January 16, 2018 Excellent. Thank you. It’s definitely very lack luster for sure. Share this post Link to post Share on other sites