This commit is contained in:
IT07 2016-06-02 23:18:27 +02:00
parent 20d883973c
commit 7b9a321a09
18 changed files with 0 additions and 1770 deletions

View File

@ -1,36 +0,0 @@
/*
Author: IT07
Description:
checks for players within given distance of given location/position
Params:
_this select 0: POSITION - center of area to check around
_this select 1: SCALAR - radius around the position to check for players
Returns:
BOOL - true if player(s) found
*/
private ["_pos","_found"];
// By default, we assume that there are no players close. The distance check below should prove otherwise if there are players close
_found = false;
_pos = param [0, [], [[]]];
if (count _pos isEqualTo 3) then
{
private ["_rad"];
_rad = param [1, -1, [0]];
if (_rad > -1) then
{ // Check all player distances from _loc
{
if (isPlayer _x AND speed _x < 250) then
{
private ["_isClose"];
_isClose = if ((position _x distance _pos) < _rad) then { true } else { false };
if _isClose then { _found = true };
};
} forEach allPlayers;
};
};
_found

View File

@ -1,52 +0,0 @@
/*
Author: IT07
Description: checks the side of given unit and returns it
Params:
_this: STRING - unit classname
Returns: SIDE - unit's side
*/
private ["_return"];
if (_this isEqualType "") then
{
private ["_faction"];
_faction = getText (configFile >> "CfgVehicles" >> _this >> "faction");
if not(_faction isEqualTo "") then
{
scopeName "isNull";
if (_faction isEqualTo "BLU_G_F") then
{
_return = WEST;
breakOut "isNull";
};
if (_faction isEqualTo "CIV_F") then
{
_return = civilian;
breakOut "isNull";
};
if (_faction isEqualTo "IND_F") then
{
_return = independent;
breakOut "isNull";
};
if (_faction isEqualTo "IND_G_F") then
{
_return = resistance;
breakOut "isNull";
};
if (_faction isEqualTo "OPF_G_F") then
{
_return = 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
{
_return
};
};

View File

@ -1,246 +0,0 @@
/*
Author: IT07
Description:
can find a location or pos randomly on the map where there are no players
Params:
_this select 0: STRING - Mode to use. Options: "loc" or "pos"
_this select 1: BOOLEAN - True if _pos needs to be a road
_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 6: STRING (optional) - Exact config name of mission override settings to load
Returns:
if mode = loc: LOCATION
if mode = pos: POSITION
*/
private ["_ret","_settings","_nonPopulated","_blackPos","_missionDistance","_range","_missionConfigName"];
_ret = false;
// Define settings
_settings = [["nonPopulated","noMissionPos","missionDistance"]] call VEMFr_fnc_getSetting;
_nonPopulated = _settings param [0, 1, [0]];
_blackPos = _settings param [1, [], [[]]];
_missionDistance = _settings param [2, 3000, [0]];
_range = worldSize;
// Settings override system
_missionConfigName = param [6, "", [""]];
if not(_missionConfigName isEqualTo "") then
{
private ["_nonPopulatedOverride"];
_nonPopulatedOverride = ([[_missionConfigName],["nonPopulated"]] call VEMFr_fnc_getSetting) select 0;
if not isNil"_nonPopulatedOverride" then
{
if not(_nonPopulatedOverride isEqualTo -1) then
{
_nonPopulated = _nonPopulatedOverride;
};
};
};
private ["_checkBlackPos"];
_checkBlackPos = false;
if (count _blackPos > 0) then
{
_checkBlackPos = true;
};
private ["_mode"];
_mode = param [0, "", [""]];
if not(_mode isEqualTo "") then
{
private ["_onRoad","_roadRange","_cntr"];
_onRoad = param [1, false, [false]];
_roadRange = 5000;
_cntr = param [2, [], [[]]];
if (_cntr isEqualTypeArray [0,0,0]) then
{
private ["_tooCloseRange"];
_tooCloseRange = param [3, -1, [0]];
if (_tooCloseRange > -1) then
{
private ["_maxPrefered"];
_maxPrefered = param [4, -1, [0]];
if (_maxPrefered > -1) then
{
private ["_skipDistance"];
_skipDistance = param [5, -1, [0]];
if (_skipDistance > -1) then
{
if (_mode isEqualTo "loc") then
{
// Get a list of locations close to _cntr (position of player)
private ["_locs"];
_locs = nearestLocations [_cntr, ["CityCenter","Strategic","StrongpointArea","NameVillage","NameCity","NameCityCapital",if(_nonPopulated isEqualTo 1)then{"nameLocal","Area","BorderCrossing","Hill","fakeTown","Name","RockArea","ViewPoint"}], _range];
if (count _locs > 0) then
{
private ["_usedLocs","_remLocs","_blackListMapClasses","_listedMaps"];
_usedLocs = uiNamespace getVariable "VEMFrUsedLocs";
_remLocs = [];
_blackListMapClasses = "true" configClasses (configFile >> "CfgVemfReloaded" >> "locationBlackLists");
_listedMaps = []; // Define
{ // Make a list of locationBlackLists's children
_listedMaps pushBack (configName _x);
} forEach _blackListMapClasses;
private ["_blackList"];
if (worldName in _listedMaps) then { _blackList = ([["locationBlackLists", worldName],["locations"]] call VEMFr_fnc_getSetting) select 0 }
else { _blackList = ([["locationBlackLists","Other"],["locations"]] call VEMFr_fnc_getSetting) select 0 };
{ // Check _locs for invalid locations (too close, hasPlayers or inBlacklist)
private ["_hasPlayers"];
_hasPlayers = [locationPosition _x, _skipDistance] call VEMFr_fnc_checkPlayerPresence;
if _hasPlayers then
{
_remLocs pushBack _x;
} else
{
if _checkBlackPos then
{
private ["_locPos","_loc"];
_locPos = locationPosition _x;
_loc = _x;
{
if (count _x isEqualTo 2) 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";
};
} 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;
};
};
};
if (count _usedLocs > 0) then
{
private ["_loc"];
_loc = _x;
{
if (((locationPosition _loc) distance (locationPosition _x)) < _missionDistance) then
{
_remLocs pushBack _loc;
};
} forEach _usedLocs;
};
};
} 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
{
_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
{
_loc = selectRandom _far;
};
};
// 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
{
if (_ret isEqualType true) 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;
};
};
};
};
};
};
};
};
};
};
_ret

