dwringer 45 Posted March 9, 2013 (edited) Hello, I have been working on this script for over a year and only recently made the breakthrough allowing it to work effectively on entire groups rather than single units, so I decided to release it here. Hopefully there are not too many bugs. /* Arma 3 Dismissed Unit Bounding Script Stops "DISMISSED" units from moving beyond a certain radius. Reinitializes the unit/group. Break by adding "hasRebelled" flag to leader's namespace. Not tested for MP. Updated: 9 March 2013 Author: dwringer Arguments: [leader, radius] */ private ["_man", "_distMax", "_distRet", "_posStart", "_tx", "_ty", "_td", "_distCurr", "_grpOld", "_grpNew", "_wptReturn", "_wptDismiss"]; _man = _this select 0; _distMax = _this select 1; _distRet = _distMax * 0.85; _posStart = getPos _man; _man setVariable ["hasRebelled", false]; sleep random 5; while {!(_man getVariable "hasRebelled")} do { _grpOld = group _man; _distCurr = 0; {_tx = (position _x select 0) - (_posStart select 0); _ty = (position _x select 1) - (_posStart select 1); _td = sqrt ((_tx * _tx) + (_ty * _ty)); _distCurr = _distCurr max _td;} forEach units _grpOld; if (_distCurr >= _distMax) then { _grpNew = createGroup (side _man); _wptReturn = _grpNew addWaypoint [_posStart, 0]; _wptReturn setWaypointType "MOVE"; _wptReturn setWaypointSpeed "LIMITED"; _wptReturn setWaypointCompletionRadius _distRet; _wptDismiss = _grpNew addWaypoint [waypointPosition _wptReturn, 0]; _wptDismiss setWaypointType "DISMISS"; _wptDismiss setWaypointSpeed "NORMAL"; _wptDismiss setWaypointCompletionRadius _distRet; _grpNew setCurrentWaypoint _wptReturn; {[_x] join _grpNew} forEach units (group _man); deleteGroup _grpOld; }; sleep 45; }; Usage is simple: Save the script to an .sqf file such as "wrangle.sqf". Call with _nil = [groupLeader, radius] execVM "wrangle.sqf" For example: Place a group of civilians in the editor. Give them an initial waypoint of "DISMISSED", right where they are. In the leader's Initialization: field, put: _l = [this, 100] execVM "wrangle.sqf" Now preview the mission. The group of civilians will wander about aimlessly until one of them gets 100m from the group's starting location. At this point, you should see the group coalesce and reconverge at their initial starting position. Hopefully this works okay for people. The AI in "DISMISSED" mode is very dodgy, but this mitigates the worst effect (the endless roaming) in exchange for groups that frequently like to reconvene. Edited March 9, 2013 by dwringer set more forgiving sleep duration Share this post Link to post Share on other sites