ErisMCM 1 Posted April 29, 2022 Hey all! I'm working on a mission, and I have some jets flying by using unitPlay to play pre recorded flight paths. Problem is, even if I force their engines on and have AI in them, they will just stay at 0 throttle and by consequence be dead quiet which just looks wrong. I am aware of setAirplaneThrottle, but it only works on player aircraft. is there a way to force the AI or the planes to be at full throttle upon script execution? I hope what I said makes sense! <3 Share this post Link to post Share on other sites
beno_83au 1369 Posted April 29, 2022 I've done it before with unitPlay. Try turning the engines on first: _plane engineOn true; _plane setAirplaneThrottle 0.3; Share this post Link to post Share on other sites
soldierXXXX 107 Posted April 29, 2022 Hi. Unfortunately setAirplaneThrottle works only on player´s aircraft. However there is another command forceSpeed, which might do exactly what you need. You can test it with airplaneThrottle command. Here is example code. PathJet1 = [path data...]; Jet1 engineOn TRUE; Jet1 setVehicleTIPars [1, 1, 1];//sets the heat so the plane isn´t "cold" pilotJet1 doMove [-7974.6,30547.9,678.112];//assures that engines stays on (i personally use this every time) Jet1 forceSpeed 1100;//simulates throttle private _Jet1Path = [Jet1,PathJet1] spawn BIS_fnc_UnitPlay; sleep 5; hint str airplaneThrottle Jet1;//should return 1 waitUntil {sleep 2;scriptDone _Jet1Path}; PathJet1 = nil; Jet1 forceSpeed -1;//returns throttle to normal 1 Share this post Link to post Share on other sites
ErisMCM 1 Posted April 29, 2022 9 hours ago, beno_83au said: I've done it before with unitPlay. Try turning the engines on first: _plane engineOn true; _plane setAirplaneThrottle 0.3; setAirplaneTHrottle only works on player aircraft as I said. The plane is not a player driven one. Share this post Link to post Share on other sites
ErisMCM 1 Posted April 29, 2022 8 hours ago, soldierXXXX said: Hi. Unfortunately setAirplaneThrottle works only on player´s aircraft. However there is another command forceSpeed, which might do exactly what you need. You can test it with airplaneThrottle command. Here is example code. PathJet1 = [path data...]; Jet1 engineOn TRUE; Jet1 setVehicleTIPars [1, 1, 1];//sets the heat so the plane isn´t "cold" pilotJet1 doMove [-7974.6,30547.9,678.112];//assures that engines stays on (i personally use this every time) Jet1 forceSpeed 1100;//simulates throttle private _Jet1Path = [Jet1,PathJet1] spawn BIS_fnc_UnitPlay; sleep 5; hint str airplaneThrottle Jet1;//should return 1 waitUntil {sleep 2;scriptDone _Jet1Path}; PathJet1 = nil; Jet1 forceSpeed -1;//returns throttle to normal worked like a charm, except they jets are still pretty quiet, I'll figure it out tho! ❤️ 1 Share this post Link to post Share on other sites
h4wek 43 Posted April 3, 2023 Did you try how it works when observer is not near the plane? Beacouse forceSpeed work only in range of 50m from observer why?? Share this post Link to post Share on other sites
Harzach 2517 Posted April 3, 2023 13 hours ago, h4wek said: Beacouse forceSpeed work only in range of 50m from observer why?? I can't reproduce this. Please share your methodology. *edit* - currently, this command seems to be very unpredictable when attempting to assign an integer - it seems to set the speed limit semi-randomly between "SLOW", "NORMAL", and "FAST" speed. It works fine when used according to @Leopard20's note on the forceSpeed page: _unit forceSpeed (_unit getSpeed "NORMAL"); // force the unit to run I still can't reproduce the range issue mentioned above. Share this post Link to post Share on other sites
soldierXXXX 107 Posted April 3, 2023 Can´t reproduce this either. I´ve tested it with multiple situations and the smoke was visible everytime. We need more informations. 1) Do you play with mods ? 2) What is your Video option settings 3) Which plane do you use ? 4) Do you have a repro code you can provide that issue occurred with ? 5) Rpt file you can provide ? 6) Anything you might tell us Here are some pictures so you can see this works normally on my end. *Edit Smoke example is to confirm command forceSpeed is working as expected (like: plane1 forceSpeed 2000;). Not sure if the issue is related to effect visibility or just the sound. 1 Share this post Link to post Share on other sites
h4wek 43 Posted April 4, 2023 17 hours ago, Harzach said: I can't reproduce this. Please share your methodology. *edit* - currently, this command seems to be very unpredictable when attempting to assign an integer - it seems to set the speed limit semi-randomly between "SLOW", "NORMAL", and "FAST" speed. It works fine when used according to @Leopard20's note on the forceSpeed page: _unit forceSpeed (_unit getSpeed "NORMAL"); // force the unit to run I still can't reproduce the range issue mentioned above. try to place plane on the ground for example on taxi way to runway and place objects near it's path (this cause plane to move in jumps - it afraid to colision with near objects) and not runing in taxi mode, so using on plane forcespeed make this problem solved for example plane forcespeed 15, but when plane go from observer more thaen 50m it stops again if any object is near it's road still, or sufrace of map in place where plane touching ground in this moment is not compatibile with plane taxi road capabilities to move on. Force speed could be solution for this situation but when I program scripts for use it on Ai units what are out my range - for example enemy side on oposite ide of map it not worjk (when I swithch to observer it work again - but I observe when my view point was in distance more than 50m it stips again - when i move closer view it start again - so my conclusion is like I described. Share this post Link to post Share on other sites
Harzach 2517 Posted April 4, 2023 This sounds like it has more to do with the situation you are presenting the AI with. I can control AI speed via forceSpeed (as described in my previous reply) from a distance of 50KM+. 1 Share this post Link to post Share on other sites
soldierXXXX 107 Posted April 4, 2023 Alright so this seems like a collision issue. I´ve tested the case you described in your previous post. I´ve seen the plane brake when aproached object(s). Solution to this is simple. ForceSpeed is not needed. If the object can be set in Atributtes as Simple object, the plane stops braking. If the object cannot be set as Simple object (mission design or doesn´t have the option) you can solve it by disabling the collision with the plane. in the colliding object init field write: this disableCollisionWith myPlane1; and the object shouldn´t be a problem anymore. Tested case: Also (not sure if you know this or not) be aware that Planes cannot move upon the runway the way you might want them to. They can move only on predefined paths that is written in world config so they will ignore any move waypoint you gave them. For that case is best to record the path with unitCapture function. Example Altis airfield points: Green are for take off and Red are for Landing Also i´m still not sure about the 50m problem. That i can´t reproduce. Might you share a video about what´s happening in your mission and the code you use ? 2 Share this post Link to post Share on other sites
h4wek 43 Posted April 5, 2023 Yes I will prepare video for You, my problem is more complicated than this with vanilla used map - we using TOH asia map with not predefined for arma roads and airfield sufraces - but I have configured paths for all airfields on map and planes AI can start (with forcespeed sometimes) and land on it. With forcespeed are moving exactly on those taxi paths like on altis - but when i not use forcespeed they stoping like some obstacle will be on their way (there are no objects near only empty field around so this must be sufrace shape or type. In some places/airfields it start to move and even starting without forcespeed but taxi is impossibile in some other is stoping and without forcespeed is no possibile to move it to taxi or to start (50m problem is perfectly visible on this example if it will work without observer I will not disturb enybody by this problem beacouse I spent many time to prepare special scripts to discover stuck and helping with force speed so how i was suprised when i observe it and it works and then i observe jamed taxi ways on airfields beacouse enemy planes without observer was not move!!!). https://steamcommunity.com/sharedfiles/filedetails/?id=2412481913 (here is longer movie from other airfild on map where is less problem with stucking) but on this is much problematic) anyway is visiblie how this problem happen. Share this post Link to post Share on other sites
soldierXXXX 107 Posted April 7, 2023 Very interesting issue indeed. I´ve tested your mod, observed how AI works normally, with forceSpeed, without custom runways and here is my conclusion. So the biggest problem that is causing this issue are those custom runways you placed in editor. AI thinks that something that they can´t recognise is blocking the way which causes them to get stuck. Doesn´t happen everytime in the same spot but mostly somewhere on the runway (mostly first right turn in mod provided mission on airfield 0). when forceSpeed was used AI got unstucked and in many cases was able to take Off. Sometimes it still got stucked somewhere but not often. The range issue is the most interresting one because when i was just a normal unit on the ground it worked pretty good but as soon as i moved further from aircraft with unit or switched to splendid camera/spectator mode the plane got stucked until i moved the camera closer just like you did on the video. When i tested it without these runways the AI didn´t have a problem and moved as expected. The range issue with forceSpeed didn´t occurred anytime in this case. My previous solution works only for one plane at time. Plane is able to move like there are no obstacles in the way. Why does this work for only one plane ? It´s because object references. Disabling collision creates reference between two objects, but as soon as some other object refers to the same object, reference on that object gets overwritten and first object automaticaly enables collision again. See example 3 in disableCollisionWith. My code for this solution: Spoiler //solution for one jet /* Syntax: [ _plane = <object> - the plane that should takeOff, _layers = <array of strings> - 3DEN layers that should disable collision with plane ] */ soldierXXXX_Allow_One_Plane_Taxi = { scriptName "soldierXXXX_Allow_One_Plane_Taxi"; params ["_plane","_layers"]; { _layer = _x; getMissionLayerEntities _layer params ["_objects"]; { _plane disableCollisionWith _x; } forEach _objects; } forEach _layers; }; [plane2,["airfield 0","airfield 1","airfield 2","airfield 3","airfield 4","airfield 5/6","airfield 7"]] spawn soldierXXXX_Allow_One_Plane_Taxi; Test for disabled collisions in debug console: Spoiler //test collisions with layer objects getMissionLayerEntities "airfield 0" params ["_objects"]; _collisions = []; { _collisions pushBack (collisionDisabledWith _x); } forEach _objects; _collisions; //notice that only the latest jet has collisions disabled Only solution for more planes i could have think of was to create pushing script so the AI cannot get stucked anywhere. AI is still able to turn around the runway so pushing the aircraft is working, but it´s not eye candy. However it works anywhere on the map and player doesn´t have to be around. Ideal solution would be to make these runways as part of the map but i think that´s not possible in this case. Another ideal solution would be allowing objects to be set as Simple objects. Here is my code for this solution: Spoiler //solution for more planes at once (pushing) /* Syntax: [ _plane = <object> - the plane that should be forced to takeOff, _speed = <number> - (optional-default 10) Pushing speed/force should be <= 20 , _angle = <number> - (optional-default 120) Angle for vehicles collision check, _timeOut = <number> - (optional-default 0.1) Refresh rate of the script in seconds ideally 0.05 ] */ soldierXXXX_forcedTakeOff = { params ["_plane",["_speed",10],["_angle",120],["_timeOut",0.1]]; scriptName format ["forcedTakeOff_%1",_plane]; _speed = _speed min 20; while {isTouchingGround _plane} do { if (damage _plane > 0.05) exitWith {}; sleep _timeOut; if (speed _plane < _speed) then { private _NearEntities = _plane nearEntities ["AllVehicles", (_speed + 20)]; private _correctedEntities = _NearEntities - [_plane]; private _isColliding = FALSE; { private _collisionCheck = [getPosWorld _plane, getDir _plane, _angle, getPosWorld _x] call BIS_fnc_inAngleSector; if (_collisionCheck) exitWith {_isColliding = TRUE;hintSilent format ["%1 is colliding with %2",_plane,_x];}; } forEach _correctedEntities; if (!_isColliding) then { _plane setVelocityModelSpace [0,_speed,0]; }; }; }; hint format ["script ForcedTakeOff_%1 ended",_plane]; }; [planex,10,120,0.1] spawn soldierXXXX_forcedTakeOff; So in conclusion runways colliding with planes. Range issue with forceSpeed only appears when there are custom objects in the runway path that might normally block pilot AI movement. It´s a very specific case that causes this issue. Still, i´m not entirely sure if it should happen. Because it´s strange that when you´re around plane moves, but as soon as you move out of sight the plane stops. Maybe create a feedback ticket for that. I´m thinking about something universal like _unit disableAI "COLLISIONCHECK" or something like that might be pretty useful in such situations. But i´m not sure if it´s doable. I´m afraid i cannot help any further with this problem. At least i can confirm the issue does happen when AI is dealing with this situation 😄. I hope this helped 🙂. For anyone interested here is a debug code that will mark config positions on any map. I created it to test these airport ways. Spoiler //This function will draw airports paths for AI on the map-use for debug purposes //you can execute it directly in Debug console on any map //Draw Main AirPort //Draw Main In _array = getArray (configfile >> "CfgWorlds" >> worldName >> "ilsTaxiIn"); if (_array isEqualTo []) exitWith {hint "Map doesn´t have Airport";}; _arrayPosAll = []; _arrayPos = []; { if (_forEachIndex % 2 == 0) then { _arrayPos pushBack _x; }; if (_forEachIndex % 2 == 1) then { _arrayPos pushBack _x; _arrayPosAll pushBack _arrayPos; _arrayPos = []; }; } forEach _array; { _marker = createMarker ["Main" + "In"+ str _forEachIndex,_x]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "ColorGreen"; _marker setMarkerText "In" + str _forEachIndex; } forEach _arrayPosAll; //Draw Main Out _array = getArray (configfile >> "CfgWorlds" >> worldName >> "ilsTaxiOff"); _arrayPosAll = []; _arrayPos = []; { if (_forEachIndex % 2 == 0) then { _arrayPos pushBack _x; }; if (_forEachIndex % 2 == 1) then { _arrayPos pushBack _x; _arrayPosAll pushBack _arrayPos; _arrayPos = []; }; } forEach _array; { _marker = createMarker ["Main" + "Out"+ str _forEachIndex,_x]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "ColorRed"; _marker setMarkerText "Out" + str _forEachIndex; } forEach _arrayPosAll; //Draw Main Position _array = getArray (configfile >> "CfgWorlds" >> worldName >> "ilsPosition"); _marker = createMarker ["Main" + "Pos",_array]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "colorBlue"; _marker setMarkerText "Pos_Main"; //Draw all SecondaryAirports _configAirPorts = configProperties [configfile >> "CfgWorlds" >> worldName >> "SecondaryAirports","true"] apply {configName _x}; if (_configAirPorts isEqualTo []) exitWith {hint "Map has only one airport";}; { _airportName = _x; //Draw Pos IN _array = getArray (configfile >> "CfgWorlds" >> worldName >> "SecondaryAirports" >> _x >> "ilsTaxiIn"); _arrayPosAll = []; _arrayPos = []; { if (_forEachIndex % 2 == 0) then { _arrayPos pushBack _x; }; if (_forEachIndex % 2 == 1) then { _arrayPos pushBack _x; _arrayPosAll pushBack _arrayPos; _arrayPos = []; }; } forEach _array; { _marker = createMarker [_airportName + "In"+ str _forEachIndex,_x]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "ColorGreen"; _marker setMarkerText "In" + str _forEachIndex; } forEach _arrayPosAll; //Draw Pos OUT _array = getArray (configfile >> "CfgWorlds" >> worldName >> "SecondaryAirports" >> _x >> "ilsTaxiOff"); _arrayPosAll = []; _arrayPos = []; { if (_forEachIndex % 2 == 0) then { _arrayPos pushBack _x; }; if (_forEachIndex % 2 == 1) then { _arrayPos pushBack _x; _arrayPosAll pushBack _arrayPos; _arrayPos = []; }; } forEach _array; { _marker = createMarker [_airportName + "Out"+ str _forEachIndex,_x]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "ColorRed"; _marker setMarkerText "Out" + str _forEachIndex; } forEach _arrayPosAll; //Draw Position _array = getArray (configfile >> "CfgWorlds" >> worldName >> "SecondaryAirports" >> _x >> "ilsPosition"); _marker = createMarker [_airportName + "Pos",_array]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "colorCivilian"; _marker setMarkerText "Pos" + "_" + _airportName; } forEach _configAirPorts; 1 Share this post Link to post Share on other sites
h4wek 43 Posted April 8, 2023 I report this problem 2 years ago nobody, react so probably this will stay as it is. Share this post Link to post Share on other sites
Harzach 2517 Posted April 8, 2023 8 hours ago, h4wek said: I report this problem 2 years ago I can't find your report on the feedback tracker. Share this post Link to post Share on other sites
h4wek 43 Posted April 9, 2023 I didn't report it on feedback tracker, i write post about this and similar problems here , later Bi was ban me from discord and now block my steam acount for EULA rules so maybe you sholdn't write or ansver on my posts :) , but is not matter now, If you will be able to fix it now or check what is wrong, it will be great for all players of A3 (who try to use it like me of course), I am very frustrated of thi situation after 20 years of modding in OFP/ARMA but sttill I like this game very much so this kind of doings for improove i still try to do :) my ban (if you are interested) was for do this kind of alived vanilla content (working with deformer scripts big shovel - for those who will not be able to use link on bottom anymore -> video) (probably nobody from BI didn't find it yet for block like it was with for example with TRAWLER) https://steamcommunity.com/sharedfiles/filedetails/?id=2879760031 (but if you want ban it too - probably you will be even obligated to this if you read this post but anyway all acount is blocked so go on). Share this post Link to post Share on other sites
h4wek 43 Posted November 4, 2023 Any body ansver for technical issue or EULA rule shame is too much?? Anyway is other problem on objects with forceSpeed and setAirplaneThrottle (when I make UAV ramp for drone and attach it to it after i set engine on before start and set full throttle drone after start fly by setmodel velocity and then run down becouse?? throttle is overwrite to 0 - and even I set it via command to 1 engine set it back to 0 until drone, after it get to ground back it set throttle to 1 by itself - but in most cases it is too late beacouse when hit ground effect is obvious - WTF????!!!!!! Best ansver for self questions: for all who try the same some solution like: _UAV engineON true;sleep 0.1;_UAV setAirplaneThrottle 1; waituntil {sleep 1;(airplaneThrottle _UAV == 1) || !(alive _UAV)};(gunner _unit) remoteControl (driver _UAV); ............. detach _UAV;//_UAV setVehicleLock "LOCKED"; _UAV setVelocityModelSpace [0,30,0]; _UAV setAirplaneThrottle 1; waituntil {sleep 1;(airplaneThrottle _UAV == 1) || !(alive _UAV)};(gunner _unit) remoteControl objnull; Share this post Link to post Share on other sites