mirror of
https://github.com/IT07/a3_vemf_reloaded.git
synced 2024-08-30 16:52:11 +00:00
Speed tweaks
This commit is contained in:
parent
4e6158fa01
commit
796371c7f9
@ -9,44 +9,44 @@
|
||||
Returns: SIDE - unit's side
|
||||
*/
|
||||
|
||||
private ["_return"];
|
||||
private ["_r"];
|
||||
if (_this isEqualType "") then
|
||||
{
|
||||
private ["_faction"];
|
||||
_faction = getText (configFile >> "CfgVehicles" >> _this >> "faction");
|
||||
if not(_faction isEqualTo "") then
|
||||
private ["_f"];
|
||||
_f = getText (configFile >> "CfgVehicles" >> _this >> "faction");
|
||||
if not(_f isEqualTo "") then
|
||||
{
|
||||
scopeName "isNull";
|
||||
if (_faction isEqualTo "BLU_G_F") then
|
||||
if (_f isEqualTo "BLU_G_F") then
|
||||
{
|
||||
_return = WEST;
|
||||
_r = WEST;
|
||||
breakOut "isNull";
|
||||
};
|
||||
if (_faction isEqualTo "CIV_F") then
|
||||
if (_f isEqualTo "CIV_F") then
|
||||
{
|
||||
_return = civilian;
|
||||
_r = civilian;
|
||||
breakOut "isNull";
|
||||
};
|
||||
if (_faction isEqualTo "IND_F") then
|
||||
if (_f isEqualTo "IND_F") then
|
||||
{
|
||||
_return = independent;
|
||||
_r = independent;
|
||||
breakOut "isNull";
|
||||
};
|
||||
if (_faction isEqualTo "IND_G_F") then
|
||||
if (_f isEqualTo "IND_G_F") then
|
||||
{
|
||||
_return = resistance;
|
||||
_r = resistance;
|
||||
breakOut "isNull";
|
||||
};
|
||||
if (_faction isEqualTo "OPF_G_F") then
|
||||
if (_f isEqualTo "OPF_G_F") then
|
||||
{
|
||||
_return = EAST;
|
||||
_r = EAST;
|
||||
};
|
||||
} else
|
||||
{
|
||||
["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
|
||||
};
|
||||
};
|
||||
|
@ -10,215 +10,156 @@
|
||||
_this select 2: POSITION - Center for nearestLocations check
|
||||
_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 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
|
||||
|
||||
Returns:
|
||||
if mode = loc: LOCATION
|
||||
if mode = pos: POSITION
|
||||
if mode == loc: LOCATION
|
||||
if mode == pos: POSITION
|
||||
*/
|
||||
|
||||
private ["_ret","_settings","_nonPopulated","_blackPos","_missionDistance","_mode","_onRoad","_cntr","_tooCloseRange","_maxPrefered","_skipDistance","_range","_missionConfigName"];
|
||||
_ret = false;
|
||||
// Define settings
|
||||
_settings = [["nonPopulated","noMissionPos","missionDistance"]] call VEMFr_fnc_getSetting;
|
||||
_settings params [["_nonPopulated",1,[0]], ["_blackPos",[],[[]]], ["_missionDistance",3000,[0]]];
|
||||
params [["_mode","",[""]], ["_onRoad",false,[false]], ["_cntr",[],[[]]], ["_tooCloseRange",-1,[0]], ["_maxPrefered",-1,[0]], ["_skipDistance",-1,[0]], ["_missionConfigName","",[""]]];
|
||||
_range = worldSize;
|
||||
if not(_missionConfigName isEqualTo "") then
|
||||
private [
|
||||
"_r","_this0","_this1","_this2","_this3","_this4","_this5","_this6",
|
||||
"_s0","_s1","_s2","_s3",
|
||||
"_rad","_arr","_bin","_used","_badNames","_maps","_bad",
|
||||
"_locPos","_xx","_pos","_hi","_low","_dist","_loc"
|
||||
];
|
||||
|
||||
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"];
|
||||
_nonPopulatedOverride = ([[_missionConfigName],["nonPopulated"]] call VEMFr_fnc_getSetting) select 0;
|
||||
if not isNil "_nonPopulatedOverride" then
|
||||
_s0 = ([[_this6],["nonPopulated"]] call VEMFr_fnc_config) select 0;
|
||||
};
|
||||
|
||||
_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"];
|
||||
_checkBlackPos = false;
|
||||
if (count _blackPos > 0) then
|
||||
{
|
||||
_checkBlackPos = true;
|
||||
};
|
||||
|
||||
private ["_mode","_roadRange"];
|
||||
if (not(_mode isEqualTo "") AND (_cntr isEqualTypeArray [0,0,0]) AND (_tooCloseRange > -1) AND (_maxPrefered > -1)) 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
|
||||
_bin = [];
|
||||
_used = uiNamespace getVariable ["VEMFrUsedLocs",[]];
|
||||
{ // Check _arr for invalid locations (too close, hasPlayers or inBlacklist)
|
||||
if ([locationPosition _x, _this5] call VEMFr_fnc_playerNear) then
|
||||
{
|
||||
_bin pushBack _x;
|
||||
} else
|
||||
{
|
||||
if ((count _s1) > 0) then
|
||||
{
|
||||
_remLocs pushBack _x;
|
||||
} else
|
||||
{
|
||||
if _checkBlackPos then
|
||||
{
|
||||
private ["_locPos","_loc"];
|
||||
_locPos = locationPosition _x;
|
||||
_loc = _x;
|
||||
_locPos = locationPosition _x;
|
||||
_xx = _x;
|
||||
{
|
||||
if ((count _x) isEqualTo 2) then
|
||||
{
|
||||
if (count _x isEqualTo 2) then
|
||||
if (((_x select 0) distance _locPos) <= (_x select 1)) then
|
||||
{
|
||||
private ["_pos"];
|
||||
_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";
|
||||
_bin pushBack _xx;
|
||||
};
|
||||
} forEach _blackPos;
|
||||
};
|
||||
if ((text _x) in _blackList) then
|
||||
{
|
||||
_remLocs pushBack _x;
|
||||
} else
|
||||
{
|
||||
if (_cntr distance (locationPosition _x) < _tooCloseRange) then
|
||||
{
|
||||
_remLocs pushBack _x;
|
||||
} else
|
||||
{
|
||||
if (_x in _usedLocs) then
|
||||
{
|
||||
_remLocs pushBack _x;
|
||||
};
|
||||
};
|
||||
["fn_findPos", 0, format["found invalid entry in mission blacklist: %1", _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
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"];
|
||||
_loc = _x;
|
||||
{
|
||||
if (((locationPosition _loc) distance (locationPosition _x)) < _missionDistance) then
|
||||
{
|
||||
_remLocs pushBack _loc;
|
||||
};
|
||||
} forEach _usedLocs;
|
||||
_bin pushBack _x;
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _locs;
|
||||
|
||||
private ["_index"];
|
||||
{ // 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
|
||||
if ((count _used) > 0) then
|
||||
{
|
||||
_far pushBack _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
|
||||
_xx = _x;
|
||||
{
|
||||
_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
|
||||
if (count _locs > 0) then
|
||||
{
|
||||
// Return Name and POS
|
||||
_ret = _loc;
|
||||
(uiNamespace getVariable "VEMFrUsedLocs") pushBack _loc;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_mode isEqualTo "pos") then
|
||||
{
|
||||
private ["_valid"];
|
||||
_valid = false;
|
||||
for "_p" from 1 to 10 do
|
||||
{ // Remove all invalid locations from _arr
|
||||
_arr deleteAt (_arr find _x);
|
||||
} forEach _bin;
|
||||
|
||||
// Check what kind of distances we have
|
||||
_low = []; // Closer then _this4
|
||||
_hi = []; // Further than _this4
|
||||
{
|
||||
_dist = _this2 distance (locationPosition _x);
|
||||
if (_dist > _this4) then { _hi pushBack _x };
|
||||
if (_dist <= _this4) then { _low pushBack _x };
|
||||
} forEach _arr;
|
||||
|
||||
// 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
|
||||
{
|
||||
private ["_pos"];
|
||||
_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;
|
||||
};
|
||||
};
|
||||
_loc = selectRandom _hi;
|
||||
_r = _loc;
|
||||
_used pushBackUnique _loc;
|
||||
};
|
||||
};
|
||||
};
|
||||
} 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
|
||||
|
@ -15,60 +15,53 @@
|
||||
BOOLEAN - true if successful
|
||||
*/
|
||||
|
||||
private ["_done"];
|
||||
_done = false;
|
||||
if (_this isEqualType []) then
|
||||
private ["_r","_this0"];
|
||||
params [
|
||||
["_this0", objNull, [objNull]],
|
||||
["_this1", "", [""]],
|
||||
["_this2", "", [""]],
|
||||
["_this3", "", [""]]
|
||||
];
|
||||
|
||||
_r = [];
|
||||
if not(_this1 isEqualTo "") then
|
||||
{
|
||||
private ["_unit"];
|
||||
params [["_unit", objNull, [objNull]],["_classPrimary", "", [""]],["_classSecondary", "", [""]],["_classHandgun", "", [""]]];
|
||||
if not isNull _unit then
|
||||
private ["_m"];
|
||||
_m = selectRandom (getArray (configFile >> "CfgWeapons" >> _this1 >> "magazines"));
|
||||
for "_l" from 1 to 5 do
|
||||
{
|
||||
if local _unit then
|
||||
{
|
||||
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";
|
||||
if not(_this0 canAdd _m) exitWith {};
|
||||
_this0 addItem _m;
|
||||
};
|
||||
} else
|
||||
{
|
||||
["fn_giveAmmo", 0, "_this is not an ARRAY"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
_r pushBack true;
|
||||
};
|
||||
_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
|
||||
|
@ -11,64 +11,54 @@
|
||||
Returns: BOOLEAN - true if no errors occured
|
||||
*/
|
||||
|
||||
private ["_done"];
|
||||
_done = false;
|
||||
if (_this isEqualType []) then
|
||||
private ["_r","_p","_w","_a","_bin"];
|
||||
_u = param [0,objNull,[objNull]];
|
||||
if not (isNull _u) then
|
||||
{
|
||||
_unit = param [0,objNull,[objNull]];
|
||||
if not (isNull _unit) then
|
||||
{
|
||||
// primaryWeapon items
|
||||
private ["_randomPattern","_primaryWeapon"];
|
||||
_randomPattern = [1,0,1,0,1,1,1,1,0,0,1,1,1];
|
||||
_primaryWeapon = primaryWeapon _unit;
|
||||
if (selectRandom _randomPattern isEqualTo 1) then
|
||||
{ // Select random scope
|
||||
private ["_scopes"];
|
||||
_scopes = getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
|
||||
if (("allowTWS" call VEMFr_fnc_getSetting) isEqualTo 0) then
|
||||
{
|
||||
private["_forbiddenScopes"];
|
||||
_forbiddenScopes = [];
|
||||
_p = [1,0,1,0,1,1,1,1,0,0,1,1,1];
|
||||
_w = primaryWeapon _u;
|
||||
if ((selectRandom _p) isEqualTo 1) then
|
||||
{ // Select random scope
|
||||
_a = getArray (configFile >> "CfgWeapons" >> _w >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
|
||||
if (("allowTWS" call VEMFr_fnc_config) isEqualTo 0) then
|
||||
{
|
||||
_bin = [];
|
||||
{
|
||||
if (((toLower _x) find "tws") > -1) then
|
||||
{
|
||||
if (((toLower _x) find "tws") > -1) then
|
||||
{
|
||||
_forbiddenScopes pushBack _x;
|
||||
};
|
||||
} forEach _scopes;
|
||||
{
|
||||
_index = _scopes find _x;
|
||||
_scopes deleteAt _index;
|
||||
} forEach _forbiddenScopes;
|
||||
};
|
||||
_unit addPrimaryWeaponItem (selectRandom _scopes);
|
||||
_bin pushBack _x;
|
||||
};
|
||||
} forEach _a;
|
||||
{
|
||||
_a deleteAt (_a find _x);
|
||||
} forEach _bin;
|
||||
};
|
||||
if (selectRandom _randomPattern isEqualTo 1) then
|
||||
{ // 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;
|
||||
_u addPrimaryWeaponItem (selectRandom _a);
|
||||
};
|
||||
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
|
||||
|
@ -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";
|
||||
uiNamespace setVariable ["VEMFrUsedLocs", []];
|
||||
uiNamespace setVariable ["VEMFrAttackedFlags", []];
|
||||
uiNamespace setVariable ["VEMFrHcLoad", []];
|
||||
uiNamespace setVariable ["VEMFrHcLoad", [[],[]]];
|
||||
|
||||
[] 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
|
||||
{
|
||||
_classLv1Name = configName _x;
|
||||
_levelOne = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _classLv1Name, "true", false];
|
||||
_c1 = configName _x;
|
||||
_l1 = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _c1, "true", false];
|
||||
{
|
||||
if (isClass _x) then
|
||||
{
|
||||
_classLv2Name = configName _x;
|
||||
_levelTwo = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _classLv1Name >> _classLv2Name, "true", false];
|
||||
_c2 = configName _x;
|
||||
_l2 = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _c1 >> _c2, "true", false];
|
||||
{
|
||||
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
|
||||
{
|
||||
["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
|
||||
{
|
||||
["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];
|
||||
} forEach _scripts;
|
||||
} forEach _s;
|
||||
|
||||
west setFriend [independent, 0];
|
||||
independent setFriend [west, 0];
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
Author: VAMPIRE, rebooted by IT07
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
loads AI inventory
|
||||
gives inventory to given units
|
||||
|
||||
Param:
|
||||
_this: ARRAY
|
||||
@ -14,223 +14,200 @@
|
||||
BOOLEAN - true if nothing failed
|
||||
*/
|
||||
|
||||
private ["_ok","_params"];
|
||||
_ok = false;
|
||||
_params = _this;
|
||||
if (_this isEqualType []) then
|
||||
private ["_r","_this0","_this1","_this2"];
|
||||
params [
|
||||
["_this0", [], [[]]],
|
||||
["_this1", "", [""]],
|
||||
["_this2", 0, [0]]
|
||||
];
|
||||
|
||||
if ((_this1 in ("missionList" call VEMFr_fnc_config)) OR (_this1 isEqualTo "Static")) then
|
||||
{
|
||||
private ["_units","_missionName","_aiMode"];
|
||||
params [["_units", [], [[]]],["_missionName", "", [""]],["_aiMode", 0, [0]]];
|
||||
if (count _units > 0) then
|
||||
scopeName "this";
|
||||
if (_this2 isEqualTo 0) then // "Militia"
|
||||
{
|
||||
if (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static") then
|
||||
{
|
||||
scopeName "this";
|
||||
if (_aiMode isEqualTo 0) then // "Militia"
|
||||
{
|
||||
private ["_aiGear","_uniforms","_headGear","_vests","_backpacks","_rifles","_pistols","_aiLaunchers","_launchers","_launcherChance"];
|
||||
// Define settings
|
||||
_aiGear = [["aiGear"],["aiUniforms","aiHeadGear","aiVests","aiBackpacks","aiLaunchers","aiRifles","aiPistols"]] call VEMFr_fnc_getSetting;
|
||||
_uniforms = _aiGear select 0;
|
||||
_headGear = _aiGear select 1;
|
||||
_vests = _aiGear select 2;
|
||||
_backpacks = _aiGear select 3;
|
||||
_rifles = _aiGear select 5;
|
||||
_pistols = _aiGear select 6;
|
||||
_aiLaunchers = ([[_missionName],["aiLaunchers"]] call VEMFr_fnc_getSetting) select 0;
|
||||
if (_aiLaunchers isEqualTo 1) then
|
||||
{
|
||||
_launchers = _aiGear select 4;
|
||||
_launcherChance = ([[_missionName],["hasLauncherChance"]] call VEMFr_fnc_getSetting) select 0;
|
||||
};
|
||||
private ["_s","_unifs","_headG","_vests","_packs","_lnchers","_rfles","_pstls","_ls"];
|
||||
// Define settings
|
||||
_s = [["aiGear"],["aiUniforms","aiHeadGear","aiVests","aiBackpacks","aiLaunchers","aiRifles","aiPistols"]] call VEMFr_fnc_config;
|
||||
_s params ["_unifs","_headG","_vests","_packs","_lnchers","_rfles","_pstls"];
|
||||
{
|
||||
private ["_xx","_g","_a","_pw","_hw"];
|
||||
_xx = _x;
|
||||
// Strip it
|
||||
removeAllWeapons _xx;
|
||||
removeAllItems _xx;
|
||||
if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo 1) then
|
||||
{
|
||||
removeAllAssignedItems _xx;
|
||||
};
|
||||
removeVest _xx;
|
||||
removeBackpack _xx;
|
||||
removeGoggles _xx;
|
||||
removeHeadGear _xx;
|
||||
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"];
|
||||
_unit = _x;
|
||||
// Strip it
|
||||
removeAllWeapons _unit;
|
||||
removeAllItems _unit;
|
||||
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
|
||||
if not(_this1 isEqualTo "BaseAttack") then
|
||||
{
|
||||
removeAllAssignedItems _unit;
|
||||
_g = selectRandom _packs;
|
||||
_xx addBackpack _g;
|
||||
};
|
||||
removeVest _unit;
|
||||
removeBackpack _unit;
|
||||
removeGoggles _unit;
|
||||
removeHeadGear _unit;
|
||||
if (count _uniforms > 0) then
|
||||
_g = selectRandom _lnchers;
|
||||
private ["_a"];
|
||||
_a = getArray (configFile >> "cfgWeapons" >> _g >> "magazines");
|
||||
if (count _a > 2) then
|
||||
{
|
||||
removeUniform _unit;
|
||||
_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;
|
||||
};
|
||||
_a resize 2;
|
||||
};
|
||||
for "_i" from 0 to (2 + (round random 1)) do
|
||||
{
|
||||
_xx addMagazine (selectRandom _a);
|
||||
};
|
||||
_xx addWeapon _g;
|
||||
};
|
||||
};
|
||||
|
||||
// Select a random weapon
|
||||
private ["_primaryWeapon","_handgunWeapon"];
|
||||
_primaryWeapon = selectRandom _rifles;
|
||||
_handgunWeapon = selectRandom _pistols;
|
||||
// Give this guy some ammo
|
||||
_givenAmmo = [_unit, _primaryWeapon, "", _handgunWeapon] 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 _primaryWeapon;
|
||||
_unit selectWeapon _primaryWeapon;
|
||||
_unit addWeapon _handgunWeapon;
|
||||
// Give this guy some weaponItems
|
||||
_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 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;
|
||||
// Select a random weapon
|
||||
_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;
|
||||
// Give this guy some weaponItems
|
||||
_g = [_xx] call VEMFr_fnc_giveWeaponItems;
|
||||
if not _g then
|
||||
{
|
||||
["fn_loadInv", 0, format["FAILED to giveWeaponItems to %1", _xx]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
} forEach _this0;
|
||||
_r = true;
|
||||
breakOut "this";
|
||||
};
|
||||
|
||||
_hat = selectRandom _headGear;
|
||||
_unit addHeadGear _hat;
|
||||
_vest = selectRandom _vests;
|
||||
_unit addVest _vest;
|
||||
_uniform = selectRandom _uniforms;
|
||||
_unit forceAddUniform _uniform;
|
||||
_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 not(_missionName isEqualTo "BaseAttack") then
|
||||
{
|
||||
_backpack = selectRandom _backpacks;
|
||||
_unit addBackPack _backpack;
|
||||
} else
|
||||
{
|
||||
_unit addBackpack "B_Parachute";
|
||||
};
|
||||
// Give this guy some weaponItems
|
||||
_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 (_this2 isEqualTo 1) then // Regular police
|
||||
{
|
||||
private ["_s","_headG","_vests","_unifs","_rfles","_pstls","_packs"];
|
||||
_s = [["policeConfig"],["headGear","vests","uniforms","rifles","pistols","backpacks"]] call VEMFr_fnc_config;
|
||||
_s params ["_headG","_vests","_unifs","_rfles","_pstls","_packs"];
|
||||
{
|
||||
private ["_xx","_g","_pw","_hw"];
|
||||
_xx = _x;
|
||||
// Strip it
|
||||
removeAllWeapons _xx;
|
||||
removeAllItems _xx;
|
||||
if ("removeAllAssignedItems" call VEMFr_fnc_config isEqualTo 1) then
|
||||
{
|
||||
removeAllAssignedItems _xx;
|
||||
};
|
||||
removeUniform _xx;
|
||||
removeVest _xx;
|
||||
removeBackpack _xx;
|
||||
removeGoggles _xx;
|
||||
removeHeadGear _xx;
|
||||
_g = selectRandom _headG;
|
||||
_xx addHeadGear _g;
|
||||
_g = selectRandom _vests;
|
||||
_xx addVest _g;
|
||||
_g = selectRandom _unifs;
|
||||
_xx forceAddUniform _g;
|
||||
|
||||
if (_missionName isEqualTo "BaseAttack") then
|
||||
{
|
||||
_unit addBackpack "B_Parachute";
|
||||
};
|
||||
// Give this guy some weaponItems
|
||||
_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;
|
||||
};
|
||||
};
|
||||
_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 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;
|
||||
};
|
||||
};
|
||||
|
||||
_ok
|
||||
_r
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
Author: original by Vampire, completely rewritten by IT07
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
spawns AI using given _pos and unit/group count.
|
||||
spawns AI using given _this0 and unit/group count.
|
||||
|
||||
Params:
|
||||
_this select 0: POSITION - where to spawn the units around
|
||||
@ -16,180 +16,168 @@
|
||||
ARRAY format [[groups],[50cals]]
|
||||
*/
|
||||
|
||||
private ["_spawned","_pos","_grpCount","_unitsPerGrp","_mode","_missionName","_maxRange"];
|
||||
_spawned = [[],[]];
|
||||
params [["_pos",[],[[]]], ["_grpCount",1,[0]], ["_unitsPerGrp",1,[0]], ["_mode",-1,[0]], ["_missionName","",[""]], ["_maxRange",175,[0]]];
|
||||
if ((count _pos isEqualTo 3) AND (_grpCount > 0) AND (_unitsPerGrp > 0) AND (_missionName in ("missionList" call VEMFr_fnc_getSetting))) then
|
||||
private ["_r","_this0","_this1","_this2","_this3","_this4","_this5"];
|
||||
params [
|
||||
["_this0", [], [[]]],
|
||||
["_this1", 1, [0]],
|
||||
["_this2", 1, [0]],
|
||||
["_this3", -1, [0]],
|
||||
["_this4", "", [""]],
|
||||
["_this5", 175, [0]]
|
||||
];
|
||||
|
||||
if (_this4 in ("missionList" call VEMFr_fnc_config)) then
|
||||
{
|
||||
private [
|
||||
"_sldrClass","_groups","_hc","_aiDifficulty","_skills","_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime",
|
||||
"_courage","_reloadSpd","_commanding","_general","_houses","_notTheseHouses","_goodHouses","_noHouses","_cal50s","_units"
|
||||
"_grps","_s","_ccrcy","_mShk","_mSpd","_stmna","_sptDst","_sptTme",
|
||||
"_crge","_rldSpd","_cmmndng","_gnrl","_notTheseHouses","_gdHss","_nHss","_cl50s","_nts"
|
||||
];
|
||||
_sldrClass = "unitClass" call VEMFr_fnc_getSetting;
|
||||
_groups = [];
|
||||
_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"];
|
||||
_houses = nearestTerrainObjects [_pos, ["House"], _maxRange]; // Find some houses to spawn in
|
||||
_notTheseHouses = "housesBlackList" call VEMFr_fnc_getSetting;
|
||||
_goodHouses = [];
|
||||
_r = [[],[]];
|
||||
_grps = [];
|
||||
_s = [["aiSkill", ([["aiSkill"],["difficulty"]] call VEMFr_fnc_config) select 0],["accuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]] call VEMFr_fnc_config;
|
||||
_s params ["_ccrcy","_mShk","_mSpd","_stmna","_sptDst","_sptTme","_crge","_rldSpd","_cmmndng","_gnrl"];
|
||||
_notTheseHouses = "housesBlackList" call VEMFr_fnc_config;
|
||||
_gdHss = [];
|
||||
{ // Filter the houses that are too small for one group
|
||||
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;
|
||||
_goodHouses = _goodHouses call BIS_fnc_arrayShuffle;
|
||||
_noHouses = false;
|
||||
if (count _goodHouses < _grpCount) then
|
||||
} forEach (nearestTerrainObjects [_this0,["House"],_this5]);
|
||||
|
||||
_gdHss = _gdHss call BIS_fnc_arrayShuffle;
|
||||
_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 = [];
|
||||
};
|
||||
_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 not _nHss 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;
|
||||
if not isNil "_groupSide" then
|
||||
|
||||
private ["_grp","_hs","_hsPstns","_plcd50","_i"];
|
||||
_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"];
|
||||
_grp = createGroup _groupSide;
|
||||
(_spawned select 0) pushBack _grp;
|
||||
_grp allowFleeing 0;
|
||||
private ["_house","_housePositions"];
|
||||
if not _noHouses then
|
||||
_hs = selectRandom _gdHss;
|
||||
_hsID = _gdHss find _hs;
|
||||
_gdHss deleteAt _hsID;
|
||||
_hsPstns = [_hs] call BIS_fnc_buildingPositions;
|
||||
};
|
||||
|
||||
_plcd50 = false;
|
||||
for "_u" from 1 to _this2 do
|
||||
{
|
||||
private ["_spwnPs","_hmg","_nt"];
|
||||
if _nHss then
|
||||
{
|
||||
_house = selectRandom _goodHouses;
|
||||
_houseID = _goodHouses find _house;
|
||||
_goodHouses deleteAt _houseID;
|
||||
_housePositions = [_house] call BIS_fnc_buildingPositions;
|
||||
};
|
||||
private ["_placed50"];
|
||||
_placed50 = false;
|
||||
for "_u" from 1 to _unitsPerGrp do
|
||||
_spwnPs = [_this0,20,_this5,1,0,200,0] call BIS_fnc_findSafePos; // Find Nearby Position
|
||||
} else
|
||||
{
|
||||
private ["_spawnPos","_hmg"];
|
||||
if _noHouses then
|
||||
_spwnPs = selectRandom _hsPstns;
|
||||
if not _plcd50 then
|
||||
{
|
||||
_spawnPos = [_pos,20,_maxRange,1,0,200,0] call BIS_fnc_findSafePos; // Find Nearby Position
|
||||
} else
|
||||
{
|
||||
_spawnPos = selectRandom _housePositions;
|
||||
if not _placed50 then
|
||||
_plcd50 = true;
|
||||
if (_cl50s > 0) then
|
||||
{
|
||||
_placed50 = true;
|
||||
if (_cal50s > 0) then
|
||||
{
|
||||
_hmg = createVehicle ["O_HMG_01_high_F", _spawnPos, [], 0, "CAN_COLLIDE"];
|
||||
_hmg setVehicleLock "LOCKEDPLAYER";
|
||||
(_spawned select 1) pushBack _hmg;
|
||||
};
|
||||
_hmg = createVehicle ["O_HMG_01_high_F", _spwnPs, [], 0, "CAN_COLLIDE"];
|
||||
_hmg setVehicleLock "LOCKEDPLAYER";
|
||||
(_r 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
|
||||
if not _invLoaded then
|
||||
|
||||
_nt = _grp createUnit [("unitClass" call VEMFr_fnc_config), _spwnPs, [], 0, "CAN_COLLIDE"]; // Create Unit There
|
||||
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 ["_waypoints"];
|
||||
_waypoints = [
|
||||
[(_pos select 0), (_pos select 1)+50, 0],
|
||||
[(_pos select 0)+50, (_pos select 1), 0],
|
||||
[(_pos select 0), (_pos select 1)-50, 0],
|
||||
[(_pos select 0)-50, (_pos select 1), 0]
|
||||
];
|
||||
{ // Make them Patrol
|
||||
for "_z" from 1 to (count _waypoints) do
|
||||
{
|
||||
private ["_wp"];
|
||||
_wp = _x addWaypoint [(_waypoints select (_z-1)), 10];
|
||||
_wp setWaypointType "SAD";
|
||||
_wp setWaypointCompletionRadius 20;
|
||||
};
|
||||
private ["_cyc"];
|
||||
_cyc = _x addWaypoint [_pos,10];
|
||||
_cyc setWaypointType "CYCLE";
|
||||
_cyc setWaypointCompletionRadius 20;
|
||||
} forEach _groups;
|
||||
};
|
||||
private ["_wypnts","_wp","_cyc"];
|
||||
_wypnts =
|
||||
[
|
||||
[(_this0 select 0), (_this0 select 1)+50, 0],
|
||||
[(_this0 select 0)+50, (_this0 select 1), 0],
|
||||
[(_this0 select 0), (_this0 select 1)-50, 0],
|
||||
[(_this0 select 0)-50, (_this0 select 1), 0]
|
||||
];
|
||||
{ // Make them Patrol
|
||||
for "_z" from 1 to (count _wypnts) do
|
||||
{
|
||||
_wp = _x addWaypoint [(_wypnts select (_z-1)), 10];
|
||||
_wp setWaypointType "SAD";
|
||||
_wp setWaypointCompletionRadius 20;
|
||||
};
|
||||
_cyc = _x addWaypoint [_this0,10];
|
||||
_cyc setWaypointType "CYCLE";
|
||||
_cyc setWaypointCompletionRadius 20;
|
||||
} forEach _grps;
|
||||
};
|
||||
} 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
Author: original by Vampire, completely rewritten by IT07
|
||||
|
||||
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:
|
||||
_this select 0: POSITION - where to spawn the units around
|
||||
@ -17,82 +17,76 @@
|
||||
ARRAY with group(s)
|
||||
*/
|
||||
|
||||
private ["_spawned","_allUnits","_pos","_grpCount","_unitsPerGrp","_mode","_missionName"];
|
||||
_spawned = [];
|
||||
private ["_r","_allUnits","_this0","_this1","_this2","_this3","_this4"];
|
||||
_allUnits = [];
|
||||
params [["_pos",[],[[]]], ["_grpCount",1,[0]], ["_unitsPerGrp",1,[0]], ["_mode",-1,[0]], ["_missionName","",[""]], ["_altitude",0,[0]], ["_spawnRadius",20,[0]]];
|
||||
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
|
||||
params [
|
||||
["_this0", [], [[]]],
|
||||
["_this1", 1, [0]],
|
||||
["_this2", 1, [0]],
|
||||
["_this3", -1, [0]],
|
||||
["_this4", "", [""]],
|
||||
["_this5", 0, [0]],
|
||||
["_this6", 20, [0]]
|
||||
];
|
||||
|
||||
if ((_this4 in ("missionList" call VEMFr_fnc_config)) OR (_this4 isEqualTo "Static")) then
|
||||
{
|
||||
scopeName "outer";
|
||||
_pos = [_pos select 0, _pos select 1, _altitude];
|
||||
private [
|
||||
"_sldrClass","_hc","_aiDifficulty","_skills","_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime","_courage","_reloadSpd","_commanding","_general","_units"
|
||||
];
|
||||
_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];
|
||||
_r = [];
|
||||
_this0 = [_this0 select 0, _this0 select 1, _this5];
|
||||
private ["_s","_ccrcy","_mshk","_mspd","_stmn","_sptDst","_sptTm","_crg","_rldSpd","_cmmndng","_gnrl","_i"];
|
||||
|
||||
_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";
|
||||
};
|
||||
_spawned pushBack _grp;
|
||||
} else
|
||||
_s = [["aiSkill", ([["aiSkill"],["difficulty"]] call VEMFr_fnc_config) select 0],["accuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]] call VEMFr_fnc_config;
|
||||
_s params ["_ccrcy","_mshk","_mspd","_stmn","_sptDst","_sptTm","_crg","_rldSpd","_cmmndng","_gnrl"];
|
||||
for "_g" from 1 to _this1 do
|
||||
{
|
||||
private["_grp"];
|
||||
_grp = createGroup (("unitClass" call VEMFr_fnc_config) call VEMFr_fnc_checkSide);
|
||||
_grp allowFleeing 0;
|
||||
for "_u" from 1 to _this2 do
|
||||
{
|
||||
["fn_spawnVEMFrAI", 0, "failed to retrieve _groupSide"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
breakOut "outer";
|
||||
private ["_unit"];
|
||||
_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"];
|
||||
_invLoaded = [_allUnits, _missionName, _mode] call VEMFr_fnc_loadInv; // Load the AI's inventory
|
||||
if not _invLoaded then
|
||||
{
|
||||
_spawned = false;
|
||||
["fn_spawnVEMFrAI", 0, "failed to load AI's inventory..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
breakOut "outer";
|
||||
};
|
||||
_i = [_allUnits, _this4, _this3] call VEMFr_fnc_loadInv; // Load the AI's inventory
|
||||
if (isNil "_i") then
|
||||
{
|
||||
_r = nil;
|
||||
["fn_spawnVEMFrAI", 0, "failed to load AI's inventory..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
breakOut "outer";
|
||||
};
|
||||
} 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
|
||||
|
@ -12,31 +12,25 @@
|
||||
BOOL - true if there is a player present
|
||||
*/
|
||||
|
||||
private ["_playerNear","_pos","_rad"];
|
||||
_playerNear = false;
|
||||
params [["_pos",[],[[]]], ["_rad",-1,[0]]];
|
||||
if (((count _pos) isEqualTo 3) AND (_rad > -1)) then
|
||||
private ["_r","_this0","_this1"];
|
||||
params [
|
||||
["_this0", [], [[]]],
|
||||
["_this1", -1, [0]]
|
||||
];
|
||||
|
||||
_r = false;
|
||||
if ([_this0, _this1] call VEMFr_fnc_playerNear) then
|
||||
{
|
||||
private ["_time","_timeOutTime","_pp"];
|
||||
_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;
|
||||
};
|
||||
};
|
||||
_r = true;
|
||||
} 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;
|
||||
};
|
||||
};
|
||||
|
||||
_playerNear
|
||||
_r
|
||||
|
@ -6,55 +6,54 @@
|
||||
*/
|
||||
|
||||
VEMFrMissionCount = VEMFrMissionCount + 1;
|
||||
_missionName = param [0, "", [""]];
|
||||
if isNil "VEMFrAttackCount" then { VEMFrAttackCount = 0 };
|
||||
_mn = param [0, "", [""]];
|
||||
if (isNil "VEMFrAttackCount") then { VEMFrAttackCount = 0 };
|
||||
VEMFrAttackCount = VEMFrAttackCount + 1;
|
||||
_settings = [[_missionName],["maxAttacks","aiSetup","minimumLevel"]] call VEMFr_fnc_getSetting;
|
||||
_settings params ["_maxAttacks","_aiSetup","_minimumLevel"];
|
||||
if (VEMFrAttackCount <= _maxAttacks) then
|
||||
_s = [[_mn],["maxAttacks","aiSetup","minimumLevel"]] call VEMFr_fnc_config;
|
||||
_s params ["_s0","_s1","_s2"];
|
||||
if (VEMFrAttackCount <= _s0) then
|
||||
{
|
||||
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",[]];
|
||||
_flags = [];
|
||||
_hst = uiNamespace getVariable ["VEMFrAttackedFlags",[]];
|
||||
_objs = [];
|
||||
{
|
||||
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 };
|
||||
} forEach _flagsObjs;
|
||||
if (not(_x in _hst) AND ((_x getVariable ["ExileTerritoryLevel",0]) > _s2)) then { _objs pushBack _x };
|
||||
} forEach (nearestObjects [position _x, ["Exile_Construction_Flag_Static"], 150]);
|
||||
};
|
||||
} forEach allPlayers;
|
||||
|
||||
if (count _flags > 0) then
|
||||
if (count _objs > 0) then
|
||||
{
|
||||
_flagToAttack = selectRandom _flags;
|
||||
_attackedFlags pushBack _flagToAttack;
|
||||
_flagPos = position _flagToAttack;
|
||||
_nearestPlayer = selectRandom (nearestObjects [_flagPos, ["Exile_Unit_Player"], 150]);
|
||||
if not isNil "_nearestPlayer" then
|
||||
_flg = selectRandom _objs;
|
||||
_hst pushBack _flg;
|
||||
_pos = position _flg;
|
||||
_nrPlyr = selectRandom (nearestObjects [_pos, ["Exile_Unit_Player"], 150]);
|
||||
if not(isNil "_nrPlyr") then
|
||||
{
|
||||
_flagName = _flagToAttack 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;
|
||||
if (count _paraGroups isEqualTo (_aiSetup select 0)) then
|
||||
_flgNm = _flg getVariable ["exileterritoryname", "ERROR: UNKNOWN NAME"];
|
||||
_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 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;
|
||||
if (_unitCount isEqualTo ((_aiSetup select 0) * (_aiSetup select 1))) then
|
||||
} forEach _prGrps;
|
||||
if (_ntCnt isEqualTo ((_s1 select 0) * (_s1 select 1))) then
|
||||
{
|
||||
_wayPoints = [];
|
||||
_units = [];
|
||||
_wyPnts = [];
|
||||
_nts = [];
|
||||
{
|
||||
_wp = _x addWaypoint [_flagPos, 50, 1];
|
||||
_wp = _x addWaypoint [_pos, 50, 1];
|
||||
_wp setWaypointBehaviour "COMBAT";
|
||||
_wp setWaypointCombatMode "RED";
|
||||
_wp setWaypointCompletionRadius 10;
|
||||
@ -62,27 +61,27 @@ if (VEMFrAttackCount <= _maxAttacks) then
|
||||
_wp setWaypointSpeed "FULL";
|
||||
_wp setWaypointType "SAD";
|
||||
_x setCurrentWaypoint _wp;
|
||||
_wayPoints pushback _wp;
|
||||
_wyPnts pushback _wp;
|
||||
{
|
||||
_units pushback _x;
|
||||
_nts pushback _x;
|
||||
} forEach (units _x);
|
||||
[_x] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
|
||||
} forEach _paraGroups;
|
||||
_players = nearestObjects [_flagPos, ["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, "BaseAttack", format["A para team is on the way to %1 @ %2's location!", _flagName, name _nearestPlayer]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
} forEach _prGrps;
|
||||
_plyrs = nearestObjects [_pos, ["Exile_Unit_Player"], 275];
|
||||
[-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";
|
||||
["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
|
||||
{
|
||||
scopeName "loop";
|
||||
_deadCount = 0;
|
||||
_ddCnt = 0;
|
||||
{
|
||||
if (damage _x isEqualTo 1 OR isNull _x) then
|
||||
{
|
||||
_deadCount = _deadCount + 1;
|
||||
_ddCnt = _ddCnt + 1;
|
||||
};
|
||||
} forEach _units;
|
||||
if (_deadCount isEqualTo _unitCount) then
|
||||
} forEach _nts;
|
||||
if (_ddCnt isEqualTo _ntCnt) then
|
||||
{
|
||||
breakOut "loop";
|
||||
} else
|
||||
@ -90,8 +89,8 @@ if (VEMFrAttackCount <= _maxAttacks) then
|
||||
uiSleep 4;
|
||||
};
|
||||
};
|
||||
_players = nearestObjects [_flagPos, ["Exile_Unit_Player"], 275];
|
||||
[-1, "DEFEATED", format["Base attack on %1 has been defeated!", _flagname], _players] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
|
||||
_plyrs = nearestObjects [_pos, ["Exile_Unit_Player"], 275];
|
||||
[-1, "DEFEATED", format["Base attack on %1 has been defeated!", _flgNm], _plyrs] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
|
||||
breakOut "outer";
|
||||
} else
|
||||
{
|
||||
@ -99,26 +98,18 @@ if (VEMFrAttackCount <= _maxAttacks) then
|
||||
{
|
||||
deleteVehicle _x;
|
||||
} forEach (units _x);
|
||||
} forEach _paraGroups;
|
||||
["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";
|
||||
} forEach _prGrps;
|
||||
["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";
|
||||
};
|
||||
} 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";
|
||||
};
|
||||
} else
|
||||
{
|
||||
_index = _attackedFlags find _flagToAttack;
|
||||
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";
|
||||
};
|
||||
_hst deleteAt (_hst find _flg);
|
||||
["BaseAttack", 0, "Can not find player near flag!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
breakOut "outer";
|
||||
};
|
||||
@ -128,13 +119,12 @@ if (VEMFrAttackCount <= _maxAttacks) then
|
||||
};
|
||||
} 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";
|
||||
};
|
||||
} else
|
||||
{
|
||||
["BaseAttack", 0, format["Failed to start mission. Given _missionName (%1) is not in active missionList", _missionName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
breakOut "outer";
|
||||
["BaseAttack", 0, format["Failed to start mission. Given _mn (%1) is not in active missionList", _mn]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
};
|
||||
VEMFrAttackCount = VEMFrAttackCount - 1;
|
||||
|
@ -5,119 +5,117 @@
|
||||
VEMFrMissionCount = VEMFrMissionCount + 1;
|
||||
if isNil "VEMFrInvasionCount" then { VEMFrInvasionCount = 0; };
|
||||
VEMFrInvasionCount = VEMFrInvasionCount + 1;
|
||||
_missionName = param [0, "", [""]];
|
||||
if (VEMFrInvasionCount <= (([[_missionName],["maxInvasions"]] call VEMFr_fnc_getSetting) select 0)) then
|
||||
_this0 = param [0, "", [""]];
|
||||
if (VEMFrInvasionCount <= (([[_this0],["maxInvasions"]] call VEMFr_fnc_config) select 0)) then
|
||||
{
|
||||
scopeName "outer";
|
||||
private ["_hasPlayers","_spawned","_grpArr","_unitArr","_done","_boxes","_box","_chute","_colors","_lightType","_light","_smoke"];
|
||||
// Define _settings
|
||||
_settings = [[_missionName],["groupCount","groupUnits","maxDistance","maxDistancePrefered","skipDistance","marker","parachuteCrate","markCrateVisual","markCrateOnMap","announce","streetLights","streetLightsRestore","streetLightsRange","allowCrateLift"]] call VEMFr_fnc_getSetting;
|
||||
_settings params ["_grpCount","_groupUnits","_range","_maxPref","_skipDistance","_useMissionMarker","","_markCrateVisual","_markCrateOnMap","_announce","_streetLights","_streetLightsRestore","_streetLightsRange","_allowCrateLift"];
|
||||
(_settings select 6) params ["_useChute","_crateAltitude"];
|
||||
// Define the settings
|
||||
_ms = [
|
||||
[_this0],
|
||||
["groupCount","groupUnits","maxDistancePrefered","skipDistance","useMarker","markCrateVisual","markCrateOnMap","announce","streetLights","streetLightsRestore","streetLightsRange","allowCrateLift","allowRepeat","randomModes","spawnCrateFirst","mines","flairTypes","smokeTypes","minesCleanup"]
|
||||
] 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;
|
||||
if (_loc isEqualType locationNull) then
|
||||
([[_this0,"crateParachute"],["enabled","altitude"]] call VEMFr_fnc_config) params ["_cp0","_cp1"];
|
||||
|
||||
_l = ["loc", false, position (selectRandom allPlayers), _ms3, _ms2, _ms3, _this0] call VEMFr_fnc_findPos;
|
||||
if (_l isEqualType locationNull) then
|
||||
{
|
||||
_locName = text _loc;
|
||||
_locPos = position _loc;
|
||||
if (_locName isEqualTo "") then { _locName = "Area"; };
|
||||
[_missionName, 1, format["Invading %1...", _locName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
// Send message to all players
|
||||
private ["_mode"];
|
||||
_mode = "aiMode" call VEMFr_fnc_getSetting;
|
||||
_randomModes = ([[_missionName],["randomModes"]] call VEMFr_fnc_getSetting) select 0;
|
||||
if (_randomModes isEqualTo 1) then
|
||||
_ln = text _l;
|
||||
_lp = position _l;
|
||||
if (_ln isEqualTo "") then { _ln = "Area"; };
|
||||
[_this0, 1, format["Invading %1...", _ln]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
|
||||
_m = "aiMode" call VEMFr_fnc_config;
|
||||
if (_ms13 isEqualTo 1) then { _m = selectRandom [0,1,2] };
|
||||
if (_ms7 isEqualTo 1) then
|
||||
{
|
||||
_mode = selectRandom [0,1,2];
|
||||
};
|
||||
if (_announce isEqualTo 1) then
|
||||
{
|
||||
if (_mode isEqualTo 0) then
|
||||
if (_m 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
|
||||
_marker = createMarker [format["VEMFr_DynaLocInva_ID%1", random 9000], _locPos];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "o_unknown";
|
||||
if (_mode < 0 OR _mode > 2) then
|
||||
_mrkr = createMarker [format["VEMFr_DynaLocInva_ID%1", random 9000], _lp];
|
||||
_mrkr setMarkerShape "ICON";
|
||||
_mrkr setMarkerType "o_unknown";
|
||||
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";
|
||||
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 (_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
|
||||
{
|
||||
_x setDamage 0.95;
|
||||
uiSleep 0.1;
|
||||
};
|
||||
} forEach _all;
|
||||
} forEach (nearestObjects [_lp, ["Lamps_Base_F","PowerLines_base_F","Land_PowerPoleWooden_L_F"], _ms10]);
|
||||
};
|
||||
|
||||
private ["_crate"];
|
||||
_doSpawnCrate = {
|
||||
_dSpwnCrt = {
|
||||
// Choose a box
|
||||
_boxes = [[_missionName],["crateTypes"]] call VEMFr_fnc_getSetting;
|
||||
_box = selectRandom (_boxes select 0);
|
||||
_pos = [_locPos, 0, 200, 0, 0, 300, 0] call bis_fnc_findSafePos;
|
||||
if (_useChute isEqualTo 1) then
|
||||
_bx = selectRandom (([[_this0],["crateTypes"]] call VEMFr_fnc_config) select 0);
|
||||
_ps = [_lp, 0, 200, 0, 0, 300, 0] call bis_fnc_findSafePos;
|
||||
if (_cp0 > 0) then
|
||||
{
|
||||
_chute = createVehicle ["I_Parachute_02_F", _pos, [], 0, "FLY"];
|
||||
_chute setPos [getPos _chute select 0, getPos _chute select 1, _crateAltitude];
|
||||
_chute enableSimulationGlobal true;
|
||||
_cht = createVehicle ["I_Parachute_02_F", _ps, [], 0, "FLY"];
|
||||
_cht setPos [getPos _cht select 0, getPos _cht select 1, _cp1];
|
||||
_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 enableSimulationGlobal true;
|
||||
_crate attachTo [_chute, [0,0,0]];
|
||||
[_missionName, 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 attachTo [_cht, [0,0,0]];
|
||||
[_this0, 1, format ["Crate parachuted at: %1 / Grid: %2", (getPosATL _crate), mapGridPosition (getPosATL _crate)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
[_crate, _ln, _lp] ExecVM "exile_vemf_reloaded\sqf\loadLoot.sqf";
|
||||
waitUntil { if (((getPos _crate) select 2) < 7) then {true} else {uiSleep 1; false} };
|
||||
detach _crate;
|
||||
} 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";
|
||||
};
|
||||
};
|
||||
if (_useChute isEqualTo 0) then
|
||||
} else
|
||||
{
|
||||
_crate = createVehicle [_box, _pos, [], 0, "NONE"];
|
||||
_crate = createVehicle [_bx, _ps, [], 0, "NONE"];
|
||||
_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;
|
||||
} else
|
||||
@ -126,308 +124,258 @@ if (VEMFrInvasionCount <= (([[_missionName],["maxInvasions"]] call VEMFr_fnc_get
|
||||
};
|
||||
};
|
||||
|
||||
// Usage: POSITION, Radius
|
||||
_playerNear = [_locPos, 800] call VEMFr_fnc_waitForPlayers;
|
||||
if _playerNear then
|
||||
{ // Player is Near, so Spawn the Units
|
||||
_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 ([_lp, 800] call VEMFr_fnc_waitForPlayers) 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;
|
||||
_nts = [];
|
||||
{
|
||||
if (_spawned isEqualTypeArray [[],[]]) then
|
||||
[_x] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
|
||||
{
|
||||
private ["_units","_groups","_cal50s"];
|
||||
_units = [];
|
||||
_groups = _spawned select 0;
|
||||
{
|
||||
[_x] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
|
||||
{
|
||||
_units pushBack _x;
|
||||
} forEach (units _x);
|
||||
} forEach _groups;
|
||||
_cal50s = _spawned select 1;
|
||||
_nts pushBack _x;
|
||||
} forEach (units _x);
|
||||
} forEach (_spwnd select 0);
|
||||
|
||||
private ["_heliUnits"];
|
||||
_heliPatrolSettings = ([[_missionName],["heliPatrol"]] call VEMFr_fnc_getSetting) select 0;
|
||||
if (_heliPatrolSettings select 0 isEqualTo 1) then
|
||||
{ // If heliPatrol setting is enabled
|
||||
[_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);
|
||||
if (_classToSpawn isKindOf "Air") then
|
||||
_cl50s = _spwnd select 1;
|
||||
|
||||
([[_this0,"heliPatrol"],["enabled","classes","locked"]] call VEMFr_fnc_config) params ["_hp0","_hp1","_hp2"];
|
||||
if (_hp0 > 0) then
|
||||
{
|
||||
[_this0, 1, format["Adding a heli patrol to the invasion of %1 at %2", _ln, mapGridPosition _lp]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
_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 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
|
||||
_heli lock true;
|
||||
};
|
||||
|
||||
_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;
|
||||
};
|
||||
_turrets = allTurrets [_heli, false];
|
||||
_spawnHeliGroup = [_locPos, 1, ((count _turrets) + (_heli emptyPositions "commander") + 1), _mode, _missionName] call VEMFr_fnc_spawnVEMFrAI;
|
||||
if (_spawnHeliGroup isEqualType []) then
|
||||
_x moveInDriver _heli;
|
||||
} else
|
||||
{
|
||||
_heliGroup = _spawnHeliGroup select 0;
|
||||
_heliUnits = units _heliGroup;
|
||||
private ["_path"];
|
||||
{
|
||||
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
|
||||
{
|
||||
private ["_path"];
|
||||
{
|
||||
_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
|
||||
if ((_heli emptyPositions "commander") > 0) then
|
||||
{
|
||||
_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 isNil "_crate" then
|
||||
{
|
||||
if not isNull _crate then
|
||||
if not(backPack _x isEqualTo "") then
|
||||
{
|
||||
if not ([getPos _crate, 3] call VEMFr_fnc_checkPlayerPresence) then
|
||||
{
|
||||
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";
|
||||
removeBackpack _x;
|
||||
};
|
||||
_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
|
||||
{
|
||||
[_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
|
||||
if not isNil "_minesPlaced" then
|
||||
["DynamicLocationInvasion", 1, format["mission in %1 has been completed!", _ln]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
|
||||
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));
|
||||
[(_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;
|
||||
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
|
||||
if (_streetLightsRestore isEqualTo 1) then
|
||||
{
|
||||
private ["_all"];
|
||||
_all = nearestObjects [_locPos, ["Lamps_Base_F","PowerLines_base_F","Land_PowerPoleWooden_L_F"], _streetLightsRange];
|
||||
{
|
||||
if (damage _x > 0.94) then
|
||||
{
|
||||
_x setDamage 0;
|
||||
uiSleep (1 + (random 2));
|
||||
};
|
||||
} forEach _all;
|
||||
_mnsPlcd = nil;
|
||||
};
|
||||
if (_ms18 isEqualTo 1) then
|
||||
{
|
||||
[_mnsPlcd] spawn
|
||||
{
|
||||
{
|
||||
if not(isNull _x) then { deleteVehicle _x };
|
||||
} forEach (_this select 0);
|
||||
};
|
||||
|
||||
[_this0, 1, format["Successfully deleted all %1 mines at %2", count _mnsPlcd, _ln]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
};
|
||||
};
|
||||
} else
|
||||
{
|
||||
[-1, "CRITICAL ERROR", format["Failed to spawn AI in %1 @ %2", _locName, mapGridPosition (_locPos)]] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
|
||||
breakOut "outer";
|
||||
};
|
||||
|
||||
// If enabled, fix all the lights
|
||||
if (_ms9 isEqualTo 1) then
|
||||
{
|
||||
{
|
||||
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
|
||||
{ // 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";
|
||||
if not isNil "_marker" then { deleteMarker _marker };
|
||||
_usedLocs = uiNamespace getVariable "VEMFrUsedLocs";
|
||||
_index = _usedLocs find _loc;
|
||||
if (_index > -1) then
|
||||
{
|
||||
_usedLocs deleteAt _index;
|
||||
};
|
||||
[_this0, 1, format["Invasion of %1 @ %2 timed out.", _ln, mapGridPosition _lp]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
if not(isNil "_mrkr") then { deleteMarker _mrkr };
|
||||
_arr = uiNamespace getVariable "VEMFrUsedLocs";
|
||||
_arr deleteAt (_arr find _l);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
VEMFrInvasionCount = VEMFrInvasionCount - 1;
|
||||
VEMFrMissionCount = VEMFrMissionCount - 1;
|
||||
|
@ -12,7 +12,6 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
uiNamespace setVariable ["VEMFrHcLoad", []];
|
||||
while {true} do
|
||||
{
|
||||
if ((count playableUnits) > 0) then
|
||||
@ -23,11 +22,11 @@ while {true} do
|
||||
{
|
||||
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
|
||||
_handle = [_x] ExecVM "exile_vemf_reloaded\sqf\setGroupOwner.sqf";
|
||||
waitUntil { if (scriptDone _handle) then {true} else {uiSleep 0.1; false} };
|
||||
["REMOTEguard",1,format["Transfer attempted. Group (%1) is %2", _x, if (local _x) then {"still local!"} else {"now REMOTE"}]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
_h = [_x] ExecVM "exile_vemf_reloaded\sqf\setGroupOwner.sqf";
|
||||
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";
|
||||
} else
|
||||
{
|
||||
deleteGroup _x;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
VEMF AI Killed by Vampire, rewritten by IT07
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
executed upon AI unit death
|
||||
@ -13,118 +13,125 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
params [["_target",objNull,[objNull]], ["_killer",objNull,[objNull]]];
|
||||
if (isPlayer _killer) then
|
||||
(_this select 0) params [
|
||||
["_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
|
||||
{
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (("punishRoadKills" call VEMFr_fnc_getSetting) isEqualTo 1) then
|
||||
if (("punishRoadKills" call VEMFr_fnc_config) isEqualTo 1) then
|
||||
{
|
||||
_respectDeduct = "respectRoadKillDeduct" call VEMFr_fnc_getSetting;
|
||||
_curRespect = _killer getVariable ["ExileScore", 0];
|
||||
//diag_log text format["_curRespect of _killer (%1) is %2", _killer, _curRespect];
|
||||
_newRespect = _curRespect - _respectDeduct;
|
||||
_killer setVariable ["ExileScore", _newRespect];
|
||||
ExileClientPlayerScore = _newRespect;
|
||||
(owner _killer) publicVariableClient "ExileClientPlayerScore";
|
||||
_pnsh = "respectRoadKillDeduct" call VEMFr_fnc_config;
|
||||
_crRspct = _k getVariable ["ExileScore", 0];
|
||||
//diag_log text format["_crRspct of _k (%1) is %2", _k, _crRspct];
|
||||
_nwRspct = _crRspct - _pnsh;
|
||||
_k setVariable ["ExileScore", _nwRspct];
|
||||
ExileClientPlayerScore = _nwRspct;
|
||||
(owner _k) publicVariableClient "ExileClientPlayerScore";
|
||||
ExileClientPlayerScore = nil;
|
||||
[_killer, "showFragRequest", [[["ROADKILL..."],["Respect Penalty:", -_respectDeduct]]]] call ExileServer_system_network_send_to;
|
||||
format["setAccountMoneyAndRespect:%1:%2:%3", _killer getVariable ["ExileMoney", 0], _newRespect, (getPlayerUID _killer)] call ExileServer_system_database_query_fireAndForget;
|
||||
[_k, "showFragRequest", [[["ROADKILL..."],["Respect Penalty:", -_pnsh]]]] call ExileServer_system_network_send_to;
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
_killer = effectiveCommander _killer;
|
||||
if (("respectReward" call VEMFr_fnc_getSetting) > 0) then
|
||||
_k = effectiveCommander _k;
|
||||
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;
|
||||
_removeLaunchers = _settings select 0;
|
||||
if (_removeLaunchers isEqualTo 1) then
|
||||
([["aiCleanup"],["removeLaunchers","aiDeathRemovalEffect","removeHeadGear"]] call VEMFr_fnc_config) params ["_ms0","_ms1","_ms2"];
|
||||
if (_ms0 isEqualTo 1) then
|
||||
{
|
||||
_secWeapon = secondaryWeapon _target;
|
||||
if not(_secWeapon isEqualTo "") then
|
||||
_sw = secondaryWeapon _t;
|
||||
if not(_sw isEqualTo "") then
|
||||
{
|
||||
_target removeWeaponGlobal _secWeapon;
|
||||
_missiles = getArray (configFile >> "cfgWeapons" >> _secWeapon >> "magazines");
|
||||
_t removeWeaponGlobal _sw;
|
||||
_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
|
||||
{
|
||||
if not(isObjectHidden _target) then
|
||||
if not(isObjectHidden _t) then
|
||||
{
|
||||
_target hideObjectGlobal true;
|
||||
_t hideObjectGlobal true;
|
||||
} else
|
||||
{
|
||||
_target hideObjectGlobal false;
|
||||
_t hideObjectGlobal false;
|
||||
};
|
||||
uiSleep 0.12;
|
||||
};
|
||||
_target hideObjectGlobal true;
|
||||
removeAllWeapons _target;
|
||||
_t hideObjectGlobal true;
|
||||
removeAllWeapons _t;
|
||||
// Automatic cleanup yaaay
|
||||
deleteVehicle _target;
|
||||
deleteVehicle _t;
|
||||
};
|
||||
|
||||
_target removeAllEventHandlers "MPKilled";
|
||||
_t removeAllEventHandlers "MPKilled";
|
||||
|
@ -22,42 +22,39 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
if (_this isEqualType []) then
|
||||
_send =
|
||||
{
|
||||
_broadCast =
|
||||
private ["_arr"];
|
||||
if (count _this isEqualTo 0) then
|
||||
{
|
||||
private ["_arr"];
|
||||
if (count _this isEqualTo 0) then
|
||||
_arr = allPlayers;
|
||||
} else
|
||||
{
|
||||
_arr = _this;
|
||||
};
|
||||
{
|
||||
if (isPlayer _x AND alive _x) then
|
||||
{
|
||||
_arr = allPlayers;
|
||||
} else
|
||||
{
|
||||
_arr = _this;
|
||||
VEMFrMsgToClient = [_msg, _mode];
|
||||
(owner _x) publicVariableClient "VEMFrMsgToClient";
|
||||
};
|
||||
{
|
||||
if (isPlayer _x AND alive _x) then
|
||||
{
|
||||
VEMFrMsgToClient = [_msg, _mode];
|
||||
(owner _x) publicVariableClient "VEMFrMsgToClient";
|
||||
};
|
||||
} forEach _arr;
|
||||
};
|
||||
_targets = param [1, [], [[]]];
|
||||
if (_this select 0 isEqualType []) then // mission notification
|
||||
{
|
||||
_mode = (_this select 0) param [0, -1, [0]];
|
||||
_title = (_this select 0) param [1, "DEFAULT TITLE", [""]];
|
||||
_msgLine = (_this select 0) param [2, "Default message", [""]];
|
||||
_msg = [_mode, _title, _msgLine];
|
||||
_targets call _broadCast;
|
||||
};
|
||||
if (_this select 0 isEqualType "") then // systemchat broadcast
|
||||
{
|
||||
_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";
|
||||
} forEach _arr;
|
||||
};
|
||||
|
||||
_to = param [1, [], [[]]];
|
||||
|
||||
if (_this select 0 isEqualType []) then // mission notification
|
||||
{
|
||||
_mode = (_this select 0) param [0, -1, [0]];
|
||||
_title = (_this select 0) param [1, "DEFAULT TITLE", [""]];
|
||||
_line = (_this select 0) param [2, "Default message", [""]];
|
||||
_msg = [_mode, _title, _line];
|
||||
_to call _send;
|
||||
};
|
||||
|
||||
if (_this select 0 isEqualType "") then // systemchat broadcast
|
||||
{
|
||||
_mode = param [2, "", [""]];
|
||||
_msg = param [0, "", [""]];
|
||||
_to call _send;
|
||||
};
|
||||
|
@ -11,15 +11,15 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
if ("validateLoot" call VEMFr_fnc_getSetting isEqualTo 1) then
|
||||
if ("validateLoot" call VEMFr_fnc_config isEqualTo 1) then
|
||||
{ // _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";
|
||||
} else
|
||||
{
|
||||
["CheckLoot", 1, "Validating loot tables..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
_invalidClasses = [];
|
||||
_bin = [];
|
||||
|
||||
_mags = [];
|
||||
_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);
|
||||
} 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
|
||||
{
|
||||
_invalidClasses pushBack _x;
|
||||
_bin pushBack _x;
|
||||
};
|
||||
} forEach _x;
|
||||
} 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;
|
||||
if not((_class in _mags) OR (_class in _weapons) OR (_class in _bags)) then
|
||||
{
|
||||
_invalidClasses pushBack _x;
|
||||
_bin pushBack _x;
|
||||
};
|
||||
} forEach _x;
|
||||
} 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";
|
||||
} 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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -14,108 +14,117 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
params [["_crate",objNull,[objNull]], ["_locName","",[""]], ["_locPos",[],[[]]]];
|
||||
if not isNull _crate then
|
||||
params [
|
||||
["_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];
|
||||
clearBackpackCargoGlobal _crate;
|
||||
clearItemCargoGlobal _crate;
|
||||
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"];
|
||||
_prim = _primaries call BIS_fnc_selectRandom;
|
||||
if not((_prim select 0) in _blackList) then
|
||||
{
|
||||
private ["_prim"];
|
||||
_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";
|
||||
_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];
|
||||
};
|
||||
};
|
||||
|
||||
["loadLoot", 1, format["Loot loaded into crate located in '%1' at %2", _locName, mapGridPosition _crate]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
|
@ -14,33 +14,36 @@
|
||||
nothing (use spawn, not call)
|
||||
*/
|
||||
|
||||
if (("debugMode" call VEMFr_fnc_getSetting) > 0) then
|
||||
if (("debugMode" call VEMFr_fnc_config) > 0) then
|
||||
{
|
||||
scopeName "outer";
|
||||
private ["_prefix","_type","_line","_doLog"];
|
||||
params [["_prefix","",[""]], ["_type",3,[0]], ["_line","",[""]]];
|
||||
scopeName "_top";
|
||||
params [
|
||||
["_p", "", [""]],
|
||||
["_t", 3, [0]],
|
||||
["_l", "", [""]]
|
||||
];
|
||||
|
||||
_doLog = { diag_log text format["IT07: [VEMFr] %1 -- %2: %3", _prefix, _this, _line] };
|
||||
_debugMode = "debugMode" call VEMFr_fnc_getSetting;
|
||||
if (_type isEqualTo 0) then
|
||||
_do = { diag_log text format["IT07: [VEMFr] %1 -- %2: %3", _p, _this, _l] };
|
||||
_m = "debugMode" call VEMFr_fnc_config;
|
||||
if (_t isEqualTo 0) then
|
||||
{
|
||||
if (_debugMode isEqualTo 1 OR _debugMode isEqualTo 3) then
|
||||
if (_m isEqualTo 1 OR _m isEqualTo 3) then
|
||||
{
|
||||
"ERROR" call _doLog;
|
||||
breakOut "outer";
|
||||
"ERROR" call _do;
|
||||
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;
|
||||
breakOut "outer";
|
||||
"INFO" call _do;
|
||||
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;
|
||||
breakOut "outer";
|
||||
"SYSTEM" call _do;
|
||||
breakOut "_top";
|
||||
};
|
||||
};
|
||||
|
@ -12,76 +12,58 @@
|
||||
*/
|
||||
|
||||
scopeName "outer";
|
||||
_maxGlobalMissions = "maxGlobalMissions" call VEMFr_fnc_getSetting;
|
||||
_minNew = "minNew" call VEMFr_fnc_getSetting;
|
||||
_mgm = "maxGlobalMissions" call VEMFr_fnc_config;
|
||||
["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
|
||||
{
|
||||
_maxNew = "maxNew" call VEMFr_fnc_getSetting;
|
||||
_maxNew = "maxNew" call VEMFr_fnc_config;
|
||||
if (_maxNew > 0) then
|
||||
{
|
||||
_missionList = "missionList" call VEMFr_fnc_getSetting;
|
||||
if (count _missionList > 0) then
|
||||
_ml = "missionList" call VEMFr_fnc_config;
|
||||
if (count _ml > 0) then
|
||||
{
|
||||
_minFps = "minServerFPS" call VEMFr_fnc_getSetting;
|
||||
_minPlayers = "minPlayers" call VEMFr_fnc_getSetting;
|
||||
_minFps = "minServerFPS" call VEMFr_fnc_config;
|
||||
_mnPlyrs = "minPlayers" call VEMFr_fnc_config;
|
||||
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
|
||||
{
|
||||
["missionTimer", 1, format["VEMFr has been forced to start. Server FPS: %1", diag_fps]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
} 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["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;
|
||||
};
|
||||
} else
|
||||
{
|
||||
uiSleep 60; // If no players online, check again in 60 seconds
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
VEMFrMissionCount = 0;
|
||||
_im = false;
|
||||
if (_mgm isEqualTo 0) then { _im = true };
|
||||
_zz = { uiSleep ((_minNew*60)+ floor random ((_maxNew*60)-(_minNew*60))) };
|
||||
call _zz;
|
||||
|
||||
while {true} do
|
||||
{
|
||||
// Pick A Mission if enough players online
|
||||
if ((count allPlayers) >= _mnPlyrs) then
|
||||
{
|
||||
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 };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -14,9 +14,15 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
params [["_missionType",-1,[-1]], ["_title","",[""]], ["_msgLine","",[""]], ["_sendTo",[],[[]]]];
|
||||
if (count _sendTo isEqualTo 0) then { _sendTo = allPlayers };
|
||||
params [
|
||||
["_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";
|
||||
} forEach _sendTo;
|
||||
} forEach _to;
|
||||
|
@ -5,24 +5,21 @@
|
||||
handles the broadcast of a systemChat kill message
|
||||
*/
|
||||
|
||||
params [["_target",objNull,[objNull]], ["_killer",objNull,[objNull]]];
|
||||
_curWeapon = "Weapon";
|
||||
if (vehicle _killer isEqualTo _killer) then // If on foot
|
||||
{
|
||||
_curWeapon = currentWeapon _killer;
|
||||
};
|
||||
if not(vehicle _killer isEqualTo _killer) then // If in vehicle
|
||||
{
|
||||
_curWeapon = currentWeapon (vehicle _killer);
|
||||
};
|
||||
(_this select 0) params [
|
||||
["_t", objNull, [objNull]],
|
||||
["_nt", "", [""]]
|
||||
];
|
||||
(_this select 1) params [
|
||||
["_k", objNull, [objNull]],
|
||||
["_nk", "", [""]]
|
||||
];
|
||||
|
||||
_dist = _target distance _killer;
|
||||
_sayKilled = "sayKilled" call VEMFr_fnc_getSetting;
|
||||
if (_sayKilled isEqualTo 1) then
|
||||
{
|
||||
[format["(VEMFr) %1 [%2, %3m] AI", name _killer, getText(configFile >> "CfgWeapons" >> _curWeapon >> "displayName"), round _dist]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf";
|
||||
};
|
||||
if (_sayKilled isEqualTo 2) then
|
||||
{
|
||||
[format["(VEMFr) You [%1, %2m] AI", getText(configFile >> "CfgWeapons" >> _curWeapon >> "displayName"), round _dist]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf";
|
||||
};
|
||||
|
||||
_crWpn = "Weapon";
|
||||
if (vehicle _k isEqualTo _k) then { _crWpn = currentWeapon _k };
|
||||
if not(vehicle _k isEqualTo _k) then { _crWpn = currentWeapon (vehicle _k) };
|
||||
_dist = _t distance _k;
|
||||
|
||||
_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" };
|
||||
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" };
|
||||
|
@ -12,50 +12,33 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
_toTransfer = param [0, grpNull, [grpNull]];
|
||||
if not(isNull _toTransfer) then
|
||||
_grp = param [0, grpNull, [grpNull]];
|
||||
if not(isNull _grp) then
|
||||
{
|
||||
// Check if HC is enabled
|
||||
_hcEnabled = "headLessClientSupport" call VEMFr_fnc_getSetting;
|
||||
_forceClients = uiNamespace getVariable ["VEMFr_forceAItoClients", nil];
|
||||
if not(isNil "_forceClients") then
|
||||
{
|
||||
if (_forceClients isEqualType true) then
|
||||
{
|
||||
if _forceClients then
|
||||
{
|
||||
_hcEnabled = -1;
|
||||
};
|
||||
};
|
||||
};
|
||||
_hcNbld = "headLessClientSupport" call VEMFr_fnc_config;
|
||||
_force = uiNamespace getVariable ["VEMFr_forceAItoClients", nil];
|
||||
if not(isNil "_force") then { if (_force isEqualType true) then { if _force then { _hcNbld = -1 } } };
|
||||
|
||||
private ["_to"];
|
||||
if (_hcEnabled isEqualTo 1) then
|
||||
{ // Gather the Headless Client(s)
|
||||
_hcClients = [];
|
||||
if (_hcNbld isEqualTo 1) then
|
||||
{
|
||||
_arr = [];
|
||||
{
|
||||
if (typeOf _x isEqualTo "HeadlessClient_F") then // it is an HC
|
||||
{
|
||||
_hcClients pushBack [_x, owner _x];
|
||||
};
|
||||
if (typeOf _x isEqualTo "HeadlessClient_F") then { _arr pushBack [_x, owner _x] };
|
||||
} forEach allPlayers;
|
||||
if (count _hcClients > 0) then
|
||||
{
|
||||
_to = call VEMFr_fnc_headlessClient; // Select a random hc
|
||||
} else
|
||||
{
|
||||
uiNamespace setVariable ["VEMFr_forceAItoClients", true];
|
||||
};
|
||||
|
||||
if (count _arr > 0) then { _to = call VEMFr_fnc_hc } else { uiNamespace setVariable ["VEMFr_forceAItoClients", true] };
|
||||
} else // If Headlessclient setting is not enabled
|
||||
{
|
||||
if ((count allPlayers) > 0) then
|
||||
{
|
||||
_distanceToX = worldSize;
|
||||
_distToX = worldSize;
|
||||
{
|
||||
_dist = _x distance (leader _toTransfer);
|
||||
if (_dist <= _distanceToX) then
|
||||
_dist = _x distance (leader _grp);
|
||||
if (_dist <= _distToX) then
|
||||
{
|
||||
_distanceToX = _dist;
|
||||
_distToX = _dist;
|
||||
_to = _x;
|
||||
};
|
||||
} forEach allPlayers;
|
||||
@ -64,26 +47,7 @@ if not(isNull _toTransfer) then
|
||||
|
||||
if not(isNil "_to") then
|
||||
{
|
||||
(uiNamespace getVariable ["VEMFrHcLoad", nil]) pushBack _to;
|
||||
_transfer = _toTransfer setGroupOwner (owner _to);
|
||||
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";
|
||||
_grp setGroupOwner (owner _to);
|
||||
waitUntil { if not(local _grp) then {true} else {uiSleep 0.1; false} };
|
||||
};
|
||||
} else
|
||||
{
|
||||
["setGroupOwner",0,"Can not transfer a non-existent group!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
|
@ -12,4 +12,4 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
(param [0, grpNull, [grpNull]]) setVariable ["isVEMFrGroup",true,false];
|
||||
(param [0, grpNull, [grpNull]]) setVariable ["isVEMFrGroup",true,true];
|
||||
|
@ -11,14 +11,12 @@
|
||||
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";
|
||||
_settings = [["aiStatic"],["positions","amount"]] call VEMFr_fnc_getSetting;
|
||||
_positions = _settings select 0;
|
||||
([["aiStatic"],["positions","amount"]] call VEMFr_fnc_config) params ["_s0","_s1"];
|
||||
["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;
|
||||
} forEach _positions;
|
||||
[_x, 2, _s1 select _foreachindex, ("aiMode" call VEMFr_fnc_config), "Static"] spawn VEMFr_fnc_spawnVEMFrAI;
|
||||
} forEach _s0;
|
||||
};
|
||||
|
@ -9,9 +9,13 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
params [["_line","",[""]], ["_sendTo",[],[[]]]];
|
||||
if (_sendTo isEqualTo []) then { _sendTo = allPlayers };
|
||||
params [
|
||||
["_line", "", [""]],
|
||||
["_to", [], [[]]]
|
||||
];
|
||||
|
||||
if (_to isEqualTo []) then { _to = allPlayers };
|
||||
{
|
||||
VEMFrMsgToClient = [_line, "sys"];
|
||||
(owner _x) publicVariableClient "VEMFrMsgToClient";
|
||||
} forEach _sendTo;
|
||||
} forEach _to;
|
||||
|
Loading…
Reference in New Issue
Block a user