Muzza 0 Posted March 18, 2013 The players are trying to defend camp Rogain, in the final stages of the mission the players are surrounded, the enemy stop attacking after a few minutes and wait at nearby rally points. Artillery shells rain down on the camp and just as they stop enemies rush into the camp from all directions before opening fire on the few shell-shocked survivors. Or at least that is the plan. I have a code below that does most of that. I am using the disableAI command to encourage the AI to actually run straight to the objective instead of faffing about as they normally do. The trouble is in using the enableAI command, I would like it to be done when the units complete their move waypoints, however the syntax for setwaypoint statement is as follows: waypoint setWaypointStatements [condition, statement] which requires the name if the waypoint and not just the reference in relation to the group. so i cannot just use {{[_x, 3] setWaypointStatements ["true", "_x enableAI "AUTOTARGET"; _x enableAI "TARGET";"] forEach units _x} forEach _all; as I normally would. How can I code around this problem? Many thanks for help the community has provided me, I hope you find the scenario worth it! hint "beginning script"; _all = [g1, g2, g3, g4, g5, g6, g7, g8, g13, g9, g10, g11, g12, f1, f2, f3, f4, f5, f6, f7, f8, f13, f9, f10, f11, f12]; _1g = [g1, g2, g3, g4]; // Create an array with the names of all of the groups. _2g = [g5, g6, g7, g8, g13]; _3g = [g9, g10, g11, g12]; _1f = [f1, f2, f3, f4]; // Create an array with the names of all of the groups. _2f = [f5, f6, f7, f8, f13]; _3f = [f9, f10, f11, f12]; {deleteWaypoint [_x, 5];} foreach _all; {deleteWaypoint [_x, 4];} foreach _all; {deleteWaypoint [_x, 3];} foreach _all; {deleteWaypoint [_x, 2];} foreach _all; {deleteWaypoint [_x, 1];} foreach _all; //move to position {_wp = _x addWaypoint [getmarkerpos "rally_1", 0];} foreach _1g; {_wp = _x addWaypoint [getmarkerpos "rally_2", 0];} foreach _2g; {_wp = _x addWaypoint [getmarkerpos "rally_6", 0];} foreach _3g; {_wp = _x addWaypoint [getmarkerpos "rally_3", 0];} foreach _1f; {_wp = _x addWaypoint [getmarkerpos "rally_4", 0];} foreach _2f; {_wp = _x addWaypoint [getmarkerpos "rally_5", 0];} foreach _3f; ; {[_x, 1] setWaypointType "MOVE";} foreach _all; {[_x, 1] setWaypointBehaviour "AWARE";} foreach _all; {[_x, 1] setWaypointSpeed "FULL";} foreach _all; //wait for artillery hint "go go go!"; {{_x disableAI "AUTOTARGET"; _x disableAI "TARGET";} forEach units _x} foreach _all; {_wp2 = _x addWaypoint [getmarkerpos "entry_1", 0];} foreach _1g; {_wp2 = _x addWaypoint [getmarkerpos "entry_2", 0];} foreach _2g; {_wp2 = _x addWaypoint [getmarkerpos "entry_6", 0];} foreach _3g; {_wp2 = _x addWaypoint [getmarkerpos "entry_3", 0];} foreach _1f; {_wp2 = _x addWaypoint [getmarkerpos "entry_4", 0];} foreach _2f; {_wp2 = _x addWaypoint [getmarkerpos "entry_5", 0];} foreach _3f; {[_x, 2] setWaypointType "MOVE";} foreach _all; {[_x, 2] setWaypointBehaviour "AWARE";} foreach _all; {[_x, 2] setWaypointSpeed "FULL";} foreach _all; // ** THIS IS WHERE I NEED setWaypointStatements to enableAI*** {_wp3 = _x addWaypoint [getmarkerpos "attack", 10];} foreach _all; {[_x, 3] setWaypointType "SAD";} foreach _all; Share this post Link to post Share on other sites
cobra4v320 27 Posted March 18, 2013 (edited) You would need to either use double quotation marks in the waypoint statement like this hint ""Hello?""; or like this hint 'hello?' {{[_x, 3] setWaypointStatements ["true", "_x enableAI ""AUTOTARGET""; _x enableAI ""TARGET"""] forEach _all; Edited March 18, 2013 by cobra4v320 Share this post Link to post Share on other sites
Muzza 0 Posted March 19, 2013 Cant get anything to work at all anymore! No idea what has happened. Has the disableai feature been removed? I have tried soldiers with "this disableai "AUTOTARGET"; this disableAI "TARGET";" in their inits and the fire as per normal, help! Here is a concise version of the problem. I want the AI to dynamically stop caring about shooting things, run blindly to a waypoint aand then open fire. //groupnames _all = [g1, g2, g3, g4, g5, g6, g7, g8, g13, g9, g10, g11, g12, f1, f2, f3, f4, f5, f6, f7, f8, f13, f9, f10, f11, f12]; //disable the ai {{_x disableAI "AUTOTARGET"; _x disableAI "TARGET";} forEach units _x;} foreach _all; //give new waypoint {_wp2 = _x addWaypoint [getmarkerpos "entry_5", 0];} foreach _all; {[_x, 2] setWaypointType "MOVE";} foreach _all; {[_x, 2] setWaypointBehaviour "AWARE";} foreach _all; {[_x, 2] setWaypointSpeed "FULL";} foreach _all; {{[_x, 2] setWaypointStatements ["true", "_x enableAI ""AUTOTARGET""; _x enableAI ""TARGET""; hint ""wp completed"";"];} forEach units _x} forEach _all; Share this post Link to post Share on other sites
cobra4v320 27 Posted March 19, 2013 {_x disableAI "AUTOTARGET"; _x disableAI "TARGET"} forEach _all; ---------- Post added at 19:47 ---------- Previous post was at 19:42 ---------- Not tested. _all = [g1, g2, g3, g4, g5, g6, g7, g8, g13, g9, g10, g11, g12, f1, f2, f3, f4, f5, f6, f7, f8, f13, f9, f10, f11, f12]; {_x disableAI "AUTOTARGET"; _x disableAI "TARGET"} forEach _all; {_wp2 = _x addWaypoint [getmarkerpos "entry_5", 0]} foreach _all; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "AWARE"; _wp2 setWaypointSpeed "FULL"; _wp2 setWaypointStatements ["true", "{_x enableAI 'AUTOTARGET'; _x enableAI 'TARGET'; hint 'wp completed'} foreach _all"]; Share this post Link to post Share on other sites
Muzza 0 Posted March 19, 2013 The g1, g2, etc refer to group names. This is mostly pointess if putting "this disableAI "AUTOTARGET"; this disableAI "TARGET"" in the init field of a soldier has no effect on his fire output when it did yesterday. Could an alpha release have broken this? does it work for anyone else? Share this post Link to post Share on other sites
f2k sel 164 Posted March 19, 2013 Your using a local variable in the waypoint statement int 'wp completed'} foreach _all"]; it needs to be all = [g1, ect int 'wp completed'} foreach all"]; Share this post Link to post Share on other sites
cobra4v320 27 Posted March 19, 2013 Learned something new, thanks guys. //groupnames _all = [g1, g2, g3, g4, g5, g6, g7, g8, g13, g9, g10, g11, g12, f1, f2, f3, f4, f5, f6, f7, f8, f13, f9, f10, f11, f12]; //disable the ai {{_x disableAI "AUTOTARGET"; _x disableAI "TARGET"} forEach units _x} foreach _all; //give new waypoint {_wp2 = _x addWaypoint [getmarkerpos "entry_5", 0]} foreach _all; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "AWARE"; _wp2 setWaypointSpeed "FULL"; _wp2 setWaypointStatements ["true", "{{_x enableAI 'AUTOTARGET'; _x enableAI 'TARGET'; hint 'wp completed'} forEach units _x} forEach _all"]; Share this post Link to post Share on other sites