Syntax tweaks and speed improvements

This commit is contained in:
IT07 2016-08-21 21:35:29 +02:00
parent 5602f86e87
commit 0be79c632b
30 changed files with 624 additions and 810 deletions

View File

@ -9,16 +9,16 @@
Returns: SIDE - unit's side
*/
private [("_r"),("_f")];
_f = getText (configFile >> "CfgVehicles" >> _this >> "faction");
if not(_f isEqualTo "") then
private [ "_r", "_f" ];
_f = getText ( configFile >> "CfgVehicles" >> _this >> "faction" );
if not ( _f isEqualTo "" ) then
{
scopeName "isEqualTo";
if (_f isEqualTo "BLU_G_F") then { _r = WEST; breakOut "isEqualTo" };
if (_f isEqualTo "CIV_F") then { _r = civilian; breakOut "isEqualTo" };
if (_f isEqualTo "IND_F") then { _r = independent; breakOut "isEqualTo" };
if (_f isEqualTo "IND_G_F") then { _r = resistance; breakOut "isEqualTo" };
if (_f isEqualTo "OPF_G_F") then { _r = EAST };
} else { [("fn_checkSide"),(0),(format["Failed to find faction of %1", _this])] ExecVM ("log" call VEMFr_fnc_scriptPath) };
if ( _f isEqualTo "BLU_G_F" ) then { _r = WEST; breakOut "isEqualTo" };
if ( _f isEqualTo "CIV_F" ) then { _r = civilian; breakOut "isEqualTo" };
if ( _f isEqualTo "IND_F" ) then { _r = independent; breakOut "isEqualTo" };
if ( _f isEqualTo "IND_G_F" ) then { _r = resistance; breakOut "isEqualTo" };
if ( _f isEqualTo "OPF_G_F" ) then { _r = EAST };
} else { [ "fn_checkSide", 0, format [ "failed to find faction of %1", _this ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -17,33 +17,28 @@
ARRAY - Result
*/
private [("_r"),("_chck"),("_v"),("_cfg")];
_r = [];
private [ "_r", "_chck", "_v", "_cfg" ];
_r = [ ];
_chck =
{
if (isNumber _cfg) then { _v = getNumber _cfg };
if (isText _cfg) then { _v = toLower (getText _cfg) };
if (isArray _cfg) then { _v = getArray _cfg };
if ( isNumber _cfg ) then { _v = getNumber _cfg };
if ( isText _cfg ) then { _v = toLower (getText _cfg) };
if ( isArray _cfg ) then { _v = getArray _cfg };
};
if (_this isEqualType "") then
if ( _this isEqualType "" ) then
{
if (isNull (configFile >> "CfgVemfReloadedOverrides" >> _this)) then
{
_cfg = configFile >> "CfgVemfReloaded" >> _this;
} else
{
_cfg = configFile >> "CfgVemfReloadedOverrides" >> _this;
};
if ( isNull ( configFile >> "CfgVemfReloadedOverrides" >> _this ) ) then { _cfg = configFile >> "CfgVemfReloaded" >> _this
} else { _cfg = configFile >> "CfgVemfReloadedOverrides" >> _this };
call _chck;
_r = _v;
};
if (_this isEqualType []) then
if ( _this isEqualType [] ) then
{
if (_this isEqualTypeArray [[],[]]) then
if ( _this isEqualTypeArray [ [], [] ] ) then
{
private [("_p"),("_b")];
private [ "_p", "_b" ];
_p = _this select 0;
_b =
{
@ -55,7 +50,7 @@ if (_this isEqualType []) then
_cfg = configFile >> "CfgVemfReloadedOverrides";
call _b;
_cfg = _cfg >> _x;
if (isNull _cfg) then
if ( isNull _cfg ) then
{
_cfg = configFile >> "CfgVemfReloaded";
call _b;
@ -63,20 +58,17 @@ if (_this isEqualType []) then
};
call _chck;
_r pushBack _v;
} forEach (_this select 1);
} forEach ( _this select 1 );
};
if (_this isEqualTypeArray [[]]) then
if ( _this isEqualTypeArray [ [] ] ) then
{
{
_cfg = configFile >> "CfgVemfReloadedOverrides" >> _x;
if (isNull _cfg) then
{
_cfg = configFile >> "CfgVemfReloaded" >> _x;
};
if ( isNull _cfg ) then { _cfg = configFile >> "CfgVemfReloaded" >> _x };
call _chck;
_r pushBack _v;
} forEach (_this select 0);
} forEach ( _this select 0 );
};
};
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -11,7 +11,7 @@
_this select 3: SCALAR - Distance in meters. Locations closer than given position will be excluded/included
_this select 4: SCALAR - Max prefered distance in meters from center. If not achievable, further dest will be selected
_this select 5: SCALAR - Distance in meters to check from _this2 for players
_this select 6: STRING (optional) - Exact config name of mission override settings to load
_this select 6: STRING - Exact config name of mission override settings to load
Returns:
if mode == loc: LOCATION
@ -19,101 +19,87 @@
*/
private [
("_r"),("_this0"),("_this1"),("_this2"),("_this3"),("_this4"),("_this5"),("_this6"),
("_s0"),("_s1"),("_s2"),("_s3"),
("_ms0"),("_arr"),("_bin"),("_used"),("_fltr"),("_badNames"),("_maps"),("_bad"),
("_pos"),("_xx"),("_pos"),("_hi"),("_low"),("_dist"),("_loc")
"_r", "_this0", "_this1", "_this2", "_this3", "_this4", "_this5", "_this6",
"_s0", "_s1", "_s2", "_s3",
"_ms0", "_arr", "_bin", "_used", "_fltr", "_badNames", "_maps", "_bad",
"_pos", "_xx", "_pos", "_hi", "_low", "_dist", "_loc"
];
params [
[("_this0"),(""),([""])],
[("_this1"),(false),([false])],
[("_this2"),([]),([[]])],
[("_this3"),(-1),([0])],
[("_this4"),(-1),([0])],
[("_this5"),(-1),([0])],
[("_this6"),(""),([""])]
];
params [ "_this0" , "_this1", "_this2", "_this3", "_this4", "_this5", "_this6" ];
([[("nonPopulated"),("noMissionPos"),("missionDistance"),("missionList")]] call VEMFr_fnc_config) params [("_s0"),("_s1"),("_s2"),("_s3")];
_ms0 = ([[("missionSettings"),(_this6)],["skipDistanceReversed"]] call VEMFr_fnc_config) select 0;
if (_this6 in _s3) then { _s0 = ([[("missionSettings"),(_this6)],["nonPopulated"]] call VEMFr_fnc_config) select 0 };
( [ [ "nonPopulated", "noMissionPos", "missionDistance", "missionList" ] ] call VEMFr_fnc_config ) params [ "_s0", "_s1", "_s2", "_s3" ];
_ms0 = ( [ [ "missionSettings", _this6 ], [ "skipDistanceReversed" ] ] call VEMFr_fnc_config ) select 0;
if ( _this6 in _s3 ) then { _s0 = ( [ [ "missionSettings", _this6 ], [ "nonPopulated" ] ] call VEMFr_fnc_config ) select 0 };
if (_this0 isEqualTo "loc") then
if ( _this0 isEqualTo "loc" ) then
{
// Get a list of locations close to _this2 (position of player)
_t = [("CityCenter"),("Strategic"),("StrongpointArea"),("NameVillage"),("NameCity"),("NameCityCapital")];
if (_s0 isEqualTo "yes") then { _t append [("nameLocal"),("Area"),("BorderCrossing"),("Hill"),("fakeTown"),("Name"),("RockArea"),("ViewPoint")] };
_arr = nearestLocations [(_this2),(_t),(if (_ms0 > 0) then {_ms0*2} else {worldSize})];
if ((count _arr) > 0) then
_t = [ "CityCenter", "Strategic", "StrongpointArea", "NameVillage", "NameCity", "NameCityCapital" ];
if ( _s0 isEqualTo "yes" ) then { _t append [ "nameLocal", "Area", "BorderCrossing", "Hill", "fakeTown", "Name", "RockArea", "ViewPoint" ] };
_arr = nearestLocations [ _this2, _t, if ( _ms0 > 0 ) then { _ms0 * 2 } else { worldSize } ];
if ( ( count _arr ) > 0 ) then
{
_maps = "isClass _x" configClasses (configFile >> "CfgVemfReloaded" >> "blacklists" >> "locations");
{ _maps set [_forEachIndex, toLower (configName _x)] } forEach _maps;
_maps = "isClass _x" configClasses ( configFile >> "CfgVemfReloaded" >> "blacklists" >> "locations" );
{ _maps set [ _forEachIndex, toLower ( configName _x ) ] } forEach _maps;
if ((toLower worldName) in _maps) then
{
_bad = ([[("blacklists"),("locations"),(worldName)],["names"]] call VEMFr_fnc_config) select 0
} else
{
_bad = ([[("blacklists"),("locations"),("Other")],["names"]] call VEMFr_fnc_config) select 0
};
_bin = [];
_used = uiNamespace getVariable [("VEMFrUsedLocs"),([])];
if ( ( toLower worldName ) in _maps ) then { _bad = ([[("blacklists"),("locations"),(worldName)],["names"]] call VEMFr_fnc_config) select 0
} else { _bad = ([[("blacklists"),("locations"),("Other")],["names"]] call VEMFr_fnc_config) select 0 };
_bin = [ ];
_used = uiNamespace getVariable [ "VEMFrUsedLocs", [] ];
_fltr =
{
scopeName "filter";
_xx = _x;
{
if (((_x select 0) distance (locationPosition _xx)) <= (_x select 1)) then { _bin pushBack _xx; breakOut "filter" };
if ( ( ( _x select 0 ) distance ( locationPosition _xx ) ) <= ( _x select 1 ) ) then { _bin pushBack _xx; breakOut "filter" };
} forEach _s1;
if (_x in _used) then { _bin pushBack _x }
if ( _x in _used ) then { _bin pushBack _x }
else
{
{
if (((locationPosition _xx) distance (locationPosition _x)) < _s2) then { _bin pushBack _xx; breakOut "filter" };
} forEach _used;
};
{
if ( ( ( locationPosition _xx ) distance ( locationPosition _x ) ) < _s2 ) then { _bin pushBack _xx; breakOut "filter" };
} forEach _used;
};
if (((text _x) in _bad) OR ((toLower (text _x)) in _bad)) then { _bin pushBack _x };
if ( ( ( text _x ) in _bad ) OR ( ( toLower ( text _x ) ) in _bad ) ) then { _bin pushBack _x };
};
{
_dist = _this2 distance (locationPosition _x);
if (_ms0 > 0) then
_dist = _this2 distance ( locationPosition _x );
if ( _ms0 > 0 ) then
{
if ((_dist <= (_ms0*2)) AND (_dist > _ms0)) then { call _fltr }
if ( ( _dist <= ( _ms0 * 2 ) ) AND ( _dist > _ms0 ) ) then { call _fltr }
else { _bin pushBack _x };
} else
{
if (_dist > _this3) then { call _fltr }
if ( _dist > _this3 ) then { call _fltr }
else { _bin pushBack _x };
};
} forEach _arr;
{ // Remove all invalid locations from _arr
_arr deleteAt (_arr find _x);
_arr deleteAt ( _arr find _x );
} forEach _bin;
// Check what kind of distances we have
_low = []; // Closer then _this4
_hi = []; // Further than _this4
_low = [ ]; // Closer then _this4
_hi = [ ]; // Further than _this4
{
_dist = _this2 distance (locationPosition _x);
if (_dist > _this4) then { _hi pushBack _x };
if (_dist <= _this4) then { _low pushBack _x };
_dist = _this2 distance ( locationPosition _x );
if ( _dist > _this4 ) then { _hi pushBack _x };
if ( _dist <= _this4 ) then { _low pushBack _x };
} forEach _arr;
// Check if there are any prefered locations. If yes, randomly select one
if ((count _low) > 0) then
if ( ( count _low ) > 0 ) then
{
_loc = selectRandom _low;
_r = _loc;
_used pushBackUnique _loc;
} else
{
if ((count _hi) > 0) then
if ( ( count _hi ) > 0 ) then
{
_loc = selectRandom _hi;
_r = _loc;
@ -123,17 +109,14 @@ if (_this0 isEqualTo "loc") then
};
};
if (_this0 isEqualTo "pos") then
if ( _this0 isEqualTo "pos" ) then
{
for "_p" from 1 to 10 do
{
_pos = [_this2, _this3, -1, 2, 0, 50, 0] call BIS_fnc_findSafePos;
if _this1 then { _pos = position (nearRoads select 0) };
if not([_pos, _this5] call VEMFr_fnc_playerNear) then
{
_r = _pos;
};
_pos = [ _this2, _this3, -1, 2, 0, 50, 0 ] call BIS_fnc_findSafePos;
if _this1 then { _pos = position ( nearRoads select 0 ) };
if not ( [ _pos, _this5 ] call VEMFr_fnc_playerNear ) then { _r = _pos };
};
};
if not(isNil "_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -15,49 +15,43 @@
BOOLEAN - true if successful
*/
private [("_r"),("_this0"),("_m")];
params [
[("_this0"),(objNull),([objNull])],
[("_this1"),(""),([""])],
[("_this2"),(""),([""])],
[("_this3"),(""),([""])]
];
_r = [];
if not(_this1 isEqualTo "") then
private [ "_r", "_m" ];
params [ "_this0", "_this1", "_this2", "_this3" ];
_r = [ ];
if not ( _this1 isEqualTo "" ) then
{
_m = selectRandom (getArray (configFile >> "CfgWeapons" >> _this1 >> "magazines"));
_m = selectRandom ( getArray ( configFile >> "CfgWeapons" >> _this1 >> "magazines" ) );
for "_l" from 1 to 5 do
{
if not(_this0 canAdd _m) exitWith {};
if not ( _this0 canAdd _m ) exitWith { };
_this0 addItem _m;
};
_r pushBack true;
};
if not(_this2 isEqualTo "") then
if not ( _this2 isEqualTo "" ) then
{
if not((backPack _this0) isEqualTo "") then
if not ( ( backPack _this0 ) isEqualTo "" ) then
{
_m = selectRandom (getArray (configFile >> "CfgWeapons" >> _this2 >> "magazines"));
_m = selectRandom ( getArray ( configFile >> "CfgWeapons" >> _this2 >> "magazines" ) );
for "_l" from 1 to 3 do
{
if not(_this0 canAdd _m) exitWith {};
if not ( _this0 canAdd _m ) exitWith { };
_this0 addItem _m;
};
_r pushBack true;
};
};
if not(_this3 isEqualTo "") then
if not ( _this3 isEqualTo "" ) then
{
_m = selectRandom (getArray (configFile >> "CfgWeapons" >> _this3 >> "magazines"));
_m = selectRandom ( getArray ( configFile >> "CfgWeapons" >> _this3 >> "magazines" ) );
for "_l" from 1 to 4 do
{
if not(_this0 canAdd _m) exitWith {};
if not ( _this0 canAdd _m ) exitWith { };
_this0 addItem _m;
};
_r pushBack true;
};
if ((count _r) > 0) then { _r = true; _r } else { _r = nil };
if ( ( count _r ) > 0 ) then { _r = true; _r } else { _r = nil };

View File

@ -11,55 +11,51 @@
Returns: BOOLEAN - true if no errors occured
*/
private [("_r"),("_p"),("_w"),("_a"),("_bin")];
_u = param [0,objNull,[objNull]];
if not (isNull _u) then
private [ "_r", "_p", "_w", "_a", "_bin" ];
_u = _this select 0;
if not ( isNull _u ) then
{
_p = [1,0,1,0,1,1,1,1,0,0,1,1,1];
_p = [ 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1 ];
_w = primaryWeapon _u;
if ((selectRandom _p) isEqualTo 1) then
if ( ( selectRandom _p ) isEqualTo 1 ) then
{ // Select random scope
_a = getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
if (("allowTWS" call VEMFr_fnc_config) isEqualTo "no") then
_a = getArray ( configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems" );
if ( ( "allowTWS" call VEMFr_fnc_config ) isEqualTo "no" ) then
{
_bin = [];
_b = ( [ [ "blacklists", "scopes" ], [ "thermal" ] ] call VEMFr_fnc_config ) select 0;
_bin = [ ];
{
if (((toLower _x) find "tws") > -1) then
{
_bin pushBack _x;
};
if ( ( ( ( toLower _x ) find "tws" ) > -1 ) OR ( _x in _b ) ) then { _bin pushBack _x };
} forEach _a;
{
_a deleteAt (_a find _x);
} forEach _bin;
{ _a deleteAt ( _a find _x ) } forEach _bin;
};
_u addPrimaryWeaponItem (selectRandom _a);
_u addPrimaryWeaponItem ( selectRandom _a );
};
if ((selectRandom _p) isEqualTo 1) then
if ( ( selectRandom _p ) isEqualTo 1 ) then
{ // Select random muzzle
_u addPrimaryWeaponItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems")));
_u addPrimaryWeaponItem ( selectRandom ( getArray ( configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems" ) ) );
};
if ((selectRandom _p) isEqualTo 1) then
if ( ( selectRandom _p ) isEqualTo 1 ) then
{ // Select random pointer
_u addPrimaryWeaponItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems")));
_u addPrimaryWeaponItem ( selectRandom ( getArray ( configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems" ) ) );
};
if ((selectRandom _p) isEqualTo 1) then
if ( ( selectRandom _p ) isEqualTo 1 ) then
{ // Select random bipod
_u addPrimaryWeaponItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "UnderbarrelSlot" >> "compatibleItems")));
_u addPrimaryWeaponItem ( selectRandom ( getArray ( configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "UnderbarrelSlot" >> "compatibleItems" ) ) );
};
// handgunWeapon items
_w = handgunWeapon _u;
_p = [1,0,1,0,0,1,0,0,0,0,1,1,1];
if ((selectRandom _p) isEqualTo 1) then
_p = [ 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1 ];
if ( ( selectRandom _p ) isEqualTo 1 ) then
{ // Select random scope
_u addHandgunItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems")));
_u addHandgunItem ( selectRandom ( getArray ( configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems" ) ) );
};
if ((selectRandom _p) isEqualTo 1) then
if ( ( selectRandom _p ) isEqualTo 1 ) then
{ // Select random muzzle
_u addHandgunItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems")));
_u addHandgunItem ( selectRandom ( getArray ( configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems" ) ) );
};
_r = true;
};
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -11,31 +11,31 @@
OBJECT - the headless client
*/
private [("_r"),("_n"),("_arr"),("_gl"),("_hc")];
private [ "_r", "_n", "_arr", "_gl", "_hc" ];
_n = "headLessClientNames" call VEMFr_fnc_config;
_arr = [];
_arr = [ ];
_gl = uiNamespace getVariable "VEMFrHcLoad";
{
_hc = missionNameSpace getVariable [(_x),"nope"];
if not(_hc isEqualTo "nope") then
_hc = missionNameSpace getVariable [ _x, "nope" ];
if not ( _hc isEqualTo "nope" ) then
{
if (((typeName _hc) isEqualTo "OBJECT") AND (toLower(typeOf _hc) isEqualTo toLower("HeadlessClient_F"))) then
if ( ( ( typeName _hc ) isEqualTo "OBJECT" ) AND ( ( toLower ( typeOf _hc ) ) isEqualTo ( toLower ( "HeadlessClient_F" ) ) ) ) then
{
_arr pushBackUnique _hc;
if not(_x in (_gl select 0)) then
if not ( _x in ( _gl select 0 ) ) then
{
_i = (_gl select 0) pushBack _hc;
(_gl select 1) set [_i, 0];
_i = ( _gl select 0 ) pushBack _hc;
( _gl select 1 ) set [ _i, 0 ];
};
};
};
} forEach _n;
if ((count _arr) > 0) then
if ( ( count _arr ) > 0 ) then
{
_l = 99999;
{ if (_x <= _l) then { _l = _x } } forEach (_gl select 1);
_r = (_gl select 0) select ((_gl select 1) find _l);
(_gl select 1) set [(_gl select 0) find _r, _l + 1];
if not(isNil"_r") then { _r };
{ if ( _x <= _l ) then { _l = _x } } forEach ( _gl select 1 );
_r = ( _gl select 0 ) select ( ( _gl select 1 ) find _l );
( _gl select 1 ) set [ ( _gl select 0 ) find _r, _l + 1 ];
if not ( isNil "_r" ) then { _r };
};

View File

@ -5,25 +5,24 @@
launches VEMFr (You don't say?)
*/
if (isNil "VEMFrHasStarted") then
if ( isNil "VEMFrHasStarted" ) then
{
[] spawn
{
VEMFrHasStarted = call compileFinal "true";
[("Launcher"),(2),(format["/// booting up VEMFr v%1 (%2) \\\", getText (configFile >> "CfgPatches" >> "a3_vemf_reloaded" >> "version"), call VEMFr_fnc_whichMod])] ExecVM ("log" call VEMFr_fnc_scriptPath);
uiSleep 0.5;
[("Launcher"),(2),(format[("Headless client support: %1"),(if (("headlessClientSupport" call VEMFr_fnc_config) isEqualTo "yes") then {"ENABLED"} else {"DISABLED"})])] ExecVM ("log" call VEMFr_fnc_scriptPath);
uiNamespace setVariable ["VEMFrUsedLocs", []];
uiNamespace setVariable ["VEMFrHcLoad", [[],[]]];
uiSleep 1;
if (("overridesToRPT" call VEMFr_fnc_config) isEqualTo "yes") then { _h = ExecVM ("overrides" call VEMFr_fnc_scriptPath); waitUntil { if (scriptDone _h) then {true} else {uiSleep 0.5; false} } };
{
_h = [] ExecVM format["a3_vemf_reloaded\sqf\%1.sqf", _x];
if ((_x isEqualTo "checkClasses") OR (_x isEqualTo "spawnStaticAI")) then { waitUntil { if (scriptDone _h) then {true} else {uiSleep 0.1; false} } };
} forEach [("checkClasses"),("missionTimer"),("REMOTEguard"),("spawnStaticAI")];
VEMFrHasStarted = call compileFinal "true";
[ "Launcher", 2, format [ "/// booting up VEMFr v%1 (%2) \\\", getText ( configFile >> "CfgPatches" >> "a3_vemf_reloaded" >> "version" ), call VEMFr_fnc_whichMod ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
uiSleep 0.5;
[ "Launcher", 2, format [ "Headless client support: %1", if ( ( "headlessClientSupport" call VEMFr_fnc_config) isEqualTo "yes" ) then { "ENABLED" } else { "DISABLED" } ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
uiNamespace setVariable [ "VEMFrUsedLocs", [] ];
uiNamespace setVariable [ "VEMFrHcLoad", [ [], [] ] ];
uiSleep 1;
if ( ( "overridesToRPT" call VEMFr_fnc_config ) isEqualTo "yes" ) then { _h = ExecVM ( "overrides" call VEMFr_fnc_scriptPath ); waitUntil { if ( scriptDone _h ) then {true} else { uiSleep 0.5; false } } };
if ((call VEMFr_fnc_whichMod) isEqualTo "Epoch") then { west setFriend [independent, 0]; independent setFriend [west, 0] };
};
} else { [("Launcher"),(0),(format[("a3_vemf_reloaded FAILED to launch! VEMFrHasStarted (%1) is already defined!"),(VEMFrHasStarted)])] ExecVM ("log" call VEMFr_fnc_scriptPath) };
{
_h = [] ExecVM format [ "a3_vemf_reloaded\sqf\%1.sqf", _x ];
if ( ( _x isEqualTo "checkClasses" ) OR ( _x isEqualTo "spawnStaticAI" ) ) then { waitUntil { if ( scriptDone _h ) then { true } else { uiSleep 0.1; false } } };
} forEach [ "checkClasses", "missionTimer", "REMOTEguard", "spawnStaticAI" ];
if ( ( call VEMFr_fnc_whichMod ) isEqualTo "Epoch" ) then { west setFriend [ independent, 0 ]; independent setFriend [ west, 0 ] };
};
} else { [ "Launcher", 0, format [ "a3_vemf_reloaded FAILED to launch! VEMFrHasStarted (%1) is already defined!", VEMFrHasStarted ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };

View File

@ -14,69 +14,55 @@
BOOLEAN - true if nothing failed
*/
private [("_r"),("_this0"),("_this1"),("_this2")];
params [
[("_this0"),([]),([[]])],
[("_this1"),(""),([""])],
[("_this2"),(0),([0])]
];
if ((_this1 in ("missionList" call VEMFr_fnc_config)) OR (_this1 isEqualTo "Static")) then
private "_r";
params [ "_this0", "_this1", "_this2" ];
if ( ( _this1 in ( "missionList" call VEMFr_fnc_config ) ) OR ( _this1 isEqualTo "Static" ) ) then
{
scopeName "this";
if (_this2 isEqualTo 0) then // Guerilla
if ( _this2 isEqualTo 0 ) then // Guerilla
{
private [("_s"),("_unifs"),("_headGr"),("_vests"),("_packs"),("_lnchers"),("_rfles"),("_pstls"),("_ls"),("_lc"),("_a")];
private [ "_s", "_unifs", "_headGr", "_vests", "_packs", "_lnchers", "_rfles", "_pstls", "_ls", "_lc", "_a" ];
// Define settings
([[("aiInventory"),("Guerilla")],[("backpacks"),("faceWear"),("headGear"),("launchers"),("rifles"),("uniforms"),("vests")]] call VEMFr_fnc_config) params [("_packs"),("_faceWr"),("_headGr"),("_lnchers"),("_rfles"),("_unifs"),("_vests")];
( [ [ "aiInventory", "Guerilla" ], [ "backpacks", "faceWear", "headGear", "launchers", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config) params [ "_packs", "_faceWr", "_headGr", "_lnchers", "_rfles", "_unifs", "_vests" ];
{
private [("_xx"),("_g"),("_a"),("_pw"),("_hw")];
private [ "_xx", "_g", "_a", "_pw", "_hw" ];
_xx = _x;
// Strip it
removeAllWeapons _xx;
removeAllItems _xx;
if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo "yes") then { removeAllAssignedItems _xx };
if ( ( "removeAllAssignedItems" call VEMFr_fnc_config ) isEqualTo "yes" ) then { removeAllAssignedItems _xx };
removeVest _xx;
removeBackpack _xx;
removeGoggles _xx;
removeHeadGear _xx;
if (count _unifs > 0) then
if ( ( count _unifs ) > 0 ) then
{
removeUniform _xx;
_g = selectRandom _unifs;
_xx forceAddUniform _g; // Give the poor naked guy some clothing :)
};
if (_this1 isEqualTo "BaseAttack") then
{
_xx addBackpack "B_Parachute";
};
if ( _this1 isEqualTo "BaseAttack" ) then { _xx addBackpack "B_Parachute" };
_g = selectRandom _headGr;
_xx addHeadGear _g;
_g = selectRandom _faceWr;
_xx addGoggles _g;
_g = selectRandom _vests;
_xx addVest _g;
_ls = [[("missionSettings"),(_this1)],[("allowLaunchers"),("hasLauncherChance")]] call VEMFr_fnc_config;
if ((_ls select 0) isEqualTo "yes") then
_ls = [ [ "missionSettings", _this1 ], [ "allowLaunchers", "hasLauncherChance" ] ] call VEMFr_fnc_config;
if ( ( _ls select 0 ) isEqualTo "yes" ) then
{
_lc = _ls select 1;
if ((_lc isEqualTo 100) OR ((ceil random (100 / _lc) isEqualTo (ceil random (100 / _lc))))) then
if ( ( _lc isEqualTo 100 ) OR ( ( ceil random ( 100 / _lc ) isEqualTo ( ceil random ( 100 / _lc ) ) ) ) ) then
{
if not(_this1 isEqualTo "BaseAttack") then
if not ( _this1 isEqualTo "BaseAttack" ) then
{
_g = selectRandom _packs;
_xx addBackpack _g;
};
_g = selectRandom _lnchers;
_a = getArray (configFile >> "cfgWeapons" >> _g >> "magazines");
if (count _a > 2) then
{
_a resize 2;
};
for "_i" from 0 to (2 + (round random 1)) do
{
_xx addMagazine (selectRandom _a);
};
_a = getArray ( configFile >> "cfgWeapons" >> _g >> "magazines" );
if ( ( count _a ) > 2 ) then { _a resize 2 };
for "_i" from 0 to ( 2 + ( round random 1 ) ) do { _xx addMagazine ( selectRandom _a ) };
_xx addWeapon _g;
};
};
@ -84,36 +70,30 @@ if ((_this1 in ("missionList" call VEMFr_fnc_config)) OR (_this1 isEqualTo "Stat
// Select a random weapon
_pw = selectRandom _rfles;
// Give this guy some ammo
_g = [(_xx),(_pw),(""),("")] call VEMFr_fnc_giveAmmo;
if (isNil "_g") then
{
[("fn_loadInv"),(0),(format["FAILED to give ammo to AI: %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_g = [ _xx, _pw, "", "" ] call VEMFr_fnc_giveAmmo;
if ( isNil "_g" ) then { [ "fn_loadInv", 0, format [ "FAILED to give ammo to AI: %1", _xx ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
_xx addWeapon _pw;
_xx selectWeapon _pw;
// Give this guy some weaponItems
_g = [_xx] call VEMFr_fnc_giveWeaponItems;
if not _g then
{
[("fn_loadInv"),(0),(format["FAILED to giveWeaponItems to %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_g = [ _xx ] call VEMFr_fnc_giveWeaponItems;
if not _g then { [ "fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _xx] ] ExecVM ("log" call VEMFr_fnc_scriptPath) };
} forEach _this0;
_r = true;
breakOut "this";
};
if (_this2 isEqualTo 1) then // Regular police
if ( _this2 isEqualTo 1 ) then // Regular police
{
private [("_s"),("_headGr"),("_vests"),("_unifs"),("_rfles"),("_pstls"),("_packs")];
_s = [[("aiInventory"),("PoliceRegular")],[("headGear"),("pistols"),("rifles"),("uniforms"),("vests")]] call VEMFr_fnc_config;
_s params [("_headGr"),("_pstls"),("_rfles"),("_unifs"),("_vests")];
private [ "_s", "_headGr", "_vests", "_unifs", "_rfles", "_pstls", "_packs" ];
_s = [ [ "aiInventory", "PoliceRegular" ], [ "headGear", "pistols", "rifles" , "uniforms", "vests" ] ] call VEMFr_fnc_config;
_s params [ "_headGr", "_pstls", "_rfles", "_unifs", "_vests" ];
{
private [("_xx"),("_g"),("_pw"),("_hw")];
private [ "_xx", "_g", "_pw", "_hw" ];
_xx = _x;
// Strip it
removeAllWeapons _xx;
removeAllItems _xx;
if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo "yes") then { removeAllAssignedItems _xx };
if ( ( "removeAllAssignedItems" call VEMFr_fnc_config ) isEqualTo "yes" ) then { removeAllAssignedItems _xx };
removeUniform _xx;
removeVest _xx;
removeBackpack _xx;
@ -129,32 +109,29 @@ if ((_this1 in ("missionList" call VEMFr_fnc_config)) OR (_this1 isEqualTo "Stat
_pw = selectRandom _rfles;
_hw = selectRandom _pstls;
// Give this guy some ammo
_g = [_xx, _pw, "", _hw] call VEMFr_fnc_giveAmmo;
if (isNil "_g") then { [("fn_loadInv"),(0),(format["FAILED to give ammo to AI: %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath) };
_g = [ _xx, _pw, "", _hw ] call VEMFr_fnc_giveAmmo;
if ( isNil "_g" ) then { [ "fn_loadInv", 0, format [ "FAILED to give ammo to AI: %1", _xx ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
_xx addWeapon _pw;
_xx selectWeapon _pw;
_xx addWeapon _hw;
if (_this1 isEqualTo "BaseAttack") then
{
_xx addBackpack "B_Parachute";
};
if ( _this1 isEqualTo "BaseAttack" ) then { _xx addBackpack "B_Parachute" };
// Give this guy some weaponItems
_g = [_xx] call VEMFr_fnc_giveWeaponItems;
if (isNil "_g") then { [("fn_loadInv"),(0),(format["FAILED to giveWeaponItems to %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath) };
_g = [ _xx ] call VEMFr_fnc_giveWeaponItems;
if ( isNil "_g" ) then { [ "fn_loadInv", 0, format [ "FAILED to giveWeaponItems to %1", _xx ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} forEach _this0;
_r = true;
breakOut "this";
};
if (_this2 isEqualTo 2) then // Police Special Forces
if ( _this2 isEqualTo 2 ) then // Police Special Forces
{
private [("_s"),("_rfles"),("_pstls")];
([[("aiInventory"),("PoliceSpecialForces")],[("faceWear"),("headGear"),("pistols"),("rifles"),("uniforms"),("vests")]] call VEMFr_fnc_config) params [("_faceWr"),("_headGrr"),("_pstls"),("_rfles"),("_unifs"),("_vests")];
private [ "_s", "_rfles", "_pstls" ];
( [ [ "aiInventory", "PoliceSpecialForces" ], [ "faceWear", "headGear", "pistols", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config ) params [ "_faceWr", "_headGrr", "_pstls", "_rfles", "_unifs", "_vests" ];
{
private [("_xx"),("_g"),("_pw"),("_hw")];
private [ "_xx", "_g", "_pw", "_hw" ];
_xx = _x;
// Strip it
if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo "yes") then { removeAllAssignedItems _xx };
if ( ( "removeAllAssignedItems" call VEMFr_fnc_config ) isEqualTo "yes" ) then { removeAllAssignedItems _xx };
removeAllItems _xx;
removeAllWeapons _xx;
removeBackpack _xx;
@ -162,44 +139,38 @@ if ((_this1 in ("missionList" call VEMFr_fnc_config)) OR (_this1 isEqualTo "Stat
removeHeadGear _xx;
removeUniform _xx;
removeVest _xx;
_xx addHeadGear (selectRandom _headGrr);
_xx addGoggles (selectRandom _faceWr);
_xx addVest (selectRandom _vests);
_xx forceAddUniform (selectRandom _unifs);
_xx addHeadGear ( selectRandom _headGrr );
_xx addGoggles ( selectRandom _faceWr );
_xx addVest ( selectRandom _vests );
_xx forceAddUniform ( selectRandom _unifs );
_pw = selectRandom _rfles;
_hw = selectRandom _pstls;
// Give this guy some ammo
_g = [_xx, _pw, "", _hw] call VEMFr_fnc_giveAmmo;
if (isNil "_g") then
{
[("fn_loadInv"),(0),(format["FAILED to give ammo to AI: %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_g = [ _xx, _pw, "", _hw ] call VEMFr_fnc_giveAmmo;
if ( isNil "_g" ) then { [ "fn_loadInv", 0, format [ "FAILED to give ammo to AI: %1", _xx ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
_xx addWeapon _pw;
_xx selectWeapon _pw;
_xx addWeapon _hw;
if (_this1 isEqualTo "BaseAttack") then { _xx addBackpack "B_Parachute" };
if ( _this1 isEqualTo "BaseAttack" ) then { _xx addBackpack "B_Parachute" };
// Give this guy some weaponItems
_g = [_xx] call VEMFr_fnc_giveWeaponItems;
if (isNil "_g") then
{
[("fn_loadInv"),(0),(format["FAILED to giveWeaponItems to %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_g = [ _xx ] call VEMFr_fnc_giveWeaponItems;
if ( isNil "_g" ) then { [ "fn_loadInv", 0, format [ "FAILED to giveWeaponItems to %1", _xx ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} forEach _this0;
_r = true;
};
if (_this2 isEqualTo 3) then // Gendarmerie
if ( _this2 isEqualTo 3 ) then // Gendarmerie
{
private [("_rfles"),("_pstls")];
([[("aiInventory"),("Gendarmerie")],[("headGear"),("faceWear"),("pistols"),("rifles"),("uniforms"),("vests")]] call VEMFr_fnc_config) params [("_headGrr"),("_facewr"),("_pstls"),("_rfles"),("_unifs"),("_vests")];
private [ "_rfles", "_pstls" ];
( [ [ "aiInventory", "Gendarmerie" ], [ "headGear", "faceWear", "pistols", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config ) params [ "_headGrr" , "_facewr", "_pstls", "_rfles", "_unifs", "_vests" ];
{
private [("_xx"),("_g"),("_pw"),("_hw")];
private [ "_xx", "_g", "_pw", "_hw" ];
_xx = _x;
// Strip it
if (("removeAllAssignedItems" call VEMFr_fnc_config) isEqualTo "yes") then { removeAllAssignedItems _xx };
if ( ( "removeAllAssignedItems" call VEMFr_fnc_config ) isEqualTo "yes" ) then { removeAllAssignedItems _xx };
removeAllItems _xx;
removeAllWeapons _xx;
removeBackpack _xx;
@ -207,86 +178,71 @@ if ((_this1 in ("missionList" call VEMFr_fnc_config)) OR (_this1 isEqualTo "Stat
removeHeadGear _xx;
removeUniform _xx;
removeVest _xx;
_xx addHeadGear (selectRandom _headGrr);
_xx addGoggles (selectRandom _facewr);
_xx addVest (selectRandom _vests);
_xx forceAddUniform (selectRandom _unifs);
_xx addHeadGear ( selectRandom _headGrr );
_xx addGoggles ( selectRandom _facewr );
_xx addVest ( selectRandom _vests );
_xx forceAddUniform ( selectRandom _unifs );
_pw = selectRandom _rfles;
_hw = selectRandom _pstls;
// Give this guy some ammo
_g = [_xx, _pw, "", _hw] call VEMFr_fnc_giveAmmo;
if (isNil "_g") then
{
[("fn_loadInv"),(0),(format["FAILED to give ammo to AI: %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_g = [ _xx, _pw, "", _hw ] call VEMFr_fnc_giveAmmo;
if ( isNil "_g" ) then { [ "fn_loadInv", 0, format [ "FAILED to give ammo to AI: %1", _xx ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
_xx addWeapon _pw;
_xx selectWeapon _pw;
_xx addWeapon _hw;
if (_this1 isEqualTo "BaseAttack") then { _xx addBackpack "B_Parachute" };
if ( _this1 isEqualTo "BaseAttack" ) then { _xx addBackpack "B_Parachute" };
// Give this guy some weaponItems
_g = [_xx] call VEMFr_fnc_giveWeaponItems;
if (isNil "_g") then
{
[("fn_loadInv"),(0),(format["FAILED to giveWeaponItems to %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_g = [ _xx ] call VEMFr_fnc_giveWeaponItems;
if ( isNil "_g" ) then { [ "fn_loadInv", 0, format [ "FAILED to giveWeaponItems to %1", _xx ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} forEach _this0;
_r = true;
};
if (_this2 isEqualTo 4) then // Raiders
if ( _this2 isEqualTo 4 ) then // Raiders
{
private [("_s"),("_unifs"),("_headGr"),("_vests"),("_packs"),("_lnchers"),("_rfles"),("_pstls"),("_ls"),("_lc"),("_a")];
private [ "_s", "_unifs", "_headGr", "_vests", "_packs", "_lnchers", "_rfles", "_pstls", "_ls", "_lc", "_a" ];
// Define settings
([[("aiInventory"),("ApexBandits")],[("backpacks"),("headGear"),("launchers"),("rifles"),("uniforms"),("vests")]] call VEMFr_fnc_config) params [("_packs"),("_headGrr"),("_lnchers"),("_rfles"),("_unifs"),("_vests")];
( [ [ "aiInventory", "ApexBandits" ], [ "backpacks", "headGear", "launchers", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config) params [ "_packs", "_headGrr", "_lnchers", "_rfles", "_unifs", "_vests" ];
{
private [("_xx"),("_g"),("_a"),("_pw")];
private [ "_xx", "_g", "_a", "_pw" ];
_xx = _x;
// Strip it
removeAllWeapons _xx;
removeAllItems _xx;
if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo "yes") then { removeAllAssignedItems _xx };
if ( ( "removeAllAssignedItems" call VEMFr_fnc_config ) isEqualTo "yes" ) then { removeAllAssignedItems _xx };
removeVest _xx;
removeBackpack _xx;
removeGoggles _xx;
removeHeadGear _xx;
if (count _unifs > 0) then
if ( ( count _unifs ) > 0 ) then
{
removeUniform _xx;
_g = selectRandom _unifs;
_xx forceAddUniform _g; // Give the poor naked guy some clothing :)
};
if (_this1 isEqualTo "BaseAttack") then
{
_xx addBackpack "B_Parachute";
};
if ( _this1 isEqualTo "BaseAttack" ) then { _xx addBackpack "B_Parachute" };
_g = selectRandom _headGrr;
_xx addHeadGear _g;
_g = selectRandom _vests;
_xx addVest _g;
_ls = [[("missionSettings"),(_this1)],[("allowLaunchers"),("hasLauncherChance")]] call VEMFr_fnc_config;
if ((_ls select 0) isEqualTo "yes") then
_ls = [ [ "missionSettings", _this1 ], [ "allowLaunchers", "hasLauncherChance" ] ] call VEMFr_fnc_config;
if ( ( _ls select 0 ) isEqualTo "yes" ) then
{
_lc = _ls select 1;
if ((_lc isEqualTo 100) OR ((ceil random (100 / _lc) isEqualTo (ceil random (100 / _lc))))) then
if ( ( _lc isEqualTo 100 ) OR ( ( ceil random ( 100 / _lc ) isEqualTo ( ceil random ( 100 / _lc ) ) ) ) ) then
{
if not(_this1 isEqualTo "BaseAttack") then
if not ( _this1 isEqualTo "BaseAttack" ) then
{
_g = selectRandom _packs;
_xx addBackpack _g;
};
_g = selectRandom _lnchers;
_a = getArray (configFile >> "cfgWeapons" >> _g >> "magazines");
if (count _a > 2) then
{
_a resize 2;
};
for "_i" from 0 to (2 + (round random 1)) do
{
_xx addMagazine (selectRandom _a);
};
if ( ( count _a ) > 2 ) then { _a resize 2 };
for "_i" from 0 to ( 2 + ( round random 1 ) ) do { _xx addMagazine (selectRandom _a) };
_xx addWeapon _g;
};
};
@ -294,23 +250,17 @@ if ((_this1 in ("missionList" call VEMFr_fnc_config)) OR (_this1 isEqualTo "Stat
// Select a random weapon
_pw = selectRandom _rfles;
// Give this guy some ammo
_g = [_xx, _pw, "", ""] call VEMFr_fnc_giveAmmo;
if (isNil "_g") then
{
[("fn_loadInv"),(0),(format["FAILED to give ammo to AI: %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_g = [ _xx, _pw, "", "" ] call VEMFr_fnc_giveAmmo;
if ( isNil "_g" ) then { [ "fn_loadInv", 0, format [ "FAILED to give ammo to AI: %1", _xx] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
_xx addWeapon _pw;
_xx selectWeapon _pw;
// Give this guy some weaponItems
_g = [_xx] call VEMFr_fnc_giveWeaponItems;
if not _g then
{
[("fn_loadInv"),(0),(format["FAILED to giveWeaponItems to %1", _xx])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_g = [ _xx ] call VEMFr_fnc_giveWeaponItems;
if not _g then { [ "fn_loadInv", 0, format [ "FAILED to giveWeaponItems to %1", _xx ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} forEach _this0;
_r = true;
breakOut "this";
};
};
if not(isNil "_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -15,28 +15,22 @@
*/
scopeName "mines";
private [("_r"),("_this0"),("_this1"),("_this2"),("_this3"),("_t"),("_c"),("_mt")];
params [
[("_this0"),([]),([[]])],
[("_this1"),(-1),([0])],
[("_this2"),(-1),([0])],
[("_this3"),(""),([""])]
];
if (_this3 in ("missionList" call VEMFr_fnc_config)) then
private [ "_r", "_this0", "_this1", "_this2", "_this3", "_t", "_c", "_mt" ];
params [ "_this0", "_this1", "_this2", "_this3" ];
if (_this3 in ( "missionList" call VEMFr_fnc_config ) ) then
{
([[("missionSettings"),(_this3),("mines")],[("count"),("type")]] call VEMFr_fnc_config) params [("_c"),("_t")];
if (_t isEqualTo "at") then { _mt = ["ATMine"] };
if (_t isEqualTo "ap") then { _mt = ["APERSMine"] };
if (_t isEqualTo "atap") then { _mt = ["ATMine","APERSMine"] };
if (isNil "_mt") exitWith { [("fn_mines"),(0),(format["Invalid mines type: %1",(_t)])] ExecVM ("log" call VEMFr_fnc_scriptPath) };
_r = [];
( [ [ "missionSettings", _this3, "mines" ], [ "count", "type" ] ] call VEMFr_fnc_config ) params [ "_c", "_t" ];
if ( _t isEqualTo "at" ) then { _mt = [ "ATMine" ] };
if ( _t isEqualTo "ap" ) then { _mt = [ "APERSMine" ] };
if ( _t isEqualTo "atap" ) then { _mt = [ "ATMine", "APERSMine" ] };
if ( isNil "_mt" ) exitWith { [ "fn_mines", 0, format [ "invalid mines type: %1", _t ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
_r = [ ];
for "_m" from 1 to _c do
{
_r pushBack (createMine [selectRandom _mt, ([_this0, _this1, _this2, 2, 0, 20, 0] call BIS_fnc_findSafePos), [], 0]);
_r pushBack ( createMine [ selectRandom _mt, ( [ _this0, _this1, _this2, 2, 0, 20, 0 ] call BIS_fnc_findSafePos ), [], 0 ] );
uiSleep 0.1;
};
};
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -12,5 +12,5 @@
*/
private "_r";
_r = getNumber (configFile >> "CfgAppIDs" >> _this);
if not(isNil"_r") then { _r };
_r = getNumber ( configFile >> "CfgAppIDs" >> _this );
if not ( isNil "_r" ) then { _r };

View File

@ -12,22 +12,19 @@
BOOL - true if player(s) found
*/
private [("_r"),("_this0"),("_this1")];
private "_r";
// By default, we assume that there are no players close. The distance check below should prove otherwise if there are players close
_r = false;
params [
[("_this0"),([]),([[]])],
[("_this1"),(-1),([0])]
];
if (((count _this0) isEqualTo 3) AND (_this1 > -1)) then
params [ "_this0", "_this1" ];
if ( ( ( count _this0 ) isEqualTo 3 ) AND ( _this1 > -1 ) ) then
{
scopeName "find";
{
if ((isPlayer _x) AND ((speed _x) < 250)) then
if ( ( isPlayer _x ) AND ( ( speed _x ) < 250 ) ) then
{
if ((position _x distance _this0) < _this1) then { _r = true; breakOut "find" };
if ( ( ( position _x ) distance _this0 ) < _this1 ) then { _r = true; breakOut "find" };
};
} forEach allPlayers;
};
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -9,5 +9,5 @@
*/
private "_r";
_r = getText (configFile >> "CfgVemfrScripts" >> _this);
if not(isNil"_r") then { _r };
_r = getText ( configFile >> "CfgVemfrScripts" >> _this );
if not ( isNil "_r" ) then { _r };

View File

@ -14,99 +14,91 @@
ARRAY format [[groups],[50cals]]
*/
private [("_r"),("_this0"),("_ms0"),("_ms1"),("_this3")];
params [
[("_this0"),([]),([[]])],
[("_this1"),(-1),([0])],
[("_this2"),(""),([""])],
[("_this3"),(175),([0])]
];
if (_this2 in ("missionList" call VEMFr_fnc_config)) then
private [ "_r", "_ms0", "_ms1" ];
params [ "_this0", "_this1", "_this2", "_this3" ];
if ( _this2 in ( "missionList" call VEMFr_fnc_config ) ) then
{
private [("_grps"),("_s"),("_ccrcy"),("_mShk"),("_mSpd"),("_stmna"),("_sptDst"),("_sptTme"),("_crge"),("_rldSpd"),("_cmmndng"),("_gnrl"),("_gdHss"),("_nHss"),("_cl50s"),("_nts")];
_r = [[],[]];
_grps = [];
([[("aiSkill"),(([["aiSkill"],["difficulty"]] call VEMFr_fnc_config) select 0)],[("accuracy"),("aimingShake"),("aimingSpeed"),("endurance"),("spotDistance"),("spotTime"),("courage"),("reloadSpeed"),("commanding"),("general")]] call VEMFr_fnc_config) params [("_ccrcy"),("_mShk"),("_mSpd"),("_stmna"),("_sptDst"),("_sptTme"),("_crge"),("_rldSpd"),("_cmmndng"),("_gnrl")];
_bad = ([[("blacklists"),("buildings")],["classes"]] call VEMFr_fnc_config) select 0;
([[("missionSettings"),(_this2)],[("groupCount"),("groupUnits")]] call VEMFr_fnc_config) params [("_ms0"),("_ms1")];
_ms0 = (round random (_ms0 select 1)) max (_ms0 select 0);
_ms1 = (round random (_ms1 select 1)) max (_ms1 select 0);
private [ "_grps", "_s", "_ccrcy", "_mShk", "_mSpd", "_stmna", "_sptDst", "_sptTme", "_crge", "_rldSpd", "_cmmndng", "_gnrl", "_gdHss", "_nHss", "_cl50s", "_nts" ];
_r = [ [], [] ];
_grps = [ ];
( [ [ "aiSkill", ( ( [ [ "aiSkill" ], [ "difficulty" ] ] call VEMFr_fnc_config ) select 0 ) ], [ "accuracy", "aimingShake", "aimingSpeed", "endurance", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general" ] ] call VEMFr_fnc_config ) params [ "_ccrcy", "_mShk", "_mSpd", "_stmna", "_sptDst", "_sptTme", "_crge", "_rldSpd", "_cmmndng", "_gnrl" ];
_bad = ( [ [ "blacklists", "buildings" ], [ "classes" ] ] call VEMFr_fnc_config ) select 0;
( [ [ "missionSettings", _this2 ], [ "groupCount", "groupUnits" ] ] call VEMFr_fnc_config ) params [ "_ms0", "_ms1" ];
_ms0 = ( round random ( _ms0 select 1 ) ) max ( _ms0 select 0 );
_ms1 = ( round random ( _ms1 select 1 ) ) max ( _ms1 select 0 );
_gdHss = [];
{ if not(typeOf _x in _bad) then { if ([(_x),(_ms1)] call BIS_fnc_isBuildingEnterable) then { _gdHss pushBack _x } } } forEach (nearestTerrainObjects [(_this0),(["House"]),(_this3)]);
_gdHss = [ ];
{ if not ( ( typeOf _x ) in _bad ) then { if ( [ _x, _ms1 ] call BIS_fnc_isBuildingEnterable ) then { _gdHss pushBack _x } } } forEach ( nearestTerrainObjects [ _this0, [ "House" ], if not ( isNil "_this3" ) then { _this3 } else { 150 } ] );
_gdHss = _gdHss call BIS_fnc_arrayShuffle;
_nHss = false;
if ((count _gdHss) < _ms0) then { _nHss = true };
if ( ( count _gdHss ) < _ms0 ) then { _nHss = true };
_cl50s = ([[("missionSettings"),(_this2)],["cal50s"]] call VEMFr_fnc_config) select 0;
_cl50s = ( [ [ "missionSettings", _this2 ], [ "cal50s" ] ] call VEMFr_fnc_config ) select 0;
_nts = []; // Define units array. the for loops below will fill it with units
_nts = [ ]; // Define units array. the for loops below will fill it with units
for "_g" from 1 to _ms0 do // Spawn Groups near Position
{
if not _nHss then { if (count _gdHss < 1) then { _nHss = true } };
private [("_grp"),("_hs"),("_hsPstns"),("_plcd50"),("_i")];
_grp = createGroup ((([[call VEMFr_fnc_whichMod],["unitClass"]] call VEMFr_fnc_config) select 0) call VEMFr_fnc_checkSide);
(_r select 0) pushBack _grp;
if not _nHss then { if ( ( count _gdHss ) < 1 ) then { _nHss = true } };
private [ "_grp", "_hs", "_hsPstns", "_plcd50", "_i" ];
_grp = createGroup ( ( ( [ [ call VEMFr_fnc_whichMod ], [ "unitClass" ] ] call VEMFr_fnc_config ) select 0 ) call VEMFr_fnc_checkSide );
( _r select 0 ) pushBack _grp;
_grp allowFleeing 0;
if not _nHss then
{
_hs = selectRandom _gdHss;
_hsID = _gdHss find _hs;
_gdHss deleteAt _hsID;
_hsPstns = [_hs] call BIS_fnc_buildingPositions;
_hsPstns = [ _hs ] call BIS_fnc_buildingPositions;
};
_plcd50 = false;
for "_u" from 1 to _ms1 do
{
private [("_spwnPs"),("_hmg"),("_nt")];
if _nHss then
{
_spwnPs = [(_this0),(20),(_this3),(1),(0),(200),(0)] call BIS_fnc_findSafePos; // Find Nearby Position
} else
{
_spwnPs = selectRandom _hsPstns;
if not _plcd50 then
{
_plcd50 = true;
if (_cl50s > 0) then
{
_hmg = createVehicle [("O_HMG_01_high_F"),(_spwnPs),([]),(0),("CAN_COLLIDE")];
_hmg setVehicleLock "LOCKEDPLAYER";
(_r select 1) pushBack _hmg;
};
};
};
private [ "_spwnPs", "_hmg", "_nt" ];
if _nHss then { _spwnPs = [ _this0, 20, if not ( isNil "_this3" ) then { _this3 } else { 150 }, 1, 0, 200, 0 ] call BIS_fnc_findSafePos }
else
{
_spwnPs = selectRandom _hsPstns;
if not _plcd50 then
{
_plcd50 = true;
if ( _cl50s > 0 ) then
{
_hmg = createVehicle [ "O_HMG_01_high_F", _spwnPs, [], 0, "CAN_COLLIDE" ];
_hmg setVehicleLock "LOCKEDPLAYER";
( _r select 1 ) pushBack _hmg;
};
};
};
_nt = _grp createUnit [(([[call VEMFr_fnc_whichMod],["unitClass"]] call VEMFr_fnc_config) select 0),(_spwnPs),([]),(0),("CAN_COLLIDE")]; // Create Unit There
if ((not _nHss) AND (_cl50s > 0)) then
_nt = _grp createUnit [ ( ( [ [ call VEMFr_fnc_whichMod ], [ "unitClass" ] ] call VEMFr_fnc_config ) select 0 ), _spwnPs, [], 0, "CAN_COLLIDE" ]; // Create Unit There
if ( ( not _nHss ) AND ( _cl50s > 0 ) ) then
{
if not(isNil "_hmg") then
if not ( isNil "_hmg" ) then
{
if not(isNull _hmg) then
if not ( isNull _hmg ) then
{
_nt moveInGunner _hmg;
_hmg = nil;
_cl50s = _cl50s - 1;
};
};
_hsPstns deleteAt (_hsPstns find _spwnPs);
_hsPstns deleteAt ( _hsPstns find _spwnPs );
};
_nt addMPEventHandler [("mpkilled"),("if (isDedicated) then { [[(_this select 0),(name(_this select 0))],[(_this select 1),(name(_this select 1))]] ExecVM ('aiKilled' call VEMFr_fnc_scriptPath) }")];
_nt addMPEventHandler [ "mpkilled", "if isDedicated then { [ _this select 0 ] ExecVM ( 'handleKillCleanup' call VEMFr_fnc_scriptPath ); [ _this select 0, name ( _this select 0 ), _this select 1, name (_this select 1) ] ExecVM ( 'handleKillReward' call VEMFr_fnc_scriptPath ); ( _this select 0 ) removeAllEventHandlers 'MPKilled' } " ];
// Set skills
_nt setSkill [("aimingAccuracy"),(_ccrcy)];
_nt setSkill [("aimingShake"),(_mShk)];
_nt setSkill [("aimingSpeed"),(_mSpd)];
_nt setSkill [("endurance"),(_stmna)];
_nt setSkill [("spotDistance"),(_sptDst)];
_nt setSkill [("spotTime"),(_sptTme)];
_nt setSkill [("courage"),(_crge)];
_nt setSkill [("reloadSpeed"),(_rldSpd)];
_nt setSkill [("commanding"),(_cmmndng)];
_nt setSkill [("general"),(_gnrl)];
_nt setSkill [ "aimingAccuracy", _ccrcy ];
_nt setSkill [ "aimingShake", _mShk ];
_nt setSkill [ "aimingSpeed", _mSpd ];
_nt setSkill [ "endurance", _stmna ];
_nt setSkill [ "spotDistance", _sptDst ];
_nt setSkill [ "spotTime", _sptTme ];
_nt setSkill [ "courage", _crge ];
_nt setSkill [ "reloadSpeed", _rldSpd ];
_nt setSkill [ "commanding", _cmmndng ];
_nt setSkill [ "general", _gnrl ];
_nt enableAI "TARGET";
_nt enableAI "AUTOTARGET";
@ -122,39 +114,33 @@ if (_this2 in ("missionList" call VEMFr_fnc_config)) then
_nt enableAI "PATH";
};
_i = [(units _grp),(_this2),(_this1)] call VEMFr_fnc_loadInv; // Load the AI's inventory
if isNil "_i" then
{
[("fn_spawnInvasionAI"),(0),("failed to load AI's inventory...")] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
_i = [ units _grp, _this2, _this1 ] call VEMFr_fnc_loadInv; // Load the AI's inventory
if isNil "_i" then { [ "fn_spawnInvasionAI", 0, "failed to load AI's inventory..." ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
_grps pushBack _grp; // Push it into the _grps array
};
if (((count _grps) isEqualTo _ms0) AND _nHss) then
if ( ( ( count _grps ) isEqualTo _ms0 ) AND _nHss ) then
{
private [("_wypnts"),("_wp"),("_cyc")];
private [ "_wypnts", "_wp", "_cyc" ];
_wypnts =
[
[(_this0 select 0),((_this0 select 1) + 50),(0)],
[((_this0 select 0) + 50),(_this0 select 1),(0)],
[(_this0 select 0),((_this0 select 1) - 50),(0)],
[((_this0 select 0) - 50),(_this0 select 1),(0)]
[ _this0 select 0, ( ( _this0 select 1 ) + 50 ), 0 ],
[ ( _this0 select 0 ) + 50, _this0 select 1, 0 ],
[ _this0 select 0, (_this0 select 1) - 50, 0 ],
[ (_this0 select 0) - 50, _this0 select 1, 0 ]
];
{ // Make them Patrol
for "_z" from 1 to (count _wypnts) do
{
_wp = _x addWaypoint [(_wypnts select (_z-1)),(10)];
_wp = _x addWaypoint [ _wypnts select (_z-1), 10 ];
_wp setWaypointType "SAD";
_wp setWaypointCompletionRadius 20;
};
_cyc = _x addWaypoint [(_this0),(100)];
_cyc = _x addWaypoint [ _this0, 100 ];
_cyc setWaypointType "CYCLE";
_cyc setWaypointCompletionRadius 20;
} forEach _grps;
};
} else
{
[("fn_spawnInvasionAI"),(0),(format[("'%1' is not in missionList"),(_this2)])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
} else { [ "fn_spawnInvasionAI", 0, format [ "'%1' is not in missionList", _this2 ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -17,47 +17,38 @@
ARRAY with group(s)
*/
private [("_r"),("_allUnits"),("_this0"),("_this1"),("_this2"),("_this3"),("_this4")];
private [ "_r", "_allUnits" ];
params [ "_this0", "_this1", "_this2", "_this3", "_this4", "_this5", "_this6" ];
_allUnits = [];
params [
[("_this0"),([]),([[]])],
[("_this1"),(1),([0])],
[("_this2"),(1),([0])],
[("_this3"),(-1),([0])],
[("_this4"),(""),([""])],
[("_this5"),(0),([0])],
[("_this6"),(20),([0])]
];
if ((_this4 in ("missionList" call VEMFr_fnc_config)) OR (_this4 isEqualTo "Static")) then
if ( ( _this4 in ( "missionList" call VEMFr_fnc_config ) ) OR ( _this4 isEqualTo "Static" ) ) then
{
scopeName "outer";
_r = [];
_this0 = [_this0 select 0, _this0 select 1, _this5];
private [("_s"),("_ccrcy"),("_mshk"),("_mspd"),("_stmn"),("_sptDst"),("_sptTm"),("_crg"),("_rldSpd"),("_cmmndng"),("_gnrl"),("_i"),("_grp"),("_unit")];
_this0 = [ _this0 select 0, _this0 select 1, if not ( isNil "_this5" ) then { _this5 } else { 0 } ];
private [ "_s", "_ccrcy", "_mshk", "_mspd", "_stmn", "_sptDst", "_sptTm", "_crg", "_rldSpd", "_cmmndng", "_gnrl", "_i", "_grp", "_unit" ];
_s = [[("aiSkill"),(([["aiSkill"],["difficulty"]] call VEMFr_fnc_config) select 0)],[("accuracy"),("aimingShake"),("aimingSpeed"),("endurance"),("spotDistance"),("spotTime"),("courage"),("reloadSpeed"),("commanding"),("general")]] call VEMFr_fnc_config;
_s = [ [ "aiSkill", ( [ [ "aiSkill" ], [ "difficulty" ] ] call VEMFr_fnc_config ) select 0 ], [ "accuracy", "aimingShake", "aimingSpeed", "endurance", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general" ] ] call VEMFr_fnc_config;
_s params [("_ccrcy"),("_mshk"),("_mspd"),("_stmn"),("_sptDst"),("_sptTm"),("_crg"),("_rldSpd"),("_cmmndng"),("_gnrl")];
for "_g" from 1 to _this1 do
{
_grp = createGroup ((([[call VEMFr_fnc_whichMod],["unitClass"]] call VEMFr_fnc_config) select 0) call VEMFr_fnc_checkSide);
_grp = createGroup ( ( ( [ [ call VEMFr_fnc_whichMod ], [ "unitClass" ] ] call VEMFr_fnc_config ) select 0 ) call VEMFr_fnc_checkSide );
_grp allowFleeing 0;
for "_u" from 1 to _this2 do
{
_unit = _grp createUnit [(([[call VEMFr_fnc_whichMod],["unitClass"]] call VEMFr_fnc_config) select 0), _this0, [], _this6, "FORM"]; // Create Unit There
_unit = _grp createUnit [ ( [ [ call VEMFr_fnc_whichMod ], [ "unitClass" ] ] call VEMFr_fnc_config ) select 0, _this0, [], if not ( isNil "_this6" ) then { _this6 } else { 5 }, "FORM" ]; // Create Unit There
_allUnits pushBack _unit;
_unit addMPEventHandler [("mpkilled"),("if (isDedicated) then { [[(_this select 0),(name(_this select 0))],[(_this select 1),(name(_this select 1))]] ExecVM ('aiKilled' call VEMFr_fnc_scriptPath) }")];
_unit addMPEventHandler [ "mpkilled", "if isDedicated then { [ _this select 0 ] ExecVM ( 'handleKillCleanup' call VEMFr_fnc_scriptPath ); [ _this select 0, name (_this select 0), _this select 1, name (_this select 1) ] ExecVM ( 'handleKillReward' call VEMFr_fnc_scriptPath ); ( _this select 0 ) removeAllEventHandlers 'MPKilled' }" ];
// Set skills
_unit setSkill [("aimingAccuracy"),(_ccrcy)];
_unit setSkill [("aimingShake"),(_mshk)];
_unit setSkill [("aimingSpeed"),(_mspd)];
_unit setSkill [("endurance"),(_stmn)];
_unit setSkill [("spotDistance"),(_sptDst)];
_unit setSkill [("spotTime"),(_sptTm)];
_unit setSkill [("courage"),(_crg)];
_unit setSkill [("reloadSpeed"),(_rldSpd)];
_unit setSkill [("commanding"),(_cmmndng)];
_unit setSkill [("general"),(_gnrl)];
_unit setSkill [ "aimingAccuracy" , _ccrcy ];
_unit setSkill [ "aimingShake", _mshk ];
_unit setSkill [ "aimingSpeed", _mspd ];
_unit setSkill [ "endurance", _stmn ];
_unit setSkill [ "spotDistance", _sptDst ];
_unit setSkill [ "spotTime", _sptTm ];
_unit setSkill [ "courage", _crg ];
_unit setSkill [ "reloadSpeed", _rldSpd ];
_unit setSkill [ "commanding", _cmmndng ];
_unit setSkill [ "general", _gnrl ];
_unit enableAI "TARGET";
_unit enableAI "AUTOTARGET";
@ -75,16 +66,13 @@ if ((_this4 in ("missionList" call VEMFr_fnc_config)) OR (_this4 isEqualTo "Stat
_r pushBack _grp;
};
_i = [(_allUnits),(_this4),(_this3)] call VEMFr_fnc_loadInv; // Load the AI's inventory
if (isNil "_i") then
_i = [ _allUnits, _this4, _this3 ] call VEMFr_fnc_loadInv; // Load the AI's inventory
if ( isNil "_i" ) then
{
_r = nil;
[("fn_spawnVEMFrAI"),(0),("unable to load AI's inventory")] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ "fn_spawnVEMFrAI", 0, "unable to load AI's inventory" ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
breakOut "outer";
};
} else
{
[("fn_spawnVEMFrAI"),(0),(format["'%1' is not in missionList or is not equal to 'Static'", _this4])] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
} else { [ "fn_spawnVEMFrAI", 0, format [ "'%1' is not in missionList or is not equal to 'Static'", _this4 ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -12,20 +12,16 @@
BOOL - true if there is a player present
*/
private [("_r"),("_this0"),("_this1")];
params [
[("_this0"),([]),([[]])],
[("_this1"),(-1),([0])]
];
private "_r";
params [ "_this0", "_this1" ];
_r = false;
if ([(_this0),(_this1)] call VEMFr_fnc_playerNear) then { _r = true }
if ( [ _this0, _this1 ] call VEMFr_fnc_playerNear ) then { _r = true }
else
{
private [("_t"),("_tot")];
private [ "_t", "_tot" ];
_t = round time;
_tot = ("timeOutTime" call VEMFr_fnc_config)*60;
waitUntil { if (([(_this0),(_this1)] call VEMFr_fnc_playerNear) OR (round time - _t > _tot)) then {true} else {uiSleep 4; false} };
if ([(_this0),(_this1)] call VEMFr_fnc_playerNear) then { _r = true };
_tot = ( "timeOutTime" call VEMFr_fnc_config ) * 60;
waitUntil { if ( ( [ _this0, _this1 ] call VEMFr_fnc_playerNear ) OR ( ( ( round time ) - _t ) > _tot ) ) then { true } else { uiSleep 4; false } };
if ( [ _this0, _this1 ] call VEMFr_fnc_playerNear ) then { _r = true };
};
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -10,7 +10,7 @@
private "_r";
if not(isNull(configFile >> "CfgPatches" >> "exile_server")) then { _r = "Exile" };
if not(isNull(configFile >> "CfgPatches" >> "a3_epoch_server")) then { _r = "Epoch" };
if not ( isNull ( configFile >> "CfgPatches" >> "exile_server" ) ) then { _r = "Exile" };
if not ( isNull ( configFile >> "CfgPatches" >> "a3_epoch_server" ) ) then { _r = "Epoch" };
if not(isNil"_r") then { _r };
if not ( isNil "_r" ) then { _r };

View File

@ -3,169 +3,153 @@
*/
VEMFrMissionCount = VEMFrMissionCount + 1;
if isNil "VEMFrInvasionCount" then { VEMFrInvasionCount = 0; };
if ( isNil "VEMFrInvasionCount" ) then { VEMFrInvasionCount = 0; };
VEMFrInvasionCount = VEMFrInvasionCount + 1;
_this0 = param [0, "", [""]];
if (VEMFrInvasionCount <= (([[("missionSettings"),(_this0)],["maxInvasions"]] call VEMFr_fnc_config) select 0)) then
_this0 = _this select 0;
if ( VEMFrInvasionCount <= ( ( [ [ "missionSettings", _this0 ], [ "maxInvasions" ] ] call VEMFr_fnc_config ) select 0 ) ) then
{
scopeName "outer";
_mod = call VEMFr_fnc_whichMod;
// Define the settings
([
[("missionSettings"),(_this0)],
[("groupCount"),("groupUnits"),("maxDistancePrefered"),("skipDistance"),("useMarker"),("markCrateVisual"),("markCrateOnMap"),("announce"),("streetLightsEnabled"),("streetLightsRestore"),("streetLightsRange"),("allowCrateLift"),("allowRepeat"),("randomModes"),("spawnCrateFirst"),("flairTypes"),("smokeTypes"),("skipDistanceReversed")]
] call VEMFr_fnc_config) params [("_ms0"),("_ms1"),("_ms2"),("_ms3"),("_ms4"),("_ms5"),("_ms6"),("_ms7"),("_ms8"),("_ms9"),("_ms10"),("_ms11"),("_ms12"),("_ms13"),("_ms14"),("_ms15"),("_ms16"),("_ms17")];
( [
[ "missionSettings", _this0 ],
[ "groupCount", "groupUnits", "maxDistancePrefered", "skipDistance", "useMarker", "markCrateVisual", "markCrateOnMap", "announce", "streetLightsEnabled", "streetLightsRestore", "streetLightsRange", "allowCrateLift", "allowRepeat", "randomModes", "spawnCrateFirst", "flairTypes", "smokeTypes", "skipDistanceReversed" ]
] call VEMFr_fnc_config ) params [ "_ms0", "_ms1", "_ms2", "_ms3", "_ms4", "_ms5", "_ms6", "_ms7", "_ms8", "_ms9", "_ms10", "_ms11", "_ms12", "_ms13", "_ms14", "_ms15", "_ms16", "_ms17" ];
([[("missionSettings"),(_this0),("crateParachute")],[("enabled"),("altitude")]] call VEMFr_fnc_config) params [("_cp0"),("_cp1")];
( [ [ "missionSettings", _this0, "crateParachute" ], [ "enabled", "altitude" ] ] call VEMFr_fnc_config ) params [ "_cp0", "_cp1" ];
([[("missionSettings"),(_this0),("mines")],[("enabled"),("cleanup")]] call VEMFr_fnc_config) params [("_ms18"),("_ms19")];
( [ [ "missionSettings", _this0, "mines" ], [ "enabled", "cleanup" ] ] call VEMFr_fnc_config ) params [ "_ms18", "_ms19" ];
_l = ["loc", false, position (selectRandom allPlayers), if (_ms17 > 0) then {_ms17} else {_ms3}, _ms2, if (_ms17 > 0) then {_ms17} else {_ms3}, _this0] call VEMFr_fnc_findPos;
if not(isNil "_l") then
_l = [ "loc", false, position ( selectRandom allPlayers ), if ( _ms17 > 0 ) then { _ms17 } else { _ms3 }, _ms2, if ( _ms17 > 0 ) then { _ms17 } else { _ms3 }, _this0 ] call VEMFr_fnc_findPos;
if not ( isNil "_l" ) then
{
_ln = text _l;
_lp = position _l;
if (_ln isEqualTo "") then { _ln = "Area"; };
[_this0, 1, format["Invading %1...", _ln]] ExecVM ("log" call VEMFr_fnc_scriptPath);
if ( _ln isEqualTo "" ) then { _ln = "Area" };
[ _this0, 1, format [ "invading %1...", _ln ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
_m = ([[_mod],["aiMode"]] call VEMFr_fnc_config) select 0;
if (_ms13 isEqualTo "yes") then { _m = [0,1,2]; if (("Apex" call VEMFr_fnc_modAppID) in (getDLCs 1)) then { _m pushBack 3; _m pushBack 4 }; _m = selectRandom _m };
if (_ms7 isEqualTo "yes") then
_m = ( [ [ _mod ], [ "aiMode" ] ] call VEMFr_fnc_config ) select 0;
if ( _ms13 isEqualTo "yes" ) then { _m = [ 0, 1, 2 ]; if ( ( "Apex" call VEMFr_fnc_modAppID ) in ( getDLCs 1 ) ) then { _m pushBack 3; _m pushBack 4 }; _m = selectRandom _m };
if ( _ms7 isEqualTo "yes" ) then
{
if (_m isEqualTo 0) then { [(_m),("NEW MISSION"),(format[("%1 Guerilla has invaded %2 @ %3"),(worldName),(_ln),(mapGridPosition _lp)])] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if (_m isEqualTo 1) then { [(_m),("NEW MISSION"),(format[("%1 Police forces are now controlling %2 @ %3"),(worldName),(_ln),(mapGridPosition _lp)])] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if (_m isEqualTo 2) then { [_m,"NEW MISSION", format["%1 Special Forces are now raiding %2 @ %3", worldName, _ln, mapGridPosition _lp]] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if (_m isEqualTo 3) then { [1,"NEW MISSION", format["The Gendarmerie has invaded %1 @ %2", _ln, mapGridPosition _lp]] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if (_m isEqualTo 4) then { [0,"NEW MISSION", format["%1 bandits have taken %2 @ %3", worldName, _ln, mapGridPosition _lp]] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if ( _m isEqualTo 0 ) then { [ _m, "NEW MISSION", format [ "%1 Guerilla has invaded %2 @ %3", worldName, _ln, mapGridPosition _lp ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
if ( _m isEqualTo 1 ) then { [ _m, "NEW MISSION", format [ "%1 Police forces are now controlling %2 @ %3", worldName, _ln, mapGridPosition _lp ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
if ( _m isEqualTo 2 ) then { [ _m, "NEW MISSION", format [ "%1 Special Forces are now raiding %2 @ %3", worldName, _ln, mapGridPosition _lp ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
if ( _m isEqualTo 3 ) then { [ 1, "NEW MISSION", format [ "The Gendarmerie has invaded %1 @ %2", _ln, mapGridPosition _lp ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
if ( _m isEqualTo 4 ) then { [ 0, "NEW MISSION", format [ "%1 bandits have taken %2 @ %3", worldName, _ln, mapGridPosition _lp ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
};
private "_mrkr";
if (_ms4 isEqualTo "yes") then
if ( _ms4 isEqualTo "yes" ) then
{ // Create/place the marker if enabled
_mrkr = createMarker [format["VEMFrMarker%1", _ln], _lp];
_mrkr = createMarker [ format [ "VEMFrMarker%1", _ln ], _lp ];
_mrkr setMarkerShape "ICON";
_mrkr setMarkerType "o_unknown";
_mrkr setMarkerSize [0.85,0.85];
_mrkr setMarkerSize [ 0.85, 0.85 ];
if ((_m isEqualTo 0) OR (_m isEqualTo 4)) then { _mrkr setMarkerColor "ColorEAST" };
if ((_m isEqualTo 1) OR (_m isEqualTo 3)) then { _mrkr setMarkerColor "ColorWEST" };
if (_m isEqualTo 2) then { _mrkr setMarkerColor "ColorBlack" };
if ( ( _m isEqualTo 0 ) OR ( _m isEqualTo 4 ) ) then { _mrkr setMarkerColor "ColorEAST" };
if ( ( _m isEqualTo 1 ) OR ( _m isEqualTo 3 ) ) then { _mrkr setMarkerColor "ColorWEST" };
if ( _m isEqualTo 2 ) then { _mrkr setMarkerColor "ColorBlack" };
};
// If enabled, kill all the lights
if (_ms8 isEqualTo "no") then
if ( _ms8 isEqualTo "no" ) then
{
{
if (damage _x < 0.95) then
if ( ( damage _x ) < 0.95 ) then
{
_x setDamage 0.95;
uiSleep 0.1;
};
} forEach (nearestObjects [_lp, ["Lamps_Base_F","PowerLines_base_F","Land_PowerPoleWooden_L_F"], _ms10]);
} forEach ( nearestObjects [ _lp, [ "Lamps_Base_F", "PowerLines_base_F", "Land_PowerPoleWooden_L_F" ], _ms10 ] );
};
private "_crate";
_dSpwnCrt =
{
// Choose a box
_bx = selectRandom (([[("missionSettings"),(_this0)],[("crateTypes")]] call VEMFr_fnc_config) select 0);
_ps = [_lp, 0, 200, 0, 0, 300, 0] call bis_fnc_findSafePos;
if (_cp0 isEqualTo "yes") then
_bx = selectRandom ( ( [ [ "missionSettings", _this0], [ "crateTypes" ] ] call VEMFr_fnc_config ) select 0 );
_ps = [ _lp, 0, 200, 0, 0, 300, 0 ] call bis_fnc_findSafePos;
if ( _cp0 isEqualTo "yes" ) then
{
_cht = createVehicle ["I_Parachute_02_F", _ps, [], 0, "FLY"];
if (_mod isEqualTo "Epoch") then { _cht call EPOCH_server_setVToken };
_cht setPos [getPos _cht select 0, getPos _cht select 1, _cp1];
_cht = createVehicle [ "I_Parachute_02_F", _ps, [], 0, "FLY" ];
if ( _mod isEqualTo "Epoch" ) then { _cht call EPOCH_server_setVToken };
_cht setPos [ ( getPos _cht ) select 0, ( getPos _cht ) select 1, _cp1 ];
_cht enableSimulationGlobal true;
if not(isNull _cht) then
if not ( isNull _cht ) then
{
_crate = createVehicle [_bx, getPos _cht, [], 0, "NONE"];
_crate = createVehicle [ _bx, getPos _cht, [], 0, "NONE" ];
_crate allowDamage false;
_crate enableSimulationGlobal true;
_crate attachTo [_cht, [0,0,0]];
[_this0, 1, format ["Crate parachuted at: %1 / Grid: %2", (getPosATL _crate), mapGridPosition (getPosATL _crate)]] ExecVM ("log" call VEMFr_fnc_scriptPath);
[_crate, _ln, _lp] ExecVM ("loadLoot" call VEMFr_fnc_scriptPath);
waitUntil { if (((getPos _crate) select 2) < 7) then {true} else {uiSleep 1; false} };
_crate attachTo [ _cht, [ 0, 0, 0 ] ];
[ _this0, 1, format [ "crate parachuted at: %1 / Grid: %2", ( getPosATL _crate ), mapGridPosition ( getPosATL _crate ) ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
[ _crate, _ln, _lp ] ExecVM ( "loadLoot" call VEMFr_fnc_scriptPath );
waitUntil { if ( ( ( getPos _crate ) select 2 ) < 7 ) then { true } else { uiSleep 1; false } };
detach _crate;
} else
{
[_this0, 0, "Where is the chute??"] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
} else { [ _this0, 0, "where is the chute??" ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} else
{
_crate = createVehicle [_bx, _ps, [], 0, "NONE"];
_crate = createVehicle [ _bx, _ps, [], 0, "NONE" ];
_crate allowDamage false;
[_crate, _ln, _lp] ExecVM ("loadLoot" call VEMFr_fnc_scriptPath);
[ _crate, _ln, _lp ] ExecVM ( "loadLoot" call VEMFr_fnc_scriptPath );
};
if (_ms11 > 0) then { _crate enableRopeAttach false } else { _crate enableRopeAttach true };
if ( _ms11 > 0 ) then { _crate enableRopeAttach false } else { _crate enableRopeAttach true };
};
if ([_lp, 800] call VEMFr_fnc_waitForPlayers) then
if ( [ _lp, 800 ] call VEMFr_fnc_waitForPlayers ) then
{
_spwnd = [(_lp),(_m),(_this0),(200)] call VEMFr_fnc_spawnInvasionAI;
_nts = [];
_spwnd = [ _lp, _m, _this0, 200 ] call VEMFr_fnc_spawnInvasionAI;
_nts = [ ];
{
[_x] ExecVM ("signAI" call VEMFr_fnc_scriptPath);
[ _x ] ExecVM ( "signAI" call VEMFr_fnc_scriptPath );
{
_nts pushBack _x;
} forEach (units _x);
} forEach (_spwnd select 0);
} forEach ( units _x );
} forEach ( _spwnd select 0 );
_cl50s = _spwnd select 1;
([[("missionSettings"),(_this0),("heliPatrol")],[("enabled"),("classesVanilla"),("classesHeliDLC"),("classesApex"),("locked")]] call VEMFr_fnc_config) params [("_hp0"),("_hp1"),("_hp2"),("_hp3"),("_hp4")];
if ((_hp0 isEqualTo "yes") AND ((_m isEqualTo 1) OR (_m isEqualTo 2) OR (_m isEqualTo 3))) then
( [ [ "missionSettings", _this0, "heliPatrol" ], [ "enabled", "classesVanilla", "classesHeliDLC", "classesApex", "locked" ] ] call VEMFr_fnc_config ) params [ "_hp0", "_hp1", "_hp2", "_hp3", "_hp4" ];
if ( ( _hp0 isEqualTo "yes" ) AND ( ( _m isEqualTo 1 ) OR ( _m isEqualTo 2 ) OR (_m isEqualTo 3) ) ) then
{
[_this0, 1, format["Adding a heli patrol to the invasion of %1 at %2", _ln, mapGridPosition _lp]] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ _this0, 1, format [ "adding a heli patrol to the invasion of %1 at %2", _ln, mapGridPosition _lp ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
_classes = _hp1;
if (("Heli" call VEMFr_fnc_modAppID) in (getDLCs 1)) then { _classes append _hp2 };
if (("Apex" call VEMFr_fnc_modAppID) in (getDLCs 1)) then { _classes append _hp3 };
_heli = createVehicle [(selectRandom _classes), _lp, [], 5, "FLY"];
if (_mod isEqualTo "Epoch") then { _heli call EPOCH_server_setVToken };
_heli setPosATL [(getPos _heli) select 0, (getPos _heli) select 1, 750];
if ( ( "Heli" call VEMFr_fnc_modAppID ) in ( getDLCs 1 ) ) then { _classes append _hp2 };
if ( ( "Apex" call VEMFr_fnc_modAppID ) in ( getDLCs 1 ) ) then { _classes append _hp3 };
_heli = createVehicle [ selectRandom _classes, _lp, [], 5, "FLY" ];
if ( _mod isEqualTo "Epoch" ) then { _heli call EPOCH_server_setVToken };
_heli setPosATL [ ( getPos _heli ) select 0, ( getPos _heli ) select 1, 750 ];
_heli flyInHeight 80;
if (_hp4 isEqualTo "yes") then { _heli lock true };
if ( _hp4 isEqualTo "yes" ) then { _heli lock true };
_trrts = allTurrets [_heli, false];
_trrts = allTurrets [ _heli, false ];
_hlGrp = ([_lp, 1, ((count _trrts) + (_heli emptyPositions "commander") + 1), _m, _this0] call VEMFr_fnc_spawnVEMFrAI) select 0;
_hlGrp = ( [ _lp, 1, ( ( count _trrts ) + ( _heli emptyPositions "commander" ) + 1 ), _m, _this0 ] call VEMFr_fnc_spawnVEMFrAI ) select 0;
{
if (((_heli emptyPositions "driver") isEqualTo 1) AND (_x isEqualTo (leader(group _x)))) then
{
_x moveInDriver _heli;
} else
{
private "_path";
if ( ( ( _heli emptyPositions "driver" ) isEqualTo 1 ) AND ( _x isEqualTo ( leader ( group _x ) ) ) ) then { _x moveInDriver _heli }
else
{
if (isNull (_heli turretUnit _x)) then
{
_path = _x;
};
} forEach _trrts;
private "_path";
{
if ( isNull ( _heli turretUnit _x ) ) then { _path = _x };
} forEach _trrts;
if not(isNil "_path") then
{
_x moveInTurret [_heli, _path];
} else
{
if ((_heli emptyPositions "commander") > 0) then
if not ( isNil "_path" ) then { _x moveInTurret [ _heli, _path ] }
else
{
_x moveInCommander _heli;
if ( ( _heli emptyPositions "commander" ) > 0 ) then { _x moveInCommander _heli };
};
};
};
};
if not(backPack _x isEqualTo "") then
{
removeBackpack _x;
};
if not ( ( backPack _x ) isEqualTo "" ) then { removeBackpack _x };
_x addBackpack "B_Parachute";
_nts pushBack _x;
} forEach (units _hlGrp);
} forEach ( units _hlGrp );
_wp = _hlGrp addWaypoint [[_lp select 0, _lp select 1, 50], 0, 2];
_wp = _hlGrp addWaypoint [ [ _lp select 0, _lp select 1, 50 ], 0, 2 ];
_wp setWaypointType "SAD";
_wp setWaypointSpeed "NORMAL";
_wp setWaypointBehaviour "AWARE";
@ -174,159 +158,156 @@ if (VEMFrInvasionCount <= (([[("missionSettings"),(_this0)],["maxInvasions"]] ca
//_wp setWaypointLoiterRadius 200;
_hlGrp setCurrentWaypoint _wp;
[_hlGrp] ExecVM ("signAI" call VEMFr_fnc_scriptPath);
[ _hlGrp ] ExecVM ( "signAI" call VEMFr_fnc_scriptPath );
};
// Place the crate if enabled
if (_ms14 isEqualTo "yes") then
{
call _dSpwnCrt;
};
if (_ms14 isEqualTo "yes") then { call _dSpwnCrt };
// Place mines if enabled
private [("_mnsPlcd"),("_mines")];
if (_ms18 isEqualTo "yes") then
private [ "_mnsPlcd", "_mines" ];
if ( _ms18 isEqualTo "yes" ) then
{
_mnsPlcd = [_lp, 5, 100, _this0] call VEMFr_fnc_mines;
if not(isNil "_mnsPlcd") then { [_this0, 1, format["%1 mines placed at %2", count _mnsPlcd, _ln]] ExecVM ("log" call VEMFr_fnc_scriptPath) }
else { [(_this0),(0),(format[("Failed to place %1 mines at %2"),(count _mnsPlcd),(_ln)])] ExecVM ("log" call VEMFr_fnc_scriptPath) };
_mnsPlcd = [ _lp, 5, 100, _this0 ] call VEMFr_fnc_mines;
if not ( isNil "_mnsPlcd" ) then { [ _this0, 1, format [ "%1 mines placed at %2", count _mnsPlcd, _ln ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) }
else { [ _this0, 0, format [ "failed to place %1 mines at %2", count _mnsPlcd, _ln ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
};
// Wait for Mission Completion
_h = [_nts] ExecVM ("killedMonitor" call VEMFr_fnc_scriptPath);
waitUntil { if (scriptDone _h) then {true} else {uiSleep 1; false} };
_h = [ _nts, _this0 ] ExecVM ( "killedMonitor" call VEMFr_fnc_scriptPath );
waitUntil { if ( scriptDone _h ) then { true } else { uiSleep 1; false } };
[("DynamicLocationInvasion"),(1),(format[("mission in %1 has been completed!"),(_ln)])] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ "DynamicLocationInvasion", 1, format [ "mission in %1 has been completed!", _ln ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
if (_ms12 isEqualTo "yes") then
if ( _ms12 isEqualTo "yes" ) then
{
_u = uiNamespace getVariable "VEMFrUsedLocs";
_u deleteAt (_u find _l);
};
// Broadcast
if (_ms7 isEqualTo "yes") then
if ( _ms7 isEqualTo "yes" ) then
{
if (_m isEqualTo 0) then { [(_m),("MISSION ENDED"),(format[("%1 @ %2 is now clear of %3 Guerillas"),(_ln),(mapGridPosition _lp),(worldName)])] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if (_m isEqualTo 1) then { [(_m),("MISSION ENDED"),(format[("%1 @ %2 is now clear of %3 Police Forces"),(_ln),(mapGridPosition _lp),(worldName)])] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if (_m isEqualTo 2) then { [(_m),("MISSION ENDED"),(format[("%1 @ %2 is now clear of %3 Special Forces"),(_ln),(mapGridPosition _lp)])] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if (_m isEqualTo 3) then { [(1),("MISSION ENDED"),(format[("%1 @ %2 is now clear of %3 Gendarmerie"),(_ln),(mapGridPosition _lp),(worldName)])] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if (_m isEqualTo 4) then { [(0),("MISSION ENDED"),(format[("%1 @ %2 is now clear of %3 bandits"),(_ln),(mapGridPosition _lp),(worldName)])] ExecVM ("notificationToClient" call VEMFr_fnc_scriptPath) };
if ( _m isEqualTo 0 ) then { [ _m, "MISSION ENDED", format [ "%1 @ %2 is now clear of %3 Guerillas", _ln, mapGridPosition _lp, worldName ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
if ( _m isEqualTo 1 ) then { [ _m, "MISSION ENDED", format [ "%1 @ %2 is now clear of %3 Police Forces", _ln, mapGridPosition _lp, worldName ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
if ( _m isEqualTo 2 ) then { [ _m, "MISSION ENDED", format [ "%1 @ %2 is now clear of %3 Special Forces", _ln, mapGridPosition _lp ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
if ( _m isEqualTo 3 ) then { [ 1, "MISSION ENDED", format [ "%1 @ %2 is now clear of %3 Gendarmerie", _ln, mapGridPosition _lp, worldName ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
if ( _m isEqualTo 4 ) then { [ 0, "MISSION ENDED", format [ "%1 @ %2 is now clear of %3 bandits", _ln, mapGridPosition _lp, worldName ] ] ExecVM ( "notificationToClient" call VEMFr_fnc_scriptPath ) };
};
// Deal with the 50s
if not(isNil "_cl50s") then
if not ( isNil "_cl50s" ) then
{
_d = ([[("missionSettings"),(_this0)],["cal50sDelete"]] call VEMFr_fnc_config) select 0;
if (_d isEqualTo "yes") then { { deleteVehicle _x } forEach _cl50s };
if (_d isEqualTo "destroy") then { { _x setDamage 1 } forEach _cl50s };
_d = ( [ [ "missionSettings", _this0 ], [ "cal50sDelete" ] ] call VEMFr_fnc_config ) select 0;
if ( _d isEqualTo "yes" ) then { { deleteVehicle _x } forEach _cl50s };
if ( _d isEqualTo "destroy" ) then { { _x setDamage 1 } forEach _cl50s };
};
if not(isNil "_mrkr") then { deleteMarker _mrkr };
if (_ms14 isEqualTo "no") then { call _dSpwnCrt };
if not ( isNil "_mrkr" ) then { deleteMarker _mrkr };
if ( _ms14 isEqualTo "no" ) then { call _dSpwnCrt };
// Put a marker on the crate if enabled
if not(isNil "_crate") then
if not ( isNil "_crate" ) then
{
if not(isNull _crate) then
if not ( isNull _crate ) then
{
if not ([getPos _crate, 3] call VEMFr_fnc_playerNear) then
if not ( [ getPos _crate, 3 ] call VEMFr_fnc_playerNear ) then
{
if (_ms5 isEqualTo "yes") then
if ( _ms5 isEqualTo "yes" ) then
{
// If night, attach a chemlight
if (sunOrMoon <= 0.35) then
if ( sunOrMoon <= 0.35 ) then
{
[_this0, 1, "attaching a chemlight to the crate"] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ _this0, 1, "attaching a chemlight to the crate" ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
_lightType = selectRandom _ms15;
(_lightType createVehicle (position _crate)) attachTo [_crate,[0,0,0]];
( _lightType createVehicle ( position _crate ) ) attachTo [ _crate, [ 0, 0, 0 ] ];
} else
{
[_this0, 1, "attaching smoke to the crate"] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ _this0, 1, "attaching smoke to the crate" ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
// Attach smoke
_rndmColor = selectRandom _ms16;
(createVehicle [_rndmColor, getPos _crate, [], 0, "CAN_COLLIDE"]) attachTo [_crate,[0,0,0]];
( createVehicle [ _rndmColor, getPos _crate, [], 0, "CAN_COLLIDE" ] ) attachTo [ _crate, [ 0, 0, 0 ] ];
};
};
if (_ms6 isEqualTo "yes") then
if ( _ms6 isEqualTo "yes" ) then
{
private "_mrkr";
_mrkr = createMarker [format["VEMF_lootCrate_ID%1", random 9000], position _crate];
_mrkr = createMarker [ format [ "VEMF_lootCrate_ID%1", random 9000 ], position _crate ];
_mrkr setMarkerShape "ICON";
_mrkr setMarkerType "mil_box";
_mrkr setMarkerColor "colorBlack";
_mrkr setMarkerText " Loot";
[_crate, _mrkr] spawn
[ _crate, _mrkr ] spawn
{
_crate = _this select 0;
_mrkr = _this select 1;
waitUntil { if ([getPos _crate, 3] call VEMFr_fnc_playerNear) then {true} else {uiSleep 4; false} };
waitUntil { if ( [ getPos _crate, 3 ] call VEMFr_fnc_playerNear ) then { true } else { uiSleep 4; false } };
deleteMarker _mrkr;
};
};
};
} else
{
[_this0, 0, "isNull _crate!"] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ _this0, 0, "isNull _crate!" ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
};
} else
{
[_this0, 0, "isNil _crate!"] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ _this0, 0, "isNil _crate!" ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
};
// Explode or remove the mines
if not(isNil "_mnsPlcd") then
if not ( isNil "_mnsPlcd" ) then
{
if (_ms19 isEqualTo "explode") then
if ( _ms19 isEqualTo "explode" ) then
{
[_this0, _ln, _mnsPlcd] spawn
[ _this0, _ln, _mnsPlcd ] spawn
{
uiSleep (5 + (random 2));
[(_this select 0), 1, format["Starting to explode all %1 mines at %2", count (_this select 2), (_this select 1)]] ExecVM ("log" call VEMFr_fnc_scriptPath);
uiSleep ( 5 + ( random 2 ) );
[ _this select 0, 1, format [ "starting to explode all %1 mines at %2", count ( _this select 2 ), _this select 1 ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
{
if not(isNull _x) then
if not ( isNull _x ) then
{
_x setDamage 1;
uiSleep (1.25 + (random 3.5));
uiSleep ( 1.25 + ( random 3.5 ) );
};
} forEach (_this select 2);
[(_this select 0), 1, format["Successfully exploded all %1 mines at %2", count (_this select 2), (_this select 1)]] ExecVM ("log" call VEMFr_fnc_scriptPath);
} forEach ( _this select 2 );
[ _this select 0, 1, format [ "successfully exploded all %1 mines at %2", count ( _this select 2 ), ( _this select 1 ) ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
};
_mnsPlcd = nil;
};
if (_ms19 isEqualTo "yes") then
if ( _ms19 isEqualTo "yes" ) then
{
[_mnsPlcd] spawn
[ _mnsPlcd ] spawn
{
{
if not(isNull _x) then { deleteVehicle _x };
} forEach (_this select 0);
if not ( isNull _x ) then { deleteVehicle _x };
} forEach ( _this select 0 );
};
[_this0, 1, format["Successfully deleted all %1 mines at %2", count _mnsPlcd, _ln]] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ _this0, 1, format [ "successfully deleted all %1 mines at %2", count _mnsPlcd, _ln ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
};
};
// If enabled, fix all the lights
if (_ms9 isEqualTo "yes") then
if ( _ms9 isEqualTo "yes" ) then
{
{
if (damage _x > 0.94) then
if ( ( damage _x ) > 0.94 ) then
{
_x setDamage 0;
uiSleep (1 + (random 2));
uiSleep ( 1 + ( random 2 ) );
};
} forEach (nearestObjects [_lp, ["Lamps_Base_F","PowerLines_base_F","Land_PowerPoleWooden_L_F"], _ms10]);
} forEach ( nearestObjects [ _lp, [ "Lamps_Base_F", "PowerLines_base_F", "Land_PowerPoleWooden_L_F" ], _ms10 ] );
};
} else
{ // If done waiting, and no players were detected
[_this0, 1, format["Invasion of %1 @ %2 timed out.", _ln, mapGridPosition _lp]] ExecVM ("log" call VEMFr_fnc_scriptPath);
if not(isNil "_mrkr") then { deleteMarker _mrkr };
[ _this0, 1, format [ "invasion of %1 @ %2 timed out.", _ln, mapGridPosition _lp ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
if not ( isNil "_mrkr" ) then { deleteMarker _mrkr };
_arr = uiNamespace getVariable "VEMFrUsedLocs";
_arr deleteAt (_arr find _l);
_arr deleteAt ( _arr find _l );
};
};
};

View File

@ -12,22 +12,20 @@
nothing
*/
while {true} do
while { true } do
{
if ((count playableUnits) > 0) then
if ( ( count playableUnits ) > 0 ) then
{
{
if ((local _x) AND (_x getVariable [("isVEMFrGroup"),(false)]) AND (_x getVariable [("isVEMFrGroupLocal"),(false)])) then
if ( ( local _x ) AND ( _x getVariable [ "isVEMFrGroup", false ] ) AND ( _x getVariable [ "isVEMFrGroupLocal", false ] ) ) then
{
if ((count (units _x)) > 0) 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
[_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);
[ _x ] ExecVM ( "setGroupOwner" call VEMFr_fnc_scriptPath );
} else { deleteGroup _x };
};
if (not(local _x) AND (_x getVariable [("isVEMFrGroupLocal"),(false)])) then { _x setVariable [("isVEMFrGroupLocal"),(false),(true)] };
if ( not ( local _x ) AND ( _x getVariable [ "isVEMFrGroupLocal", false ] ) ) then { _x setVariable [ "isVEMFrGroupLocal", false, true ] };
} forEach allGroups;
uiSleep 0.5;
} else { uiSleep 5 };

View File

@ -11,39 +11,39 @@
nothing
*/
if (("validateLoot" call VEMFr_fnc_config) isEqualTo "yes") then
if ( ( "validateLoot" call VEMFr_fnc_config ) isEqualTo "yes" ) then
{ // _validateLoot is enabled, go ahead...
if (("debugMode" call VEMFr_fnc_config) < 1) then { ["checkLoot", 0, "Can not validate classnames: no output allowed in RPT"] ExecVM ("log" call VEMFr_fnc_scriptPath) }
if ( ( "debugMode" call VEMFr_fnc_config ) < 1 ) then { [ "checkLoot", 0, "Can not validate classnames: no output allowed in RPT" ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) }
else
{
["checkLoot",1,"Validating VEMFr config classes..."] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ "checkLoot", 1, "validating VEMFr config classes..." ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
uiSleep 0.5;
_bin = [];
_cfgMags = [];
"_cfgMags pushBack (toLower (configName _x)); true" configClasses (configFile >> "cfgMagazines");
_bin = [ ];
_cfgMags = [ ];
"_cfgMags pushBack ( toLower ( configName _x ) ); true" configClasses ( configFile >> "cfgMagazines" );
_cfgWpns = [];
"_cfgWpns pushBack (toLower (configName _x)); true" configClasses (configFile >> "cfgWeapons");
_cfgWpns = [ ];
"_cfgWpns pushBack ( toLower ( configName _x ) ); true" configClasses ( configFile >> "cfgWeapons" );
_cfgBags = "(toLower (getText (_x >> 'vehicleClass'))) isEqualTo 'backpacks'" configClasses (configFile >> "cfgVehicles");
{ _cfgBags set [_forEachIndex, toLower (configName _x)] } forEach _cfgBags;
_cfgBags = "( toLower ( getText ( _x >> 'vehicleClass' ) ) ) isEqualTo 'backpacks'" configClasses ( configFile >> "cfgVehicles" );
{ _cfgBags set [ _forEachIndex, toLower ( configName _x ) ] } forEach _cfgBags;
_cfgGlasses = [];
"_cfgGlasses pushBack (toLower (configName _x)); true" configClasses (configFile >> "CfgGlasses");
_cfgGlasses = [ ];
"_cfgGlasses pushBack ( toLower ( configName _x ) ); true" configClasses ( configFile >> "CfgGlasses" );
if (("Apex" call VEMFr_fnc_modAppID) in (getDLCs 1)) then
if ( ( "Apex" call VEMFr_fnc_modAppID ) in ( getDLCs 1 ) ) then
{
{ { if not(((toLower _x) in _cfgMags) OR ((toLower _x) in _cfgWpns) OR ((toLower _x) in _cfgBags) OR ((toLower _x) in _cfgGlasses)) then { _bin pushBack (toLower _x) } } forEach _x } forEach ([["aiInventory","ApexBandits"],["backpacks","faceWear","headGear","launchers","rifles","uniforms","vests"]] call VEMFr_fnc_config);
{ { if not(((toLower _x) in _cfgMags) OR ((toLower _x) in _cfgWpns) OR ((toLower _x) in _cfgBags) OR ((toLower _x) in _cfgGlasses)) then { _bin pushBack (toLower _x) } } forEach _x } forEach ([["aiInventory","Gendarmerie"],["headGear","faceWear","pistols","rifles","uniforms","vests"]] call VEMFr_fnc_config);
{ { _x0 = toLower (_x select 0); if not((_x0 in _cfgMags) OR (_x0 in _cfgWpns) OR (_x0 in _cfgBags) OR (_x in _cfgGlasses)) then { _bin pushBack (toLower _x) } } forEach _x } forEach ([["missionSettings","DynamicLocationInvasion","crateLootApex"],["attachments","backpacks","headGear","headGearSpecial","magazines","pistols","rifles","vests"]] call VEMFr_fnc_config);
{ { if not ( ( ( toLower _x ) in _cfgMags ) OR ( ( toLower _x ) in _cfgWpns ) OR ( ( toLower _x ) in _cfgBags ) OR ( ( toLower _x ) in _cfgGlasses ) ) then { _bin pushBack ( toLower _x ) } } forEach _x } forEach ( [ [ "aiInventory", "ApexBandits" ], [ "backpacks", "faceWear", "headGear", "launchers", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config );
{ { if not ( ( ( toLower _x ) in _cfgMags ) OR ( ( toLower _x ) in _cfgWpns ) OR ( ( toLower _x ) in _cfgBags ) OR ( ( toLower _x ) in _cfgGlasses ) ) then { _bin pushBack ( toLower _x ) } } forEach _x } forEach ( [ [ "aiInventory", "Gendarmerie" ], [ "headGear", "faceWear", "pistols", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config );
{ { _x0 = toLower ( _x select 0 ); if not ( ( _x0 in _cfgMags ) OR ( _x0 in _cfgWpns ) OR ( _x0 in _cfgBags ) OR ( _x in _cfgGlasses ) ) then { _bin pushBack ( toLower _x ) } } forEach _x } forEach ( [ [ "missionSettings", "DynamicLocationInvasion", "crateLootApex" ], [ "attachments", "backpacks", "headGear", "headGearSpecial", "magazines", "pistols", "rifles", "vests" ] ] call VEMFr_fnc_config );
};
{ { if not(((toLower _x) in _cfgMags) OR ((toLower _x) in _cfgWpns) OR ((toLower _x) in _cfgBags) OR ((toLower _x) in _cfgGlasses)) then { _bin pushBack (toLower _x) } } forEach _x } forEach ([["aiInventory","Guerilla"],["backpacks","headGear","launchers","pistols","rifles","uniforms","vests"]] call VEMFr_fnc_config);
{ { if not(((toLower _x) in _cfgMags) OR ((toLower _x) in _cfgWpns) OR ((toLower _x) in _cfgBags) OR ((toLower _x) in _cfgGlasses)) then { _bin pushBack (toLower _x) } } forEach _x } forEach ([["aiInventory","PoliceRegular"],["headGear","pistols","rifles","uniforms","vests"]] call VEMFr_fnc_config);
{ { if not(((toLower _x) in _cfgMags) OR ((toLower _x) in _cfgWpns) OR ((toLower _x) in _cfgBags) OR ((toLower _x) in _cfgGlasses)) then { _bin pushBack (toLower _x) } } forEach _x } forEach ([["aiInventory","PoliceSpecialForces"],["faceWear","headGear","pistols","rifles","uniforms","vests"]] call VEMFr_fnc_config);
{ { if not ( ( ( toLower _x ) in _cfgMags ) OR ( ( toLower _x ) in _cfgWpns ) OR ( ( toLower _x ) in _cfgBags ) OR ( ( toLower _x ) in _cfgGlasses ) ) then { _bin pushBack ( toLower _x ) } } forEach _x } forEach ( [ [ "aiInventory", "Guerilla" ], [ "backpacks", "headGear", "launchers", "pistols", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config );
{ { if not ( ( ( toLower _x ) in _cfgMags ) OR ( ( toLower _x ) in _cfgWpns ) OR ( ( toLower _x ) in _cfgBags ) OR ( ( toLower _x ) in _cfgGlasses ) ) then { _bin pushBack ( toLower _x ) } } forEach _x } forEach ( [ [ "aiInventory", "PoliceRegular" ], [ "headGear", "pistols", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config );
{ { if not ( ( ( toLower _x ) in _cfgMags ) OR ( ( toLower _x ) in _cfgWpns ) OR ( ( toLower _x ) in _cfgBags ) OR ( ( toLower _x ) in _cfgGlasses ) ) then { _bin pushBack ( toLower _x ) } } forEach _x } forEach ( [ [ "aiInventory", "PoliceSpecialForces" ], [ "faceWear", "headGear", "pistols", "rifles", "uniforms", "vests" ] ] call VEMFr_fnc_config );
{ { _x0 = toLower (_x select 0); if not((_x0 in _cfgMags) OR (_x0 in _cfgWpns) OR (_x0 in _cfgBags) OR (_x in _cfgGlasses)) then { _bin pushBack _x } } forEach _x } forEach ([["missionSettings","DynamicLocationInvasion","crateLootVanilla"],["attachments","backpacks","headGear",format["itemsLoot%1", call VEMFr_fnc_whichMod],"magazines","pistols","rifles","vests"]] call VEMFr_fnc_config);
{ { _x0 = toLower ( _x select 0 ); if not ( ( _x0 in _cfgMags ) OR ( _x0 in _cfgWpns ) OR ( _x0 in _cfgBags ) OR ( _x in _cfgGlasses ) ) then { _bin pushBack _x } } forEach _x } forEach ( [ [ "missionSettings", "DynamicLocationInvasion", "crateLootVanilla" ], [ "attachments", "backpacks", "headGear", format [ "itemsLoot%1", call VEMFr_fnc_whichMod ], "magazines", "pistols", "rifles", "vests" ] ] call VEMFr_fnc_config );
if ((count _bin) isEqualTo 0) then { ["checkLoot", 1, "All classnames are valid! :)"] ExecVM ("log" call VEMFr_fnc_scriptPath) }
else { ["checkLoot",0,format["Invalid classes found in config! | %1", _bin]] ExecVM ("log" call VEMFr_fnc_scriptPath) };
if ( ( count _bin ) isEqualTo 0 ) then { [ "checkLoot", 1, "All classnames are valid! :)" ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) }
else { [ "checkLoot", 0, format [ "invalid classes found in config! | %1", _bin ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
};
};

View File

@ -6,30 +6,23 @@
Params:
_this select 0: ARRAY - array of objects to monitor
_this select 1: STRING - name of mission (must match config name)
Returns:
nothing
*/
_a = param [0,[],[[]]];
if ((count _a) > 0) then
params [ "_a", "_m" ];
if ( ( count _a ) > 0 ) then
{
_k = 0;
_cnt = count _a;
_kp = round(("killPercentage" call VEMFr_fnc_config)/100*_cnt);
_kp = round ( ( ( [ [ "missionSettings", _m ], [ "killPercentage" ] ] call VEMFr_fnc_config ) select 0 ) / 100 *_cnt );
while {true} do
{
scopeName "while";
_k = 0;
{
if (((damage _x) isEqualTo 1) OR (isNull _x)) then { _k = _k + 1 };
} forEach _a;
if (_k < _kp) then
{
uiSleep 3;
} else
{
breakOut "while";
};
{ if ( ( ( damage _x ) isEqualTo 1 ) OR ( isNull _x ) ) then { _k = _k + 1 } } forEach _a;
if ( _k < _kp ) then { uiSleep 3 } else { breakOut "while" };
};
};

View File

@ -7,137 +7,133 @@
Params:
_this: ARRAY
_this select 0: OBJECT - the crate
_this select 1: STRING - (optional) name of the location where crate is
_this select 2: ARRAY - (optional) position of location where crate is
_this select 1: STRING - name of the location where crate is
_this select 2: ARRAY - position of location where crate is
Returns:
nothing
*/
params [
[("_obj"),(objNull),([objNull])],
[("_locName"),(""),([""])],
[("_locPos"),([]),([[]])]
];
params [ "_obj", "_locName", "_locPos" ];
_obj setVariable ["isVEMFrCrate", 1, true];
_obj setVariable [ "isVEMFrCrate", 1, true ];
clearBackpackCargoGlobal _obj;
clearItemCargoGlobal _obj;
clearMagazineCargoGlobal _obj;
clearWeaponCargoGlobal _obj;
([
[("missionSettings"),("DynamicLocationInvasion"),("crateSettings")],
[("rifleSlotsMax"),("rifleSlotsMin"),("pistolSlotsMax"),("pistolSlotsMin"),("magSlotsMax"),("magSlotsMin"),("attSlotsMax"),("attSlotsMin"),("itemSlotsMax"),("itemSlotsMin"),
("vestSlotsMax"),("vestSlotsMin"),("headGearSlotsMax"),("headGearSlotsMin"),("bagSlotsMax"),("bagSlotsMin")]
] call VEMFr_fnc_config) params [("_cs0"),("_cs1"),("_cs2"),("_cs3"),("_cs4"),("_cs5"),("_cs6"),("_cs7"),("_cs8"),("_cs9"),("_cs10"),("_cs11"),("_cs12"),("_cs13"),("_cs14"),("_cs15")];
( [
[ "missionSettings", "DynamicLocationInvasion", "crateSettings" ],
[ "rifleSlotsMax", "rifleSlotsMin", "pistolSlotsMax", "pistolSlotsMin", "magSlotsMax", "magSlotsMin", "attSlotsMax", "attSlotsMin", "itemSlotsMax", "itemSlotsMin",
"vestSlotsMax", "vestSlotsMin", "headGearSlotsMax", "headGearSlotsMin", "bagSlotsMax", "bagSlotsMin" ]
] call VEMFr_fnc_config ) params [ "_cs0", "_cs1", "_cs2", "_cs3", "_cs4", "_cs5", "_cs6", "_cs7", "_cs8", "_cs9", "_cs10", "_cs11", "_cs12", "_cs13", "_cs14", "_cs15" ];
([
[("missionSettings"),("DynamicLocationInvasion"),("crateLootVanilla")],
[("attachments"),("backpacks"),("headGear"),(format["items%1", call VEMFr_fnc_whichMod]),("magazines"),("pistols"),("rifles"),("vests")]
] call VEMFr_fnc_config) params [("_vl0"),("_vl1"),("_vl2"),("_vl3"),("_vl4"),("_vl5"),("_vl6"),("_vl7")];
( [
[ "missionSettings", "DynamicLocationInvasion", "crateLootVanilla" ],
[ "attachments", "backpacks", "headGear", format [ "items%1", call VEMFr_fnc_whichMod ], "magazines", "pistols", "rifles", "vests" ]
] call VEMFr_fnc_config ) params [ "_vl0", "_vl1", "_vl2", "_vl3", "_vl4", "_vl5", "_vl6", "_vl7" ];
if ((call VEMFr_fnc_whichMod) isEqualTo "Exile") then
if ( ( call VEMFr_fnc_whichMod ) isEqualTo "Exile" ) then
{
private "_c";
_c = ([["Exile"],["crateMoney"]] call VEMFr_fnc_config) select 0;
if (_c > 0) then { _obj setVariable [("ExileMoney"),((_c / 2) + (round random (_c / 2))),(true)] };
_c = ( [ [ "Exile" ], [ "crateMoney" ] ] call VEMFr_fnc_config ) select 0;
if ( _c > 0 ) then { _obj setVariable [ "ExileMoney", ( ( _c / 2 ) + ( round random ( _c / 2 ) ) ), true ] };
};
if (("Apex" call VEMFr_fnc_modAppID) in (getDLCs 1)) then
if ( ( "Apex" call VEMFr_fnc_modAppID ) in ( getDLCs 1 ) ) then
{
private [("_el0"),("_el1"),("_el2"),("_el3"),("_el4"),("_el5"),("_el6"),("_el7")];
private [ "_el0", "_el1", "_el2", "_el3", "_el4", "_el5", "_el6", "_el7" ];
([
[("missionSettings"),("DynamicLocationInvasion"),("crateLootApex")],
[("attachments"),("backpacks"),("headGear"),("headGearSpecial"),("magazines"),("pistols"),("rifles"),("vests")]
] call VEMFr_fnc_config) params [("_el0"),("_el1"),("_el2"),("_el3"),("_el4"),("_el5"),("_el6"),("_el7")];
[ "missionSettings", "DynamicLocationInvasion", "crateLootApex" ],
[ "attachments", "backpacks", "headGear", "headGearSpecial", "magazines", "pistols", "rifles", "vests" ]
] call VEMFr_fnc_config ) params [ "_el0", "_el1", "_el2", "_el3", "_el4", "_el5", "_el6", "_el7" ];
_vl0 append _el0;
_vl1 append _el1;
_vl2 append _el2;
if ((([[("missionSettings"),("DynamicLocationInvasion"),("crateSettings")],["allowThermalHelmets"]] call VEMFr_fnc_config) select 0) isEqualTo "yes") then { _vl2 append _el3 };
if ( ( ( [ [ "missionSettings", "DynamicLocationInvasion", "crateSettings" ],[ "allowThermalHelmets" ] ] call VEMFr_fnc_config ) select 0 ) isEqualTo "yes" ) then { _vl2 append _el3 };
_vl4 append _el4;
_vl5 append _el5;
_vl6 append _el6;
_vl7 append _el7;
};
_bad = ([[("blacklists"),("loot")],["classes"]] call VEMFr_fnc_config) select 0;
_bad = ( [ [ "blacklists", "loot" ],[ "classes" ] ] call VEMFr_fnc_config ) select 0;
if ((round random 30) > 1) then
if ( ( round random 30 ) > 1 ) then
{
// Rifles
for "_l" from 0 to (_cs0 - _cs1 + floor random _cs1) do
for "_l" from 0 to ( ( _cs0 - _cs1 ) + ( floor random _cs1 ) ) do
{
_g = selectRandom _vl6;
if not((_g select 0) in _bad) then { _obj addWeaponCargoGlobal [_g select 0, (1 + (floor random (_g select 1)))] };
if not ( ( _g select 0 ) in _bad ) then { _obj addWeaponCargoGlobal [ _g select 0, ( 1 + ( floor random ( _g select 1 ) ) ) ] };
};
};
if ((round random 10) > 1) then
if ( ( round random 10 ) > 1 ) then
{
// Pistols
for "_l" from 0 to (_cs2 - _cs3 + floor random _cs3) do
for "_l" from 0 to ( ( _cs2 - _cs3 ) + ( floor random _cs3 ) ) do
{
_g = selectRandom _vl5;
if not((_g select 0) in _bad) then { _obj addWeaponCargoGlobal [_g select 0, (1 + (floor random (_g select 1)))] };
if not ( ( _g select 0 ) in _bad ) then { _obj addWeaponCargoGlobal [ _g select 0, ( 1 + ( floor random ( _g select 1 ) ) ) ] };
};
};
if ((round random 2) isEqualTo 1) then
if ( ( round random 2 ) isEqualTo 1 ) then
{
// Magazines
for "_l" from 0 to (_cs4 - _cs5 + floor random _cs5) do
for "_l" from 0 to ( ( _cs4 - _cs5 ) + ( floor random _cs5 ) ) do
{
_g = selectRandom _vl4;
if not((_g select 0) in _bad) then { _obj addMagazineCargoGlobal [_g select 0, (1 + (floor random (_g select 1)))] };
if not ( ( _g select 0 ) in _bad ) then { _obj addMagazineCargoGlobal [ _g select 0, ( 1 + ( floor random ( _g select 1 ) ) ) ] };
};
};
if ((round random 4) isEqualTo 1) then
if ( ( round random 4 ) isEqualTo 1 ) then
{
// Weapon attachments
for "_l" from 0 to (_cs6 - _cs7 + floor random _cs7) do
for "_l" from 0 to ( ( _cs6 - _cs7 ) + ( floor random _cs7) ) do
{
_g = selectRandom _vl0;
if not((_g select 0) in _bad) then { _obj addItemCargoGlobal [_g select 0, (1 + (floor random (_g select 1)))] };
if not ( ( _g select 0 ) in _bad ) then { _obj addItemCargoGlobal [ _g select 0, ( 1 + ( floor random ( _g select 1 ) ) ) ] };
};
};
// Items
for "_l" from 0 to (_cs8 - _cs9 + floor random _cs9) do
for "_l" from 0 to ( ( _cs8 - _cs9 ) + ( floor random _cs9 ) ) do
{
_g = selectRandom _vl3;
if not((_g select 0) in _bad) then { _obj addItemCargoGlobal [_g select 0, (1 + (floor random (_g select 1)))] };
if not ( ( _g select 0 ) in _bad ) then { _obj addItemCargoGlobal [ _g select 0, ( 1 + ( floor random ( _g select 1 ) ) ) ] };
};
if ((round random 4) isEqualTo 1) then
if ( ( round random 4 ) isEqualTo 1 ) then
{
// Vests
for "_l" from 0 to (_cs10 - _cs11 + floor random _cs11) do
for "_l" from 0 to ( ( _cs10 - _cs11 ) + ( floor random _cs11 ) ) do
{
_g = selectRandom _vl7;
if not((_g select 0) in _bad) then { _obj addItemCargoGlobal [_g select 0, (1 + (floor random (_g select 1)))] };
if not ( ( _g select 0 ) in _bad ) then { _obj addItemCargoGlobal [ _g select 0, ( 1 + ( floor random ( _g select 1 ) ) ) ] };
};
};
if ((round random 2) isEqualTo 1) then
if ( ( round random 2 ) isEqualTo 1 ) then
{
// Helmets / caps / berets / bandanas
for "_l" from 0 to (_cs12 - _cs13 + floor random _cs13) do
for "_l" from 0 to ( ( _cs12 - _cs13 ) + ( floor random _cs13 ) ) do
{
_g = selectRandom _vl2;
if not((_g select 0) in _bad) then { _obj addItemCargoGlobal [_g select 0, (1 + (floor random (_g select 1)))] };
if not ( ( _g select 0 ) in _bad ) then { _obj addItemCargoGlobal [ _g select 0, ( 1 + ( floor random ( _g select 1 ) ) ) ] };
};
};
if ((round random 3) isEqualTo 1) then
if ( ( round random 3 ) isEqualTo 1 ) then
{
// Backpacks
for "_l" from 0 to (_cs14 - _cs15 + floor random _cs15) do
for "_l" from 0 to ( ( _cs14 - _cs15 ) + ( floor random _cs15 ) ) do
{
_g = selectRandom _vl1;
if not((_g select 0) in _bad) then { _obj addBackpackCargoGlobal [_g select 0, (1 + (floor random (_g select 1)))] };
if not ( ( _g select 0 ) in _bad ) then { _obj addBackpackCargoGlobal [ _g select 0, ( 1 + ( floor random ( _g select 1 ) ) ) ] };
};
};
["loadLoot", 1, format["Loot loaded into crate located in '%1' at %2", _locName, mapGridPosition _obj]] ExecVM ("log" call VEMFr_fnc_scriptPath);
["loadLoot", 1, format [ "loot loaded into crate located in '%1' at %2", _locName, mapGridPosition _obj ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );

View File

@ -14,34 +14,29 @@
nothing (use spawn, not call)
*/
if (("debugMode" call VEMFr_fnc_config) > 0) then
if ( ( "debugMode" call VEMFr_fnc_config ) > 0 ) then
{
scopeName "_top";
params [
[("_p"),(""),([""])],
[("_t"),(3),([0])],
[("_l"),(""),([""])]
];
_do = { diag_log text format["IT07: [VEMFr] %1 -- %2: %3", _p, _this, _l] };
params [ "_p", "_t", "_l" ];
_do = { diag_log text format [ "IT07: [VEMFr] %1 -- %2: %3", _p, _this, _l ] };
_m = "debugMode" call VEMFr_fnc_config;
if (_t isEqualTo 0) then
if ( _t isEqualTo 0 ) then
{
if (_m isEqualTo 1 OR _m isEqualTo 3) then
if ( ( _m isEqualTo 1 ) OR ( _m isEqualTo 3 ) ) then
{
"ERROR" call _do;
breakOut "_top";
};
};
if (_t isEqualTo 1) then
if ( _t isEqualTo 1 ) then
{
if (_m isEqualTo 2 OR _m isEqualTo 3) then
if ( ( _m isEqualTo 2 ) OR ( _m isEqualTo 3 ) ) then
{
"INFO" call _do;
breakOut "_top";
};
};
if (_t isEqualTo 2) then // This bypasses _m setting. Always logs given params even if debugMode is set to 0
if ( _t isEqualTo 2 ) then // This bypasses _m setting. Always logs given params even if debugMode is set to 0
{
"SYSTEM" call _do;
breakOut "_top";

View File

@ -13,51 +13,46 @@
scopeName "outer";
_mgm = "maxGlobalMissions" call VEMFr_fnc_config;
["missionTimer", 1, format["Global mission-limit is set at: %1", _mgm]] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ "missionTimer", 1, format [ "global mission-limit is set at: %1", _mgm ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
_minNew = "minNew" call VEMFr_fnc_config;
if (_minNew > -1) then
if ( _minNew > -1 ) then
{
_maxNew = "maxNew" call VEMFr_fnc_config;
if (_maxNew > 0) then
if ( _maxNew > 0 ) then
{
_ml = "missionList" call VEMFr_fnc_config;
if (count _ml > 0) then
if ( ( count _ml ) > 0 ) then
{
_minFps = "minServerFPS" call VEMFr_fnc_config;
_mnPlyrs = "minPlayers" call VEMFr_fnc_config;
if isNil "VEMFrForceStart" then { VEMFrForceStart = false };
waitUntil { if ((((count allPlayers) >= _mnPlyrs) AND (diag_fps > _minFps)) OR VEMFrForceStart) then { true } else { uiSleep 5; false } };
if VEMFrForceStart then
{
["missionTimer", 1, format["VEMFr has been forced to start. Server FPS: %1", diag_fps]] ExecVM ("log" call VEMFr_fnc_scriptPath);
} else
{
["missionTimer", 1, format["Enough players online (%1) and server FPS (%2) is above %3. Starting missionTimer...", count allPlayers, diag_fps, _minFps]] ExecVM ("log" call VEMFr_fnc_scriptPath);
};
if ( isNil "VEMFrForceStart" ) then { VEMFrForceStart = false };
waitUntil { if ( ( ( ( count allPlayers ) >= _mnPlyrs ) AND ( diag_fps > _minFps ) ) OR VEMFrForceStart ) then { true } else { uiSleep 5; false } };
if VEMFrForceStart then { ["missionTimer", 1, format["VEMFr has been forced to start. Server FPS: %1", diag_fps]] ExecVM ("log" call VEMFr_fnc_scriptPath) }
else { [ "missionTimer", 1, format [ "enough players online (%1) and server FPS (%2) is above %3. Starting missionTimer...", count allPlayers, diag_fps, _minFps ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
VEMFrMissionCount = 0;
_im = false;
if (_mgm isEqualTo 0) then { _im = true };
_zz = { uiSleep ((_minNew*60)+ floor random ((_maxNew*60)-(_minNew*60))) };
if ( _mgm isEqualTo 0 ) then { _im = true };
_zz = { uiSleep ( ( _minNew * 60 ) + ( floor random ( ( _maxNew * 60 ) - ( _minNew * 60 ) ) ) ) };
call _zz;
while {true} do
{
// Pick A Mission if enough players online
if ((count allPlayers) >= _mnPlyrs) then
if ( ( count allPlayers ) >= _mnPlyrs ) then
{
scopeName "pick";
if ((VEMFrMissionCount < _mgm) AND (VEMFrMissionCount >= 0) OR _im) then
if ( ( VEMFrMissionCount < _mgm ) AND ( VEMFrMissionCount >= 0 ) OR _im ) then
{
_mssnNm = selectRandom _ml;
_h = [_mssnNm] execVM format["a3_vemf_reloaded\missions\%1.sqf", _mssnNm];
_h = [ _mssnNm ] execVM format [ "a3_vemf_reloaded\missions\%1.sqf", _mssnNm ];
uiSleep 5;
if (scriptDone _h) then { breakOut "pick" } else { call _zz };
if ( scriptDone _h ) then { breakOut "pick" } else { call _zz };
} else
{
if (VEMFrMissionCount < 0) then
if ( VEMFrMissionCount < 0 ) then
{
["missionTimer", 0, format["VEMFrMissionCount (%1) is BELOW 0! Stopping missionTimer...", VEMFrMissionCount]] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ "missionTimer", 0, format [ "VEMFrMissionCount (%1) is BELOW 0! Stopping missionTimer...", VEMFrMissionCount ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
breakOut "outer";
};
call _zz;

View File

@ -14,15 +14,9 @@
nothing
*/
params [
[("_mt"),(-1),([-1])],
[("_title"),(""),([""])],
[("_line"),(""),([""])],
[("_to"),([]),([[]])]
];
if ((count _to) isEqualTo 0) then { _to = allPlayers };
params [ "_mt", "_title", "_line", "_to" ];
if ( isNil "_to" ) then { _to = allPlayers };
{
VEMFrMsgToClient = [[(_mt),(_title),(_line)],("")];
(owner _x) publicVariableClient "VEMFrMsgToClient";
VEMFrMsgToClient = [ [ _mt, _title, _line ], "" ];
( owner _x ) publicVariableClient "VEMFrMsgToClient";
} forEach _to;

View File

@ -9,23 +9,23 @@
*/
{
if (isClass _x) then
if ( isClass _x ) then
{
_c1 = configName _x;
{
if (isClass _x) then
if ( isClass _x ) then
{
_c2 = configName _x;
{
if (isClass _x) then
if ( isClass _x ) then
{
_c3 = configName _x;
{
if not(isClass _x) then { [("Overrides"),(1),(format[("Overriding 'CfgVemfReloaded >> %1 >> %2 >> %3 >> %4'"),(_c1),(_c2),(_c3),(configName _x)])] ExecVM ("log" call VEMFr_fnc_scriptPath) };
} forEach (configProperties [(configFile >> "CfgVemfReloadedOverrides" >> _c1 >> _c2 >> _c3),("true"),(false)]);
} else { ["Overrides", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2 >> %3'", _c1, _c2, configName _x]] ExecVM ("log" call VEMFr_fnc_scriptPath) };
} forEach (configProperties [(configFile >> "CfgVemfReloadedOverrides" >> _c1 >> _c2),("true"),(false)]);
} else { ["Overrides", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2", _c1, configName _x]] ExecVM ("log" call VEMFr_fnc_scriptPath) };
} forEach (configProperties [(configFile >> "CfgVemfReloadedOverrides" >> _c1),("true"),(false)]);
} else { ["Overrides", 1, format["Overriding 'CfgVemfReloaded >> %1'", configName _x]] ExecVM ("log" call VEMFr_fnc_scriptPath) };
} forEach (configProperties [(configFile >> "CfgVemfReloadedOverrides"),("true"),(false)]);
if not ( isClass _x ) then { [ "Overrides", 1, format [ "Overriding 'CfgVemfReloaded >> %1 >> %2 >> %3 >> %4'", _c1, _c2, _c3, configName _x ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} forEach ( configProperties [ configFile >> "CfgVemfReloadedOverrides" >> _c1 >> _c2 >> _c3, "true", false ] );
} else { [ "Overrides", 1, format [ "Overriding 'CfgVemfReloaded >> %1 >> %2 >> %3'", _c1, _c2, configName _x ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} forEach ( configProperties [ configFile >> "CfgVemfReloadedOverrides" >> _c1 >> _c2, "true", false ] );
} else { [ "Overrides", 1, format [ "Overriding 'CfgVemfReloaded >> %1 >> %2", _c1, configName _x ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} forEach ( configProperties [ configFile >> "CfgVemfReloadedOverrides" >> _c1, "true", false] );
} else { [ "Overrides", 1, format [ "Overriding 'CfgVemfReloaded >> %1'", configName _x ] ] ExecVM ( "log" call VEMFr_fnc_scriptPath ) };
} forEach ( configProperties [ configFile >> "CfgVemfReloadedOverrides", "true", false ] );

View File

@ -5,20 +5,11 @@
handles the broadcast of a systemChat kill message
*/
(_this select 0) params [
[("_t"),(objNull),([objNull])],
[("_nt"),(""),([""])]
];
(_this select 1) params [
[("_k"),(objNull),([objNull])],
[("_nk"),(""),([""])]
];
private [("_crWpn"),("_cfg")];
if (vehicle _k isEqualTo _k) then { _crWpn = currentWeapon _k; _cfg = "CfgWeapons" }
else { _crWpn = typeOf (vehicle _k); _cfg = "CfgVehicles" };
params [ "_t", "_nt", "_k", "_nk" ];
private [ "_crWpn", "_cfg" ];
if ( ( vehicle _k ) isEqualTo _k ) then { _crWpn = currentWeapon _k; _cfg = "CfgWeapons" }
else { _crWpn = typeOf ( vehicle _k ); _cfg = "CfgVehicles" };
_dist = _t distance _k;
_dspName = getText(configFile >> _cfg >> _crWpn >> "displayName");
_dspName = _dspName select [0, _dspName find " "];
[format["%1 killed %2 with %3 from %4m", _nk, if (("sayKilledName" call VEMFr_fnc_config) isEqualTo "yes") then {_nt + " (AI)"} else {"an AI"}, _dspName, round _dist]] ExecVM ("systemChatToClient" call VEMFr_fnc_scriptPath);
_dspName = getText ( configFile >> _cfg >> _crWpn >> "displayName" );
_dspName = _dspName select [ 0, _dspName find " " ];
[ format [ "%1 killed %2 with %3 from %4m", _nk, if ( ( "sayKilledName" call VEMFr_fnc_config ) isEqualTo "yes" ) then { _nt + " (AI)" } else { "an AI" }, _dspName, round _dist ] ] ExecVM ( "systemChatToClient" call VEMFr_fnc_scriptPath );

View File

@ -12,28 +12,28 @@
nothing
*/
_grp = param [0, grpNull, [grpNull]];
if not(isNull _grp) then
_grp = _this select 0;
if not ( isNull _grp ) then
{
// Check if HC is enabled
_hcNbld = "headLessClientSupport" call VEMFr_fnc_config;
_force = uiNamespace getVariable ["VEMFr_forceAItoClients", nil];
if not(isNil "_force") then { if (_force isEqualType true) then { if _force then { _hcNbld = -1 } } };
_force = uiNamespace getVariable [ "VEMFr_forceAItoClients", nil ];
if not ( isNil "_force" ) then { if ( _force isEqualType true ) then { if _force then { _hcNbld = -1 } } };
private "_to";
if (_hcNbld isEqualTo "yes") then
if ( _hcNbld isEqualTo "yes" ) then
{
_to = call VEMFr_fnc_hc;
if isNil("_to") then { uiNamespace setVariable [("VEMFr_forceAItoClients"),(true)] };
if ( isNil "_to" ) then { uiNamespace setVariable [ "VEMFr_forceAItoClients", true ] };
};
if ((_hcNbld isEqualTo "no") OR (uiNamespace getVariable [("VEMFr_forceAItoClients"),(false)])) then
if ( ( _hcNbld isEqualTo "no" ) OR ( uiNamespace getVariable [ "VEMFr_forceAItoClients", false ] ) ) then
{
if ((count allPlayers) > 0) then
if ( ( count allPlayers ) > 0 ) then
{
_distToX = worldSize;
{
_dist = _x distance (leader _grp);
if (_dist <= _distToX) then
_dist = _x distance ( leader _grp );
if ( _dist <= _distToX ) then
{
_distToX = _dist;
_to = _x;
@ -42,9 +42,9 @@ if not(isNull _grp) then
};
};
if not(isNil "_to") then
if not ( isNil "_to" ) then
{
_grp setGroupOwner (owner _to);
_grp setVariable [("isVEMFrGroupLocal"),(false),(true)];
_grp setGroupOwner ( owner _to );
_grp setVariable [ "isVEMFrGroupLocal", false, true ];
};
};

View File

@ -13,6 +13,6 @@
*/
private "_grp";
_grp = param [0, grpNull, [grpNull]];
_grp setVariable [("isVEMFrGroup"),(true),(true)];
_grp setVariable [("isVEMFrGroupLocal"),(true),(true)];
_grp = param [ 0, grpNull, [ grpNull ] ];
_grp setVariable [ "isVEMFrGroup", true, true ];
_grp setVariable [ "isVEMFrGroupLocal", true, true ];

View File

@ -11,10 +11,10 @@
nothing
*/
([["aiStatic"],[("enabled"),("positions"),("amount")]] call VEMFr_fnc_config) params [("_s0"),("_s1"),("_s2")];
if (_s0 isEqualTo "yes") then
( [ [ "aiStatic" ], [ "enabled", "positions", "amount" ] ] call VEMFr_fnc_config ) params [ "_s0", "_s1", "_s2" ];
if ( _s0 isEqualTo "yes" ) then
{
["spawnStaticAI", 2, "spawning AI on positions..."] ExecVM ("log" call VEMFr_fnc_scriptPath);
[ "spawnStaticAI", 2, "spawning AI on positions..." ] ExecVM ( "log" call VEMFr_fnc_scriptPath );
_uc = _s2 select _forEachIndex;
{ [(_x),(2),((_uc / 2) + (round random (_uc / 2))),(([[call VEMFr_fnc_whichMod],["aiMode"]] call VEMFr_fnc_config) select 0),("Static")] spawn VEMFr_fnc_spawnVEMFrAI } forEach _s1;
{ [ _x, 2, ( _uc / 2 ) + ( round random ( _uc / 2 ) ), ( [ [ call VEMFr_fnc_whichMod ], [ "aiMode" ] ] call VEMFr_fnc_config ) select 0, "Static" ] spawn VEMFr_fnc_spawnVEMFrAI } forEach _s1;
};

View File

@ -9,13 +9,9 @@
nothing
*/
params [
[("_line"),(""),([""])],
[("_to"),([]),([[]])]
];
if (_to isEqualTo []) then { _to = allPlayers };
params [ "_line", "_to" ];
if ( isNil "_to" ) then { _to = allPlayers };
{
VEMFrMsgToClient = [(_line),("sys")];
(owner _x) publicVariableClient "VEMFrMsgToClient";
VEMFrMsgToClient = [ _line, "sys" ];
( owner _x ) publicVariableClient "VEMFrMsgToClient";
} forEach _to;