jwllorens 43 Posted June 24, 2016 How do I make an AI pilot follow waypoints normally as if there are no enemy contacts around. I am sick of helicopters dive bombing the moment an enemy unit is spotted, I want the pilot to continue on his path to the waypoint as if everything is normal, while letting the subordinate group members (gunners and whatnot) target enemies and fire at them freely. I have tried all sorts of combinations of disableAI on the pilot and gunners, trying to get the gunners to autotarget freely but make the pilot ignore everything and carry on flying as if there are no enemies around. To no avail. As soon as a single enemy appears, the pilot ignores any flyInHeight commands I give and ignore waypoints, and immediately goes into a dive. It looks stupid, it acts stupid, it is stupid. It shouldn't be this hard to do this. A loiter waypoint should be a loiter waypoint,. I want the aircraft to fly in a circle defined by my script commands and not ignore them completely and go into a senseless dive. Share this post Link to post Share on other sites
kylania 568 Posted June 24, 2016 The the waypoint behaviour to CARELESS. 1 Share this post Link to post Share on other sites
nikiller 18 Posted June 24, 2016 hi, Try to ungroup the pilot (join grpNull). [_this] joinSilent grpNull; CARELESS behaviour as kylania suggested. _this setBehaviour "CARELESS"; DisaleAI target, autotarget, checkvisible, fsm, suppression, autocombat. {_this disableAI _x} forEach ["TARGET", "AUTOTARGET", "FSM", "SUPPRESSION", "COMBAT", "CHECKVISIBLE", "AUTOCOMBAT", "COVER"]; cya. Nikiller. Share this post Link to post Share on other sites
jwllorens 43 Posted June 24, 2016 Negatory, removing the pilot from the group and setting him as careless only causes the aircraft to fly in circles or hover and never proceed to the assigned waypoint. The waypoint is a loiter waypoint. Share this post Link to post Share on other sites
nikiller 18 Posted June 24, 2016 Remove gunners from the group might be a better solution. [_gunner1, _gunner2] joinSilent grpNull; Or maybe MoveInGunner, MoveInDriver the 3 not grouped units and give waypoint only to the pilot. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted June 24, 2016 Remove gunners from the group might be a better solution. [_gunner1, _gunner2] joinSilent grpNull; Or maybe MoveInGunner, MoveInDriver the 3 not grouped units and give waypoint only to the pilot. I would do it that way to ensure that gunners r in same group because i think they will call targets each other then: [_gunner1, _gunner2] joinSilent (createGroup west); Share this post Link to post Share on other sites
barbolani 198 Posted June 24, 2016 Negatory, removing the pilot from the group and setting him as careless only causes the aircraft to fly in circles or hover and never proceed to the assigned waypoint. The waypoint is a loiter waypoint. Thats probably because you have set waypoint in editor or previous to that code, so the pilot joins another group and loses all it's waypoints. The CARELESS and disableAI lines will be enough. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted June 24, 2016 Thats probably because you have set waypoint in editor or previous to that code, so the pilot joins another group and loses all it's waypoints. The CARELESS and disableAI lines will be enough. for that reason nikiller suggested to let the gunners leave the group instead of the pilot 1 Share this post Link to post Share on other sites
kylania 568 Posted June 24, 2016 let the gunners leave the group That was Drowning Pool's best song ever! 2 Share this post Link to post Share on other sites
JB47394 30 Posted May 26, 2017 As I cannot post new threads, I'm replying to this one. I'm attempting to get a Marid to just go to its waypoint. I want its gunner to continue to engage targets, but for the vehicle to keep moving. I've read countless threads of people trying to do this very thing. Nobody ever came up with a solution. I've gone through as many experiments on my own as I can stomach in a four day period. Careless, split groups, disableAI permutations, FSM performing direct control over each crew member, etc. Ultimately, the closest that I've gotten is to use an FSM to do a bunch of disableAIs on driver and commander, with a doMove to get the vehicle moving. That vehicle will drive right through everything and anything with the crew buttoned up - but the gunner won't shoot. He'll even look at enemies, but he won't shoot. I assume what's going on here is that the commander is responsible for assigning targets, and since he's disabled for such activities, the gunner doesn't get targets, and so he doesn't have anything to shoot. However, i further pushed my FSM to manually doTarget and doFire. I just picked anything that the gunner knew about and had him fire at that for five seconds at a time. Despite being given the commands, not a shot was fired. The target is being assigned, but he Just. Won't. Shoot. I tried another experiment with a Hunter, manually directing it to target and shoot me. It would also look at me but not fire. So I broke out a Marid again while I was set captive. Directed him to shoot at me. Didn't even point at me. Turn off captive and he starts blasting away. I have this nagging belief that the vehicle crew is being managed in a strict hierarchy, where the commander tells both gunner and driver what to do. If the commander isn't present, then the gunner tells the driver what to do. So it looks like Bohemia [long and unpleasant rant deleted] has essentially designed out any possibility of having a driver driving separately from a gunner gunning. They are always linked. If the vehicle is intent on reaching a destination, it cannot shoot. If it is intent on engaging enemies, it will not pursue its destination. Worst of all, that behavior seems so fundamental that there is no way to circumvent it. Does anyone have any insights on this? Can I orient and fire the turret without an AI in it? Can I play with multiple factions on the crew such that the gunner is AAF and the rest of the crew is CSAT? Will the CSAT commander still give orders to an AAF gunner? I'm more than a little burnt out on this idiocy and would appreciate some help from anyone else who has tackled this methodically. It's a fundamental task for an IFV yet ARMA cannot pull it off. Share this post Link to post Share on other sites
Tankbuster 1746 Posted May 26, 2017 Here's a direct copy paste of code from my mission, that works well. The pilots pretty reliably ignore enemy activity. _dwp = _dropgroup addWaypoint [_droppos, 0]; _dwp setWaypointBehaviour "CARELESS"; _dwp setWaypointSpeed "NORMAL"; _dwp setWaypointtype "MOVE"; _dropgroup setCombatMode "BLUE"; _dropgroup allowFleeing 0; (driver _dropveh) setskill ["courage",1]; (driver _dropveh) disableAI "FSM"; (driver _dropveh) disableAI "TARGET"; (driver _dropveh) disableAI "AUTOTARGET"; (driver _dropveh) disableAI "AUTOCOMBAT"; Much of the above I got from an existing BI function, I forget which, ambient flyby or similar. Share this post Link to post Share on other sites
crewt 31 Posted May 26, 2017 https://community.bistudio.com/wiki/setCombatMode set the combat mode to red and it should work. If not: move the Gunner in his own group. Share this post Link to post Share on other sites
JB47394 30 Posted May 26, 2017 Thanks for the post. Aircraft aren't a problem. I have Kajman gunships doing paradrops and cleanly exiting the area as their gunners rake enemies with the chin gun. The difference is in the makeup of the crews, and I'm certain that Bohemia has different code for air crews versus ground crews. In aircraft, the pilot appears to be in charge, so the aircraft goes where he says, and the gunner is obliged to shoot at whatever the pilot says. If the pilot's waypoint is careless, he just flies there, and the gunner seems free to engage whatever he likes as they fly along. In contrast, when a vehicle has a commander seat, the commander of the ground vehicle is directing both driver and gunner. It seems built-in to ARMA that the commander doesn't multitask; he can't just let the driver go where the vehicle is headed while leaving the gunner to engage whatever he sees. The commander is either taking the vehicle to its destination or he's engaging enemies. There is no middle ground. This seems to be true regardless of the group structure of the crew. Here's the setup before the doMove in the FSM: _unit = _this select 0; _destination = _this select 1; { _x disableAI "target"; _x disableAI "autotarget"; _x disableAI "autocombat"; _x disableAI "suppression"; _x disableAI "checkvisible"; _x disableAI "cover"; } forEach [driver _unit, commander _unit]; commander _unit allowDamage false; _unit setUnloadInCombat [false, false]; _unit allowCrewInImmobile true; As I've been working on this for the past couple hours, I've found that I can do _unit doTarget _target; and _unit fireAtTarget _target; to get the weapon to fire. It's not a very good implementation right now because the tracking of the turret is off, and fireAtTarget causes the weapon to fire regardless of the aim direction, but I'm out of time for this evening so I'll get back to it tomorrow, including an aimedAtTarget check, etc. Another tidbit of information is that to get a crew with a commander tracking and firing at a target, you doTarget the commander, then doFire both commander and gunner. This is true if you have them in a blue combatMode group (which is what I did for some isolated testing). A crew with only driver and gunner (e.g. Ifrit) can use doTarget and doFire on the gunner. Note that when using fireAtTarget, I just doTarget the vehicle itself. 16 minutes ago, crewt said: https://community.bistudio.com/wiki/setCombatMode set the combat mode to red and it should work. If not: move the Gunner in his own group. red combatMode didn't have any effect. The gun turrets just point around randomly. Remember that this is for a crew with a commander. As for the gunner in his own group, I certainly tried many combinations of groups for the crew, and without success. If the gunner is in his own group, he will not acquire and shoot targets on his own; he appears to need the commander to tell him to shoot. The same is true of the driver. If he's on his own, he won't drive. I may be suffering from pilot error here, so I can always go back and recheck this stuff. There are simply far too many moving parts and their impact isn't entirely clear. Share this post Link to post Share on other sites
f2k sel 164 Posted May 27, 2017 Commander has control when in the vehicle even when not in the same group so removing him from the group results in removal of waypoints from the driver. It also looks like if the commander is killed the vehicle stops and waypoints are not restored to the driver. I don't think this was how it worked in A2/OA. If you play as commander however driver will follow waypoints until you order him to do otherwise. Share this post Link to post Share on other sites
JB47394 30 Posted May 27, 2017 I completed a first cut FSM for APCs. It allows an AI crew with commander to move to a destination location while the gunner engages targets. I can't claim anything definitive, but repeated runs through bunches of infantry saw no stops. If the FSM is used on a tank, the vehicle will still stop to engage targets, so something different is needed there. Thanks, Bohemia. The core is pretty much as above: { _x disableAI "target"; _x disableAI "autotarget"; _x disableAI "autocombat"; } forEach [driver _unit, commander _unit]; commander _unit allowDamage false; _unit setUnloadInCombat [false, false]; _unit doMove _destination; Apparently, checkVisible had to stay enabled so the commander could spot targets for the gunner. Without it, the gunner is useless. The target selection and shooting is handled manually by the FSM, allowing the code to choose targets on whatever criteria is desired. at whatever frequency desired, etc. It's all done with targetsQuery, doTarget, and fireAtTarget. If that part of the FSM is turned off, the vehicle will just drive along seemingly without any concern for enemies. Here's the full FSM as a spoiler. I couldn't figure out attachments. Spoiler /*%FSM<COMPILE "scriptedFSM.cfg, GoToPosition">*/ /*%FSM<HEAD>*/ /* item0[] = {"_",0,4346,-198.438644,-331.626434,-108.438637,-281.626434,0.000000,""}; item1[] = {"Completed",4,218,146.313416,-206.141510,236.313416,-156.141510,0.000000,"Completed"}; item2[] = {"__1",1,250,145.390350,-89.423615,235.390381,-39.423630,0.000000,""}; item3[] = {"_",8,218,-36.763321,-332.234375,53.236679,-282.234375,0.000000,""}; item4[] = {"In_Transit",2,250,146.830750,-334.457275,236.830765,-284.457275,0.000000,"In Transit"}; item5[] = {"HasTarget",4,218,146.632507,-448.385315,236.632507,-398.385315,0.000000,"HasTarget"}; item6[] = {"Shoot",2,250,293.717407,-634.982849,383.717407,-584.982849,0.000000,"Shoot"}; item7[] = {"Delay",4,218,293.375336,-550.892151,383.375336,-500.892120,0.000000,"Delay"}; item8[] = {"Engage",2,250,146.886017,-550.009705,236.886032,-500.009674,0.000000,"Engage"}; item9[] = {"Done",4,218,289.858887,-447.480957,379.858887,-397.480957,0.000000,"Done"}; item10[] = {"KeepGoing",4,218,148.650909,-633.843811,238.650909,-583.843811,0.000000,"KeepGoing"}; link0[] = {0,3}; link1[] = {1,2}; link2[] = {3,4}; link3[] = {4,1}; link4[] = {4,5}; link5[] = {5,8}; link6[] = {6,7}; link7[] = {7,8}; link8[] = {8,9}; link9[] = {8,10}; link10[] = {9,4}; link11[] = {10,6}; globals[] = {0.000000,0,0,0,0,640,480,1,26,6316128,1,-382.882751,581.796143,141.769867,-751.828979,1045,968,1}; window[] = {2,-1,-1,-1,-1,969,210,1528,210,3,1067}; *//*%FSM</HEAD>*/ class FSM { fsmName = "GoToPosition"; class States { /*%FSM<STATE "_">*/ class _ { name = "_"; itemno = 0; init = /*%FSM<STATEINIT""">*/"private _unit = _this select 0;" \n "private _destination = _this select 1;" \n "private _completionRadius = _this select 2;" \n "private _enemySides = _this select 3;" \n "" \n "private _completionRadiusSqr = _completionRadius * _completionRadius;" \n "private _nextTarget = 0;" \n "private _nextShot = 0;" \n "" \n "{" \n " _x disableAI ""target"";" \n " _x disableAI ""autotarget"";" \n " _x disableAI ""autocombat"";" \n "} forEach [driver _unit, commander _unit];" \n "" \n "commander _unit allowDamage false;" \n "" \n "_unit setUnloadInCombat [false, false];" \n "" \n "_unit doMove _destination;"/*%FSM</STATEINIT""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; class Links { /*%FSM<LINK "_">*/ class _ { itemno = 3; priority = 0.000000; to="In_Transit"; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/; condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/; action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/; }; /*%FSM</LINK>*/ }; }; /*%FSM</STATE>*/ /*%FSM<STATE "__1">*/ class __1 { name = "__1"; itemno = 2; init = /*%FSM<STATEINIT""">*/"{" \n " _x enableAI ""target"";" \n " _x enableAI ""autotarget"";" \n " _x enableAI ""autocombat"";" \n "} forEach [driver _unit, commander _unit];" \n "" \n "commander _unit allowDamage true;" \n "" \n "_unit setUnloadInCombat [true, true];" \n "_unit allowCrewInImmobile false;" \n "" \n "systemchat ""completed"";"/*%FSM</STATEINIT""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; class Links { }; }; /*%FSM</STATE>*/ /*%FSM<STATE "In_Transit">*/ class In_Transit { name = "In_Transit"; itemno = 4; init = /*%FSM<STATEINIT""">*/"systemchat format [""In transit %1"", _nextTarget];"/*%FSM</STATEINIT""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; class Links { /*%FSM<LINK "HasTarget">*/ class HasTarget { itemno = 5; priority = 0.000000; to="Engage"; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/; condition=/*%FSM<CONDITION""">*/"_hasTarget = false;" \n "" \n "if (not moveToFailed _unit && not moveToCompleted _unit && canFire _unit) then" \n "{" \n " _targets = (gunner _unit) targetsQuery [objNull, west, ""Man"", getPos gunner _unit, 0];" \n " _targets = _targets select { (_x select 2) in _enemySides && lifeState (_x select 1) in [""HEALTHY"", ""INJURED"", """"] };" \n "" \n " if (count _targets > 0 && { not isNull (_targets select 0 select 1) }) then" \n " {" \n " systemchat format [""Picking %1"", (_targets select 0 select 1)];" \n " _unit doTarget (_targets select 0 select 1);" \n " _nextTarget = time + 5;" \n " _hasTarget = true;" \n " };" \n "};" \n "" \n "_hasTarget"/*%FSM</CONDITION""">*/; action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/; }; /*%FSM</LINK>*/ /*%FSM<LINK "Completed">*/ class Completed { itemno = 1; priority = 0.000000; to="__1"; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/; condition=/*%FSM<CONDITION""">*/"not alive _unit || not canMove _unit || _unit distanceSqr _destination < _completionRadiusSqr"/*%FSM</CONDITION""">*/; action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/; }; /*%FSM</LINK>*/ }; }; /*%FSM</STATE>*/ /*%FSM<STATE "Shoot">*/ class Shoot { name = "Shoot"; itemno = 6; init = /*%FSM<STATEINIT""">*/"if (_unit aimedAtTarget [assignedTarget _unit] > 0) then" \n "{" \n " _unit fireAtTarget [assignedTarget _unit];" \n "};" \n "_nextShot = time + 1;"/*%FSM</STATEINIT""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; class Links { /*%FSM<LINK "Delay">*/ class Delay { itemno = 7; priority = 0.000000; to="Engage"; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/; condition=/*%FSM<CONDITION""">*/"time > _nextShot"/*%FSM</CONDITION""">*/; action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/; }; /*%FSM</LINK>*/ }; }; /*%FSM</STATE>*/ /*%FSM<STATE "Engage">*/ class Engage { name = "Engage"; itemno = 8; init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; class Links { /*%FSM<LINK "KeepGoing">*/ class KeepGoing { itemno = 10; priority = 0.000000; to="Shoot"; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/; condition=/*%FSM<CONDITION""">*/"time <= _nextTarget && (lifeState (assignedTarget _unit) in [""HEALTHY"", ""INJURED""])"/*%FSM</CONDITION""">*/; action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/; }; /*%FSM</LINK>*/ /*%FSM<LINK "Done">*/ class Done { itemno = 9; priority = 0.000000; to="In_Transit"; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/; condition=/*%FSM<CONDITION""">*/"time > _nextTarget || not (lifeState (assignedTarget _unit) in [""HEALTHY"", ""INJURED"", """"])" \n ""/*%FSM</CONDITION""">*/; action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/; }; /*%FSM</LINK>*/ }; }; /*%FSM</STATE>*/ }; initState="_"; finalStates[] = { "__1", }; }; /*%FSM</COMPILE>*/ Share this post Link to post Share on other sites
Squirtman 5 Posted May 27, 2017 set the pilot of the helicopter to captive using setcaptive https://community.bistudio.com/wiki/setCaptive Share this post Link to post Share on other sites
JB47394 30 Posted May 29, 2017 Interestingly, I have been unable to duplicate this behavior without using an FSM. The Marid will stop to engage targets when using an equivalent script, even if I also throw in a disableAI "fsm" on each crew member. I also tried "move", but that gave the same results. If anyone knows how to get ARMA to treat a script the same way it treats FSMs, I'd appreciate it. Here's my FSM equivalent script: Spoiler FSMEquivalent = { private _unit = _this select 0; private _destination = _this select 1; private _enemySides = _this select 2; private _nextTarget = 0; private _nextShot = 0; { _x disableAI "target"; _x disableAI "autotarget"; _x disableAI "autocombat"; } forEach [driver _unit, commander _unit]; driver _unit disableAI "fsm"; gunner _unit disableAI "fsm"; commander _unit disableAI "fsm"; commander _unit allowDamage false; _unit setUnloadInCombat [false, false]; _unit doMove _destination; systemchat "moving"; private _nextTarget = 0; private _nextShot = 1e30; while { alive _unit && { canMove _unit } && { not unitReady _unit } } do { if (time > _nextTarget || not (lifeState (assignedTarget _unit) in ["HEALTHY", "INJURED", ""])) then { _nextShot = 1e30; _nextTarget = time + 1; if ([_unit, _enemySides] call SPM_Transport_GroundHasTarget) then { systemchat "new target"; _nextTarget = time + 5; _nextShot = 0; }; }; if (time > _nextShot) then { if (_unit aimedAtTarget [assignedTarget _unit] > 0) then { systemchat "firing"; _unit fireAtTarget [assignedTarget _unit]; }; _nextShot = time + 1; }; sleep 0.2; }; { _x enableAI "target"; _x enableAI "autotarget"; _x enableAI "autocombat"; } forEach [driver _unit, commander _unit]; driver _unit enableAI "fsm"; gunner _unit enableAI "fsm"; commander _unit enableAI "fsm"; commander _unit allowDamage true; _unit setUnloadInCombat [true, true]; systemchat "completed"; }; Edit: My continued testing with this stuff has shown me that the FSM technique only works with wheeled vehicles; cars and wheeled APCs. They reliably drive past infantry while engaging them. It just won't work with tracked vehicles; tanks and tracked APCs. The controller is different, and the controller for tracked vehicles just doesn't seem to provide a way to run and gun. The only way that I've found to prevent a tracked vehicle from stopping is to make sure that it doesn't see the enemies by using commander _vehicle disableAI "checkvisible" The commander will never see any targets and so never direct his crew to stop and engage them. The problem with this, of course, is that that the vehicle doesn't engage anything. On the upside, this does allow for vehicles to reliably move from point A to point B without the crew turning out (which is a problem with the setBehaviour "careless" approach). Note that the driver is still aware of the presence of other units because he will drive around them. My attempt to move the tracked vehicle's gunner to his own group, reveal a target for him manually, and tell him to fire manually - failed. A targetsQuery on the gunner shows the revealed target, but the turret never moves and he never fires. Perhaps I'll just have to live with turning checkvisible on and off. On when it's okay to shoot and off when I want the vehicle to move without being turned out. Share this post Link to post Share on other sites