FederalRazer89 7 Posted December 31, 2016 Hello I am trying to get a officer that got deployed though a script, and with a addaction command spawn a helicopter and board it then fly away the startpoint. when the script execute the part with is related to the officer, then an error occur. This my be because i am trying to have a lot of code inside the addaction command, but i am not sure. The script: .....//(perhaps unrelated stuff)// FOBofficer FOBofficergroup = [_mainpos, WEST, ["B_officer_F","B_recon_medic_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; FOBofficer = leader FOBofficergroup;.... //(perhaps unrelated stuff)// Add "Dismantle FOB" option to FOBofficer with heli transport FOBofficer addAction ["Dismantle FOB",{ _FOBposretreat = getMarkerPos"markerFOB"; _mainpos = getMarkerPos "markerbase"; _spawnedVehicleArray = [_mainpos,random (360),"B_Heli_Transport_01_F",west] call BIS_fnc_spawnVehicle; _heli = _spawnedVehicleArray select 0; _heliCrew = _spawnedVehicleArray select 2; _wp = _heliCrew addWaypoint [_FOBposretreat,10]; _wp setWaypointType "LOAD"; _wp setwaypointstatements ["this land 'land'"]; _wp1 = _helicrew addWaypoint [_mainpos,10]; _wp2 = _helicrew addWaypoint [_mainpos,10]; _wp2 setwaypointstatements ["true","{deleteVehicle _x} foreach units group this;"];//Changing group to remove the guard waypoint _FOBofficergroupgoinghome = createGroup EAST; {[_x] joinSilent _FOBofficergroupgoinghome} forEach (units _FOBofficergroupgoinghome); _wp1r = _FOBofficergroupgoinghome addWaypoint [_FOBposretreat, 20]; _wp1r setWaypointType "move"; sleep 90; _FOBfollower = units group (_FOBofficergroupgoinghome select 1); //Error: type group, expected array _FOBofficergoinghome = leader _FOBofficergroupgoinghome; _FOBofficergoinghome assignAsCargo _heli; _FOBfollower assignAsCargo _heli; [_FOBofficergoinghome, _FOBfollower] orderGetIn true; }];.....//(perhaps unrelated stuff) The script is about 120 lines long so cutout the stuff that i didnt cause any problems, can add all of it if needed. It wasent untill i added the "addaction" command when it started to output error. Have spent about 8 hours straght to get this to work, if anyone have some input to what to do or know a script that i can look at. And for those who read this at this time, happy new year Share this post Link to post Share on other sites
Larrow 2800 Posted December 31, 2016 Maybe would be a good idea to post the error you are getting as well. _FOBofficergroupgoinghome = createGroup EAST; {[_x] joinSilent _FOBofficergroupgoinghome} forEach (units _FOBofficergroupgoinghome); Whats this. Why are the units of the group joining the group they are already in? Unlikely to be your error, but just looks wrong. _wp setwaypointstatements ["this land 'land'"]; This is wrong it should be waypoint setWaypointStatements [condition, statement] Happy New Year to you to. Share this post Link to post Share on other sites
FederalRazer89 7 Posted January 1, 2017 The "wp setwaypointstatements ["this land 'land'"];" is something that i found when watching this tutorial. The error i get is on this line: _FOBfollower = units group (_FOBofficergroupgoinghome select 1); type group, expected array 19 hours ago, Larrow said: Whats this. Why are the units of the group joining the group they are already in? Unlikely to be your error, but just looks wrong. That was just a typo on my part Share this post Link to post Share on other sites
davidoss 550 Posted January 1, 2017 // FOBofficer _FOBofficergroup = [_mainpos, WEST, ["B_officer_F","B_recon_medic_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; _FOBofficer = leader _FOBofficergroup; .... //(perhaps unrelated stuff) // Add "Dismantle FOB" option to FOBofficer with heli transport _FOBofficer addAction ["Dismantle FOB",{ _FOBposretreat = getMarkerPos "markerFOB"; _mainpos = getMarkerPos "markerbase"; _spawnedVehicleArray = [_mainpos,random (360),"B_Heli_Transport_01_F",west] call BIS_fnc_spawnVehicle; _heli = _spawnedVehicleArray select 0; _heliGroup = _spawnedVehicleArray select 2; _wp = _heliGroup addWaypoint [_FOBposretreat,10]; _wp setWaypointType "LOAD"; _wp setwaypointstatements ["true","this land 'land'"]; _wp2 = _heliGroup addWaypoint [_mainpos,10]; _wp2 setwaypointstatements ["true","{deleteVehicle _x} forEach (thisList + [vehicle this]);"]; //Changing group to remove the guard waypoint _FOBofficergroupgoinghome = createGroup EAST; //how the group _FOBofficergroupgoinghome gets any units??? //{[_x] joinSilent _FOBofficergroupgoinghome} forEach (units _FOBofficergroupgoinghome); { [_x] joinSilent grpNull; [_x] joinSilent _FOBofficergroupgoinghome; } forEach (units _FOBofficergroup); _wp1r = _FOBofficergroupgoinghome addWaypoint [_FOBposretreat, 20]; _wp1r setWaypointType "MOVE"; sleep 90; _FOBfollower = ((units _FOBofficergroupgoinghome) select 1); _FOBofficergoinghome = leader _FOBofficergroupgoinghome; _FOBofficergoinghome assignAsCargo _heli; _FOBfollower assignAsCargo _heli; [_FOBofficergoinghome, _FOBfollower] orderGetIn true; }]; Share this post Link to post Share on other sites
FederalRazer89 7 Posted January 2, 2017 Thanks davidoss Going to check how it works when i get home from work. Share this post Link to post Share on other sites
FederalRazer89 7 Posted January 2, 2017 Tried it now, but i get the error on the line: "_FOBfollower = ((units _FOBofficergroupgoinghome) select 1);" Error zero divisor dose that mean that the second unit in the group dosent exist? Share this post Link to post Share on other sites
theend3r 83 Posted January 2, 2017 5 hours ago, FederalRazer89 said: Tried it now, but i get the error on the line: "_FOBfollower = ((units _FOBofficergroupgoinghome) select 1);" Error zero divisor dose that mean that the second unit in the group dosent exist? Instead of asking trivial questions, you could try to find out yourself. Try hint str (units _FOBofficergroupgoinghome); That will list all units from the group. The debug console is very useful for... debugging. 1 Share this post Link to post Share on other sites
FederalRazer89 7 Posted January 3, 2017 Thanks for the tip theend3r. Dont have too much knowledge in programming prior to Arma, 3D modeling. Share this post Link to post Share on other sites
FederalRazer89 7 Posted January 3, 2017 After about 4 hour i got it to work. Here is the script for those intrested. // FOBofficer FOBofficergroup = [_mainpos, WEST, ["B_officer_F","B_recon_medic_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; FOBofficer = leader FOBofficergroup; { _x assignAsCargo (_spawnedVehicleArray select 0); _x moveIncargo (_spawnedVehicleArray select 0);} foreach units FOBofficergroup; FOBofficergroup setBehaviour "SAFE"; _wp = _heliCrew addWaypoint [_FOBpos,10]; _wp setWaypointType "TR UNLOAD"; _wp setwaypointstatements ["this land 'land'"]; _wp1 = _helicrew addWaypoint [_mainpos,10]; _wp2 = _helicrew addWaypoint [_mainpos,10]; _wp2 setWaypointStatements ["true","{deleteVehicle _x} foreach units group this;"]; _wpFOB = FOBofficergroup addWaypoint [_playerpos, 0]; _wpFOB setWaypointType "guard"; _wp1a = _guard addWaypoint [[(_FOBpos select 0)+10,(_FOBpos select 1)+10], 10]; _wp1a setWaypointType "guard"; // Add "Dismantle FOB" option to FOBofficer with heli transport FOBofficer addAction ["Dismantle FOB",{ _FOBposretreat = getMarkerPos "markerFOB"; _mainpos = getMarkerPos "markerbase"; _spawnedVehicleArray = [_mainpos,random (360),"B_Heli_Transport_01_F",west] call BIS_fnc_spawnVehicle; _heli = _spawnedVehicleArray select 0; _heliGroup = _spawnedVehicleArray select 2; _wp = _heliGroup addWaypoint [_FOBposretreat,10]; _wp1 = _heliGroup addWaypoint [_FOBposretreat,10]; _wp1 setWaypointType "LOAD"; _wp1 setwaypointstatements ["true","this land 'land'"]; _wp2 = _heliGroup addWaypoint [_mainpos,10]; _wp2 setwaypointstatements ["true","{deleteVehicle _x} forEach (thisList + [vehicle this]);"]; // hint str (units FOBofficergroup); _FOBfollower = ((units FOBofficergroup) select 1); FOBofficer = leader FOBofficergroup; waitUntil {(FOBofficer distance _heli) < 200}; FOBofficer assignAsCargo _heli; _FOBfollower assignAsCargo _heli; [FOBofficer, _FOBfollower] orderGetIn true; deleteWaypoint [FOBofficergroup,1]; wpFOB = FOBofficergroup addWaypoint [_FOBposretreat,10]; wpFOB setWaypointType "GETIN"; }]; Thanks for the help, would have taken a lot more time otherwise. Share this post Link to post Share on other sites