View File

@ -1,104 +0,0 @@
/*
Author: IT07
Description:
gets config value of given var from VEMF config OR cfgPath
Params:
method 1:
_this: STRING - SINGLE config value to get from root of CfgVemfReloaded
method 2:
_this select 0: ARRAY of STRINGS - MULTIPLE config values to get from root of VEMFconfig
method 3:
_this select 0: ARRAY of STRINGS - config path to get value from. Example: "root","subclass"
_this select 1: ARRAY of STRINGS - MULTIPLE config values to get from given path
Returns:
ARRAY - Result
*/
private["_r","_check","_v"];
_r = [];
_check =
{
if (isNumber _cfg) then
{
_v = getNumber _cfg
} else
{
if (isText _cfg) then
{
_v = getText _cfg
} else
{
if (isArray _cfg) then
{
_v = getArray _cfg
};
};
};
};
if (_this isEqualType "") then
{
private ["_cfg"];
if (isNull (configFile >> "CfgVemfReloadedOverrides" >> _this)) then
{
_cfg = configFile >> "CfgVemfReloaded" >> _this;
} else
{
_cfg = configFile >> "CfgVemfReloadedOverrides" >> _this;
};
call _check;
if not isNil"_v" then
{
_r = _v;
};
};
if (_this isEqualType []) then
{
if (_this isEqualTypeArray [[],[]]) then
{
private ["_path","_build"];
_path = _this select 0;
_build =
{
{
_cfg = _cfg >> _x;
} forEach _path;
};
private ["_cfg"];
{
_cfg = configFile >> "CfgVemfReloadedOverrides";
call _build;
_cfg = _cfg >> _x;
if (isNull _cfg) then
{
_cfg = configFile >> "CfgVemfReloaded";
call _build;
_cfg = _cfg >> _x;
};
call _check;
if not isNil"_v" then
{
_r pushBack _v
};
} forEach (_this select 1);
};
if (_this isEqualTypeArray [[]]) then
{
private ["_cfg"];
{
_cfg = configFile >> "CfgVemfReloadedOverrides" >> _x;
if (isNull _cfg) then
{
_cfg = configFile >> "CfgVemfReloaded" >> _x;
};
call _check;
_r pushBack _v;
} forEach (_this select 0);
};
};
_r

