goldenfiver 11 Posted February 12, 2017 Hi guys, I am trying to create 2 patrols using a loop. Each patrol has 4 waypoints, and I want wp 3 to change positions randomly everytime the patrol goes through wp 1. It works fine, except for the last line. When they reach wp1 , I get this error : type any, expected group. Can you please help me figure out why this is happening? groups_array = []; for [{_y=0;},{_y< 2;}, {_y = _y +1;}] do { _pos = getpos h1; _cur_group = creategroup east; groups_array pushback _cur_group; _cur_group = groups_array select _y; _newUnit = _cur_group createUnit ['rhs_msv_emr_rifleman', _pos, [], 0, 'CAN_COLLIDE']; _newUnit setSkill 0.5; _newUnit setRank 'PRIVATE'; _newWaypoint = _cur_group addWaypoint [getpos h2,0]; _newWaypoint setWaypointType 'MOVE'; _newWaypoint setWaypointSpeed 'LIMITED'; _newWaypoint setWaypointFormation 'COLUMN'; _newWaypoint setWaypointCombatMode 'GREEN'; _newWaypoint setWaypointBehaviour 'SAFE'; _newWaypoint = _cur_group addWaypoint [getpos h3,0]; _newWaypoint setWaypointType 'MOVE'; _newWaypoint setWaypointSpeed 'LIMITED'; _newWaypoint setWaypointFormation 'COLUMN'; _newWaypoint setWaypointCombatMode 'GREEN'; _newWaypoint setWaypointBehaviour 'SAFE'; _newWaypoint = _cur_group addWaypoint [getpos h4,0]; _newWaypoint setWaypointType 'MOVE'; _newWaypoint setWaypointSpeed 'LIMITED'; _newWaypoint setWaypointFormation 'COLUMN'; _newWaypoint setWaypointCombatMode 'GREEN'; _newWaypoint setWaypointBehaviour 'SAFE'; _newWaypoint = _cur_group addWaypoint [getpos h5,0]; _newWaypoint setWaypointType 'CYCLE'; _newWaypoint setWaypointSpeed 'LIMITED'; _newWaypoint setWaypointFormation 'COLUMN'; _newWaypoint setWaypointCombatMode 'GREEN'; _newWaypoint setWaypointBehaviour 'SAFE'; }; {[_x, 1] setWaypointStatements ["true", "_Newpos = [getpos h4, 25, 60, 2, 0, 200, 0] call BIS_fnc_findSafePos; [_x,3] setWaypointPosition [_Newpos, 10];"];} forEach groups_array; Share this post Link to post Share on other sites
BlacKnightBK 47 Posted February 12, 2017 @goldenfiver {[_x, 1] setWaypointStatements [true, _Newpos = [getpos h4, 25, 60, 2, 0, 200, 0] call BIS_fnc_findSafePos; [_x,3] setWaypointPosition [_Newpos, 10];];} forEach groups_array; You had a syntax error right before _Newpos because you placed a " by mistake Fixed it for you Share this post Link to post Share on other sites
killzone_kid 1326 Posted February 12, 2017 8 minutes ago, BlacKnightBK said: @goldenfiver {[_x, 1] setWaypointStatements [true, _Newpos = [getpos h4, 25, 60, 2, 0, 200, 0] call BIS_fnc_findSafePos; [_x,3] setWaypointPosition [_Newpos, 10];];} forEach groups_array; You had a syntax error right before _Newpos because you placed a " by mistake Fixed it for you What is with people today totally ignoring command syntax? It will not work if you do not follow syntax! Syntax is not optional! If it says you need to use string, you cannot just use whatever you like, it has to be string! https://community.bistudio.com/wiki/setWaypointStatements Share this post Link to post Share on other sites
killzone_kid 1326 Posted February 12, 2017 54 minutes ago, goldenfiver said: [_x,3] setWaypointPosition [_Newpos, 10];"] Change _x to group this, as _x doesn't exist when statement is executed Share this post Link to post Share on other sites
goldenfiver 11 Posted February 12, 2017 6 minutes ago, killzone_kid said: Change _x to group this, as _x doesn't exist when statement is executed Thanks killzone_kid - that's what I needed. I didn't know that. Share this post Link to post Share on other sites