Speed tweaks

This commit is contained in:
IT07 2016-07-02 16:24:53 +02:00
parent 4e6158fa01
commit 796371c7f9
24 changed files with 1295 additions and 1514 deletions

View File

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

View File

@ -10,215 +10,156 @@
_this select 2: POSITION - Center for nearestLocations check _this select 2: POSITION - Center for nearestLocations check
_this select 3: SCALAR - Distance in meters. Locations closer than that will be excluded _this select 3: SCALAR - Distance in meters. Locations closer than that will be excluded
_this select 4: SCALAR - Max prefered distance in meters from center. If not achievable, further dest will be selected _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 _cntr for players _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 (optional) - Exact config name of mission override settings to load
Returns: Returns:
if mode = loc: LOCATION if mode == loc: LOCATION
if mode = pos: POSITION if mode == pos: POSITION
*/ */
private ["_ret","_settings","_nonPopulated","_blackPos","_missionDistance","_mode","_onRoad","_cntr","_tooCloseRange","_maxPrefered","_skipDistance","_range","_missionConfigName"]; private [
_ret = false; "_r","_this0","_this1","_this2","_this3","_this4","_this5","_this6",
// Define settings "_s0","_s1","_s2","_s3",
_settings = [["nonPopulated","noMissionPos","missionDistance"]] call VEMFr_fnc_getSetting; "_rad","_arr","_bin","_used","_badNames","_maps","_bad",
_settings params [["_nonPopulated",1,[0]], ["_blackPos",[],[[]]], ["_missionDistance",3000,[0]]]; "_locPos","_xx","_pos","_hi","_low","_dist","_loc"
params [["_mode","",[""]], ["_onRoad",false,[false]], ["_cntr",[],[[]]], ["_tooCloseRange",-1,[0]], ["_maxPrefered",-1,[0]], ["_skipDistance",-1,[0]], ["_missionConfigName","",[""]]]; ];
_range = worldSize;
if not(_missionConfigName isEqualTo "") then params [
["_this0", "", [""]],
["_this1", false, [false]],
["_this2", [], [[]]],
["_this3", -1, [0]],
["_this4", -1, [0]],
["_this5", -1, [0]],
["_this6", "", [""]]
];
([["nonPopulated","noMissionPos","missionDistance","missionList"]] call VEMFr_fnc_config) params ["_s0","_s1","_s2","_s3"];
if (_this6 in _s3) then
{ {
private ["_nonPopulatedOverride"]; _s0 = ([[_this6],["nonPopulated"]] call VEMFr_fnc_config) select 0;
_nonPopulatedOverride = ([[_missionConfigName],["nonPopulated"]] call VEMFr_fnc_getSetting) select 0; };
if not isNil "_nonPopulatedOverride" then
_rad = 5000;
if (_this0 isEqualTo "loc") then
{
// Get a list of locations close to _this2 (position of player)
_arr = nearestLocations [_this2, ["CityCenter","Strategic","StrongpointArea","NameVillage","NameCity","NameCityCapital",if (_s0 isEqualTo 1) then {"nameLocal","Area","BorderCrossing","Hill","fakeTown","Name","RockArea","ViewPoint"}], worldSize];
if ((count _arr) > 0) then
{ {
if not(_nonPopulatedOverride isEqualTo -1) then _maps = "isClass _x" configClasses (configFile >> "CfgVemfReloaded" >> "locationBlackLists");
{ // Make a list of locationBlackLists's children
_maps set [_forEachIndex, toLower (configName _x)];
} forEach _maps;
if ((toLower worldName) in _maps) then
{ {
_nonPopulated = _nonPopulatedOverride; _bad = ([["locationBlackLists", worldName],["locations"]] call VEMFr_fnc_config) select 0
} else
{
_bad = ([["locationBlackLists","Other"],["locations"]] call VEMFr_fnc_config) select 0
}; };
};
};
private ["_checkBlackPos"]; _bin = [];
_checkBlackPos = false; _used = uiNamespace getVariable ["VEMFrUsedLocs",[]];
if (count _blackPos > 0) then { // Check _arr for invalid locations (too close, hasPlayers or inBlacklist)
{ if ([locationPosition _x, _this5] call VEMFr_fnc_playerNear) then
_checkBlackPos = true; {
}; _bin pushBack _x;
} else
private ["_mode","_roadRange"]; {
if (not(_mode isEqualTo "") AND (_cntr isEqualTypeArray [0,0,0]) AND (_tooCloseRange > -1) AND (_maxPrefered > -1)) then if ((count _s1) > 0) then
{
_roadRange = 5000;
if (_mode isEqualTo "loc") then
{
// Get a list of locations close to _cntr (position of player)
private ["_locs"];
_locs = nearestLocations [_cntr, ["CityCenter","Strategic","StrongpointArea","NameVillage","NameCity","NameCityCapital",if(_nonPopulated isEqualTo 1)then{"nameLocal","Area","BorderCrossing","Hill","fakeTown","Name","RockArea","ViewPoint"}], _range];
if (count _locs > 0) then
{
private ["_usedLocs","_remLocs","_blackListMapClasses","_listedMaps"];
_usedLocs = uiNamespace getVariable "VEMFrUsedLocs";
_remLocs = [];
_blackListMapClasses = "true" configClasses (configFile >> "CfgVemfReloaded" >> "locationBlackLists");
_listedMaps = []; // Define
{ // Make a list of locationBlackLists's children
_listedMaps pushBack (configName _x);
} forEach _blackListMapClasses;
private ["_blackList"];
if (worldName in _listedMaps) then { _blackList = ([["locationBlackLists", worldName],["locations"]] call VEMFr_fnc_getSetting) select 0 }
else { _blackList = ([["locationBlackLists","Other"],["locations"]] call VEMFr_fnc_getSetting) select 0 };
{ // Check _locs for invalid locations (too close, hasPlayers or inBlacklist)
private ["_hasPlayers"];
_hasPlayers = [locationPosition _x, _skipDistance] call VEMFr_fnc_checkPlayerPresence;
if _hasPlayers then
{ {
_remLocs pushBack _x; _locPos = locationPosition _x;
} else _xx = _x;
{ {
if _checkBlackPos then if ((count _x) isEqualTo 2) then
{
private ["_locPos","_loc"];
_locPos = locationPosition _x;
_loc = _x;
{ {
if (count _x isEqualTo 2) then if (((_x select 0) distance _locPos) <= (_x select 1)) then
{ {
private ["_pos"]; _bin pushBack _xx;
_pos = _x param [0, [0,0,0], [[]]];
if not(_pos isEqualTo [0,0,0]) then
{
private ["_range"];
_range = _x param [1, 600, [0]];
if ((_pos distance _locPos) < _range) then
{
_remLocs pushBack _loc;
};
};
} else
{
["fn_findPos", 0, format["found invalid entry in mission blacklist: %1", _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
} forEach _blackPos;
};
if ((text _x) in _blackList) then
{
_remLocs pushBack _x;
} else } else
{ {
if (_cntr distance (locationPosition _x) < _tooCloseRange) then ["fn_findPos", 0, format["found invalid entry in mission blacklist: %1", _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
{
_remLocs pushBack _x;
} else
{
if (_x in _usedLocs) then
{
_remLocs pushBack _x;
};
};
}; };
if (count _usedLocs > 0) then } forEach _s1;
};
if ((text _x) in _bad) then
{
_bin pushBack _x;
} else
{
if (_this2 distance (locationPosition _x) < _this3) then
{
_bin pushBack _x;
} else
{
if (_x in _used) then
{ {
private ["_loc"]; _bin pushBack _x;
_loc = _x;
{
if (((locationPosition _loc) distance (locationPosition _x)) < _missionDistance) then
{
_remLocs pushBack _loc;
};
} forEach _usedLocs;
}; };
};
}; };
} forEach _locs;
private ["_index"]; if ((count _used) > 0) then
{ // Remove all invalid locations from _locs
_index = _locs find _x;
_locs deleteAt _index;
} forEach _remLocs;
private ["_far","_pref","_dist"];
// Check what kind of distances we have
_far = []; // Further than _maxPrefered
_pref = []; // Closer then _maxPrefered
{
_dist = _cntr distance (locationPosition _x);
if (_dist > _maxPrefered) then
{ {
_far pushBack _x; _xx = _x;
};
if (_dist < _maxPrefered) then
{
_pref pushBack _x;
};
} forEach _locs;
// Check if there are any prefered locations. If yes, randomly select one
private ["_loc"];
if (count _pref > 0) then
{
_loc = selectRandom _pref;
};
// Check if _far has any locations and if _pref is empty
if (count _far > 0) then
{
if (count _pref isEqualTo 0) then
{ {
_loc = selectRandom _far; if (((locationPosition _xx) distance (locationPosition _x)) < _s2) then
}; {
}; _bin pushBack _xx;
};
} forEach _used;
};
};
} forEach _arr;
// Validate _locs just to prevent the .RPT from getting spammed { // Remove all invalid locations from _arr
if (count _locs > 0) then _arr deleteAt (_arr find _x);
{ } forEach _bin;
// Return Name and POS
_ret = _loc; // Check what kind of distances we have
(uiNamespace getVariable "VEMFrUsedLocs") pushBack _loc; _low = []; // Closer then _this4
}; _hi = []; // Further than _this4
}; {
}; _dist = _this2 distance (locationPosition _x);
if (_mode isEqualTo "pos") then if (_dist > _this4) then { _hi pushBack _x };
{ if (_dist <= _this4) then { _low pushBack _x };
private ["_valid"]; } forEach _arr;
_valid = false;
for "_p" from 1 to 10 do // Check if there are any prefered locations. If yes, randomly select one
if ((count _low) > 0) then
{ {
if (_ret isEqualType true) then _loc = selectRandom _low;
_r = _loc;
_used pushBackUnique _loc;
} else
{
if ((count _hi) > 0) then
{ {
if not _ret then _loc = selectRandom _hi;
{ _r = _loc;
private ["_pos"]; _used pushBackUnique _loc;
_pos = [_cntr, _tooCloseRange, -1, 2, 0, 50, 0] call BIS_fnc_findSafePos;
if _onRoad then
{
private ["_roads"];
_roads = _pos nearRoads _roadRange;
if (count _roads > 0) then
{
private ["_closest","_dist"];
_closest = ["", _roadRange];
{ // Find the closest road
_dist = _x distance _pos;
if (_dist < (_closest select 1)) then
{
_closest = [_x, _dist];
};
} forEach _roads;
_pos = position (_closest select 0);
};
};
if not([_pos, _skipDistance] call VEMFr_fnc_checkPlayerPresence) then
{
_ret = _pos;
};
};
}; };
}; };
}; };
} else
{
["findPos",0,"params not valid!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
_ret 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;
};
};
};
_r

View File

@ -15,60 +15,53 @@
BOOLEAN - true if successful BOOLEAN - true if successful
*/ */
private ["_done"]; private ["_r","_this0"];
_done = false; params [
if (_this isEqualType []) then ["_this0", objNull, [objNull]],
["_this1", "", [""]],
["_this2", "", [""]],
["_this3", "", [""]]
];
_r = [];
if not(_this1 isEqualTo "") then
{ {
private ["_unit"]; private ["_m"];
params [["_unit", objNull, [objNull]],["_classPrimary", "", [""]],["_classSecondary", "", [""]],["_classHandgun", "", [""]]]; _m = selectRandom (getArray (configFile >> "CfgWeapons" >> _this1 >> "magazines"));
if not isNull _unit then for "_l" from 1 to 5 do
{ {
if local _unit then if not(_this0 canAdd _m) exitWith {};
{ _this0 addItem _m;
if not(_classPrimary isEqualTo "") then
{
private ["_mag"];
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _classPrimary >> "magazines"));
for "_m" from 1 to 5 do
{
if not(_unit canAdd _mag) exitWith {};
_unit addItem _mag;
};
};
if not (_classSecondary isEqualTo "") then
{
if not(backPack _unit isEqualTo "") then
{
private ["_mag"];
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _classSecondary >> "magazines"));
for "_m" from 1 to 3 do
{
if not(_unit canAdd _mag) exitWith {};
_unit addItem _mag;
};
};
};
if not (_classHandgun isEqualTo "") then
{
private ["_mag"];
_mag = selectRandom (getArray (configFile >> "CfgWeapons" >> _classHandgun >> "magazines"));
for "_m" from 1 to 4 do
{
if not(_unit canAdd _mag) exitWith {};
_unit addItem _mag;
};
};
_done = true;
} else // If unit is not local
{
["fn_giveAmmo", 0, format["%1 is not local. Can not execute!", _unit]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
} else // If unit isNull
{
["fn_giveAmmo", 0, "_unit isNull. Can not execute!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
} else _r pushBack true;
{
["fn_giveAmmo", 0, "_this is not an ARRAY"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
_done
if not(_this2 isEqualTo "") then
{
if not((backPack _this0) isEqualTo "") then
{
private ["_m"];
_m = selectRandom (getArray (configFile >> "CfgWeapons" >> _this2 >> "magazines"));
for "_l" from 1 to 3 do
{
if not(_this0 canAdd _m) exitWith {};
_this0 addItem _m;
};
_r pushBack true;
};
};
if not(_this3 isEqualTo "") then
{
private ["_m"];
_m = selectRandom (getArray (configFile >> "CfgWeapons" >> _this3 >> "magazines"));
for "_l" from 1 to 4 do
{
if not(_this0 canAdd _m) exitWith {};
_this0 addItem _m;
};
_r pushBack true;
};
if ((count _r) > 0) then { _r = true } else { _r = nil };
_r

View File

@ -11,64 +11,54 @@
Returns: BOOLEAN - true if no errors occured Returns: BOOLEAN - true if no errors occured
*/ */
private ["_done"]; private ["_r","_p","_w","_a","_bin"];
_done = false; _u = param [0,objNull,[objNull]];
if (_this isEqualType []) then if not (isNull _u) then
{ {
_unit = param [0,objNull,[objNull]]; _p = [1,0,1,0,1,1,1,1,0,0,1,1,1];
if not (isNull _unit) then _w = primaryWeapon _u;
{ if ((selectRandom _p) isEqualTo 1) then
// primaryWeapon items { // Select random scope
private ["_randomPattern","_primaryWeapon"]; _a = getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
_randomPattern = [1,0,1,0,1,1,1,1,0,0,1,1,1]; if (("allowTWS" call VEMFr_fnc_config) isEqualTo 0) then
_primaryWeapon = primaryWeapon _unit; {
if (selectRandom _randomPattern isEqualTo 1) then _bin = [];
{ // Select random scope {
private ["_scopes"]; if (((toLower _x) find "tws") > -1) then
_scopes = getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
if (("allowTWS" call VEMFr_fnc_getSetting) isEqualTo 0) then
{
private["_forbiddenScopes"];
_forbiddenScopes = [];
{ {
if (((toLower _x) find "tws") > -1) then _bin pushBack _x;
{ };
_forbiddenScopes pushBack _x; } forEach _a;
}; {
} forEach _scopes; _a deleteAt (_a find _x);
{ } forEach _bin;
_index = _scopes find _x;
_scopes deleteAt _index;
} forEach _forbiddenScopes;
};
_unit addPrimaryWeaponItem (selectRandom _scopes);
}; };
if (selectRandom _randomPattern isEqualTo 1) then _u addPrimaryWeaponItem (selectRandom _a);
{ // Select random muzzle
_unit addPrimaryWeaponItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems")));
};
if (selectRandom _randomPattern isEqualTo 1) then
{ // Select random pointer
_unit addPrimaryWeaponItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems")));
};
if (selectRandom _randomPattern isEqualTo 1) then
{ // Select random bipod
_unit addPrimaryWeaponItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "WeaponSlotsInfo" >> "UnderbarrelSlot" >> "compatibleItems")));
};
private ["_handgunWeapon","_randomPattern"];
// handgunWeapon items
_handgunWeapon = handgunWeapon _unit;
_randomPattern = [1,0,1,0,0,1,0,0,0,0,1,1,1];
if (selectRandom _randomPattern isEqualTo 1) then
{ // Select random scope
_unit addHandgunItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _handgunWeapon >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems")));
};
if (selectRandom _randomPattern isEqualTo 1) then
{ // Select random muzzle
_unit addHandgunItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _handgunWeapon >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems")));
};
_done = true;
}; };
if ((selectRandom _p) isEqualTo 1) then
{ // Select random muzzle
_u addPrimaryWeaponItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems")));
};
if ((selectRandom _p) isEqualTo 1) then
{ // Select random pointer
_u addPrimaryWeaponItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems")));
};
if ((selectRandom _p) isEqualTo 1) then
{ // Select random bipod
_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
{ // Select random scope
_u addHandgunItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems")));
};
if ((selectRandom _p) isEqualTo 1) then
{ // Select random muzzle
_u addHandgunItem (selectRandom (getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems")));
};
_r = true;
}; };
_done _r

View File

@ -11,45 +11,45 @@ if isNil "VEMFrHasStarted" then
["Launcher", 2, format["/// STARTING VEMFr v%1 \\\", getText (configFile >> "CfgPatches" >> "exile_vemf_reloaded" >> "version")]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["Launcher", 2, format["/// STARTING VEMFr v%1 \\\", getText (configFile >> "CfgPatches" >> "exile_vemf_reloaded" >> "version")]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
uiNamespace setVariable ["VEMFrUsedLocs", []]; uiNamespace setVariable ["VEMFrUsedLocs", []];
uiNamespace setVariable ["VEMFrAttackedFlags", []]; uiNamespace setVariable ["VEMFrAttackedFlags", []];
uiNamespace setVariable ["VEMFrHcLoad", []]; uiNamespace setVariable ["VEMFrHcLoad", [[],[]]];
[] spawn [] spawn
{ {
if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then if (("overridesToRPT" call VEMFr_fnc_config) isEqualTo 1) then
{ {
_root = configProperties [configFile >> "CfgVemfReloadedOverrides", "true", false]; _r = configProperties [configFile >> "CfgVemfReloadedOverrides", "true", false];
{ {
if (isClass _x) then if (isClass _x) then
{ {
_classLv1Name = configName _x; _c1 = configName _x;
_levelOne = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _classLv1Name, "true", false]; _l1 = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _c1, "true", false];
{ {
if (isClass _x) then if (isClass _x) then
{ {
_classLv2Name = configName _x; _c2 = configName _x;
_levelTwo = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _classLv1Name >> _classLv2Name, "true", false]; _l2 = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _c1 >> _c2, "true", false];
{ {
if not(isClass _x) then if not(isClass _x) then
{ {
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2 >> %3'", _classLv1Name, _classLv2Name, configName _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2 >> %3'", _c1, _c2, configName _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
} forEach _levelTwo; } forEach _l2;
} else } else
{ {
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2", _classLv1Name, configName _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2", _c1, configName _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
} forEach _levelOne; } forEach _l1;
} else } else
{ {
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1'", configName _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1'", configName _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
} forEach _root; } forEach _r;
}; };
_scripts = ["checkLoot","missionTimer","REMOTEguard","spawnStaticAI"]; _s = ["checkLoot","missionTimer","REMOTEguard","spawnStaticAI"];
{ {
ExecVM format["exile_vemf_reloaded\sqf\%1.sqf", _x]; ExecVM format["exile_vemf_reloaded\sqf\%1.sqf", _x];
} forEach _scripts; } forEach _s;
west setFriend [independent, 0]; west setFriend [independent, 0];
independent setFriend [west, 0]; independent setFriend [west, 0];

View File

@ -1,8 +1,8 @@
/* /*
Author: VAMPIRE, rebooted by IT07 Author: IT07
Description: Description:
loads AI inventory gives inventory to given units
Param: Param:
_this: ARRAY _this: ARRAY
@ -14,223 +14,200 @@
BOOLEAN - true if nothing failed BOOLEAN - true if nothing failed
*/ */
private ["_ok","_params"]; private ["_r","_this0","_this1","_this2"];
_ok = false; params [
_params = _this; ["_this0", [], [[]]],
if (_this isEqualType []) then ["_this1", "", [""]],
["_this2", 0, [0]]
];
if ((_this1 in ("missionList" call VEMFr_fnc_config)) OR (_this1 isEqualTo "Static")) then
{ {
private ["_units","_missionName","_aiMode"]; scopeName "this";
params [["_units", [], [[]]],["_missionName", "", [""]],["_aiMode", 0, [0]]]; if (_this2 isEqualTo 0) then // "Militia"
if (count _units > 0) then
{ {
if (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static") then private ["_s","_unifs","_headG","_vests","_packs","_lnchers","_rfles","_pstls","_ls"];
{ // Define settings
scopeName "this"; _s = [["aiGear"],["aiUniforms","aiHeadGear","aiVests","aiBackpacks","aiLaunchers","aiRifles","aiPistols"]] call VEMFr_fnc_config;
if (_aiMode isEqualTo 0) then // "Militia" _s params ["_unifs","_headG","_vests","_packs","_lnchers","_rfles","_pstls"];
{ {
private ["_aiGear","_uniforms","_headGear","_vests","_backpacks","_rifles","_pistols","_aiLaunchers","_launchers","_launcherChance"]; private ["_xx","_g","_a","_pw","_hw"];
// Define settings _xx = _x;
_aiGear = [["aiGear"],["aiUniforms","aiHeadGear","aiVests","aiBackpacks","aiLaunchers","aiRifles","aiPistols"]] call VEMFr_fnc_getSetting; // Strip it
_uniforms = _aiGear select 0; removeAllWeapons _xx;
_headGear = _aiGear select 1; removeAllItems _xx;
_vests = _aiGear select 2; if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo 1) then
_backpacks = _aiGear select 3; {
_rifles = _aiGear select 5; removeAllAssignedItems _xx;
_pistols = _aiGear select 6; };
_aiLaunchers = ([[_missionName],["aiLaunchers"]] call VEMFr_fnc_getSetting) select 0; removeVest _xx;
if (_aiLaunchers isEqualTo 1) then removeBackpack _xx;
{ removeGoggles _xx;
_launchers = _aiGear select 4; removeHeadGear _xx;
_launcherChance = ([[_missionName],["hasLauncherChance"]] call VEMFr_fnc_getSetting) select 0; 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";
};
_g = selectRandom _headG;
_xx addHeadGear _g;
_g = selectRandom _vests;
_xx addVest _g;
_ls = [[_this1],["allowLaunchers","hasLauncherChance"]] call VEMFr_fnc_config;
if ((_ls select 0) isEqualTo 1) then
{
private ["_lc"];
_lc = _ls select 1;
if ((_lc isEqualTo 100) OR ((ceil random (100 / _lc) isEqualTo (ceil random (100 / _lc))))) then
{ {
private ["_unit","_gear","_ammo"]; if not(_this1 isEqualTo "BaseAttack") then
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{ {
removeAllAssignedItems _unit; _g = selectRandom _packs;
_xx addBackpack _g;
}; };
removeVest _unit; _g = selectRandom _lnchers;
removeBackpack _unit; private ["_a"];
removeGoggles _unit; _a = getArray (configFile >> "cfgWeapons" >> _g >> "magazines");
removeHeadGear _unit; if (count _a > 2) then
if (count _uniforms > 0) then
{ {
removeUniform _unit; _a resize 2;
_gear = selectRandom _uniforms;
_unit forceAddUniform _gear; // Give the poor naked guy some clothing :)
};
if (_missionName isEqualTo "BaseAttack") then
{
_unit addBackpack "B_Parachute";
};
_gear = selectRandom _headGear;
_unit addHeadGear _gear;
_gear = selectRandom _vests;
_unit addVest _gear;
if (_aiLaunchers isEqualTo 1) then
{
if (_launcherChance isEqualTo 100 OR (ceil random (100 / _launcherChance) isEqualTo (ceil random (100 / _launcherChance)))) then
{
if not(_missionName isEqualTo "BaseAttack") then
{
_gear = selectRandom _backpacks;
_unit addBackpack _gear;
};
_gear = selectRandom _launchers;
private ["_ammo"];
_ammo = getArray (configFile >> "cfgWeapons" >> _gear >> "magazines");
if (count _ammo > 2) then
{
_ammo resize 2;
};
for "_i" from 0 to (2 + (round random 1)) do
{
_unit addMagazine (selectRandom _ammo);
};
_unit addWeapon _gear;
};
}; };
for "_i" from 0 to (2 + (round random 1)) do
{
_xx addMagazine (selectRandom _a);
};
_xx addWeapon _g;
};
};
// Select a random weapon // Select a random weapon
private ["_primaryWeapon","_handgunWeapon"]; _pw = selectRandom _rfles;
_primaryWeapon = selectRandom _rifles; _hw = selectRandom _pstls;
_handgunWeapon = selectRandom _pistols; // Give this guy some ammo
// Give this guy some ammo _g = [_xx, _pw, "", _hw] call VEMFr_fnc_giveAmmo;
_givenAmmo = [_unit, _primaryWeapon, "", _handgunWeapon] call VEMFr_fnc_giveAmmo; if (isNil "_g") then
if not _givenAmmo then {
{ ["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _xx]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; };
}; _xx addWeapon _pw;
_unit addWeapon _primaryWeapon; _xx selectWeapon _pw;
_unit selectWeapon _primaryWeapon; _xx addWeapon _hw;
_unit addWeapon _handgunWeapon; // Give this guy some weaponItems
// Give this guy some weaponItems _g = [_xx] call VEMFr_fnc_giveWeaponItems;
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems; if not _g then
if not _giveAttachments then {
{ ["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _xx]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; };
}; } forEach _this0;
} forEach _units; _r = true;
_ok = true; breakOut "this";
breakOut "this"; };
};
if (_aiMode isEqualTo 1) then // Regular police
{
private ["_policeGear","_headGear","_vests","_uniforms","_rifles","_pistols","_backpacks"];
_policeGear = [["policeConfig"],["headGear","vests","uniforms","rifles","pistols","backpacks"]] call VEMFr_fnc_getSetting;
_headGear = _policeGear select 0;
_vests = _policeGear select 1;
_uniforms = _policeGear select 2;
_rifles = _policeGear select 3;
_pistols = _policeGear select 4;
_backpacks = _policeGear select 5;
{
private ["_unit","_hat","_vest","_uniform","_rifle","_pistol","_backpack","_givenAmmo","_giveAttachments"];
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{
removeAllAssignedItems _unit;
};
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
_hat = selectRandom _headGear; if (_this2 isEqualTo 1) then // Regular police
_unit addHeadGear _hat; {
_vest = selectRandom _vests; private ["_s","_headG","_vests","_unifs","_rfles","_pstls","_packs"];
_unit addVest _vest; _s = [["policeConfig"],["headGear","vests","uniforms","rifles","pistols","backpacks"]] call VEMFr_fnc_config;
_uniform = selectRandom _uniforms; _s params ["_headG","_vests","_unifs","_rfles","_pstls","_packs"];
_unit forceAddUniform _uniform; {
_rifle = selectRandom _rifles; private ["_xx","_g","_pw","_hw"];
_pistol = selectRandom _pistols; _xx = _x;
// Give this guy some ammo // Strip it
_givenAmmo = [_unit, _rifle, "", _pistol] call VEMFr_fnc_giveAmmo; removeAllWeapons _xx;
if not _givenAmmo then removeAllItems _xx;
{ if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo 1) then
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; {
}; removeAllAssignedItems _xx;
_unit addWeapon _rifle; };
_unit selectWeapon _rifle; removeUniform _xx;
_unit addWeapon _pistol; removeVest _xx;
if not(_missionName isEqualTo "BaseAttack") then removeBackpack _xx;
{ removeGoggles _xx;
_backpack = selectRandom _backpacks; removeHeadGear _xx;
_unit addBackPack _backpack; _g = selectRandom _headG;
} else _xx addHeadGear _g;
{ _g = selectRandom _vests;
_unit addBackpack "B_Parachute"; _xx addVest _g;
}; _g = selectRandom _unifs;
// Give this guy some weaponItems _xx forceAddUniform _g;
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems;
if not _giveAttachments then
{
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
} forEach _units;
_ok = true;
breakOut "this";
};
if (_aiMode isEqualTo 2) then // S.W.A.T.
{
private ["_policeGear","_rifles","_pistols"];
_policeGear = [["policeConfig"],["rifles","pistols"]] call VEMFr_fnc_getSetting;
_rifles = _policeGear select 0;
_pistols = _policeGear select 1;
{
private ["_unit","_rifle","_pistol","_givenAmmo","_giveAttachments"];
_unit = _x;
// Strip it
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{
removeAllAssignedItems _unit;
};
removeAllItems _unit;
removeAllWeapons _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
removeUniform _unit;
removeVest _unit;
_unit addHeadGear "H_HelmetB_light_black";
_unit addGoggles "G_Balaclava_blk";
_unit addVest "V_PlateCarrier2_blk";
_unit forceAddUniform "Exile_Uniform_ExileCustoms";
_rifle = selectRandom _rifles;
_pistol = selectRandom _pistols;
// Give this guy some ammo
_givenAmmo = [_unit, _rifle, "", _pistol] call VEMFr_fnc_giveAmmo;
if not _givenAmmo then
{
["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _unit]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
_unit addWeapon _rifle;
_unit selectWeapon _rifle;
_unit addWeapon _pistol;
if (_missionName isEqualTo "BaseAttack") then _pw = selectRandom _rfles;
{ _hw = selectRandom _pstls;
_unit addBackpack "B_Parachute"; // Give this guy some ammo
}; _g = [_xx, _pw, "", _hw] call VEMFr_fnc_giveAmmo;
// Give this guy some weaponItems if (isNil "_g") then
_giveAttachments = [_unit] call VEMFr_fnc_giveWeaponItems; {
if not _giveAttachments then ["fn_loadInv", 0, format["FAILED to give ammo to AI: %1", _xx]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
{ };
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _unit]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; _xx addWeapon _pw;
}; _xx selectWeapon _pw;
} forEach _units; _xx addWeapon _hw;
_ok = true; if not(_this1 isEqualTo "BaseAttack") then
}; {
}; _xx addBackPack (selectRandom _packs);
} else
{
_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 "exile_vemf_reloaded\sqf\log.sqf";
};
} forEach _this0;
_r = true;
breakOut "this";
};
if (_this2 isEqualTo 2) then // S.W.A.T.
{
private ["_s","_rfles","_pstls"];
_s = [["policeConfig"],["rifles","pistols"]] call VEMFr_fnc_config;
_s params ["_rfles","_pstls"];
{
private ["_xx","_g","_pw","_hw"];
_xx = _x;
// Strip it
if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo 1) then { removeAllAssignedItems _xx };
removeAllItems _xx;
removeAllWeapons _xx;
removeBackpack _xx;
removeGoggles _xx;
removeHeadGear _xx;
removeUniform _xx;
removeVest _xx;
_xx addHeadGear "H_HelmetB_light_black";
_xx addGoggles "G_Balaclava_blk";
_xx addVest "V_PlateCarrier2_blk";
_xx forceAddUniform "Exile_Uniform_ExileCustoms";
_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 "exile_vemf_reloaded\sqf\log.sqf";
};
_xx addWeapon _pw;
_xx selectWeapon _pw;
_xx addWeapon _hw;
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 "exile_vemf_reloaded\sqf\log.sqf";
};
} forEach _this0;
_r = true;
}; };
}; };
_r
_ok

View File

@ -1,8 +1,8 @@
/* /*
Author: original by Vampire, completely rewritten by IT07 Author: IT07
Description: Description:
spawns AI using given _pos and unit/group count. spawns AI using given _this0 and unit/group count.
Params: Params:
_this select 0: POSITION - where to spawn the units around _this select 0: POSITION - where to spawn the units around
@ -16,180 +16,168 @@
ARRAY format [[groups],[50cals]] ARRAY format [[groups],[50cals]]
*/ */
private ["_spawned","_pos","_grpCount","_unitsPerGrp","_mode","_missionName","_maxRange"]; private ["_r","_this0","_this1","_this2","_this3","_this4","_this5"];
_spawned = [[],[]]; params [
params [["_pos",[],[[]]], ["_grpCount",1,[0]], ["_unitsPerGrp",1,[0]], ["_mode",-1,[0]], ["_missionName","",[""]], ["_maxRange",175,[0]]]; ["_this0", [], [[]]],
if ((count _pos isEqualTo 3) AND (_grpCount > 0) AND (_unitsPerGrp > 0) AND (_missionName in ("missionList" call VEMFr_fnc_getSetting))) then ["_this1", 1, [0]],
["_this2", 1, [0]],
["_this3", -1, [0]],
["_this4", "", [""]],
["_this5", 175, [0]]
];
if (_this4 in ("missionList" call VEMFr_fnc_config)) then
{ {
private [ private [
"_sldrClass","_groups","_hc","_aiDifficulty","_skills","_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime", "_grps","_s","_ccrcy","_mShk","_mSpd","_stmna","_sptDst","_sptTme",
"_courage","_reloadSpd","_commanding","_general","_houses","_notTheseHouses","_goodHouses","_noHouses","_cal50s","_units" "_crge","_rldSpd","_cmmndng","_gnrl","_notTheseHouses","_gdHss","_nHss","_cl50s","_nts"
]; ];
_sldrClass = "unitClass" call VEMFr_fnc_getSetting; _r = [[],[]];
_groups = []; _grps = [];
_hc = "headLessClientSupport" call VEMFr_fnc_getSetting; _s = [["aiSkill", ([["aiSkill"],["difficulty"]] call VEMFr_fnc_config) select 0],["accuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]] call VEMFr_fnc_config;
_aiDifficulty = [["aiSkill"],["difficulty"]] call VEMFr_fnc_getSetting param [0, "Veteran", [""]]; _s params ["_ccrcy","_mShk","_mSpd","_stmna","_sptDst","_sptTme","_crge","_rldSpd","_cmmndng","_gnrl"];
_skills = [["aiSkill", _aiDifficulty],["accuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]] call VEMFr_fnc_getSetting; _notTheseHouses = "housesBlackList" call VEMFr_fnc_config;
_skills params ["_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime","_courage","_reloadSpd","_commanding","_general"]; _gdHss = [];
_houses = nearestTerrainObjects [_pos, ["House"], _maxRange]; // Find some houses to spawn in
_notTheseHouses = "housesBlackList" call VEMFr_fnc_getSetting;
_goodHouses = [];
{ // Filter the houses that are too small for one group { // Filter the houses that are too small for one group
if not(typeOf _x in _notTheseHouses) then if not(typeOf _x in _notTheseHouses) then
{ {
if ([_x, _unitsPerGrp] call BIS_fnc_isBuildingEnterable) then if ([_x, _this2] call BIS_fnc_isBuildingEnterable) then
{ {
_goodHouses pushBack _x; _gdHss pushBack _x;
}; };
}; };
} forEach _houses; } forEach (nearestTerrainObjects [_this0,["House"],_this5]);
_goodHouses = _goodHouses call BIS_fnc_arrayShuffle;
_noHouses = false; _gdHss = _gdHss call BIS_fnc_arrayShuffle;
if (count _goodHouses < _grpCount) then _nHss = false;
if (count _gdHss < _this1) then
{ {
_noHouses = true; _nHss = true;
}; };
_cal50s = [["DynamicLocationInvasion"],["cal50s"]] call VEMFr_fnc_getSetting param [0, 3, [0]];
if (_cal50s > 0) then _cl50s = ([["DynamicLocationInvasion"],["cal50s"]] call VEMFr_fnc_config) select 0;
_nts = []; // Define units array. the for loops below will fill it with units
for "_g" from 1 to _this1 do // Spawn Groups near Position
{ {
_cal50sVehs = []; if not _nHss then
};
_units = []; // Define units array. the for loops below will fill it with units
for "_g" from 1 to _grpCount do // Spawn Groups near Position
{
if not _noHouses then
{ {
if (count _goodHouses < 1) then if (count _gdHss < 1) then
{ {
_noHouses = true _nHss = true
}; };
}; };
private ["_groupSide"];
_groupSide = ("unitClass" call VEMFr_fnc_getSetting) call VEMFr_fnc_checkSide; private ["_grp","_hs","_hsPstns","_plcd50","_i"];
if not isNil "_groupSide" then _grp = createGroup (("unitClass" call VEMFr_fnc_config) call VEMFr_fnc_checkSide);
(_r select 0) pushBack _grp;
_grp allowFleeing 0;
if not _nHss then
{ {
private ["_grp"]; _hs = selectRandom _gdHss;
_grp = createGroup _groupSide; _hsID = _gdHss find _hs;
(_spawned select 0) pushBack _grp; _gdHss deleteAt _hsID;
_grp allowFleeing 0; _hsPstns = [_hs] call BIS_fnc_buildingPositions;
private ["_house","_housePositions"]; };
if not _noHouses then
_plcd50 = false;
for "_u" from 1 to _this2 do
{
private ["_spwnPs","_hmg","_nt"];
if _nHss then
{ {
_house = selectRandom _goodHouses; _spwnPs = [_this0,20,_this5,1,0,200,0] call BIS_fnc_findSafePos; // Find Nearby Position
_houseID = _goodHouses find _house; } else
_goodHouses deleteAt _houseID;
_housePositions = [_house] call BIS_fnc_buildingPositions;
};
private ["_placed50"];
_placed50 = false;
for "_u" from 1 to _unitsPerGrp do
{ {
private ["_spawnPos","_hmg"]; _spwnPs = selectRandom _hsPstns;
if _noHouses then if not _plcd50 then
{ {
_spawnPos = [_pos,20,_maxRange,1,0,200,0] call BIS_fnc_findSafePos; // Find Nearby Position _plcd50 = true;
} else if (_cl50s > 0) then
{
_spawnPos = selectRandom _housePositions;
if not _placed50 then
{ {
_placed50 = true; _hmg = createVehicle ["O_HMG_01_high_F", _spwnPs, [], 0, "CAN_COLLIDE"];
if (_cal50s > 0) then _hmg setVehicleLock "LOCKEDPLAYER";
{ (_r select 1) pushBack _hmg;
_hmg = createVehicle ["O_HMG_01_high_F", _spawnPos, [], 0, "CAN_COLLIDE"];
_hmg setVehicleLock "LOCKEDPLAYER";
(_spawned select 1) pushBack _hmg;
};
}; };
}; };
private ["_unit"];
_unit = _grp createUnit [_sldrClass, _spawnPos, [], 0, "CAN_COLLIDE"]; // Create Unit There
if not _noHouses then
{
//doStop _unit;
if (_cal50s > 0) then
{
if not isNil "_hmg" then
{
if not isNull _hmg then
{
_unit moveInGunner _hmg;
_hmg = nil;
_cal50s = _cal50s - 1;
};
};
};
private ["_houseIndex"];
_houseIndex = _housePositions find _spawnPos;
_housePositions deleteAt _houseIndex;
};
_unit addMPEventHandler ["mpkilled","if (isDedicated) then { [_this select 0, _this select 1] ExecVM 'exile_vemf_reloaded\sqf\aiKilled.sqf' }"];
// Set skills
_unit setSkill ["aimingAccuracy", _accuracy];
_unit setSkill ["aimingShake", _aimShake];
_unit setSkill ["aimingSpeed", _aimSpeed];
_unit setSkill ["endurance", _stamina];
_unit setSkill ["spotDistance", _spotDist];
_unit setSkill ["spotTime", _spotTime];
_unit setSkill ["courage", _courage];
_unit setSkill ["reloadSpeed", _reloadSpd];
_unit setSkill ["commanding", _commanding];
_unit setSkill ["general", _general];
_unit enableAI "TARGET";
_unit enableAI "AUTOTARGET";
_unit enableAI "MOVE";
_unit enableAI "ANIM";
_unit enableAI "TEAMSWITCH";
_unit enableAI "FSM";
_unit enableAI "AIMINGERROR";
_unit enableAI "SUPPRESSION";
_unit enableAI "CHECKVISIBLE";
_unit enableAI "COVER";
_unit enableAI "AUTOCOMBAT";
_unit enableAI "PATH";
}; };
private ["_invLoaded"];
_invLoaded = [units _grp, _missionName, _mode] call VEMFr_fnc_loadInv; // Load the AI's inventory _nt = _grp createUnit [("unitClass" call VEMFr_fnc_config), _spwnPs, [], 0, "CAN_COLLIDE"]; // Create Unit There
if not _invLoaded then if ((not _nHss) AND (_cl50s > 0)) then
{ {
["fn_spawnInvasionAI", 0, "failed to load AI's inventory..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; if not(isNil "_hmg") then
{
if not(isNull _hmg) then
{
_nt moveInGunner _hmg;
_hmg = nil;
_cl50s = _cl50s - 1;
};
};
_hsPstns deleteAt (_hsPstns find _spwnPs);
}; };
_groups pushBack _grp; // Push it into the _groups array
_nt addMPEventHandler ["mpkilled","if (isDedicated) then { [[(_this select 0),(name(_this select 0))],[(_this select 1),(name(_this select 1))]] ExecVM 'exile_vemf_reloaded\sqf\aiKilled.sqf' }"];
// 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 enableAI "TARGET";
_nt enableAI "AUTOTARGET";
_nt enableAI "MOVE";
_nt enableAI "ANIM";
_nt enableAI "TEAMSWITCH";
_nt enableAI "FSM";
_nt enableAI "AIMINGERROR";
_nt enableAI "SUPPRESSION";
_nt enableAI "CHECKVISIBLE";
_nt enableAI "COVER";
_nt enableAI "AUTOCOMBAT";
_nt enableAI "PATH";
}; };
_i = [units _grp, _this4, _this3] call VEMFr_fnc_loadInv; // Load the AI's inventory
if isNil "_i" then
{
["fn_spawnInvasionAI", 0, "failed to load AI's inventory..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
_grps pushBack _grp; // Push it into the _grps array
}; };
if (count _groups isEqualTo _grpCount) then if (((count _grps) isEqualTo _this1) AND _nHss) then
{ {
if _noHouses then private ["_wypnts","_wp","_cyc"];
{ _wypnts =
private ["_waypoints"]; [
_waypoints = [ [(_this0 select 0), (_this0 select 1)+50, 0],
[(_pos select 0), (_pos select 1)+50, 0], [(_this0 select 0)+50, (_this0 select 1), 0],
[(_pos select 0)+50, (_pos select 1), 0], [(_this0 select 0), (_this0 select 1)-50, 0],
[(_pos select 0), (_pos select 1)-50, 0], [(_this0 select 0)-50, (_this0 select 1), 0]
[(_pos select 0)-50, (_pos select 1), 0] ];
]; { // Make them Patrol
{ // Make them Patrol for "_z" from 1 to (count _wypnts) do
for "_z" from 1 to (count _waypoints) do {
{ _wp = _x addWaypoint [(_wypnts select (_z-1)), 10];
private ["_wp"]; _wp setWaypointType "SAD";
_wp = _x addWaypoint [(_waypoints select (_z-1)), 10]; _wp setWaypointCompletionRadius 20;
_wp setWaypointType "SAD"; };
_wp setWaypointCompletionRadius 20; _cyc = _x addWaypoint [_this0,10];
}; _cyc setWaypointType "CYCLE";
private ["_cyc"]; _cyc setWaypointCompletionRadius 20;
_cyc = _x addWaypoint [_pos,10]; } forEach _grps;
_cyc setWaypointType "CYCLE";
_cyc setWaypointCompletionRadius 20;
} forEach _groups;
};
}; };
} else } else
{ {
["spawnInvasionAI", 0, format["params are not valid! [%1,%2,%3,%4]", count _pos isEqualTo 3, _grpCount > 0, _unitsPerGrp > 0, _missionName in ("missionList" call VEMFr_fnc_getSetting)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["fn_spawnInvasionAI",0,format["'%1' is not in missionList", _this4]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
_spawned _r

View File

@ -2,7 +2,7 @@
Author: original by Vampire, completely rewritten by IT07 Author: original by Vampire, completely rewritten by IT07
Description: Description:
spawns VEMFr AI using given _pos and unit/group count. Handles their inventory and transfers them to a client spawns VEMFr AI using given _this0 and unit/group count. Handles their inventory and transfers them to a client
Params: Params:
_this select 0: POSITION - where to spawn the units around _this select 0: POSITION - where to spawn the units around
@ -17,82 +17,76 @@
ARRAY with group(s) ARRAY with group(s)
*/ */
private ["_spawned","_allUnits","_pos","_grpCount","_unitsPerGrp","_mode","_missionName"]; private ["_r","_allUnits","_this0","_this1","_this2","_this3","_this4"];
_spawned = [];
_allUnits = []; _allUnits = [];
params [["_pos",[],[[]]], ["_grpCount",1,[0]], ["_unitsPerGrp",1,[0]], ["_mode",-1,[0]], ["_missionName","",[""]], ["_altitude",0,[0]], ["_spawnRadius",20,[0]]]; params [
if ((_pos isEqualTypeArray [0,0,0]) AND (_grpCount > 0) AND (_unitsPerGrp > 0) AND ((_missionName in ("missionList" call VEMFr_fnc_getSetting)) OR (_missionName isEqualTo "Static"))) then ["_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
{ {
scopeName "outer"; scopeName "outer";
_pos = [_pos select 0, _pos select 1, _altitude]; _r = [];
private [ _this0 = [_this0 select 0, _this0 select 1, _this5];
"_sldrClass","_hc","_aiDifficulty","_skills","_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime","_courage","_reloadSpd","_commanding","_general","_units" private ["_s","_ccrcy","_mshk","_mspd","_stmn","_sptDst","_sptTm","_crg","_rldSpd","_cmmndng","_gnrl","_i"];
];
_sldrClass = "unitClass" call VEMFr_fnc_getSetting;
_hc = "headLessClientSupport" call VEMFr_fnc_getSetting;
_aiDifficulty = [["aiSkill"],["difficulty"]] call VEMFr_fnc_getSetting param [0, "Veteran", [""]];
_skills = [["aiSkill", _aiDifficulty],["accuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]] call VEMFr_fnc_getSetting;
_skills params ["_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime","_courage","_reloadSpd","_commanding","_general"];
_units = []; // Define units array. the for loops below will fill it with units
for "_g" from 1 to _grpCount do // Spawn Groups near Position
{
private ["_groupSide"];
_groupSide = ("unitClass" call VEMFr_fnc_getSetting) call VEMFr_fnc_checkSide;
if not isNil "_groupSide" then
{
private["_grp"];
_grp = createGroup _groupSide;
_grp allowFleeing 0;
for "_u" from 1 to _unitsPerGrp do
{
private ["_unit"];
_unit = _grp createUnit [_sldrClass, _pos, [], _spawnRadius, "FORM"]; // Create Unit There
_allUnits pushBack _unit;
_unit addMPEventHandler ["mpkilled","if (isDedicated) then { [_this select 0, _this select 1] ExecVM 'exile_vemf_reloaded\sqf\aiKilled.sqf' }"];
// Set skills
_unit setSkill ["aimingAccuracy", _accuracy];
_unit setSkill ["aimingShake", _aimShake];
_unit setSkill ["aimingSpeed", _aimSpeed];
_unit setSkill ["endurance", _stamina];
_unit setSkill ["spotDistance", _spotDist];
_unit setSkill ["spotTime", _spotTime];
_unit setSkill ["courage", _courage];
_unit setSkill ["reloadSpeed", _reloadSpd];
_unit setSkill ["commanding", _commanding];
_unit setSkill ["general", _general];
_unit enableAI "TARGET"; _s = [["aiSkill", ([["aiSkill"],["difficulty"]] call VEMFr_fnc_config) select 0],["accuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]] call VEMFr_fnc_config;
_unit enableAI "AUTOTARGET"; _s params ["_ccrcy","_mshk","_mspd","_stmn","_sptDst","_sptTm","_crg","_rldSpd","_cmmndng","_gnrl"];
_unit enableAI "MOVE"; for "_g" from 1 to _this1 do
_unit enableAI "ANIM"; {
_unit enableAI "TEAMSWITCH"; private["_grp"];
_unit enableAI "FSM"; _grp = createGroup (("unitClass" call VEMFr_fnc_config) call VEMFr_fnc_checkSide);
_unit enableAI "AIMINGERROR"; _grp allowFleeing 0;
_unit enableAI "SUPPRESSION"; for "_u" from 1 to _this2 do
_unit enableAI "CHECKVISIBLE";
_unit enableAI "COVER";
_unit enableAI "AUTOCOMBAT";
_unit enableAI "PATH";
};
_spawned pushBack _grp;
} else
{ {
["fn_spawnVEMFrAI", 0, "failed to retrieve _groupSide"] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; private ["_unit"];
breakOut "outer"; _unit = _grp createUnit [("unitClass" call VEMFr_fnc_config), _this0, [], _this6, "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 'exile_vemf_reloaded\sqf\aiKilled.sqf' }"];
// 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 enableAI "TARGET";
_unit enableAI "AUTOTARGET";
_unit enableAI "MOVE";
_unit enableAI "ANIM";
_unit enableAI "TEAMSWITCH";
_unit enableAI "FSM";
_unit enableAI "AIMINGERROR";
_unit enableAI "SUPPRESSION";
_unit enableAI "CHECKVISIBLE";
_unit enableAI "COVER";
_unit enableAI "AUTOCOMBAT";
_unit enableAI "PATH";
}; };
_r pushBack _grp;
}; };
private ["_invLoaded"]; _i = [_allUnits, _this4, _this3] call VEMFr_fnc_loadInv; // Load the AI's inventory
_invLoaded = [_allUnits, _missionName, _mode] call VEMFr_fnc_loadInv; // Load the AI's inventory if (isNil "_i") then
if not _invLoaded then {
{ _r = nil;
_spawned = false; ["fn_spawnVEMFrAI", 0, "failed to load AI's inventory..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
["fn_spawnVEMFrAI", 0, "failed to load AI's inventory..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; breakOut "outer";
breakOut "outer"; };
};
} else } else
{ {
["spawnVEMFrAI", 0, format["params are not valid! [%1,%2,%3,%4]", (_pos isEqualTypeArray [0,0,0]), (_grpCount > 0), (_unitsPerGrp > 0), (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static")]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["fn_spawnVEMFrAI", 0, format["'%1' is not in missionList or is not equal to 'Static'", _this4]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
_spawned _r

View File

@ -12,31 +12,25 @@
BOOL - true if there is a player present BOOL - true if there is a player present
*/ */
private ["_playerNear","_pos","_rad"]; private ["_r","_this0","_this1"];
_playerNear = false; params [
params [["_pos",[],[[]]], ["_rad",-1,[0]]]; ["_this0", [], [[]]],
if (((count _pos) isEqualTo 3) AND (_rad > -1)) then ["_this1", -1, [0]]
];
_r = false;
if ([_this0, _this1] call VEMFr_fnc_playerNear) then
{ {
private ["_time","_timeOutTime","_pp"]; _r = true;
_time = round time;
// Define _settings
_timeOutTime = ("timeOutTime" call VEMFr_fnc_getSetting)*60;
// _pp = playerPresence
_pp = [_pos, _rad] call VEMFr_fnc_checkPlayerPresence;
if _pp then
{
_playerNear = true;
} else
{
waitUntil { if (([_pos, _rad] call VEMFr_fnc_checkPlayerPresence) OR (round time - _time > _timeOutTime)) then {true} else {uiSleep 4; false} };
if ([_pos, _rad] call VEMFr_fnc_checkPlayerPresence) then
{
_playerNear = true;
};
};
} else } else
{ {
["waitForPlayers",0,format["params are invalid! [%1,%2]", ((count _pos) isEqualTo 3), (_rad > -1)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; 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;
};
}; };
_r
_playerNear

View File

@ -6,55 +6,54 @@
*/ */
VEMFrMissionCount = VEMFrMissionCount + 1; VEMFrMissionCount = VEMFrMissionCount + 1;
_missionName = param [0, "", [""]]; _mn = param [0, "", [""]];
if isNil "VEMFrAttackCount" then { VEMFrAttackCount = 0 }; if (isNil "VEMFrAttackCount") then { VEMFrAttackCount = 0 };
VEMFrAttackCount = VEMFrAttackCount + 1; VEMFrAttackCount = VEMFrAttackCount + 1;
_settings = [[_missionName],["maxAttacks","aiSetup","minimumLevel"]] call VEMFr_fnc_getSetting; _s = [[_mn],["maxAttacks","aiSetup","minimumLevel"]] call VEMFr_fnc_config;
_settings params ["_maxAttacks","_aiSetup","_minimumLevel"]; _s params ["_s0","_s1","_s2"];
if (VEMFrAttackCount <= _maxAttacks) then if (VEMFrAttackCount <= _s0) then
{ {
scopeName "outer"; scopeName "outer";
if (_missionName in ("missionList" call VEMFr_fnc_getSetting)) then if (_mn in ("missionList" call VEMFr_fnc_config)) then
{ {
if (((_aiSetup select 0) > 0) AND ((_aiSetup select 1) > 0)) then if (((_s1 select 0) > 0) AND ((_s1 select 1) > 0)) then
{ {
_attackedFlags = uiNamespace getVariable ["VEMFrAttackedFlags",[]]; _hst = uiNamespace getVariable ["VEMFrAttackedFlags",[]];
_flags = []; _objs = [];
{ {
if (((speed _x) < 25) AND ((vehicle _x) isEqualTo _x)) then if (((speed _x) < 25) AND ((vehicle _x) isEqualTo _x)) then
{ {
_flagsObjs = nearestObjects [position _x, ["Exile_Construction_Flag_Static"], 150];
{ {
if (not(_x in _attackedFlags) AND ((_x getVariable ["ExileTerritoryLevel",0]) > _minimumLevel)) then { _flags pushBack _x }; if (not(_x in _hst) AND ((_x getVariable ["ExileTerritoryLevel",0]) > _s2)) then { _objs pushBack _x };
} forEach _flagsObjs; } forEach (nearestObjects [position _x, ["Exile_Construction_Flag_Static"], 150]);
}; };
} forEach allPlayers; } forEach allPlayers;
if (count _flags > 0) then if (count _objs > 0) then
{ {
_flagToAttack = selectRandom _flags; _flg = selectRandom _objs;
_attackedFlags pushBack _flagToAttack; _hst pushBack _flg;
_flagPos = position _flagToAttack; _pos = position _flg;
_nearestPlayer = selectRandom (nearestObjects [_flagPos, ["Exile_Unit_Player"], 150]); _nrPlyr = selectRandom (nearestObjects [_pos, ["Exile_Unit_Player"], 150]);
if not isNil "_nearestPlayer" then if not(isNil "_nrPlyr") then
{ {
_flagName = _flagToAttack getVariable ["exileterritoryname", "ERROR: UNKNOWN NAME"]; _flgNm = _flg getVariable ["exileterritoryname", "ERROR: UNKNOWN NAME"];
_paraGroups = [_flagPos, _aiSetup select 0, _aiSetup select 1, ([[_missionName],["aiMode"]] call VEMFr_fnc_getSetting select 0), _missionName, 1000 + (random 1000), 150] call VEMFr_fnc_spawnVEMFrAI; _prGrps = [_pos, _s1 select 0, _s1 select 1, ([[_mn],["aiMode"]] call VEMFr_fnc_config select 0), _mn, 1000 + (random 1000), 150] call VEMFr_fnc_spawnVEMFrAI;
if (count _paraGroups isEqualTo (_aiSetup select 0)) then if not(isNil "_prGrps") then
{ {
_unitCount = 0; _ntCnt = 0;
{ {
if (count (units _x) isEqualTo (_aiSetup select 1)) then if (count (units _x) isEqualTo (_s1 select 1)) then
{ {
_unitCount = _unitCount + (count(units _x)); _ntCnt = _ntCnt + (count(units _x));
}; };
} forEach _paraGroups; } forEach _prGrps;
if (_unitCount isEqualTo ((_aiSetup select 0) * (_aiSetup select 1))) then if (_ntCnt isEqualTo ((_s1 select 0) * (_s1 select 1))) then
{ {
_wayPoints = []; _wyPnts = [];
_units = []; _nts = [];
{ {
_wp = _x addWaypoint [_flagPos, 50, 1]; _wp = _x addWaypoint [_pos, 50, 1];
_wp setWaypointBehaviour "COMBAT"; _wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED"; _wp setWaypointCombatMode "RED";
_wp setWaypointCompletionRadius 10; _wp setWaypointCompletionRadius 10;
@ -62,27 +61,27 @@ if (VEMFrAttackCount <= _maxAttacks) then
_wp setWaypointSpeed "FULL"; _wp setWaypointSpeed "FULL";
_wp setWaypointType "SAD"; _wp setWaypointType "SAD";
_x setCurrentWaypoint _wp; _x setCurrentWaypoint _wp;
_wayPoints pushback _wp; _wyPnts pushback _wp;
{ {
_units pushback _x; _nts pushback _x;
} forEach (units _x); } forEach (units _x);
[_x] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf"; [_x] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
} forEach _paraGroups; } forEach _prGrps;
_players = nearestObjects [_flagPos, ["Exile_Unit_Player"], 275]; _plyrs = nearestObjects [_pos, ["Exile_Unit_Player"], 275];
[-1, "NEW BASE ATTACK", format["A para team is on the way to %1 @ %2's location!", _flagName, name _nearestPlayer], _players] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf"; [-1, "NEW BASE ATTACK", format["A para team is on the way to %1 @ %2's location!", _flgNm, name _nrPlyr], _plyrs] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
[-1, "BaseAttack", format["A para team is on the way to %1 @ %2's location!", _flagName, name _nearestPlayer]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["BaseAttack", 1, format["A para team is on the way to %1 @ %2's location!", _flgNm, name _nrPlyr]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
while {true} do while {true} do
{ {
scopeName "loop"; scopeName "loop";
_deadCount = 0; _ddCnt = 0;
{ {
if (damage _x isEqualTo 1 OR isNull _x) then if (damage _x isEqualTo 1 OR isNull _x) then
{ {
_deadCount = _deadCount + 1; _ddCnt = _ddCnt + 1;
}; };
} forEach _units; } forEach _nts;
if (_deadCount isEqualTo _unitCount) then if (_ddCnt isEqualTo _ntCnt) then
{ {
breakOut "loop"; breakOut "loop";
} else } else
@ -90,8 +89,8 @@ if (VEMFrAttackCount <= _maxAttacks) then
uiSleep 4; uiSleep 4;
}; };
}; };
_players = nearestObjects [_flagPos, ["Exile_Unit_Player"], 275]; _plyrs = nearestObjects [_pos, ["Exile_Unit_Player"], 275];
[-1, "DEFEATED", format["Base attack on %1 has been defeated!", _flagname], _players] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf"; [-1, "DEFEATED", format["Base attack on %1 has been defeated!", _flgNm], _plyrs] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
breakOut "outer"; breakOut "outer";
} else } else
{ {
@ -99,26 +98,18 @@ if (VEMFrAttackCount <= _maxAttacks) then
{ {
deleteVehicle _x; deleteVehicle _x;
} forEach (units _x); } forEach (units _x);
} forEach _paraGroups; } forEach _prGrps;
["BaseAttack", 0, format["Incorrect amount of total units (%1). Should be %2", _unitCount, (_aiSetup select 0) * (_aiSetup select 1)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["BaseAttack", 0, format["Incorrect amount of total units (%1). Should be %2", _ntCnt, (_s1 select 0) * (_s1 select 1)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer"; breakOut "outer";
}; };
} else } else
{ {
["BaseAttack", 0, format["Incorrect spawned group count (%1). Should be %2", count _paraGroups, _aiSetup select 0]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["BaseAttack", 0, format["Incorrect spawned group count (%1). Should be %2", count _prGrps, _s1 select 0]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer"; breakOut "outer";
}; };
} else } else
{ {
_index = _attackedFlags find _flagToAttack; _hst deleteAt (_hst find _flg);
if (_index > -1) then
{
_attackedFlags deleteAt _index;
["BaseAttack", 1, "Flag deleted from attackedFlag array"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
} else
{
["BaseAttack", 0, "Unable to locate and remove attacked flag!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
["BaseAttack", 0, "Can not find player near flag!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["BaseAttack", 0, "Can not find player near flag!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer"; breakOut "outer";
}; };
@ -128,13 +119,12 @@ if (VEMFrAttackCount <= _maxAttacks) then
}; };
} else } else
{ {
["BaseAttack", 0, format["invalid aiSetup setting! (%1)", _aiSetup]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["BaseAttack", 0, format["invalid aiSetup setting! (%1)", _s1]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer"; breakOut "outer";
}; };
} else } else
{ {
["BaseAttack", 0, format["Failed to start mission. Given _missionName (%1) is not in active missionList", _missionName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["BaseAttack", 0, format["Failed to start mission. Given _mn (%1) is not in active missionList", _mn]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer";
}; };
}; };
VEMFrAttackCount = VEMFrAttackCount - 1; VEMFrAttackCount = VEMFrAttackCount - 1;

View File

@ -5,119 +5,117 @@
VEMFrMissionCount = VEMFrMissionCount + 1; VEMFrMissionCount = VEMFrMissionCount + 1;
if isNil "VEMFrInvasionCount" then { VEMFrInvasionCount = 0; }; if isNil "VEMFrInvasionCount" then { VEMFrInvasionCount = 0; };
VEMFrInvasionCount = VEMFrInvasionCount + 1; VEMFrInvasionCount = VEMFrInvasionCount + 1;
_missionName = param [0, "", [""]]; _this0 = param [0, "", [""]];
if (VEMFrInvasionCount <= (([[_missionName],["maxInvasions"]] call VEMFr_fnc_getSetting) select 0)) then if (VEMFrInvasionCount <= (([[_this0],["maxInvasions"]] call VEMFr_fnc_config) select 0)) then
{ {
scopeName "outer"; scopeName "outer";
private ["_hasPlayers","_spawned","_grpArr","_unitArr","_done","_boxes","_box","_chute","_colors","_lightType","_light","_smoke"]; // Define the settings
// Define _settings _ms = [
_settings = [[_missionName],["groupCount","groupUnits","maxDistance","maxDistancePrefered","skipDistance","marker","parachuteCrate","markCrateVisual","markCrateOnMap","announce","streetLights","streetLightsRestore","streetLightsRange","allowCrateLift"]] call VEMFr_fnc_getSetting; [_this0],
_settings params ["_grpCount","_groupUnits","_range","_maxPref","_skipDistance","_useMissionMarker","","_markCrateVisual","_markCrateOnMap","_announce","_streetLights","_streetLightsRestore","_streetLightsRange","_allowCrateLift"]; ["groupCount","groupUnits","maxDistancePrefered","skipDistance","useMarker","markCrateVisual","markCrateOnMap","announce","streetLights","streetLightsRestore","streetLightsRange","allowCrateLift","allowRepeat","randomModes","spawnCrateFirst","mines","flairTypes","smokeTypes","minesCleanup"]
(_settings select 6) params ["_useChute","_crateAltitude"]; ] call VEMFr_fnc_config;
_ms params [
"_ms0","_ms1","_ms2","_ms3","_ms4","_ms5","_ms6","_ms7","_ms8","_ms9","_ms10","_ms11","_ms12","_ms13","_ms14","_ms15","_ms16","_ms17","_ms18"
];
_loc = ["loc", false, position (selectRandom allPlayers), _skipDistance, _maxPref, _skipDistance, _missionName] call VEMFr_fnc_findPos; ([[_this0,"crateParachute"],["enabled","altitude"]] call VEMFr_fnc_config) params ["_cp0","_cp1"];
if (_loc isEqualType locationNull) then
_l = ["loc", false, position (selectRandom allPlayers), _ms3, _ms2, _ms3, _this0] call VEMFr_fnc_findPos;
if (_l isEqualType locationNull) then
{ {
_locName = text _loc; _ln = text _l;
_locPos = position _loc; _lp = position _l;
if (_locName isEqualTo "") then { _locName = "Area"; }; if (_ln isEqualTo "") then { _ln = "Area"; };
[_missionName, 1, format["Invading %1...", _locName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; [_this0, 1, format["Invading %1...", _ln]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
// Send message to all players
private ["_mode"]; _m = "aiMode" call VEMFr_fnc_config;
_mode = "aiMode" call VEMFr_fnc_getSetting; if (_ms13 isEqualTo 1) then { _m = selectRandom [0,1,2] };
_randomModes = ([[_missionName],["randomModes"]] call VEMFr_fnc_getSetting) select 0; if (_ms7 isEqualTo 1) then
if (_randomModes isEqualTo 1) then
{ {
_mode = selectRandom [0,1,2]; if (_m isEqualTo 0) then
};
if (_announce isEqualTo 1) then
{
if (_mode isEqualTo 0) then
{ {
[_mode, "NEW INVASION", format["Raiders have invaded %1 @ %2", _locName, mapGridPosition _locPos]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf"; [_m, "NEW INVASION", format["Raiders have invaded %1 @ %2", _ln, mapGridPosition _lp]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
}; };
if (_mode isEqualTo 1) then if (_m isEqualTo 1) then
{ {
[_mode, "NEW POLICE RAID", format["%1 Police forces are now controlling %2 @ %3", worldName, _locName, mapGridPosition _locPos]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf"; [_m, "NEW POLICE RAID", format["%1 Police forces are now controlling %2 @ %3", worldName, _ln, mapGridPosition _lp]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
}; };
if (_mode isEqualTo 2) then if (_m isEqualTo 2) then
{ {
[_mode, "NEW S.W.A.T. RAID", format["%1 S.W.A.T. teams are now raiding %2 @ %3", worldName, _locName, mapGridPosition _locPos]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf"; [_m, "NEW S.W.A.T. RAID", format["%1 S.W.A.T. teams are now raiding %2 @ %3", worldName, _ln, mapGridPosition _lp]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
}; };
}; };
private ["_marker"];
if (_useMissionMarker isEqualTo 1) then private ["_mrkr"];
if (_ms4 isEqualTo 1) then
{ // Create/place the marker if enabled { // Create/place the marker if enabled
_marker = createMarker [format["VEMFr_DynaLocInva_ID%1", random 9000], _locPos]; _mrkr = createMarker [format["VEMFr_DynaLocInva_ID%1", random 9000], _lp];
_marker setMarkerShape "ICON"; _mrkr setMarkerShape "ICON";
_marker setMarkerType "o_unknown"; _mrkr setMarkerType "o_unknown";
if (_mode < 0 OR _mode > 2) then if (_m < 0 OR _m > 2) then
{ {
["DynamicLocationInvasion", 0, format["Invalid aiMode (%1) detected, failed to setMarkerColor!", _aiMode]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["DynamicLocationInvasion", 0, format["Invalid aiMode (%1) detected, failed to setMarkerColor!", _aiMode]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer"; breakOut "outer";
}; };
if (_mode isEqualTo 0) then if (_m isEqualTo 0) then
{ {
_marker setMarkerColor "ColorEAST"; _mrkr setMarkerColor "ColorEAST";
}; };
if (_mode isEqualTo 1) then if (_m isEqualTo 1) then
{ {
_marker setMarkerColor "ColorWEST"; _mrkr setMarkerColor "ColorWEST";
}; };
if (_mode isEqualTo 2) then if (_m isEqualTo 2) then
{ {
_marker setMarkerColor "ColorBlack"; _mrkr setMarkerColor "ColorBlack";
}; };
}; };
// If enabled, kill all the lights // If enabled, kill all the lights
if (_streetLights isEqualTo 0) then if (_ms8 isEqualTo 0) then
{ {
private ["_all"];
_all = nearestObjects [_locPos, ["Lamps_Base_F","PowerLines_base_F","Land_PowerPoleWooden_L_F"], _streetLightsRange];
{ {
if (damage _x < 0.95) then if (damage _x < 0.95) then
{ {
_x setDamage 0.95; _x setDamage 0.95;
uiSleep 0.1; uiSleep 0.1;
}; };
} forEach _all; } forEach (nearestObjects [_lp, ["Lamps_Base_F","PowerLines_base_F","Land_PowerPoleWooden_L_F"], _ms10]);
}; };
private ["_crate"]; private ["_crate"];
_doSpawnCrate = { _dSpwnCrt = {
// Choose a box // Choose a box
_boxes = [[_missionName],["crateTypes"]] call VEMFr_fnc_getSetting; _bx = selectRandom (([[_this0],["crateTypes"]] call VEMFr_fnc_config) select 0);
_box = selectRandom (_boxes select 0); _ps = [_lp, 0, 200, 0, 0, 300, 0] call bis_fnc_findSafePos;
_pos = [_locPos, 0, 200, 0, 0, 300, 0] call bis_fnc_findSafePos; if (_cp0 > 0) then
if (_useChute isEqualTo 1) then
{ {
_chute = createVehicle ["I_Parachute_02_F", _pos, [], 0, "FLY"]; _cht = createVehicle ["I_Parachute_02_F", _ps, [], 0, "FLY"];
_chute setPos [getPos _chute select 0, getPos _chute select 1, _crateAltitude]; _cht setPos [getPos _cht select 0, getPos _cht select 1, _cp1];
_chute enableSimulationGlobal true; _cht enableSimulationGlobal true;
if not isNull _chute then if not(isNull _cht) then
{ {
_crate = createVehicle [_box, getPos _chute, [], 0, "NONE"]; _crate = createVehicle [_bx, getPos _cht, [], 0, "NONE"];
_crate allowDamage false; _crate allowDamage false;
_crate enableSimulationGlobal true; _crate enableSimulationGlobal true;
_crate attachTo [_chute, [0,0,0]]; _crate attachTo [_cht, [0,0,0]];
[_missionName, 1, format ["Crate parachuted at: %1 / Grid: %2", (getPosATL _crate), mapGridPosition (getPosATL _crate)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; [_this0, 1, format ["Crate parachuted at: %1 / Grid: %2", (getPosATL _crate), mapGridPosition (getPosATL _crate)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
[_crate, _locName, _locPos] ExecVM "exile_vemf_reloaded\sqf\loadLoot.sqf"; [_crate, _ln, _lp] ExecVM "exile_vemf_reloaded\sqf\loadLoot.sqf";
waitUntil { if (((getPos _crate) select 2) < 7) then {true} else {uiSleep 1; false} }; waitUntil { if (((getPos _crate) select 2) < 7) then {true} else {uiSleep 1; false} };
detach _crate; detach _crate;
} else } else
{ {
[_missionName, 0, "Where is the chute??"] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; [_this0, 0, "Where is the chute??"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
}; } else
if (_useChute isEqualTo 0) then
{ {
_crate = createVehicle [_box, _pos, [], 0, "NONE"]; _crate = createVehicle [_bx, _ps, [], 0, "NONE"];
_crate allowDamage false; _crate allowDamage false;
[_crate, _locName, _locPos] ExecVM "exile_vemf_reloaded\sqf\loadLoot.sqf"; [_crate, _ln, _lp] ExecVM "exile_vemf_reloaded\sqf\loadLoot.sqf";
}; };
if (_allowCrateLift isEqualTo 0) then
if (_ms11 > 0) then
{ {
_crate enableRopeAttach false; _crate enableRopeAttach false;
} else } else
@ -126,308 +124,258 @@ if (VEMFrInvasionCount <= (([[_missionName],["maxInvasions"]] call VEMFr_fnc_get
}; };
}; };
// Usage: POSITION, Radius if ([_lp, 800] call VEMFr_fnc_waitForPlayers) then
_playerNear = [_locPos, 800] call VEMFr_fnc_waitForPlayers; {
if _playerNear then _spwnd = [_lp, ((_ms0 select 0) + round random ((_ms0 select 1) - (_ms0 select 0))), ((_ms1 select 0) + round random ((_ms1 select 1) - (_ms1 select 0))), _m, _this0, 200] call VEMFr_fnc_spawnInvasionAI;
{ // Player is Near, so Spawn the Units _nts = [];
_spawned = [_locPos, ((_grpCount select 0) + round random ((_grpCount select 1) - (_grpCount select 0))), ((_groupUnits select 0) + round random ((_groupUnits select 1) - (_groupUnits select 0))), _mode, _missionName, 200] call VEMFr_fnc_spawnInvasionAI;
if (_spawned isEqualType []) then
{ {
if (_spawned isEqualTypeArray [[],[]]) then [_x] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
{ {
private ["_units","_groups","_cal50s"]; _nts pushBack _x;
_units = []; } forEach (units _x);
_groups = _spawned select 0; } forEach (_spwnd select 0);
{
[_x] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
{
_units pushBack _x;
} forEach (units _x);
} forEach _groups;
_cal50s = _spawned select 1;
private ["_heliUnits"]; _cl50s = _spwnd select 1;
_heliPatrolSettings = ([[_missionName],["heliPatrol"]] call VEMFr_fnc_getSetting) select 0;
if (_heliPatrolSettings select 0 isEqualTo 1) then ([[_this0,"heliPatrol"],["enabled","classes","locked"]] call VEMFr_fnc_config) params ["_hp0","_hp1","_hp2"];
{ // If heliPatrol setting is enabled if (_hp0 > 0) then
[_missionName, 1, format["Adding a heli patrol to the invasion of %1 at %2", _locName, mapGridPosition _locPos]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; {
_classToSpawn = selectRandom (_heliPatrolSettings select 1); [_this0, 1, format["Adding a heli patrol to the invasion of %1 at %2", _ln, mapGridPosition _lp]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
if (_classToSpawn isKindOf "Air") then _heli = createVehicle [(selectRandom _hp1), _lp, [], 5, "FLY"];
_heli setPosATL [(getPos _heli) select 0, (getPos _heli) select 1, 750];
_heli flyInHeight 80;
if (_hp2 isEqualTo 1) then
{ {
_heli = createVehicle [_classToSpawn, _locPos, [], 5, "FLY"]; _heli lock true;
_heli setPosATL [(getPos _heli) select 0, (getPos _heli) select 1, 750]; };
_heli flyInHeight 80;
if ([["DynamicLocationInvasion"],["heliLocked"]] call VEMFr_fnc_getSetting select 0 isEqualTo 1) then _trrts = allTurrets [_heli, false];
_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
{ {
_heli lock true; _x moveInDriver _heli;
}; } else
_turrets = allTurrets [_heli, false];
_spawnHeliGroup = [_locPos, 1, ((count _turrets) + (_heli emptyPositions "commander") + 1), _mode, _missionName] call VEMFr_fnc_spawnVEMFrAI;
if (_spawnHeliGroup isEqualType []) then
{ {
_heliGroup = _spawnHeliGroup select 0; private ["_path"];
_heliUnits = units _heliGroup;
{ {
if (_heli emptyPositions "driver" isEqualTo 1 AND (_x isEqualTo (leader(group _x)))) then if (isNull (_heli turretUnit _x)) then
{
_path = _x;
};
} forEach _trrts;
if not(isNil "_path") then
{ {
_x moveInDriver _heli; _x moveInTurret [_heli, _path];
} else } else
{ {
private ["_path"]; if ((_heli emptyPositions "commander") > 0) then
{
_unitInTurret = _heli turretUnit _x;
if (isNull _unitInTurret) then
{
_path = _x;
};
} forEach _turrets;
if not isNil "_path" then
{
_x moveInTurret [_heli, _path];
} else
{
if (_heli emptyPositions "commander" > 0) then
{ {
_x moveInCommander _heli; _x moveInCommander _heli;
}; };
};
}; };
if not(backPack _x isEqualTo "") then
{
removeBackpack _x;
};
_x addBackpack "B_Parachute";
_units pushBack _x;
} forEach _heliUnits;
_wpLoiter = _heliGroup addWaypoint [_locPos, 2, 1, "LOITER"];
_wpLoiter setWaypointType "SAD";
_wpLoiter setWaypointSpeed "NORMAL";
_wpLoiter setWaypointBehaviour "AWARE";
_wpLoiter setWaypointCombatMode "RED";
//_wpLoiter setWaypointLoiterType "CIRCLE";
//_wpLoiter setWaypointLoiterRadius 200;
_heliGroup setCurrentWaypoint _wpLoiter;
[_heliGroup] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
};
} else { // If the select classname is not an air vehicle
[_missionName, 0, format["%1 IS NOT AN AIR VEHICLE", _classToSpawn]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
};
// Place the crate if enabled
if ((([["DynamicLocationInvasion"],["spawnCrateFirst"]] call VEMFr_fnc_getSetting) select 0) isEqualTo 1) then
{
call _doSpawnCrate;
};
// Place mines if enabled
private ["_minesPlaced","_mines"];
_mines = [[_missionName],["mines"]] call VEMFr_fnc_getSetting param [0, 0, [0]];
if (_mines > 0) then
{
_minesPlaced = [_locPos, 5, 100, _missionName] call VEMFr_fnc_placeMines param [0, [], [[]]];
if (count _minesPlaced > 0) then
{
[_missionName, 1, format["%1 mines placed at %2", count _minesPlaced, _locName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
if (count _minesPlaced isEqualto 0) then
{
[_missionName, 0, format["Failed to place %1 mines at %2", count _minesPlaced, _locName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_minesPlaced = nil;
};
};
// Wait for Mission Completion
_done = [_locName, _locPos, _units, _skipDistance] call VEMFr_fnc_waitForMissionDone;
_usedLocs = uiNamespace getVariable "VEMFrUsedLocs";
_index = _usedLocs find _loc;
if (_index > -1) then
{
_usedLocs deleteAt _index;
};
if _done then
{
// Broadcast
if (_announce isEqualTo 1) then
{
if (_mode isEqualTo 0) then
{
[_mode ,"RAIDERS KILLED", format["%1 @ %2 is now clear of %3 raiders", _locName, mapGridPosition (_locPos), worldName]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
};
if (_mode isEqualTo 1) then
{
[_mode, "RAID ENDED", format["%1 @ %2 is now clear of %3 Police", _locName, mapGridPosition (_locPos), worldName]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
};
if (_mode isEqualTo 2) then
{
[_mode, "S.W.A.T. RAID ENDED", format["%1 @ %2 is now clear of %3 S.W.A.T. teams", _locName, mapGridPosition (_locPos)]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
};
};
// Deal with the 50s
if not isNil "_cal50s" then
{
private["_cal50sDelete"];
_cal50sDelete = ([[_missionName],["cal50sDelete"]] call VEMFr_fnc_getSetting) select 0;
if (_cal50sDelete > 0) then
{
{
if (_cal50sDelete isEqualTo 1) then
{
deleteVehicle _x;
};
if (_cal50sDelete isEqualTo 2) then
{
_x setDamage 1;
};
} forEach _cal50s;
};
};
if not isNil "_marker" then
{
deleteMarker _marker
};
if ((([["DynamicLocationInvasion"],["spawnCrateFirst"]] call VEMFr_fnc_getSetting) select 0) isEqualTo 0) then
{
call _doSpawnCrate;
}; };
// Put a marker on the crate if enabled if not(backPack _x isEqualTo "") then
if not isNil "_crate" then
{
if not isNull _crate then
{ {
if not ([getPos _crate, 3] call VEMFr_fnc_checkPlayerPresence) then removeBackpack _x;
{
if (_markCrateVisual isEqualTo 1) then
{
// If night, attach a chemlight
if (sunOrMoon <= 0.35) then
{
[_missionName, 1, "attaching a chemlight to the _crate"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_colors = [[_missionName],["flairTypes"]] call VEMFr_fnc_getSetting param [0, [], [[]]];
if (count _colors > 0) then
{
_lightType = selectRandom _colors;
_light = _lightType createVehicle (position _crate);
_light attachTo [_crate,[0,0,0]];
};
} else
{
[_missionName, 1, "attaching smoke to the _crate"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
// Attach smoke
_colors = [[_missionName],["smokeTypes"]] call VEMFr_fnc_getSetting param [0, [], [[]]];
if (count _colors > 0) then
{
_rndmColor = selectRandom _colors;
_smoke = createVehicle [_rndmColor, getPos _crate, [], 0, "CAN_COLLIDE"];
_smoke attachTo [_crate,[0,0,0]];
};
};
};
_addMarker = [[_missionName],["markCrateOnMap"]] call VEMFr_fnc_getSetting param [0, 1, [0]];
if (_addMarker isEqualTo 1) then
{
private ["_crateMarker"];
_crateMarker = createMarker [format["VEMF_lootCrate_ID%1", random 9000], position _crate];
_crateMarker setMarkerShape "ICON";
_crateMarker setMarkerType "mil_box";
_crateMarker setMarkerColor "colorBlack";
_crateMarker setMarkerText " Loot";
[_crate, _crateMarker] spawn
{
_crate = _this select 0;
_crateMarker = _this select 1;
waitUntil { if ([getPos _crate, 3] call VEMFr_fnc_checkPlayerPresence) then {true} else {uiSleep 4; false} };
deleteMarker _crateMarker;
};
};
};
} else
{
[_missionName, 0, "isNull _crate!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
_x addBackpack "B_Parachute";
_nts pushBack _x;
} forEach (units _hlGrp);
_wp = _hlGrp addWaypoint [_lp, 2, 1, "SAD"];
_wp setWaypointType "SAD";
_wp setWaypointSpeed "NORMAL";
_wp setWaypointBehaviour "AWARE";
_wp setWaypointCombatMode "RED";
//_wp setWaypointLoiterType "CIRCLE";
//_wp setWaypointLoiterRadius 200;
_hlGrp setCurrentWaypoint _wp;
[_hlGrp] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
};
// Place the crate if enabled
if (_ms14 isEqualTo 1) then
{
call _dSpwnCrt;
};
// Place mines if enabled
private ["_mnsPlcd","_mines"];
if (_ms15 > 0) then
{
_mnsPlcd = [_lp, 5, 100, _this0] call VEMFr_fnc_mines;
if ((count _mnsPlcd) > 0) then
{
[_this0, 1, format["%1 mines placed at %2", count _mnsPlcd, _ln]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
} else } else
{ {
[_missionName, 0, "isNil _crate!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; [_this0, 0, format["Failed to place %1 mines at %2", count _mnsPlcd, _ln]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
};
// Wait for Mission Completion
_h = [_nts] ExecVM "exile_vemf_reloaded\sqf\killedMonitor.sqf";
waitUntil { if (scriptDone _h) then {true} else {uiSleep 1; false} };
// Explode or remove the mines ["DynamicLocationInvasion", 1, format["mission in %1 has been completed!", _ln]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
if not isNil "_minesPlaced" then
if (_ms12 isEqualTo 1) then
{
_u = uiNamespace getVariable "VEMFrUsedLocs";
_u deleteAt (_u find _l);
};
// Broadcast
if (_ms7 isEqualTo 1) then
{
if (_m isEqualTo 0) then
{
[_m ,"RAIDERS KILLED", format["%1 @ %2 is now clear of %3 raiders", _ln, mapGridPosition (_lp), worldName]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
};
if (_m isEqualTo 1) then
{
[_m, "RAID ENDED", format["%1 @ %2 is now clear of %3 Police", _ln, mapGridPosition (_lp), worldName]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
};
if (_m isEqualTo 2) then
{
[_m, "S.W.A.T. RAID ENDED", format["%1 @ %2 is now clear of %3 S.W.A.T. teams", _ln, mapGridPosition (_lp)]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
};
};
// Deal with the 50s
if not(isNil "_cl50s") then
{
private["_cal50sDelete"];
_d = ([[_this0],["cal50sDelete"]] call VEMFr_fnc_config) select 0;
if (_d > 0) then
{ {
private ["_cleanMines"];
_cleanMines = [[_missionName],["minesCleanup"]] call VEMFr_fnc_getSetting param [0, 1, [0]];
if (_cleanMines isEqualTo 2) then
{ {
[_minesPlaced] spawn if (_d isEqualTo 1) then { deleteVehicle _x };
if (_d isEqualTo 2) then { _x setDamage 1 };
} forEach _cl50s;
};
};
if not(isNil "_mrkr") then
{
deleteMarker _mrkr
};
if ((([["DynamicLocationInvasion"],["spawnCrateFirst"]] call VEMFr_fnc_config) select 0) isEqualTo 0) then
{
call _dSpwnCrt;
};
// Put a marker on the crate if enabled
if not(isNil "_crate") then
{
if not(isNull _crate) then
{
if not ([getPos _crate, 3] call VEMFr_fnc_playerNear) then
{
if (_ms5 isEqualTo 1) then
{
// If night, attach a chemlight
if (sunOrMoon <= 0.35) then
{
[_this0, 1, "attaching a chemlight to the _crate"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_lightType = selectRandom _ms16;
(_lightType createVehicle (position _crate)) attachTo [_crate,[0,0,0]];
} else
{
[_this0, 1, "attaching smoke to the _crate"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
// Attach smoke
_rndmColor = selectRandom _ms17;
(createVehicle [_rndmColor, getPos _crate, [], 0, "CAN_COLLIDE"]) attachTo [_crate,[0,0,0]];
};
};
if (_ms6 isEqualTo 1) then
{
private ["_mrkr"];
_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 = _this select 0;
_mrkr = _this select 1;
waitUntil { if ([getPos _crate, 3] call VEMFr_fnc_playerNear) then {true} else {uiSleep 4; false} };
deleteMarker _mrkr;
};
};
};
} else
{
[_this0, 0, "isNull _crate!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
} else
{
[_this0, 0, "isNil _crate!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
// Explode or remove the mines
if not(isNil "_mnsPlcd") then
{
if (_ms18 isEqualTo 2) then
{
[_this0, _ln, _mnsPlcd] spawn
{ {
_minesPlaced = _this select 0;
uiSleep (5 + (random 2)); 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 "exile_vemf_reloaded\sqf\log.sqf";
{ {
if not isNull _x then if not(isNull _x) then
{ {
_x setDamage 1; _x setDamage 1;
uiSleep (1.25 + (random 3.5)); uiSleep (1.25 + (random 3.5));
}; };
} forEach _minesPlaced; } forEach (_this select 2);
[(_this select 0), 1, format["Successfully exploded all %1 mines at %2", count (_this select 2), (_this select 1)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
[_missionName, 1, format["Successfully exploded all %1 mines at %2", count _minesPlaced, _locName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_minesPlaced = nil;
};
if (_cleanMines isEqualTo 1) then
{
[_minesPlaced] spawn
{
_minesPlaced = _this select 0;
{
if not isNull _x then
{
deleteVehicle _x;
};
} forEach _minesPlaced;
};
[_missionName, 1, format["Successfully deleted all %1 mines at %2", count _minesPlaced, _locName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_minesPlaced = nil;
};
};
// If enabled, fix all the lights _mnsPlcd = nil;
if (_streetLightsRestore isEqualTo 1) then };
{ if (_ms18 isEqualTo 1) then
private ["_all"]; {
_all = nearestObjects [_locPos, ["Lamps_Base_F","PowerLines_base_F","Land_PowerPoleWooden_L_F"], _streetLightsRange]; [_mnsPlcd] spawn
{ {
if (damage _x > 0.94) then {
{ if not(isNull _x) then { deleteVehicle _x };
_x setDamage 0; } forEach (_this select 0);
uiSleep (1 + (random 2)); };
};
} forEach _all; [_this0, 1, format["Successfully deleted all %1 mines at %2", count _mnsPlcd, _ln]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
};
}; };
} else
{ // If enabled, fix all the lights
[-1, "CRITICAL ERROR", format["Failed to spawn AI in %1 @ %2", _locName, mapGridPosition (_locPos)]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf"; if (_ms9 isEqualTo 1) then
breakOut "outer"; {
}; {
if (damage _x > 0.94) then
{
_x setDamage 0;
uiSleep (1 + (random 2));
};
} forEach (nearestObjects [_lp, ["Lamps_Base_F","PowerLines_base_F","Land_PowerPoleWooden_L_F"], _ms10]);
};
} else } else
{ // If done waiting, and no players were detected { // If done waiting, and no players were detected
[_missionName, 1, format["Invasion of %1 @ %2 timed out.", _locName, mapGridPosition _locPos]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; [_this0, 1, format["Invasion of %1 @ %2 timed out.", _ln, mapGridPosition _lp]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
if not isNil "_marker" then { deleteMarker _marker }; if not(isNil "_mrkr") then { deleteMarker _mrkr };
_usedLocs = uiNamespace getVariable "VEMFrUsedLocs"; _arr = uiNamespace getVariable "VEMFrUsedLocs";
_index = _usedLocs find _loc; _arr deleteAt (_arr find _l);
if (_index > -1) then
{
_usedLocs deleteAt _index;
};
}; };
}; };
}; };
VEMFrInvasionCount = VEMFrInvasionCount - 1; VEMFrInvasionCount = VEMFrInvasionCount - 1;
VEMFrMissionCount = VEMFrMissionCount - 1; VEMFrMissionCount = VEMFrMissionCount - 1;

View File

@ -12,7 +12,6 @@
nothing nothing
*/ */
uiNamespace setVariable ["VEMFrHcLoad", []];
while {true} do while {true} do
{ {
if ((count playableUnits) > 0) then if ((count playableUnits) > 0) then
@ -23,11 +22,11 @@ while {true} do
{ {
if ((count (units _x)) > 0) then if ((count (units _x)) > 0) then
{ {
["REMOTEguard",1,format["Attempting to transfer group: %1", _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; //["REMOTEguard",1,format["Attempting to transfer group: %1", _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
// Group still has units, check if there is anyone that can be the owner // Group still has units, check if there is anyone that can be the owner
_handle = [_x] ExecVM "exile_vemf_reloaded\sqf\setGroupOwner.sqf"; _h = [_x] ExecVM "exile_vemf_reloaded\sqf\setGroupOwner.sqf";
waitUntil { if (scriptDone _handle) then {true} else {uiSleep 0.1; false} }; waitUntil { if (scriptDone _h) then {true} else {uiSleep 0.1; false} };
["REMOTEguard",1,format["Transfer attempted. Group (%1) is %2", _x, if (local _x) then {"still local!"} else {"now REMOTE"}]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; //["REMOTEguard",1,format["Transfer attempted. Group (%1) is %2", _x, if (local _x) then {"still local!"} else {"now REMOTE"}]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
} else } else
{ {
deleteGroup _x; deleteGroup _x;

View File

@ -1,5 +1,5 @@
/* /*
VEMF AI Killed by Vampire, rewritten by IT07 Author: IT07
Description: Description:
executed upon AI unit death executed upon AI unit death
@ -13,118 +13,125 @@
nothing nothing
*/ */
params [["_target",objNull,[objNull]], ["_killer",objNull,[objNull]]]; (_this select 0) params [
if (isPlayer _killer) then ["_t", objNull, [objNull]],
["_nt", "", [""]]
];
(_this select 1) params [
["_k", objNull, [objNull]],
["_nk", "", [""]]
];
if (isPlayer _k) then
{ {
if (_killer isKindOf "Man") then // Roadkill or regular kill if (_k isKindOf "Man") then // Roadkill or regular kill
{ {
if (vehicle _killer isEqualTo _killer) then // If on foot if (vehicle _k isEqualTo _k) then // If on foot
{ {
if (vehicle _target isEqualTo _target) then if (vehicle _t isEqualTo _t) then
{ {
if (("respectReward" call VEMFr_fnc_getSetting) > 0) then if (("respectReward" call VEMFr_fnc_config) > 0) then
{ {
[_target, _killer] ExecVM "exile_vemf_reloaded\sqf\handleRespectGain.sqf"; [_t, _k] ExecVM "exile_vemf_reloaded\sqf\respect.sqf";
}; };
[_target, _killer] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf"; [[_t, _nt],[_k, _nk]] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf";
} else } else
{ {
if (typeOf (vehicle _target) isEqualTo "Steerable_Parachute_F") then if (typeOf (vehicle _t) isEqualTo "Steerable_Parachute_F") then
{ {
if ("logCowardKills" call VEMFr_fnc_getSetting isEqualTo 1) then if ("logCowardKills" call VEMFr_fnc_config isEqualTo 1) then
{ {
["fn_aiKilled", 1, format["A coward (%1 @ %2) killed a parachuting AI", name _killer, mapGridPosition _killer]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["fn_aiKilled", 1, format["A coward (%1 @ %2) killed a parachuting AI", _nk, mapGridPosition _k]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
} else } else
{ {
if (("respectReward" call VEMFr_fnc_getSetting) > 0) then if (("respectReward" call VEMFr_fnc_config) > 0) then
{ {
[_target, _killer] ExecVM "exile_vemf_reloaded\sqf\handleRespectGain.sqf"; [_t, _k] ExecVM "exile_vemf_reloaded\sqf\respect.sqf";
}; };
[_target, _killer] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf"; [[_t, _nt],[_k, _nk]] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf";
}; };
}; };
} else // If in vehicle (a.k.a. roadkill) } else // If in vehicle (a.k.a. roadkill)
{ {
if (("punishRoadKills" call VEMFr_fnc_getSetting) isEqualTo 1) then if (("punishRoadKills" call VEMFr_fnc_config) isEqualTo 1) then
{ {
_respectDeduct = "respectRoadKillDeduct" call VEMFr_fnc_getSetting; _pnsh = "respectRoadKillDeduct" call VEMFr_fnc_config;
_curRespect = _killer getVariable ["ExileScore", 0]; _crRspct = _k getVariable ["ExileScore", 0];
//diag_log text format["_curRespect of _killer (%1) is %2", _killer, _curRespect]; //diag_log text format["_crRspct of _k (%1) is %2", _k, _crRspct];
_newRespect = _curRespect - _respectDeduct; _nwRspct = _crRspct - _pnsh;
_killer setVariable ["ExileScore", _newRespect]; _k setVariable ["ExileScore", _nwRspct];
ExileClientPlayerScore = _newRespect; ExileClientPlayerScore = _nwRspct;
(owner _killer) publicVariableClient "ExileClientPlayerScore"; (owner _k) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil; ExileClientPlayerScore = nil;
[_killer, "showFragRequest", [[["ROADKILL..."],["Respect Penalty:", -_respectDeduct]]]] call ExileServer_system_network_send_to; [_k, "showFragRequest", [[["ROADKILL..."],["Respect Penalty:", -_pnsh]]]] call ExileServer_system_network_send_to;
format["setAccountMoneyAndRespect:%1:%2:%3", _killer getVariable ["ExileMoney", 0], _newRespect, (getPlayerUID _killer)] call ExileServer_system_database_query_fireAndForget; format["setAccountMoneyAndRespect:%1:%2:%3", _k getVariable ["ExileMoney", 0], _nwRspct, (getPlayerUID _k)] call ExileServer_system_database_query_fireAndForget;
if (("sayKilled" call VEMFr_fnc_getSetting) isEqualTo 1) then if (("sayKilled" call VEMFr_fnc_config) isEqualTo 1) then
{ {
[format["(VEMFr) %1 [Roadkill] AI", name _killer]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf"; [format["(VEMFr) %1 [Roadkill] %2", _nk, if (("sayKilledName" call VEMFr_fnc_config) > 0) then {_nt} else {"AI"}]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf";
}; };
}; };
}; };
} else // If kill from vehicle (NOT a roadkill) } else // If kill from vehicle (NOT a roadkill)
{ {
if (typeOf (vehicle _target) isEqualTo "Steerable_Parachute_F") then if (typeOf (vehicle _t) isEqualTo "Steerable_Parachute_F") then
{ {
if ("logCowardKills" call VEMFr_fnc_getSetting isEqualTo 1) then if ("logCowardKills" call VEMFr_fnc_config isEqualTo 1) then
{ {
["fn_aiKilled", 1, format["A coward (%1 @ %2) killed a parachuting AI", name _killer, mapGridPosition _killer]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["fn_aiKilled", 1, format["A coward (%1 @ %2) killed a parachuting AI", _nk, mapGridPosition _k]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
} else } else
{ {
_killer = effectiveCommander _killer; _k = effectiveCommander _k;
if (("respectReward" call VEMFr_fnc_getSetting) > 0) then if (("respectReward" call VEMFr_fnc_config) > 0) then
{ {
[_target, _killer] ExecVM "exile_vemf_reloaded\sqf\handleRespectGain.sqf"; [_t, _k] ExecVM "exile_vemf_reloaded\sqf\respect.sqf";
}; };
[_target, _killer] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf"; [[_t, _nt],[_k, _nk]] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf";
}; };
}; };
}; };
_settings = [["aiCleanup"],["removeLaunchers","aiDeathRemovalEffect","removeHeadGear"]] call VEMFr_fnc_getSetting; ([["aiCleanup"],["removeLaunchers","aiDeathRemovalEffect","removeHeadGear"]] call VEMFr_fnc_config) params ["_ms0","_ms1","_ms2"];
_removeLaunchers = _settings select 0; if (_ms0 isEqualTo 1) then
if (_removeLaunchers isEqualTo 1) then
{ {
_secWeapon = secondaryWeapon _target; _sw = secondaryWeapon _t;
if not(_secWeapon isEqualTo "") then if not(_sw isEqualTo "") then
{ {
_target removeWeaponGlobal _secWeapon; _t removeWeaponGlobal _sw;
_missiles = getArray (configFile >> "cfgWeapons" >> _secWeapon >> "magazines"); _mssls = getArray (configFile >> "cfgWeapons" >> _sw >> "magazines");
{ {
if (_x in _missiles) then if (_x in _mssls) then
{ {
_target removeMagazineGlobal _x; _t removeMagazineGlobal _x;
}; };
} forEach (magazines _target); } forEach (magazines _t);
}; };
}; };
if (_settings select 2 isEqualTo 1) then // If removeHeadGear setting is enabled if (_ms2 isEqualTo 1) then // If removeHeadGear setting is enabled
{ {
removeHeadGear _target; removeHeadGear _t;
}; };
if (_settings select 1 isEqualTo 1) then // If killEffect enabled if (_ms1 isEqualTo 1) then // If killEffect enabled
{ {
playSound3D ["A3\Missions_F_Bootcamp\data\sounds\vr_shutdown.wss", _target, false, getPosASL _target, 2, 1, 60]; playSound3D ["A3\Missions_F_Bootcamp\data\sounds\vr_shutdown.wss", _t, false, getPosASL _t, 2, 1, 60];
for "_u" from 1 to 12 do for "_u" from 1 to 12 do
{ {
if not(isObjectHidden _target) then if not(isObjectHidden _t) then
{ {
_target hideObjectGlobal true; _t hideObjectGlobal true;
} else } else
{ {
_target hideObjectGlobal false; _t hideObjectGlobal false;
}; };
uiSleep 0.12; uiSleep 0.12;
}; };
_target hideObjectGlobal true; _t hideObjectGlobal true;
removeAllWeapons _target; removeAllWeapons _t;
// Automatic cleanup yaaay // Automatic cleanup yaaay
deleteVehicle _target; deleteVehicle _t;
}; };
_target removeAllEventHandlers "MPKilled"; _t removeAllEventHandlers "MPKilled";

View File

@ -22,42 +22,39 @@
nothing nothing
*/ */
if (_this isEqualType []) then _send =
{ {
_broadCast = private ["_arr"];
if (count _this isEqualTo 0) then
{ {
private ["_arr"]; _arr = allPlayers;
if (count _this isEqualTo 0) then } else
{
_arr = _this;
};
{
if (isPlayer _x AND alive _x) then
{ {
_arr = allPlayers; VEMFrMsgToClient = [_msg, _mode];
} else (owner _x) publicVariableClient "VEMFrMsgToClient";
{
_arr = _this;
}; };
{ } forEach _arr;
if (isPlayer _x AND alive _x) then };
{
VEMFrMsgToClient = [_msg, _mode]; _to = param [1, [], [[]]];
(owner _x) publicVariableClient "VEMFrMsgToClient";
}; if (_this select 0 isEqualType []) then // mission notification
} forEach _arr; {
}; _mode = (_this select 0) param [0, -1, [0]];
_targets = param [1, [], [[]]]; _title = (_this select 0) param [1, "DEFAULT TITLE", [""]];
if (_this select 0 isEqualType []) then // mission notification _line = (_this select 0) param [2, "Default message", [""]];
{ _msg = [_mode, _title, _line];
_mode = (_this select 0) param [0, -1, [0]]; _to call _send;
_title = (_this select 0) param [1, "DEFAULT TITLE", [""]]; };
_msgLine = (_this select 0) param [2, "Default message", [""]];
_msg = [_mode, _title, _msgLine]; if (_this select 0 isEqualType "") then // systemchat broadcast
_targets call _broadCast; {
}; _mode = param [2, "", [""]];
if (_this select 0 isEqualType "") then // systemchat broadcast _msg = param [0, "", [""]];
{ _to call _send;
_mode = param [2, "", [""]];
_msg = param [0, "", [""]];
_targets call _broadCast;
};
} else
{
["broadcast.sqf", 0, format["_this is not an ARRAY: %1", _this]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };

View File

@ -11,15 +11,15 @@
nothing nothing
*/ */
if ("validateLoot" call VEMFr_fnc_getSetting isEqualTo 1) then if ("validateLoot" call VEMFr_fnc_config isEqualTo 1) then
{ // _validateLoot is enabled, go ahead... { // _validateLoot is enabled, go ahead...
if ("debugMode" call VEMFr_fnc_getSetting < 1) then if ("debugMode" call VEMFr_fnc_config < 1) then
{ {
["CheckLoot", 0, "Failed to validate loot: no output allowed in RPT"] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["CheckLoot", 0, "Failed to validate loot: no output allowed in RPT"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
} else } else
{ {
["CheckLoot", 1, "Validating loot tables..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["CheckLoot", 1, "Validating loot tables..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_invalidClasses = []; _bin = [];
_mags = []; _mags = [];
_cfgMags = "_mags pushBack (configName _x); true" configClasses (configFile >> "cfgMagazines"); _cfgMags = "_mags pushBack (configName _x); true" configClasses (configFile >> "cfgMagazines");
@ -33,33 +33,33 @@ if ("validateLoot" call VEMFr_fnc_getSetting isEqualTo 1) then
_bags pushBack (configName _x); _bags pushBack (configName _x);
} forEach _cfgBags; } forEach _cfgBags;
_aiGear = [["aiGear"],["aiUniforms","aiVests","aiRifles","aiBackpacks","aiLaunchers","aiPistols"]] call VEMFr_fnc_getSetting; _aiGear = [["aiGear"],["aiUniforms","aiVests","aiRifles","aiBackpacks","aiLaunchers","aiPistols"]] call VEMFr_fnc_config;
{ {
{ {
if not((_x in _mags) OR (_x in _weapons) OR (_x in _bags)) then if not((_x in _mags) OR (_x in _weapons) OR (_x in _bags)) then
{ {
_invalidClasses pushBack _x; _bin pushBack _x;
}; };
} forEach _x; } forEach _x;
} forEach _aiGear; } forEach _aiGear;
_loot = [["crateLoot"],["primaryWeaponLoot","secondaryWeaponLoot","magazinesLoot","attachmentsLoot","itemsLoot","vestsLoot","headGearLoot","backpacksLoot"]] call VEMFr_fnc_getSetting; _loot = [["crateLoot"],["primaryWeaponLoot","secondaryWeaponLoot","magazinesLoot","attachmentsLoot","itemsLoot","vestsLoot","headGearLoot","backpacksLoot"]] call VEMFr_fnc_config;
{ {
{ {
_class = _x select 0; _class = _x select 0;
if not((_class in _mags) OR (_class in _weapons) OR (_class in _bags)) then if not((_class in _mags) OR (_class in _weapons) OR (_class in _bags)) then
{ {
_invalidClasses pushBack _x; _bin pushBack _x;
}; };
} forEach _x; } forEach _x;
} forEach _loot; } forEach _loot;
if (count _invalidClasses isEqualTo 0) then if (count _bin isEqualTo 0) then
{ {
["CheckLoot", 1, "Loot tables are all valid :)"] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["CheckLoot", 1, "Loot tables are all valid :)"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
} else } else
{ {
["CheckLoot", 0, format["Invalid classes found in loot! | %1", _invalidClasses]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["CheckLoot", 0, format["Invalid classes found in loot! | %1", _bin]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
}; };
}; };

View File

@ -14,108 +14,117 @@
nothing nothing
*/ */
params [["_crate",objNull,[objNull]], ["_locName","",[""]], ["_locPos",[],[[]]]]; params [
if not isNull _crate then ["_crate", objNull, [objNull]],
["_locName", "", [""]],
["_locPos", [], [[]]]
];
_crate setVariable ["isVEMFrCrate", 1, true];
clearBackpackCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
_ms = [
["crateLoot"],
[
"primarySlotsMax","primarySlotsMin","secondarySlotsMax","secondarySlotsMin","magSlotsMax","magSlotsMin","attSlotsMax","attSlotsMin","itemSlotsMax","itemSlotsMin",
"vestSlotsMax","vestSlotsMin","headGearSlotsMax","headGearSlotsMin","bagSlotsMax","bagSlotsMin","primaryWeaponLoot","secondaryWeaponLoot","magLoot","attLoot",
"itemLoot","vestLoot","backpackLoot","headGearLoot","blackListLoot"
]
] call VEMFr_fnc_config;
_ms params [
"_maxPrim","_minPrim","_maxSec","_minSec","_maxMagSlots","_minMagSlots","_maxAttSlots","_minAttSlots","_maxItemSlots","_minItemSlots","_maxVestSlots","_minVestSlots",
"_maxHeadGearSlots","_minHeadGearSlots","_maxBagSlots","_minBagSlots","_primaries","_secondaries","_magazines","_attachments","_items","_vests","_backpacks","_headGear","_blackList"
];
// Add primary weapons
for "_j" from 0 to (_maxPrim - _minPrim + floor random _minPrim) do
{ {
_crate setVariable ["isVEMFrCrate", 1, true]; private ["_prim"];
clearBackpackCargoGlobal _crate; _prim = _primaries call BIS_fnc_selectRandom;
clearItemCargoGlobal _crate; if not((_prim select 0) in _blackList) then
clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
_settings = [
["crateLoot"],
[
"primarySlotsMax","primarySlotsMin","secondarySlotsMax","secondarySlotsMin","magSlotsMax","magSlotsMin","attSlotsMax","attSlotsMin","itemSlotsMax","itemSlotsMin",
"vestSlotsMax","vestSlotsMin","headGearSlotsMax","headGearSlotsMin","bagSlotsMax","bagSlotsMin","primaryWeaponLoot","secondaryWeaponLoot","magLoot","attLoot",
"itemLoot","vestLoot","backpackLoot","headGearLoot","blackListLoot"
]
] call VEMFr_fnc_getSetting;
_settings params ["_maxPrim","_minPrim","_maxSec","_minSec","_maxMagSlots","_minMagSlots","_maxAttSlots","_minAttSlots","_maxItemSlots","_minItemSlots","_maxVestSlots","_minVestSlots",
"_maxHeadGearSlots","_minHeadGearSlots","_maxBagSlots","_minBagSlots","_primaries","_secondaries","_magazines","_attachments","_items","_vests","_backpacks","_headGear","_blackList"];
// Add primary weapons
for "_j" from 0 to (_maxPrim - _minPrim + floor random _minPrim) do
{ {
private ["_prim"]; _crate addWeaponCargoGlobal [_prim select 0, _prim select 1];
_prim = _primaries call BIS_fnc_selectRandom;
if not((_prim select 0) in _blackList) then
{
_crate addWeaponCargoGlobal [_prim select 0, _prim select 1];
};
};
// Secondary weapons
for "_j" from 0 to (_maxSec - _minSec + floor random _minSec) do
{
private ["_sec"];
_sec = _secondaries call BIS_fnc_selectRandom;
if not((_sec select 0) in _blackList) then
{
_crate addWeaponCargoGlobal [_sec select 0, _sec select 1];
};
};
// Magazines
for "_j" from 0 to (_maxMagSlots - _minMagSlots + floor random _minMagSlots) do
{
private ["_mag"];
_mag = _magazines call BIS_fnc_selectRandom;
if not((_mag select 0) in _blackList) then
{
_crate addMagazineCargoGlobal [_mag select 0, _mag select 1];
};
};
// Weapon attachments
for "_j" from 0 to (_maxAttSlots - _minAttSlots + floor random _minAttSlots) do
{
private ["_att"];
_att = _attachments call BIS_fnc_selectRandom;
if not((_att select 0) in _blackList) then
{
_crate addItemCargoGlobal [_att select 0, _att select 1];
};
};
// Items
for "_j" from 0 to (_maxItemSlots - _minItemSlots + floor random _minItemSlots) do
{
private ["_item"];
_item = _items call BIS_fnc_selectRandom;
if not((_item select 0) in _blacklist) then
{
_crate addItemCargoGlobal [_item select 0, _item select 1];
};
};
// Vests
for "_j" from 0 to (_maxVestSlots - _minVestSlots + floor random _minVestSlots) do
{
private ["_vest"];
_vest = _vests call BIS_fnc_selectRandom;
if not((_vest select 0) in _blackList) then
{
_crate addItemCargoGlobal [_vest select 0, _vest select 1];
};
};
// Helmets / caps / berets / bandanas
for "_j" from 0 to (_maxHeadGearSlots - _minHeadGearSlots + floor random _minHeadGearSlots) do
{
private ["_headGearItem"];
_headGearItem = _headGear call BIS_fnc_selectRandom;
if not((_headGearItem select 0) in _blackList) then
{
_crate addItemCargoGlobal [_headGearItem select 0, _headGearItem select 1];
};
};
// Backpacks
for "_j" from 0 to (_maxBagSlots - _minBagSlots + floor random _minBagSlots) do
{
private ["_pack"];
_pack = _backpacks call BIS_fnc_selectRandom;
if not((_pack select 0) in _blackList) then
{
_crate addBackpackCargoGlobal [_pack select 0, _pack select 1];
};
};
if (not(_locPos isEqualTo []) AND not(_locName isEqualTo "")) then
{
["loadLoot", 1, format["Loot loaded into crate located in %1 at %2", _locName, mapGridPosition _crate]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
}; };
// Secondary weapons
for "_j" from 0 to (_maxSec - _minSec + floor random _minSec) do
{
private ["_sec"];
_sec = _secondaries call BIS_fnc_selectRandom;
if not((_sec select 0) in _blackList) then
{
_crate addWeaponCargoGlobal [_sec select 0, _sec select 1];
};
};
// Magazines
for "_j" from 0 to (_maxMagSlots - _minMagSlots + floor random _minMagSlots) do
{
private ["_mag"];
_mag = _magazines call BIS_fnc_selectRandom;
if not((_mag select 0) in _blackList) then
{
_crate addMagazineCargoGlobal [_mag select 0, _mag select 1];
};
};
// Weapon attachments
for "_j" from 0 to (_maxAttSlots - _minAttSlots + floor random _minAttSlots) do
{
private ["_att"];
_att = _attachments call BIS_fnc_selectRandom;
if not((_att select 0) in _blackList) then
{
_crate addItemCargoGlobal [_att select 0, _att select 1];
};
};
// Items
for "_j" from 0 to (_maxItemSlots - _minItemSlots + floor random _minItemSlots) do
{
private ["_item"];
_item = _items call BIS_fnc_selectRandom;
if not((_item select 0) in _blacklist) then
{
_crate addItemCargoGlobal [_item select 0, _item select 1];
};
};
// Vests
for "_j" from 0 to (_maxVestSlots - _minVestSlots + floor random _minVestSlots) do
{
private ["_vest"];
_vest = _vests call BIS_fnc_selectRandom;
if not((_vest select 0) in _blackList) then
{
_crate addItemCargoGlobal [_vest select 0, _vest select 1];
};
};
// Helmets / caps / berets / bandanas
for "_j" from 0 to (_maxHeadGearSlots - _minHeadGearSlots + floor random _minHeadGearSlots) do
{
private ["_headGearItem"];
_headGearItem = _headGear call BIS_fnc_selectRandom;
if not((_headGearItem select 0) in _blackList) then
{
_crate addItemCargoGlobal [_headGearItem select 0, _headGearItem select 1];
};
};
// Backpacks
for "_j" from 0 to (_maxBagSlots - _minBagSlots + floor random _minBagSlots) do
{
private ["_pack"];
_pack = _backpacks call BIS_fnc_selectRandom;
if not((_pack select 0) in _blackList) then
{
_crate addBackpackCargoGlobal [_pack select 0, _pack select 1];
};
};
["loadLoot", 1, format["Loot loaded into crate located in '%1' at %2", _locName, mapGridPosition _crate]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";

View File

@ -14,33 +14,36 @@
nothing (use spawn, not call) nothing (use spawn, not call)
*/ */
if (("debugMode" call VEMFr_fnc_getSetting) > 0) then if (("debugMode" call VEMFr_fnc_config) > 0) then
{ {
scopeName "outer"; scopeName "_top";
private ["_prefix","_type","_line","_doLog"]; params [
params [["_prefix","",[""]], ["_type",3,[0]], ["_line","",[""]]]; ["_p", "", [""]],
["_t", 3, [0]],
["_l", "", [""]]
];
_doLog = { diag_log text format["IT07: [VEMFr] %1 -- %2: %3", _prefix, _this, _line] }; _do = { diag_log text format["IT07: [VEMFr] %1 -- %2: %3", _p, _this, _l] };
_debugMode = "debugMode" call VEMFr_fnc_getSetting; _m = "debugMode" call VEMFr_fnc_config;
if (_type isEqualTo 0) then if (_t isEqualTo 0) then
{ {
if (_debugMode isEqualTo 1 OR _debugMode isEqualTo 3) then if (_m isEqualTo 1 OR _m isEqualTo 3) then
{ {
"ERROR" call _doLog; "ERROR" call _do;
breakOut "outer"; breakOut "_top";
}; };
}; };
if (_type isEqualTo 1) then if (_t isEqualTo 1) then
{ {
if (_debugMode isEqualTo 2 OR _debugMode isEqualTo 3) then if (_m isEqualTo 2 OR _m isEqualTo 3) then
{ {
"INFO" call _doLog; "INFO" call _do;
breakOut "outer"; breakOut "_top";
}; };
}; };
if (_type isEqualTo 2) then // This bypasses _debugMode 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 _doLog; "SYSTEM" call _do;
breakOut "outer"; breakOut "_top";
}; };
}; };

View File

@ -12,76 +12,58 @@
*/ */
scopeName "outer"; scopeName "outer";
_maxGlobalMissions = "maxGlobalMissions" call VEMFr_fnc_getSetting; _mgm = "maxGlobalMissions" call VEMFr_fnc_config;
_minNew = "minNew" call VEMFr_fnc_getSetting; ["missionTimer", 1, format["Global mission-limit is set at: %1", _mgm]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_minNew = "minNew" call VEMFr_fnc_config;
if (_minNew > -1) then if (_minNew > -1) then
{ {
_maxNew = "maxNew" call VEMFr_fnc_getSetting; _maxNew = "maxNew" call VEMFr_fnc_config;
if (_maxNew > 0) then if (_maxNew > 0) then
{ {
_missionList = "missionList" call VEMFr_fnc_getSetting; _ml = "missionList" call VEMFr_fnc_config;
if (count _missionList > 0) then if (count _ml > 0) then
{ {
_minFps = "minServerFPS" call VEMFr_fnc_getSetting; _minFps = "minServerFPS" call VEMFr_fnc_config;
_minPlayers = "minPlayers" call VEMFr_fnc_getSetting; _mnPlyrs = "minPlayers" call VEMFr_fnc_config;
if isNil "VEMFrForceStart" then { VEMFrForceStart = false }; if isNil "VEMFrForceStart" then { VEMFrForceStart = false };
waitUntil { if ((((count allPlayers) >= _minPlayers) AND (diag_fps > _minFps)) OR VEMFrForceStart) then { true } else { uiSleep 5; false } }; waitUntil { if ((((count allPlayers) >= _mnPlyrs) AND (diag_fps > _minFps)) OR VEMFrForceStart) then { true } else { uiSleep 5; false } };
if VEMFrForceStart then if VEMFrForceStart then
{ {
["missionTimer", 1, format["VEMFr has been forced to start. Server FPS: %1", diag_fps]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["missionTimer", 1, format["VEMFr has been forced to start. Server FPS: %1", diag_fps]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
} else } else
{ {
["missionTimer", 1, format["Enough players online (%1) and server FPS (%2) is above %3. Starting missionTimer...", count allPlayers, diag_fps, _minFps]] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["missionTimer", 1, format["Enough players online (%1) and server FPS (%2) is above %3. Starting missionTimer...", count allPlayers, diag_fps, _minFps]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
["missionTimer", 1, format["Global mission limit is set at: %1", _maxGlobalMissions]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
VEMFrMissionCount = 0;
private ["_ignoreLimit"];
_ignoreLimit = false;
if (_maxGlobalMissions isEqualTo 0) then
{
_ignoreLimit = true;
};
_sleep =
{
// Wait random amount
uiSleep ((_minNew*60)+ floor random ((_maxNew*60)-(_minNew*60)));
};
call _sleep;
while {true} do
{
// Pick A Mission if enough players online
if ((count allPlayers) >= _minPlayers) then
{
scopeName "pick";
if ((VEMFrMissionCount < _maxGlobalMissions) AND (VEMFrMissionCount >= 0) OR _ignoreLimit) then
{
_missionName = selectRandom _missionList;
_mission = [_missionName] execVM format["exile_vemf_reloaded\missions\%1.sqf", _missionName];
uiSleep 5;
if (scriptDone _mission) then
{
// Mission sqf file finished executing within 5 seconds. Assume it did not meet requirements to spawn.
breakOut "pick"; // break the current scope and redo the loop (a.k.a. pick a new mission and launch it right away instead of the failed one)
} else
{
// Mission sqf file did not finish within 5 seconds. Assume it is running successfully.
call _sleep;
};
} else
{
if (VEMFrMissionCount < 0) then
{
["missionTimer", 0, format["VEMFrMissionCount (%1) is BELOW 0! Stopping missionTimer...", VEMFrMissionCount]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer";
};
call _sleep; VEMFrMissionCount = 0;
}; _im = false;
} else if (_mgm isEqualTo 0) then { _im = true };
{ _zz = { uiSleep ((_minNew*60)+ floor random ((_maxNew*60)-(_minNew*60))) };
uiSleep 60; // If no players online, check again in 60 seconds call _zz;
};
}; while {true} do
}; {
}; // Pick A Mission if enough players online
}; if ((count allPlayers) >= _mnPlyrs) then
{
scopeName "pick";
if ((VEMFrMissionCount < _mgm) AND (VEMFrMissionCount >= 0) OR _im) then
{
_mssnNm = selectRandom _ml;
_h = [_mssnNm] execVM format["exile_vemf_reloaded\missions\%1.sqf", _mssnNm];
uiSleep 5;
if (scriptDone _h) then { breakOut "pick" } else { call _zz };
} else
{
if (VEMFrMissionCount < 0) then
{
["missionTimer", 0, format["VEMFrMissionCount (%1) is BELOW 0! Stopping missionTimer...", VEMFrMissionCount]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer";
};
call _zz;
};
} else { uiSleep 60 };
};
};
};
};

View File

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

View File

@ -5,24 +5,21 @@
handles the broadcast of a systemChat kill message handles the broadcast of a systemChat kill message
*/ */
params [["_target",objNull,[objNull]], ["_killer",objNull,[objNull]]]; (_this select 0) params [
_curWeapon = "Weapon"; ["_t", objNull, [objNull]],
if (vehicle _killer isEqualTo _killer) then // If on foot ["_nt", "", [""]]
{ ];
_curWeapon = currentWeapon _killer; (_this select 1) params [
}; ["_k", objNull, [objNull]],
if not(vehicle _killer isEqualTo _killer) then // If in vehicle ["_nk", "", [""]]
{ ];
_curWeapon = currentWeapon (vehicle _killer);
};
_dist = _target distance _killer;
_sayKilled = "sayKilled" call VEMFr_fnc_getSetting; _crWpn = "Weapon";
if (_sayKilled isEqualTo 1) then if (vehicle _k isEqualTo _k) then { _crWpn = currentWeapon _k };
{ if not(vehicle _k isEqualTo _k) then { _crWpn = currentWeapon (vehicle _k) };
[format["(VEMFr) %1 [%2, %3m] AI", name _killer, getText(configFile >> "CfgWeapons" >> _curWeapon >> "displayName"), round _dist]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf"; _dist = _t distance _k;
};
if (_sayKilled isEqualTo 2) then _sk = "sayKilled" call VEMFr_fnc_config;
{ if (_sk isEqualTo 1) then { [format["(VEMFr) %1 [%2, %3m] %4", _nk, getText(configFile >> "CfgWeapons" >> _crWpn >> "displayName"), round _dist, if (("sayKilledName" call VEMFr_fnc_config) > 0) then {_nt} else {"AI"}]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf" };
[format["(VEMFr) You [%1, %2m] AI", getText(configFile >> "CfgWeapons" >> _curWeapon >> "displayName"), round _dist]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf"; if (_sk isEqualTo 2) then { [format["(VEMFr) You [%1, %2m] %4", getText(configFile >> "CfgWeapons" >> _crWpn >> "displayName"), round _dist, if (("sayKilledName" call VEMFr_fnc_config) > 0) then {_nt} else {"AI"}]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf" };
};

View File

@ -12,50 +12,33 @@
nothing nothing
*/ */
_toTransfer = param [0, grpNull, [grpNull]]; _grp = param [0, grpNull, [grpNull]];
if not(isNull _toTransfer) then if not(isNull _grp) then
{ {
// Check if HC is enabled // Check if HC is enabled
_hcEnabled = "headLessClientSupport" call VEMFr_fnc_getSetting; _hcNbld = "headLessClientSupport" call VEMFr_fnc_config;
_forceClients = uiNamespace getVariable ["VEMFr_forceAItoClients", nil]; _force = uiNamespace getVariable ["VEMFr_forceAItoClients", nil];
if not(isNil "_forceClients") then if not(isNil "_force") then { if (_force isEqualType true) then { if _force then { _hcNbld = -1 } } };
{
if (_forceClients isEqualType true) then
{
if _forceClients then
{
_hcEnabled = -1;
};
};
};
private ["_to"]; private ["_to"];
if (_hcEnabled isEqualTo 1) then if (_hcNbld isEqualTo 1) then
{ // Gather the Headless Client(s) {
_hcClients = []; _arr = [];
{ {
if (typeOf _x isEqualTo "HeadlessClient_F") then // it is an HC if (typeOf _x isEqualTo "HeadlessClient_F") then { _arr pushBack [_x, owner _x] };
{
_hcClients pushBack [_x, owner _x];
};
} forEach allPlayers; } forEach allPlayers;
if (count _hcClients > 0) then
{ if (count _arr > 0) then { _to = call VEMFr_fnc_hc } else { uiNamespace setVariable ["VEMFr_forceAItoClients", true] };
_to = call VEMFr_fnc_headlessClient; // Select a random hc
} else
{
uiNamespace setVariable ["VEMFr_forceAItoClients", true];
};
} else // If Headlessclient setting is not enabled } else // If Headlessclient setting is not enabled
{ {
if ((count allPlayers) > 0) then if ((count allPlayers) > 0) then
{ {
_distanceToX = worldSize; _distToX = worldSize;
{ {
_dist = _x distance (leader _toTransfer); _dist = _x distance (leader _grp);
if (_dist <= _distanceToX) then if (_dist <= _distToX) then
{ {
_distanceToX = _dist; _distToX = _dist;
_to = _x; _to = _x;
}; };
} forEach allPlayers; } forEach allPlayers;
@ -64,26 +47,7 @@ if not(isNull _toTransfer) then
if not(isNil "_to") then if not(isNil "_to") then
{ {
(uiNamespace getVariable ["VEMFrHcLoad", nil]) pushBack _to; _grp setGroupOwner (owner _to);
_transfer = _toTransfer setGroupOwner (owner _to); waitUntil { if not(local _grp) then {true} else {uiSleep 0.1; false} };
waitUntil { if not(local _toTransfer) then {true} else {uiSleep 0.1; false} };
/*_load = uiNamespace getVariable ["VEMFrHcLoad", nil];
if not(isNil "_load") then
{
_index = _load find _to;
if (_index > -1) then
{
_load set [_index, ((_load select _index) select 1) + 1];
} else
{
_load pushBack [_to, 1];
};
};*/
} else
{
["setGroupOwner",0,format["Unable to find a %1 to transfer to!", if (_hcEnabled isEqualTo 1) then {"HC"} else {"client"}]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };
} else
{
["setGroupOwner",0,"Can not transfer a non-existent group!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
}; };

View File

@ -12,4 +12,4 @@
nothing nothing
*/ */
(param [0, grpNull, [grpNull]]) setVariable ["isVEMFrGroup",true,false]; (param [0, grpNull, [grpNull]]) setVariable ["isVEMFrGroup",true,true];

View File

@ -11,14 +11,12 @@
nothing nothing
*/ */
if (([["aiStatic"],["enabled"]] call VEMFr_fnc_getSetting) select 0 isEqualTo 1) then if ((([["aiStatic"],["enabled"]] call VEMFr_fnc_config) select 0) isEqualTo 1) then
{ {
["spawnStaticAI", 2, "launching..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["spawnStaticAI", 2, "launching..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_settings = [["aiStatic"],["positions","amount"]] call VEMFr_fnc_getSetting; ([["aiStatic"],["positions","amount"]] call VEMFr_fnc_config) params ["_s0","_s1"];
_positions = _settings select 0;
["spawnStaticAI", 2, "spawning AI on positions..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf"; ["spawnStaticAI", 2, "spawning AI on positions..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
_amounts = _settings select 1;
{ {
[_x, 2, _amounts select _foreachindex, "aiMode" call VEMFr_fnc_getSetting, "Static"] spawn VEMFr_fnc_spawnVEMFrAI; [_x, 2, _s1 select _foreachindex, ("aiMode" call VEMFr_fnc_config), "Static"] spawn VEMFr_fnc_spawnVEMFrAI;
} forEach _positions; } forEach _s0;
}; };

View File

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