View File

@ -1,77 +0,0 @@
/*
Author: IT07
Description:
Adds magazines to given unit's vest/backpack if it flairTypes
Params:
_this: ARRAY
_this select 0: OBJECT - unit to give ammo to
_this select 1: STRING - primaryWeapon classname
_this select 2: STRING - secondaryWeapon classname
_this select 3: STRING - handGunWeapon classname
Returns:
BOOLEAN - true if successful
*/
private ["_done"];
_done = false;
if (_this isEqualType []) then
{
private ["_unit"];
_unit = param [0, objNull, [objNull]];
_classPrimary = param [1, "", [""]];
_classSecondary = param [2, "", [""]];
_classHandgun = param [3, "", [""]];
if not isNull _unit then
{
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";
};
} else
{
["fn_giveAmmo", 0, "_this is not an ARRAY"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
_done

View File

@ -1,79 +0,0 @@
/*
Author: IT07
Description:
Gives random weapon attachments to given unit
Params:
_this: ARRAY
_this select 0: OBJECT - unit
Returns: BOOLEAN - true if no errors occured
*/
private ["_done"];
_done = false;
if (_this isEqualType []) 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["_indexes"];
_indexes = [];
{
if (_x find "tws" > -1) then
{
_indexes pushBack _forEachIndex;
} else
{
if (_x find "TWS" > -1) then
{
_indexes pushBack _forEachIndex;
};
};
} forEach _scopes;
{
_scopes deleteAt _x;
} forEach _indexes;
};
_unit addPrimaryWeaponItem (selectRandom _scopes);
};
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;
};
};
_done

View File

