Rewritten, tweaked and fixed

This commit is contained in:
IT07 2016-06-23 22:46:33 +02:00
parent 9a09a8795e
commit 86dd2b7404

View File

@ -13,23 +13,26 @@
*/
uiNamespace setVariable ["VEMFrHcLoad", []];
uiNamespace setVariable ["VEMFrAIgroups", []];
while {true} do
{
_groups = uiNamespace getVariable "VEMFrAIgroups";
waitUntil {if (count _groups > 0) then {true} else {uiSleep 1; false} };
{
if (local _x) then
if ((count playableUnits) > 0) then
{
waitUntil {if ((count allGroups) > 0) then {uiSleep 0.25; true} else {uiSleep 0.5; false} };
{
if ((count units _x) < 1) then
if ((local _x) AND (_x getVariable ["isVEMFrGroup",false])) then
{
deleteGroup _x;
if ((count (units _x)) > 0) then
{
["REMOTEguard",1,format["Attempting to transfer group: %1", _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
// Group still has units, check if there is anyone that can be the owner
_handle = [_x] ExecVM "exile_vemf_reloaded\sqf\setGroupOwner.sqf";
waitUntil { if (scriptDone _handle) then {true} else {uiSleep 0.1; false} };
["REMOTEguard",1,format["Transfer attempted. Group (%1) is %2", _x, if (local _x) then {"still local!"} else {"now REMOTE"}]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
} else
{
deleteGroup _x;
};
};
if (count (units _x) > 0) then
{
// Group still has units, check if there is anyone that can be the owner
[_x] ExecVM "exile_vemf_reloaded\sqf\transferOwner.sqf";
};
};
} forEach _groups;
} forEach allGroups;
} else { uiSleep 5 };
};