Cigs4 18 Posted October 10, 2023 Hello, I need help please. I'm trying to move some civilians from their positions to the same location and then return them to their original positions. They are all in different positions at the start. I know how to make them go to the first position, but I have no idea how to get them back to their original position. It's for a dedicated server. Any help would be greatly appreciated. Share this post Link to post Share on other sites
JCataclisma 80 Posted October 10, 2023 Maybe you could add any simple object at their starting positions, like a crate let's say, even making it invisible ( _this hideObjectGlobal true; ), and give each one of them a variable name. So when you activate a trigger or whatever which commands civilians to walk towards original position, you could use the same method you are using for the initial move, but adding something like "GetPos _crate1" from the specific objects at the positions you want them to move. 1 Share this post Link to post Share on other sites
Cigs4 18 Posted October 10, 2023 Thanks, JCataclisma. I'll try that. Share this post Link to post Share on other sites
mrcurry 506 Posted October 10, 2023 Instead of relying on placed objects you could also have the unit remember where it came from by using setVariable/getVariable appropriately. Example: Coming to a browser near you later this evening! // Before doing the move _unit setVariable ["spot", getPos _unit]; // Do your move here... // When you want them to return private _position = _unit getVariable "spot"; // Make your unit move to _position 3 Share this post Link to post Share on other sites
Cigs4 18 Posted October 11, 2023 Thank you guys! I got help from Charlie at SML Scripting & Moding and Prisoner and LeonZ at Arma 3 Scripting & Goodies. Prisoner is the author of the script I'm going to share here, in case anyone else needs something similar. 0 = []spawn { private _civs = units civilian; private _newPos = getPosATL newpos; { private _unit = _x; private _oldPosition = getPosATL _unit; _unit setVariable ["TAG_oldPosition",_oldPosition]; _unit forceWalk true; _unit commandMove _newPos; } forEach _civs; sleep 20; { private _unit = _x; private _orginalPosition = _unit getVariable "TAG_oldPosition"; _unit forceWalk true; _unit commandMove _orginalPosition; } forEach _civs; }; Thanks again! This community is awesome. Cheers! 1 Share this post Link to post Share on other sites
pierremgi 4900 Posted October 11, 2023 { _x spawn { params ["_unit","_oldpos"]; _oldpos = getpos _unit; _unit doMove newpos; waitUntil {sleep 1; unitready _unit}; _unit domove _oldPos; }; } forEach units civilian; or, sticking to your code: { _x spawn { params ["_unit","_oldpos"]; _oldpos = getpos _unit; _unit doMove newpos; sleep 20; _unit domove _oldPos; }; } forEach units civilian; 3 Share this post Link to post Share on other sites
Cigs4 18 Posted October 13, 2023 Thanks, pierremgi !!! Share this post Link to post Share on other sites