@ -1,65 +0,0 @@
/*
Author: IT07
Description:
selects a headless client with least (VEMFr) load
Params:
None
Returns:
OBJECT - the headless client
*/
private ["_hasLowest"];
if (("headLessClientSupport" call VEMFr_fnc_getSetting) isEqualTo 1) then
{ // Ok, Headless Clients enabled. let us continue
private ["_hcList","_ingameHCs"];
_hcList = "headLessClientNames" call VEMFr_fnc_getSetting;
// We have the names now, check if any of them is actually ingame
_ingameHCs = [];
{
if (side _x isEqualTo sideLogic AND _x in _hcList) then
{
_ingameHCs pushBack [_x, name _x];
};
} forEach allPlayers;
if (count _ingameHCs > 0) then
{ // At least 1 of given headless clients is ingame, lets check their load
private ["_globalLoad","_lowestLoad","_hasLowest"];
_globalLoad = uiNamespace getVariable "VEMFrHcLoad";
_lowestLoad = 99999;
_hasLowest = "";
private ["_load"];
{ // Find the lowest load number
_load = _x select 1;
if (_load < _lowestLoad) then
{
_lowestLoad = _load;
_hasLowest = _x select 0;
};
} forEach _globalLoad;
private ["_index"];
// HC with lowest load found, add +1 to its current load
_index = _globalLoad find [_hasLowest, _lowestLoad];
if (_index > -1) then
{
_globalLoad set [_index,[_hasLowest, _lowestLoad +1]]
};
} else
{
["fn_headlessClient", 0, "Unable to find any ingame Headless Client(s)"] spawn VEMFr_fnc_log;
};
} else
{
["fn_headLessClient", 0, "Can not run. headLessClientSupport is not enabled"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
// Lowest load found, send it
if not isNil"_hasLowest" then
{
_hasLowest
} else
{
["fn_headlessClient", 0, "Unable to find HC with lowest load..."] spawn VEMFr_fnc_log;
};

View File

@ -1,53 +0,0 @@
/*
Author: IT07
Description:
launches VEMFr (You don't say?)
*/
["Launcher", 2, format["/// STARTING 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", []];
[] spawn
{
if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then
{
_root = configProperties [configFile >> "CfgVemfReloadedOverrides", "true", false];
{
if (isClass _x) then
{
_classLv1Name = configName _x;
_levelOne = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _classLv1Name, "true", false];
{
if (isClass _x) then
{
_classLv2Name = configName _x;
_levelTwo = configProperties [configFile >> "CfgVemfReloadedOverrides" >> _classLv1Name >> _classLv2Name, "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";
};
} forEach _levelTwo;
} else
{
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1 >> %2", _classLv1Name, configName _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
} forEach _levelOne;
} else
{
["overridesToRPT", 1, format["Overriding 'CfgVemfReloaded >> %1'", configName _x]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
} forEach _root;
};
_scripts = ["checkLoot","missionTimer","REMOTEguard","spawnStaticAI"];
{
ExecVM format["exile_vemf_reloaded\sqf\%1.sqf", _x];
} forEach _scripts;
west setFriend [independent, 0];
independent setFriend [west, 0];
};

View File

@ -1,240 +0,0 @@
/*
Author: VAMPIRE, rebooted by IT07
Description:
loads AI inventory
Param:
_this: ARRAY
_this select 0: ARRAY - units to load inventory for
_this select 1: STRING - must be in missionList
_this select 2: SCALAR - inventory mode
Returns:
BOOLEAN - true if nothing failed
*/
private ["_ok","_params"];
_ok = false;
_params = _this;
if (_this isEqualType []) then
{
private ["_units"];
_units = param [0, [], [[]]];
if (count _units > 0) then
{
private ["_missionName"];
_missionName = param [1, "", [""]];
if (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static") then
{
scopeName "this";
private ["_aiMode"];
_aiMode = param [2, 0, [0]];
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 ["_unit","_gear","_ammo"];
_unit = _x;
// Strip it
removeAllWeapons _unit;
removeAllItems _unit;
if ("removeAllAssignedItems" call VEMFr_fnc_getSetting isEqualTo 1) then
{
removeAllAssignedItems _unit;
};
removeVest _unit;
removeBackpack _unit;
removeGoggles _unit;
removeHeadGear _unit;
if (count _uniforms > 0) 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;
};
};
// 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;
_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 (_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;
};
};
};
};
_ok

View File

@ -1,146 +0,0 @@
/*
Author: IT07
Description:
loads loot crate inventory
Params:
_this: ARRAY
_this select 0: OBJECT - the crate
Returns:
BOOL - true if everything went ok
*/
private ["_ok","_crate"];
_ok = false;
_crate = param [0, objNull, [objNull]];
if not isNull _crate then
{
_crate setVariable ["VEMFrCrate", 1, true];
clearBackpackCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
private ["_settings"];
_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;
private [
"_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"
];
_maxPrim = _settings select 0;
_minPrim = _settings select 1;
_maxSec = _settings select 2;
_minSec = _settings select 3;
_maxMagSlots = _settings select 4;
_minMagSlots = _settings select 5;
_maxAttSlots = _settings select 6;
_minAttSlots = _settings select 7;
_maxItemSlots = _settings select 8;
_minItemSlots = _settings select 9;
_maxVestSlots = _settings select 10;
_minVestSlots = _settings select 11;
_maxHeadGearSlots = _settings select 12;
_minHeadGearSlots = _settings select 13;
_maxBagSlots = _settings select 14;
_minBagSlots = _settings select 15;
_primaries = _settings select 16;
_secondaries = _settings select 17;
_magazines = _settings select 18;
_attachments = _settings select 19;
_items = _settings select 20;
_vests = _settings select 21;
_backpacks = _settings select 22;
_headGear = _settings select 23;
_blackList = _settings select 24;
// 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
{
_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];
};
};
_ok = true;
};
_ok

View File

@ -1,69 +0,0 @@
/*
Author: IT07
Description:
places mines around given position within given radius
Params:
_this select 0: POSITION - center of area to place mines around
_this select 1: SCALAR - the minimum distance
_this select 2: SCALAR - the maximum distance (must be higher than minimum of course)
_this select 3: STRING - exact config name of mission
Returns:
ARRAY - array containing all mine objects
*/
private ["_ok","_mineSetting","_missionName"];
_ok = false;
_missionName = param [3, "", [""]];
if (_missionName in ("missionList" call VEMFr_fnc_getSetting)) then
{
scopeName "main";
private ["_mineSetting"];
_mineSetting = ([[_missionName],["mines"]] call VEMFr_fnc_getSetting) select 0;
if (_mineSetting > 0) then
{
private ["_pos"];
_pos = param [0, [], [[]]];
if (count _pos isEqualTo 3) then
{
private ["_min"];
_min = param [1, -1, [0]];
if (_min > -1) then
{
private ["_max"];
_max = param [2, -1, [0]];
if (_max > _min) then
{
private ["_amount"];
_amount = ([[_missionName],["minesAmount"]] call VEMFr_fnc_getSetting) select 0;
if (_amount > -1) then
{
private ["_mineTypes"];
if (_mineSetting isEqualTo 1) then { _mineTypes = ["ATMine"] };
if (_mineSetting isEqualTo 2) then { _mineTypes = ["APERSMine"] };
if (_mineSetting isEqualTo 3) then { _mineTypes = ["ATMine","APERSMine"] };
if (_mineSetting < 1 OR _mineSetting > 3) then
{
["fn_placeMines", 0, "Invalid mines mode!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "main"
};
_mines = [];
["fn_placeMines", 1, format["Placing %1 mines at %2", _amount, _pos]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
for "_m" from 1 to _amount do
{
private ["_mine"];
_mine = createMine [selectRandom _mineTypes, ([_pos, _min, _max, 2, 0, 20, 0] call BIS_fnc_findSafePos), [], 0];
uiSleep 0.1;
_mines pushBack _mine;
};
_ok = [_mines];
};
};
};
};
};
};
_ok

View File

@ -1,33 +0,0 @@
/*
Author: IT07
Description:
checks if player count is above or equal to given number. If no number given, default of 1 will be used.
Params:
none
Returns:
ARRAY - [false if current player count is below minimum, true if (more than OR equalTo) minimum]
*/
private ["_ok"];
_ok = false;
if (_this isEqualType []) then
{
private ["_minimum"];
_minimum = param [0, 1, [0]];
_players = 0;
{
if (isPlayer _x) then
{
_players = _players + 1;
};
} forEach allPlayers;
if (_players >= _minimum) then
{
_ok = true
};
};
_ok

View File

@ -1,27 +0,0 @@
/*
Author: IT07
Description:
marks given group(!) as VEMF AI which will then be used by REMOTEguard for monitor of groupOwner
Params:
_this: ARRAY
_this select 0: GROUP - group to sign as VEMF AI
Returns:
BOOL - true if OK
*/
private ["_ok","_group"];
_ok = false;
_group = param [0, grpNull, [grpNull]];
if not isNull _group then
{
(uiNamespace getVariable ["VEMFrAIgroups",[]]) pushBack _group;
{
_x setVariable ["VEMFrAIunit", 1, true];
} forEach (units _group);
_ok = true
};
_ok

View File

@ -1,216 +0,0 @@
/*
Author: original by Vampire, completely rewritten by IT07
Description:
spawns AI using given _pos and unit/group count.
Params:
_this select 0: POSITION - where to spawn the units around
_this select 1: SCALAR - how many groups to spawn
_this select 2: SCALAR - how many units to put in each group
_this select 3: SCALAR - AI mode
_this select 4: STRING - exact config name of mission
_this select 5: SCALAR (optional) - maximum spawn distance from center
Returns:
ARRAY format [[groups],[50cals]]
*/
private ["_spawned","_pos"];
_spawned = [[],[]];
_pos = param [0, [], [[]]];
if (count _pos isEqualTo 3) then
{
private ["_grpCount"];
_grpCount = param [1, 1, [0]];
if (_grpCount > 0) then
{
private ["_unitsPerGrp"];
_unitsPerGrp = param [2, 1, [0]];
if (_unitsPerGrp > 0) then
{
private ["_mode","_missionName"];
_mode = param [3, -1, [0]];
_missionName = param [4, "", [""]];
if (_missionName in ("missionList" call VEMFr_fnc_getSetting)) then
{
private [
"_maxRange","_sldrClass","_groups","_hc","_aiDifficulty","_skills","_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime",
"_courage","_reloadSpd","_commanding","_general","_houses","_notTheseHouses","_goodHouses","_noHouses","_cal50s","_units"
];
_maxRange = param [5, 175, [0]];
_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;
_accuracy = _skills select 0;
_aimShake = _skills select 1;
_aimSpeed = _skills select 2;
_stamina = _skills select 3;
_spotDist = _skills select 4;
_spotTime = _skills select 5;
_courage = _skills select 6;
_reloadSpd = _skills select 7;
_commanding = _skills select 8;
_general = _skills select 9;
_houses = nearestTerrainObjects [_pos, ["House"], _maxRange]; // Find some houses to spawn in
_notTheseHouses = "housesBlackList" call VEMFr_fnc_getSetting;
_goodHouses = [];
{ // Filter the houses that are too small for one group
if not(typeOf _x in _notTheseHouses) then
{
if ([_x, _unitsPerGrp] call BIS_fnc_isBuildingEnterable) then
{
_goodHouses pushBack _x;
};
};
} forEach _houses;
_goodHouses = _goodHouses call BIS_fnc_arrayShuffle;
_noHouses = false;
if (count _goodHouses < _grpCount) then
{
_noHouses = true;
};
_cal50s = [["DynamicLocationInvasion"],["cal50s"]] call VEMFr_fnc_getSetting param [0, 3, [0]];
if (_cal50s > 0) then
{
_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 (count _goodHouses < 1) then
{
_noHouses = true
};
};
private ["_groupSide"];
_groupSide = ("unitClass" call VEMFr_fnc_getSetting) call VEMFr_fnc_checkSide;
if not isNil"_groupSide" then
{
private ["_grp"];
_grp = createGroup _groupSide;
(_spawned select 0) pushBack _grp;
_grp allowFleeing 0;
private ["_house","_housePositions"];
if not _noHouses 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
{
private ["_spawnPos","_hmg"];
if _noHouses then
{
_spawnPos = [_pos,20,_maxRange,1,0,200,0] call BIS_fnc_findSafePos; // Find Nearby Position
} else
{
_spawnPos = selectRandom _housePositions;
if not _placed50 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;
};
};
};
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
{
["fn_spawnInvasionAI", 0, "failed to load AI's inventory..."] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
_groups pushBack _grp; // Push it into the _groups array
};
};
if (count _groups isEqualTo _grpCount) 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;
};
};
};
};
};
};
_spawned

