patpowercat 7 Posted January 3, 2017 Been trying to figure out how to have a surgical type airstrike via a script. Currently, this is what I have: _crew1 = []; _airframe1 = []; _crew2 = []; _airframe2 = []; if (isServer) then { _crew1 = creategroup WEST; _airframe1 = [getMarkerPos "spawn", markerDir "spawn", "B_Plane_CAS_01_F", _crew1] call BIS_fnc_spawnVehicle; _veh1 = _airframe1 select 0 ;// vehicle _veh1 setPos [getpos _veh1 select 0, getpos _veh1 select 1, 150];// set height _veh1 setvelocity [-50,-50,0]; _veh1 flyinHeight 150; _wp1 = _crew1 addWaypoint [(getMarkerPos "US_1"), 0]; _wp1 waypointAttachVehicle r_arty_1; _veh1 reveal [r_arty_1, 4]; _veh1 doTarget r_arty_1; _veh1 doFire r_arty_1; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FAST"; _wp1 setwaypointCombatMode "BLUE"; _wp2 = _crew1 addWaypoint [(getmarkerpos "spawn"), 0]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "FAST"; _wp2 setWaypointStatements ["true", "{deleteVehicle _x;} forEach crew (vehicle this) + [vehicle this];"]; //Second Jet _crew2 = creategroup WEST; _airframe2 = [getMarkerPos "spawn2", markerDir "spawn2", "B_Plane_CAS_01_F", _crew2] call BIS_fnc_spawnVehicle; _veh2 = _airframe2 select 0 ;// vehicle _veh2 setPos [getpos _veh2 select 0, getpos _veh2 select 1, 150];// set height _veh2 setvelocity [-50,-50,0]; _veh2 flyinHeight 150; _wp1 = _crew2 addWaypoint [(getmarkerpos "US_2"), 0]; _wp1 waypointAttachVehicle r_arty_3; _veh2 reveal [r_arty_3, 4]; _veh2 doTarget r_arty_3; _veh2 doFire r_arty_3; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FAST"; _wp1 setwaypointCombatMode "BLUE"; _wp2 = _crew2 addWaypoint [(getmarkerpos "spawn2"), 0]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "FAST"; _wp2 setWaypointStatements ["true", "{deleteVehicle _x;} forEach crew (vehicle this) + [vehicle this];"]; }; This is with 2 different targets (r_arty_1 and r_arty_3) with two different jets to attack them. However, I cannot get the jets to fire on targets. If I change setwaypointcombatmode to YELLOW, they fire, but at both targets. What I want, is a targeted strike against their assigned targets. Share this post Link to post Share on other sites
das attorney 858 Posted January 3, 2017 Might be worth trying forceweaponfire (see example 4) https://community.bistudio.com/wiki/forceWeaponFire Or give up with the ai and record it manually with unitcapture/unitplay TBH it might be worth giving them a sleep command after they spawn before you start assigning them targets Share this post Link to post Share on other sites
theend3r 83 Posted January 3, 2017 30 minutes ago, das attorney said: Might be worth trying forceweaponfire (see example 4) https://community.bistudio.com/wiki/forceWeaponFire Or give up with the ai and record it manually with unitcapture/unitplay TBH it might be worth giving them a sleep command after they spawn before you start assigning them targets UnitCapture is crap, it's been giving me headaches this whole day with its random chance of providing the clipboard, not to mention it can't do guided weapons, so you'd have to attack with bombs, which are better done with a script themselves (so you can drop 6/8 quickly, again, unitCapture can't do that reliably), which is additional work (although you can hit exactly the place you want to this way at least). It may be the best solution but it's still a pain. Share this post Link to post Share on other sites
das attorney 858 Posted January 3, 2017 It was fine last time I used it. Maybe a bug has crept in or something. Share this post Link to post Share on other sites
patpowercat 7 Posted January 3, 2017 forceWeaponFire works great, but the planes fire as soon as they spawn. Is there a way to wait until they are at a second waypoint or something before they fire? If I use rockets or bombs they are so far away they can't hit anything. I tried adding a waypoint prior to the forceWeaponFire like below, but they still fire as soon as they spawn. _wp1 = _crew3 addWaypoint [(getMarkerPos "m3"), 0]; _wp1 setWaypointBehaviour "CARELESS"; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FAST"; _wp1 setwaypointCombatMode "BLUE"; _wp2 = _crew3 addWaypoint [(getMarkerPos "r3"), 0]; _wp2 waypointAttachVehicle r_arty_3; _crew3 reveal [r_arty_3, 4]; CAS_3 doTarget r_arty_3; CAS_3 fireAtTarget [r_arty_3, "rhs_weap_s5"]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "FAST"; _wp2 setwaypointCombatMode "BLUE"; Share this post Link to post Share on other sites
das attorney 858 Posted January 3, 2017 You could either add some sleep into your script like I mentioned, or look at the wiki for setWaypointStatements and do forceWeaponFire from the statement. If you want to use sleep, then make sure you execVM or spawn the script (call will not suspend if executed in unscheduled environment) Share this post Link to post Share on other sites
johnnyboy 3797 Posted January 4, 2017 You can also waitUntil plane is X distance from target before fireAtTarget command. Then keep tweaking X until it happens the way you want it. Maybe this will work: _crew3 reveal [r_arty_3, 4]; CAS_3 doTarget r_arty_3; waitUntil {sleep .1; (CAS_3 distance r_arty_3) <= 400}; // Tweak this distance value until it works clean CAS_3 fireAtTarget [r_arty_3, "rhs_weap_s5"]; Share this post Link to post Share on other sites