Djavu 9 Posted August 15, 2019 Need help. I want to get units in a group into nearby vehicles. But my code returns an error, as described in the comment, next to it. In my research I found only how to convert string into object. If they point me in a way to research and learn about, it's a big help. Thank you. private _Grupo = (group p1); private _VEIC = nearestObjects [_grupo, ["Car"], 30]; {_grupo addvehicle _x} foreach _VEIC; sleep 1; { _x assignAsCargo _veic} foreach units _grupo; //error, array type waiting for object (_veic is an array of nearestObjects) {[_x] orderGetIn true; [_x] allowGetIn true}foreach units _Grupo; Share this post Link to post Share on other sites
b3lx 161 Posted August 16, 2019 First you correctly treat _VEIC as an array of objects: 48 minutes ago, Djavu said: {_grupo addvehicle _x} foreach _VEIC But then you wrongly treat _VEIC as an object: Quote _x assignAsCargo _veic You might try a nested forEach: { private _v = _x; {_x assignAsCargo _v} forEach units _grupo; } forEach _veic; (units _grupo) orderGetIn true; (units _grupo) allowGetIn true; 4 1 Share this post Link to post Share on other sites
Djavu 9 Posted August 16, 2019 16 hours ago, b3lx said: You might try a nested forEach: { private _v = _x; {_x assignAsCargo _v} forEach units _grupo; } forEach _veic; (units _grupo) orderGetIn true; (units _grupo) allowGetIn true; It works perfectly. As I am learning about Sqf, I will still make a lot of mistakes 🙂, but luckily we can count on the help of nice people in this forum, like you . Thanks 3 Share this post Link to post Share on other sites