View File

@ -1,129 +0,0 @@
/*
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
Params:
_this select 0: POSITION - where to spawn the units around
_this select 1: SCALAR - how many groups to spawn
_this select 2: SCALAR - how many units to put in each group
_this select 3: SCALAR - AI mode
_this select 4: STRING - exact config name of mission
_this select 5: SCALAR - (optional) altitude to create units at
_this select 6: SCALAR - (optional) spawn radius
Returns:
ARRAY with group(s)
*/
private ["_spawned","_allUnits","_pos"];
_spawned = [];
_allUnits = [];
_pos = param [0, [], [[]]];
if (_pos isEqualTypeArray [0,0,0]) then
{
scopeName "outer";
private ["_grpCount"];
_grpCount = param [1, 1, [0]];
if (_grpCount > 0) then
{
private ["_unitsPerGrp"];
_unitsPerGrp = param [2, 1, [0]];
if (_unitsPerGrp > 0) then
{
private ["_mode","_missionName"];
_mode = param [3, -1, [0]];
_missionName = param [4, "", [""]];
if (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static") then
{
_altitude = param [5, 0, [0]];
if not(_altitude isEqualTo 0) then
{
_pos = [_pos select 0, _pos select 1, _altitude];
};
_spawnRadius = param [6, 20, [0]];
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;
_accuracy = _skills select 0;
_aimShake = _skills select 1;
_aimSpeed = _skills select 2;
_stamina = _skills select 3;
_spotDist = _skills select 4;
_spotTime = _skills select 5;
_courage = _skills select 6;
_reloadSpd = _skills select 7;
_commanding = _skills select 8;
_general = _skills select 9;
_units = []; // Define units array. the for loops below will fill it with units
for "_g" from 1 to _grpCount do // Spawn Groups near Position
{
private ["_groupSide"];
_groupSide = ("unitClass" call VEMFr_fnc_getSetting) call VEMFr_fnc_checkSide;
if not isNil"_groupSide" then
{
private["_grp"];
_grp = createGroup _groupSide;
_grp allowFleeing 0;
for "_u" from 1 to _unitsPerGrp do
{
private ["_unit"];
_unit = _grp createUnit [_sldrClass, _pos, [], _spawnRadius, "FORM"]; // Create Unit There
_allUnits pushBack _unit;
_unit addMPEventHandler ["mpkilled","if (isDedicated) then { [_this select 0, _this select 1] ExecVM 'exile_vemf_reloaded\sqf\aiKilled.sqf' }"];
// Set skills
_unit setSkill ["aimingAccuracy", _accuracy];
_unit setSkill ["aimingShake", _aimShake];
_unit setSkill ["aimingSpeed", _aimSpeed];
_unit setSkill ["endurance", _stamina];
_unit setSkill ["spotDistance", _spotDist];
_unit setSkill ["spotTime", _spotTime];
_unit setSkill ["courage", _courage];
_unit setSkill ["reloadSpeed", _reloadSpd];
_unit setSkill ["commanding", _commanding];
_unit setSkill ["general", _general];
_unit enableAI "TARGET";
_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
{
["fn_spawnVEMFrAI", 0, "failed to retrieve _groupSide"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer";
};
};
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";
};
} else
{
["fn_spawnVEMFrAI", 0, format["(%1) is not in missionList!"]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
breakOut "outer";
};
};
};
};
_spawned

View File

@ -1,90 +0,0 @@
/*
Author: IT07
Description:
handles the transfer of ownership to another given unit/client/object.
Will transfer complete group to the same (new) owner.
Params:
_this select 0: GROUP - the group of which the ownership should be transfered
Returns:
BOOLEAN - true if transfer was successful
*/
private ["_transfer","_toTransfer"];
_transfer = false;
_toTransfer = param [0, grpNull, [grpNull]];
if not isNull _toTransfer then
{
private ["_hcEnabled","_forceClients"];
// Check if HC is enabled
_hcEnabled = "headLessClientSupport" call VEMFr_fnc_getSetting;
_forceClients = uiNamespace getVariable ["VEMFr_forceAItoClients", nil];
if not(isNil"_forceClients") then
{
if _forceClients then
{
_hcEnabled = -1;
};
};
private ["_to"];
if (_hcEnabled isEqualTo 1) then
{ // Gather the Headless Client(s)
private ["_hcClients"];
_hcClients = [];
{
if (typeOf _x isEqualTo "HeadlessClient_F") then // it is an HC
{
_hcClients 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];
};
} else // If Headlessclient setting is not enabled
{
if ([1] call VEMFr_fnc_playerCount) then
{
private ["_closest"];
_closest = [0,0,0];
{
if (isPlayer _x) then
{
private ["_leaderPos","_dist"];
_leaderPos = position (leader _toTransfer);
_dist = _leaderPos distance (position _x);
if (_dist < (_leaderPos distance _closest)) then
{ // Find the closest player
private ["_closest"];
_closest = position _x;
_to = _x;
};
};
} forEach allPlayers;
};
};
};
if not isNil"_to" then
{
_transfer = _toTransfer setGroupOwner (owner _to);
_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];
};
};
};
_transfer // Return the value of this var to the calling script

View File

@ -1,64 +0,0 @@
/*
Author: VAMPIRE, rebooted by IT07
Description:
fn_waitForMissionDone - waits for mission to be done
Params:
_this select 0: STRING - name of mission location
_this select 1: POSITION - center of area to be waiting for
_this select 2: ARRAY - array of units to check for
_this select 3: SCALAR - radius around center to check for players
Returns:
BOOL - true when mission is done
*/
private ["_complete","_pos"];
_complete = false;
_pos = param [1, [], [[]]];
if (count _pos isEqualTo 3) then
{
private ["_unitArr"];
_unitArr = param [2, [], [[]]];
if (count _unitArr > 0) then
{
private ["_unitCount","_killed","_killToComplete","_rad"];
_unitCount = count _unitArr;
_killed = [];
_killToComplete = round(("killPercentage" call VEMFr_fnc_getSetting)/100*_unitCount);
_rad = param [3, 0, [0]];
if (_rad > 0) then
{
while {not _complete} do
{
private ["_playerNear"];
// First check for a player
if not _complete then { uiSleep 1; };
_playerNear = [_pos, _rad] call VEMFr_fnc_checkPlayerPresence;
if _playerNear then
{
{
if (damage _x isEqualTo 1 OR isNull _x) then
{
_killed pushBack _x;
};
} forEach _unitArr;
{ // Delete the not(alive) units
private ["_index"];
_index = _unitArr find _x;
if not(_index isEqualTo -1) then
{
_unitArr deleteAt _index;
};
} forEach _killed;
};
if (((count _killed) isEqualTo _killToComplete) OR ((count _killed) > _killToComplete)) then { _complete = true };
if not _complete then { uiSleep 2 };
};
["fn_waitForMissionDone", 1, format["mission in %1 completed!", _this select 0]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
};
};
};
_complete

View File

@ -1,44 +0,0 @@
/*
Author: IT07
Description:
fn_waitForPlayers - waits for player to be nearby given pos
Params:
_this select 0: POSITION - center of area to check for players
_this select 1: SCALAR - radius to check around POSITION
Returns:
BOOL - true if there is a player present
*/
private ["_playerNear","_pos"];
_playerNear = false;
_pos = param [0, [], [[]]];
if (count _pos isEqualTo 3) then
{
private ["_rad"];
_rad = param [1, -1, [0]];
if (_rad > -1) 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 2; false} };
if ([_pos, _rad] call VEMFr_fnc_checkPlayerPresence) then
{
_playerNear = true;
};
};
};
};
_playerNear