lawman_actual 24 Posted June 27, 2015 Can't get a heli to land and drop of crew using an .sqf file. I suspect the waypoints aren't synchronising, as I've checked each group to make sure the waypoints are being correctly added and assigned. But I'm not getting any error messages, so I can't figure out where I'm going wrong. I've followed syntax as far as I can see... _thisposi = getMarkerPos "objmark7"; _xposi = _thisposi select 0; _yposi = _thisposi select 1; _locationi = [_xposi, _yposi, 300]; _distvari = [200,400] call BIS_fnc_randomInt; _dirvari = [0,359] call BIS_fnc_randomInt; _spawni = _distvari + 1200; _startspawni = [_locationi, _spawni, _dirvari] call BIS_fnc_relPos; _locationi = [_xposi, _yposi, 0]; _startdeployi = [_locationi, _distvari, _dirvari] call BIS_fnc_relPos; //startheli1 = "B_Heli_Transport_01_camo_F" createVehicle _startspawni; startheli1 = createVehicle ["B_Heli_Transport_01_camo_F", _startspawni, [], 0, "FLY"]; createVehicleCrew startheli1; _spawnedi = getPos startheli1; _spawnedi set [2,200]; _crewi = group startheli1; startheli1 setposATL [getpos startheli1 select 0, getpos startheli1 select 1, 300]; startheli1 flyInHeight 200; startheli1 setDir ([startheli1, (getMarkerPos "objmark7")] call BIS_fnc_dirTo); _thisunload = _crewi addWaypoint [_startdeployi, 0]; _thisunload setWaypointType "TR UNLOAD"; _crewi setCurrentWaypoint _thisunload; dag1a1 moveInCargo startheli1; dag1a2 moveInCargo startheli1; dag1a3 moveInCargo startheli1; dag1a4 moveInCargo startheli1; dag2a1 moveInCargo startheli1; dag2a2 moveInCargo startheli1; dag2a3 moveInCargo startheli1; dag2a4 moveInCargo startheli1; _groupdag1a = group dag1a1; _thisgetout = _groupdag1a addWaypoint [_startdeployi, 0]; _thisgetout setWaypointType "GETOUT"; _groupdag1a setCurrentWaypoint _thisgetout; [_crewi, 0] synchronizeWaypoint [[_groupdag1a,0]]; Share this post Link to post Share on other sites
Jigsor 176 Posted June 27, 2015 Maybe something like this for landing waypoint not sure if it would work with setCurrentWaypoint though. _helipadLZ = createVehicle ["Land_HelipadEmpty_F", _startdeployi, [], 0, "NONE"]; _groupdag1a = group dag1a1; _thisgetout = _groupdag1a addWaypoint [getPosATL _helipadLZ, 1]; _thisgetout setWaypointType "LOAD"; _thisgetout setWaypointStatements ["true","doStop startheli1; startheli1 land 'LAND';"]; _groupdag1a setCurrentWaypoint _thisgetout; deleteVehicle _helipadLZ; Share this post Link to post Share on other sites
lawman_actual 24 Posted June 27, 2015 (edited) Thank you Jigsor! The invisible heli-pad worked fine. It still bugs me that I couldn't get the waypoints to work though...it all worked fine placing waypoints in the editor. If anyone knows a solution that gets waypoints working like this I'd appreciate it :) ---------- Post added at 22:34 ---------- Previous post was at 22:18 ---------- Spoke too soon The pilot now successfully lands, but now the crew seem to want to turn off the engine and just sit on the ground, despite the land command being set to "GET OUT" (supposedly hovering low enough for units to get out, without actually landing). Here's what I'm working with so far: _thisposi = getMarkerPos "objmark7"; _xposi = _thisposi select 0; _yposi = _thisposi select 1; _zposi = _thisposi select 2; _locationi = [_xposi, _yposi, 80]; _distvari = [200,400] call BIS_fnc_randomInt; _dirvari = [0,359] call BIS_fnc_randomInt; _spawni = _distvari + 1000; _startspawni = [_locationi, _spawni, _dirvari] call BIS_fnc_relPos; _locationi = [_xposi, _yposi, 0]; _startdeployi = [_locationi, _distvari, _dirvari] call BIS_fnc_relPos; startheli1 = createVehicle ["B_Heli_Transport_01_camo_F", _startspawni, [], 0, "FLY"]; createVehicleCrew startheli1; _spawnedi = getPos startheli1; _crewi = group startheli1; startheli1 setposATL [getpos startheli1 select 0, getpos startheli1 select 1, 80]; startheli1 flyInHeight 80; startheli1 setDir ([startheli1, (getMarkerPos "objmark7")] call BIS_fnc_dirTo); _pad1 = createVehicle ["Land_HelipadEmpty_F", _startdeployi, [], 0, "NONE"]; _pad1 setposATL [_startdeployi select 0, _startdeployi select 1, 0]; _thisunload = _crewi addWaypoint [_startdeployi, 1]; _thisunload setWaypointType "MOVE"; _crewi setCurrentWaypoint _thisunload; _dag1a = group dag1a1; _dag1b = group dag1b1; _thisunload setWaypointStatements ["true", "startheli1 land 'GETOUT'; commandGetOut [dag1a1,dag1a2,dag1a3,dag1a4]; dag1a1 leaveVehicle startheli1; dag1a2 leaveVehicle startheli1; dag1a3 leaveVehicle startheli1; dag1a4 leaveVehicle startheli1; commandGetOut [dag1b1,dag1b2,dag1b3,dag1b4]; dag1b1 leaveVehicle startheli1; dag1b2 leaveVehicle startheli1; dag1b3 leaveVehicle startheli1; dag1b4 leaveVehicle startheli1; _thisreturn = _crewi addWaypoint [getMarkerPos 'returnhelo1', 1]; _thisreturn setWaypointType 'MOVE'; _crewi setCurrentWaypoint _thisreturn;"]; dag1a1 moveInCargo startheli1; dag1a2 moveInCargo startheli1; dag1a3 moveInCargo startheli1; dag1a4 moveInCargo startheli1; dag1b1 moveInCargo startheli1; dag1b2 moveInCargo startheli1; dag1b3 moveInCargo startheli1; dag1b4 moveInCargo startheli1; Edited June 27, 2015 by Lawman_Actual Share this post Link to post Share on other sites
f2k sel 164 Posted June 28, 2015 _thisreturn = _crewi addWaypoint [getMarkerPos 'returnhelo1', 1]; _thisreturn setWaypointType 'MOVE'; _crewi setCurrentWaypoint _thisreturn; You can't use local variables like those in waypoint statements. Share this post Link to post Share on other sites
lawman_actual 24 Posted June 28, 2015 (edited) _thisreturn = _crewi addWaypoint [getMarkerPos 'returnhelo1', 1]; _thisreturn setWaypointType 'MOVE'; _crewi setCurrentWaypoint _thisreturn;You can't use local variables like those in waypoint statements. Thank you Sel - this allowed me to go back to using waypoints, which now appear to have successfully synchronised. I have also now solved the engine off problem. This script would cause the helo to land and turn engines off; startheli1 land 'GETOUT'; The working version is this; startheli1 land 'GET OUT'; Working script now posted below for future reference: _thisposi = getMarkerPos "objmark7"; _xposi = _thisposi select 0; _yposi = _thisposi select 1; _locationi = [_xposi, _yposi, 80]; _distvari = [200,400] call BIS_fnc_randomInt; _dirvari = [0,359] call BIS_fnc_randomInt; _spawni = _distvari + 1000; _startspawni = [_locationi, _spawni, _dirvari] call BIS_fnc_relPos; _locationi = [_xposi, _yposi, 0]; _startdeployi = [_locationi, _distvari, _dirvari] call BIS_fnc_relPos; startheli1 = createVehicle ["B_Heli_Transport_01_camo_F", _startspawni, [], 0, "FLY"]; createVehicleCrew startheli1; helocrewi = group leader startheli1; _spawnedi = getPos startheli1; startheli1 setposATL [getpos startheli1 select 0, getpos startheli1 select 1, 80]; startheli1 flyInHeight 80; startheli1 setDir ([startheli1, (getMarkerPos "objmark7")] call BIS_fnc_dirTo); unload1 = helocrewi addWaypoint [_startdeployi, 1]; unload1 setWaypointType "TR UNLOAD"; helocrewi setCurrentWaypoint unload1; deploygroup1a = group dag1a1; deploygroup1b = group dag1b1; unload1 setWaypointStatements ["true", "startheli1 land 'GETOUT'; commandGetOut [dag1a1,dag1a2,dag1a3,dag1a4]; dag1a1 leaveVehicle startheli1; dag1a2 leaveVehicle startheli1; dag1a3 leaveVehicle startheli1; dag1a4 leaveVehicle startheli1; commandGetOut [dag1b1,dag1b2,dag1b3,dag1b4]; dag1b1 leaveVehicle startheli1; dag1b2 leaveVehicle startheli1; dag1b3 leaveVehicle startheli1; dag1b4 leaveVehicle startheli1; _thisreturn = _helogroup addWaypoint [getMarkerPos 'returnhelo1', 1]; _thisreturn setWaypointType 'MOVE'; _helogroup setCurrentWaypoint _thisreturn;"]; dag1a1 moveInCargo startheli1; dag1a2 moveInCargo startheli1; dag1a3 moveInCargo startheli1; dag1a4 moveInCargo startheli1; dag1b1 moveInCargo startheli1; dag1b2 moveInCargo startheli1; dag1b3 moveInCargo startheli1; dag1b4 moveInCargo startheli1; deploy1 = deploygroup1a addWaypoint [_startdeployi, 1]; deploy1 setWaypointType "GETOUT"; deploygroup1a setCurrentWaypoint deploy1a; deploy1b = deploygroup1a addWaypoint [_startdeployi, 1]; deploy1b setWaypointType "GET OUT"; deploygroup1a setCurrentWaypoint deploy1b; [helocrewi, 0] synchronizeWaypoint [ [deploygroup1a, 0],[deploygroup1b, 0] ]; Edited June 28, 2015 by Lawman_Actual Share this post Link to post Share on other sites
lawman_actual 24 Posted June 29, 2015 Side note: Is there a way to make the pilot ignore a set helipad when landing? I have a scenario where the pilots approach to an objective is randomised within a radius, and occasionally when the drop-off point is too close to the heli-pad the pilot automatically chooses this as the spot. Trouble is the heli-pad IS the objective, and I want the team to land near but not on the objective. Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted June 29, 2015 Side note:Is there a way to make the pilot ignore a set helipad when landing? I have a scenario where the pilots approach to an objective is randomised within a radius, and occasionally when the drop-off point is too close to the heli-pad the pilot automatically chooses this as the spot. Trouble is the heli-pad IS the objective, and I want the team to land near but not on the objective. Spawn another helipad for each chopper, in close proximity to where the land command is being issued, so they ignore the first helipad, alternatively you could make them land further away, helipads will always be chosen as a landing spot if at a certain distance (~400m I think). Cheers Share this post Link to post Share on other sites
lawman_actual 24 Posted June 29, 2015 Thanks grumpy I have previously attempted a script spawning a new helipad, but this caused the pilot to land in some pretty crumby places and often on top of trees etc. There might be a way to add in some checks to see if there are objects nearby and such... but given the crew do a neat job of landing if I leave them to it I might just have to try and keep the bird out of range of the existing pad Would still be interested in hearing if there is a way of cancelling or negating the land at the 'permanent' in-game helipad. Even if no one knows of a precedent, I'm sure we can come up with some theories :D ---------- Post added at 23:38 ---------- Previous post was at 23:32 ---------- A quick search of the BIS functions came up with this: BIS_fnc_nearestHelipad I might have a play around and see if I can re-route or override the landing if it's within a certain distance of the chopper's waypoint Share this post Link to post Share on other sites
lawman_actual 24 Posted June 30, 2015 Can anyone help me figure out the syntax for the "nearest helipad" function? I'm not too sure how to interpret the notes in the function viewer: private ["_pos","_radius","_selectRandom","_types","_pos","_nearLocations","_posLocation","_nearObjects"]; _pos = [_this,0,position vehicle player] call bis_fnc_param; _radius = [_this,1,999999,[0]] call bis_fnc_param; _selectRandom = [_this,2,false,[false]] call bis_fnc_param; _types = [_this,3,["Heliport"],[[]]] call bis_fnc_param; //--- Find all helipads around _pos = _pos call bis_fnc_position; _nearLocations = nearestLocations [_pos,_types,_radius]; if (count _nearLocations > 0) then { _location = if (_selectRandom) then { //--- Select random helipad _nearLocations call bis_fnc_selectrandom; } else { //--- Select nearest helipad [_nearLocations,_pos] call bis_fnc_nearestPosition; }; _posLocation = position _location; //--- Find helipad object _nearObjects = _posLocation nearobjects ["RooftopLanding_Base_H",500]; if (count _nearObjects > 0) then { [(_nearObjects select 0) modeltoworld [0,0,1],(_nearObjects select 0),_location]; } else { [_posLocation,objnull,_location] }; } else { //--- No locations found [[0,0,0],objnull,locationnull] }; Share this post Link to post Share on other sites