diff --git a/a3_vemf_reloaded/sqf/REMOTEguard.sqf b/a3_vemf_reloaded/sqf/REMOTEguard.sqf index e0a50b9..c6efc29 100644 --- a/a3_vemf_reloaded/sqf/REMOTEguard.sqf +++ b/a3_vemf_reloaded/sqf/REMOTEguard.sqf @@ -16,22 +16,19 @@ while {true} do { if ((count playableUnits) > 0) then { - waitUntil {if ((count allGroups) > 0) then {uiSleep 0.25; true} else {uiSleep 0.5; false} }; { - if ((local _x) AND (_x getVariable ["isVEMFrGroup",false])) then + if ((local _x) AND (_x getVariable [("isVEMFrGroup"),(false)]) AND (_x getVariable [("isVEMFrGroupLocal"),(false)])) then { if ((count (units _x)) > 0) then { //["REMOTEguard",1,format["Attempting to transfer group: %1", _x]] ExecVM ("log" call VEMFr_fnc_scriptPath); // Group still has units, check if there is anyone that can be the owner - _h = [_x] ExecVM ("setGroupOwner" call VEMFr_fnc_scriptPath); - waitUntil { if (scriptDone _h) then {true} else {uiSleep 0.1; false} }; + [_x] ExecVM ("setGroupOwner" call VEMFr_fnc_scriptPath); //["REMOTEguard",1,format["Transfer attempted. Group (%1) is %2", _x, if (local _x) then {"still local!"} else {"now REMOTE"}]] ExecVM ("log" call VEMFr_fnc_scriptPath); - } else - { - deleteGroup _x; - }; + } else { deleteGroup _x }; }; + if (not(local _x) AND (_x getVariable [("isVEMFrGroupLocal"),(false)])) then { _x setVariable [("isVEMFrGroupLocal"),(false),(true)] }; } forEach allGroups; + uiSleep 0.5; } else { uiSleep 5 }; };