thedubl 43 Posted October 18, 2016 Hello! So I am making a script for insertion. My issue is even though I am using flyInHeight at 25, the ai pilot is not using the altitude from the ground, but also including tree height. When the helo gets to the waypoint its too high to rappel down. I have tried to setPos, but the helo goes back to the same alt. Any ideas how to ignore tree height? Besides this issue the script runs great. Just need to work this last bit out. I could increase the rappel height, but I really would like to keep it around 25 m max. Thanks! dub Share this post Link to post Share on other sites
Guest Posted October 18, 2016 https://community.bistudio.com/wiki/flyInHeightASL Found this. Maybe it ignores tree height :) Share this post Link to post Share on other sites
thedubl 43 Posted October 18, 2016 Thanks! It is better, but not 100% though. I guess the pilot also looks slope? I think I might as well increase the height for the rappel script unless anyone has another idea. Thanks, dub insertion.sqf /************************************************************************************************************* thedubl setup: 1. add this to initplayerlocal.sqf [[player,[("<t color=""#ff8000"">" + ("Transport") + "</t>"),{_this execVM "scripts\insertion.sqf"},[player],0,false,true, "",'player ==_target']],"addAction",true,true,false] call BIS_fnc_MP; 2. Place this code in folder called "scripts" and name it "insertion.sqf" 3. place a default marker anywhere on the map called "transportdelete" *** I am assuming you have some type of rappelling script! ************************************************************************************************************/ _host = _this select 0; _caller = _this select 1; _id = _this select 2; _params = _this select 3; _type = _params select 0;//true for all group, false for player only. //open map and get pos if (not alive _host) exitwith { hint "Insertion Not Available"; _host removeaction _id; }; _caller groupchat "Select insertion point."; openMap true; mapclick = false; onMapSingleClick "clickpos = _pos; mapclick = true; onMapSingleClick """";true;"; waituntil {mapclick or !(visiblemap)}; if (!visibleMap) exitwith { _caller groupchat "Request Cancelled..."; }; pos = clickpos; //_caller setpos _pos; sleep 1; openMap false; "Roger... Transport for insertion inbound! " remoteExec ["hint"]; /******************************************************************** spawn chopper **Going to make this spawn multiple helos later with a number of helos requested option. ********************************************************************/ _heliPos = [(getPos player select 0)+500,(getPos player select 1)+random 1000,(getPos player select 2)+300]; //make this random distances later InsertionHeli = createGroup WEST; { _vehType = _x select 0; _vehName = _x select 1; _veh = [_heliPos, 0, _vehType, InsertionHeli] call BIS_fnc_spawnVehicle; if (_vehName != "") then { (_veh select 0) setVehicleVarName _vehName; missionNamespace setVariable [_vehName, (_veh select 0)]; }; } forEach [ ["B_CTRG_Heli_Transport_01_Tropic_F", "helo"] //** heli types B_CTRG_Heli_Transport_01_Tropic_F,B_Heli_Transport_01_camo_F ]; sleep 1; //set the way point for pickup _insertionWp = InsertionHeli addWaypoint [[(getPos player select 0)+round(random 10),(getPos player select 1)+round(random 10),(getPos player select 2)], 0]; _insertionWp setWaypointType "TR UNLOAD"; _insertionWp setWaypointSpeed "LIMITED"; _insertionWp setWaypointFormation "COLUMN"; _insertionWp setWaypointCompletionRadius 10; waituntil { sleep 1; (player != vehicle player && player in helo && alive helo || (!alive helo)) } ; if (!alive helo) exitWith {}; /**************Funcitons for commanding pilot******************************/ dub_showActions = true; dub_fnc_insertion = { _insertionWp1 = InsertionHeli addWaypoint [pos, 0]; _insertionWp1 setWaypointType "MOVE"; _insertionWp1 setWaypointSpeed "FULL"; _insertionWp1 setWaypointFormation "COLUMN"; _insertionWp1 setWaypointCompletionRadius 10; InsertionHeli setBehaviour "CARELESS"; //_insertionWp1 setWaypointStatements ["true", "";]; helo flyInHeightASL [25,25,25]; dub_showActions = false; //Add rtb addaction [] spawn dub_fnc_rtb; }; dub_fnc_Land = { _insertionWp2 = InsertionHeli addWaypoint [pos, 0]; _insertionWp2 setWaypointType "TR UNLOAD"; _insertionWp2 setWaypointSpeed "FULL"; _insertionWp2 setWaypointFormation "COLUMN"; _insertionWp2 setWaypointCompletionRadius 10; InsertionHeli setBehaviour "CARELESS"; //_insertionWp2 setWaypointStatements ["true", "";]; helo flyInHeightASL [25,50,50]; //Add rtb addaction [] spawn dub_fnc_rtb; dub_showActions = false; }; dub_fnc_rtb = { _rtb = player addAction ["<t color='#FF0000'>ORDER HELO RTB!</t>" ,{ _insertionWp3 = InsertionHeli addWaypoint [getMarkerPos "transportdelete", 0]; _insertionWp3 setWaypointType "MOVE"; _insertionWp3 setWaypointSpeed "FULL"; _insertionWp3 setWaypointFormation "COLUMN"; _insertionWp3 setWaypointCompletionRadius 50; InsertionHeli setBehaviour "CARELESS"; _insertionWp3 setWaypointStatements ["true","{deleteVehicle _x} forEach crew helo + [helo];" ]; _player = _this select 1; _id = _this select 2; _player removeaction _id; },[],0,false,true,"",'vehicle player ==_target']; }; /****************************************MENU***************************************/ MENU = [ ["Options",true], ["Insertion", [2], "", -5, [["expression", "_thread = 1 spawn dub_fnc_insertion;"]], "1", "1"], ["Land", [3], "", -5, [["expression", "_thread = 2 spawn dub_fnc_Land ;"]], "1", "1"] ]; _menu = _caller addAction [("<t color=""#007fff"">" + ("Order Pilot") + "</t>"), {showCommandingMenu "#USER:MENU";}, [], -99, false, true, "", "dub_showActions"]; if (!alive helo) exitWith { _caller removeaction _menu;}; Share this post Link to post Share on other sites
Guest Posted October 18, 2016 This is weird because I don't remember being limited with this command as I saw script that simulate a crash with an ai pilot. Weird. Share this post Link to post Share on other sites
johnnyboy 3797 Posted October 18, 2016 If its for an insertion so the chopper does not need any other AI capabiilty (i.e., combat), my fly in formation script could work. With it, the aircraft (or any object...your team could be all sitting on a flying couch), will move across the exact path you set, at exact height you set (ignoring trees or any obstacles).. It only flies in an exact straight line though. You could tweak it to stop at your rappel location, at which point normal AI could take over for hovering, and leaving after team rappels. If you only have one chopper, set birdCount parameter to 1. The script would probably have to be modified for chopper to decelerate as it neared rappel position, and then end the scirpt once at destination (the ai and your scripting would then take over to keep chopper in position during rappel). Share this post Link to post Share on other sites
thedubl 43 Posted October 18, 2016 I believe I found the answer to this. Once the helo gets to the _insertionWp1 it is waiting for the next command. So, it just hovers at its "low" hover, although it is not that low. I just increase the altitude in the rappelling script. If a helo has no waypoints, it will assume a low hover without regard to this setting. https://community.bistudio.com/wiki/flyInHeight johnnyboy, I will take look at this too, thanks. Thanks for the help. dub 1 Share this post Link to post Share on other sites
thedubl 43 Posted October 19, 2016 Removed, due to not thinking! Share this post Link to post Share on other sites
johnnyboy 3797 Posted October 19, 2016 Should post a new topic for this one, as this has nothing to do with AI height and pilot attitude. It helps keep the forums searchable and maximumly useful for all! 1 Share this post Link to post Share on other sites
duda123 1341 Posted October 28, 2016 If you're trying to get a heli to a specific position for rappelling, I have a script in my advanced rappelling addon that's really good at this. Gets the heli to move w/in 1m or so of a specific position + altitude. https://github.com/sethduda/AdvancedRappelling See the readme - there's a function that can handle all of this for you. However, if you don't want units to auto-rappel, you'd have to take a look at the source and modify the function to meet your needs. Share this post Link to post Share on other sites