mirror of
https://github.com/IT07/a3_vemf_reloaded.git
synced 2025-07-25 10:52:28 +00:00
Speed improvements
This commit is contained in:
@ -12,25 +12,20 @@
|
||||
BOOL - true if player(s) found
|
||||
*/
|
||||
|
||||
private ["_pos","_found"];
|
||||
private ["_found","_pos","_rad"];
|
||||
// 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
|
||||
params [["_pos",[],[[]]], ["_rad",-1,[0]]];
|
||||
if (((count _pos) isEqualTo 3) AND (_rad > -1)) 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
|
||||
{
|
||||
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;
|
||||
};
|
||||
private ["_isClose"];
|
||||
_isClose = if ((position _x distance _pos) < _rad) then { true } else { false };
|
||||
if _isClose then { _found = true };
|
||||
};
|
||||
} forEach allPlayers;
|
||||
};
|
||||
|
||||
_found
|
||||
|
@ -18,16 +18,13 @@
|
||||
if mode = pos: POSITION
|
||||
*/
|
||||
|
||||
private ["_ret","_settings","_nonPopulated","_blackPos","_missionDistance","_range","_missionConfigName"];
|
||||
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;
|
||||
_nonPopulated = _settings param [0, 1, [0]];
|
||||
_blackPos = _settings param [1, [], [[]]];
|
||||
_missionDistance = _settings param [2, 3000, [0]];
|
||||
_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;
|
||||
// Settings override system
|
||||
_missionConfigName = param [6, "", [""]];
|
||||
if not(_missionConfigName isEqualTo "") then
|
||||
{
|
||||
private ["_nonPopulatedOverride"];
|
||||
@ -48,199 +45,180 @@ if (count _blackPos > 0) then
|
||||
_checkBlackPos = true;
|
||||
};
|
||||
|
||||
private ["_mode"];
|
||||
_mode = param [0, "", [""]];
|
||||
if not(_mode isEqualTo "") then
|
||||
private ["_mode","_roadRange"];
|
||||
if (not(_mode isEqualTo "") AND (_cntr isEqualTypeArray [0,0,0]) AND (_tooCloseRange > -1) AND (_maxPrefered > -1)) then
|
||||
{
|
||||
private ["_onRoad","_roadRange","_cntr"];
|
||||
_onRoad = param [1, false, [false]];
|
||||
_roadRange = 5000;
|
||||
_cntr = param [2, [], [[]]];
|
||||
if (_cntr isEqualTypeArray [0,0,0]) then
|
||||
if (_mode isEqualTo "loc") then
|
||||
{
|
||||
private ["_tooCloseRange"];
|
||||
_tooCloseRange = param [3, -1, [0]];
|
||||
if (_tooCloseRange > -1) 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 ["_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
|
||||
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;
|
||||
{
|
||||
// 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
|
||||
if (count _x isEqualTo 2) 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
|
||||
private ["_pos"];
|
||||
_pos = _x param [0, [0,0,0], [[]]];
|
||||
if not(_pos isEqualTo [0,0,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
|
||||
private ["_range"];
|
||||
_range = _x param [1, 600, [0]];
|
||||
if ((_pos distance _locPos) < _range) then
|
||||
{
|
||||
_loc = selectRandom _far;
|
||||
_remLocs pushBack _loc;
|
||||
};
|
||||
};
|
||||
|
||||
// Validate _locs just to prevent the .RPT from getting spammed
|
||||
if (count _locs > 0) then
|
||||
} 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
|
||||
{
|
||||
// Return Name and POS
|
||||
_ret = _loc;
|
||||
(uiNamespace getVariable "VEMFrUsedLocs") pushBack _loc;
|
||||
_remLocs pushBack _x;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_mode isEqualTo "pos") then
|
||||
{
|
||||
private ["_valid"];
|
||||
_valid = false;
|
||||
for "_p" from 1 to 10 do
|
||||
if (count _usedLocs > 0) then
|
||||
{
|
||||
private ["_loc"];
|
||||
_loc = _x;
|
||||
{
|
||||
if (_ret isEqualType true) then
|
||||
if (((locationPosition _loc) distance (locationPosition _x)) < _missionDistance) 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;
|
||||
};
|
||||
};
|
||||
_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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} else
|
||||
{
|
||||
["findPos",0,"params not valid!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
|
||||
_ret
|
||||
|
@ -20,10 +20,7 @@ _done = false;
|
||||
if (_this isEqualType []) then
|
||||
{
|
||||
private ["_unit"];
|
||||
_unit = param [0, objNull, [objNull]];
|
||||
_classPrimary = param [1, "", [""]];
|
||||
_classSecondary = param [2, "", [""]];
|
||||
_classHandgun = param [3, "", [""]];
|
||||
params [["_unit", objNull, [objNull]],["_classPrimary", "", [""]],["_classSecondary", "", [""]],["_classHandgun", "", [""]]];
|
||||
if not isNull _unit then
|
||||
{
|
||||
if local _unit then
|
||||
|
@ -15,7 +15,7 @@ private ["_done"];
|
||||
_done = false;
|
||||
if (_this isEqualType []) then
|
||||
{
|
||||
_unit = param [0, objNull, [objNull]];
|
||||
_unit = param [0,objNull,[objNull]];
|
||||
if not (isNull _unit) then
|
||||
{
|
||||
// primaryWeapon items
|
||||
|
@ -19,17 +19,13 @@ _ok = false;
|
||||
_params = _this;
|
||||
if (_this isEqualType []) then
|
||||
{
|
||||
private ["_units"];
|
||||
_units = param [0, [], [[]]];
|
||||
private ["_units","_missionName","_aiMode"];
|
||||
params [["_units", [], [[]]],["_missionName", "", [""]],["_aiMode", 0, [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"];
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
private ["_ok","_mineSetting","_missionName"];
|
||||
_ok = false;
|
||||
_missionName = param [3, "", [""]];
|
||||
params [["_missionName", "", [""]]];
|
||||
if (_missionName in ("missionList" call VEMFr_fnc_getSetting)) then
|
||||
{
|
||||
scopeName "main";
|
||||
|
@ -16,203 +16,180 @@
|
||||
ARRAY format [[groups],[50cals]]
|
||||
*/
|
||||
|
||||
private ["_spawned","_pos"];
|
||||
private ["_spawned","_pos","_grpCount","_unitsPerGrp","_mode","_missionName","_maxRange"];
|
||||
_spawned = [[],[]];
|
||||
_pos = param [0, [], [[]]];
|
||||
if (count _pos isEqualTo 3) then
|
||||
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 ["_grpCount"];
|
||||
_grpCount = param [1, 1, [0]];
|
||||
if (_grpCount > 0) then
|
||||
private [
|
||||
"_sldrClass","_groups","_hc","_aiDifficulty","_skills","_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime",
|
||||
"_courage","_reloadSpd","_commanding","_general","_houses","_notTheseHouses","_goodHouses","_noHouses","_cal50s","_units"
|
||||
];
|
||||
_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 = [];
|
||||
{ // 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
|
||||
{
|
||||
private ["_unitsPerGrp"];
|
||||
_unitsPerGrp = param [2, 1, [0]];
|
||||
if (_unitsPerGrp > 0) 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
|
||||
{
|
||||
private ["_mode","_missionName"];
|
||||
_mode = param [3, -1, [0]];
|
||||
_missionName = param [4, "", [""]];
|
||||
if (_missionName in ("missionList" call VEMFr_fnc_getSetting)) then
|
||||
if (count _goodHouses < 1) 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;
|
||||
};
|
||||
};
|
||||
_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;
|
||||
};
|
||||
};
|
||||
} 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";
|
||||
};
|
||||
|
||||
_spawned
|
||||
|
@ -17,113 +17,82 @@
|
||||
ARRAY with group(s)
|
||||
*/
|
||||
|
||||
private ["_spawned","_allUnits","_pos"];
|
||||
private ["_spawned","_allUnits","_pos","_grpCount","_unitsPerGrp","_mode","_missionName"];
|
||||
_spawned = [];
|
||||
_allUnits = [];
|
||||
_pos = param [0, [], [[]]];
|
||||
if (_pos isEqualTypeArray [0,0,0]) then
|
||||
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
|
||||
{
|
||||
scopeName "outer";
|
||||
private ["_grpCount"];
|
||||
_grpCount = param [1, 1, [0]];
|
||||
if (_grpCount > 0) then
|
||||
_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 ["_unitsPerGrp"];
|
||||
_unitsPerGrp = param [2, 1, [0]];
|
||||
if (_unitsPerGrp > 0) then
|
||||
private ["_groupSide"];
|
||||
_groupSide = ("unitClass" call VEMFr_fnc_getSetting) call VEMFr_fnc_checkSide;
|
||||
if not isNil "_groupSide" 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
|
||||
private["_grp"];
|
||||
_grp = createGroup _groupSide;
|
||||
_grp allowFleeing 0;
|
||||
for "_u" from 1 to _unitsPerGrp do
|
||||
{
|
||||
_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];
|
||||
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";
|
||||
_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
|
||||
{
|
||||
["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";
|
||||
};
|
||||
|
||||
_spawned
|
||||
|
@ -14,20 +14,17 @@
|
||||
BOOL - true when mission is done
|
||||
*/
|
||||
|
||||
private ["_complete","_pos"];
|
||||
private ["_complete","_missionName","_pos","_unitArr","_rad"];
|
||||
_complete = false;
|
||||
_pos = param [1, [], [[]]];
|
||||
params [["_missionName","",[""]], ["_pos",[],[[]]], ["_unitArr",[],[[]]], ["_rad",0,[0]]];
|
||||
if (count _pos isEqualTo 3) then
|
||||
{
|
||||
private ["_unitArr"];
|
||||
_unitArr = param [2, [], [[]]];
|
||||
if (count _unitArr > 0) then
|
||||
{
|
||||
private ["_unitCount","_killed","_killToComplete","_rad"];
|
||||
private ["_unitCount","_killed","_killToComplete"];
|
||||
_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
|
||||
@ -42,7 +39,7 @@ if (count _pos isEqualTo 3) then
|
||||
if (_kiaCount >= _killToComplete) exitWith { _complete = true };
|
||||
uiSleep 4;
|
||||
};
|
||||
["fn_waitForMissionDone", 1, format["mission in %1 completed!", _this select 0]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
["fn_waitForMissionDone", 1, format["mission in %1 has been completed!", _missionName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -12,33 +12,31 @@
|
||||
BOOL - true if there is a player present
|
||||
*/
|
||||
|
||||
private ["_playerNear","_pos"];
|
||||
private ["_playerNear","_pos","_rad"];
|
||||
_playerNear = false;
|
||||
_pos = param [0, [], [[]]];
|
||||
if (count _pos isEqualTo 3) then
|
||||
params [["_pos",[],[[]]], ["_rad",-1,[0]]];
|
||||
if (((count _pos) isEqualTo 3) AND (_rad > -1)) 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
|
||||
{
|
||||
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;
|
||||
} else
|
||||
{
|
||||
waitUntil { if (([_pos, _rad] call VEMFr_fnc_checkPlayerPresence) OR (round time - _time > _timeOutTime)) then {true} else {uiSleep 4; false} };
|
||||
if ([_pos, _rad] call VEMFr_fnc_checkPlayerPresence) then
|
||||
{
|
||||
_playerNear = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else
|
||||
{
|
||||
["waitForPlayers",0,format["params are invalid! [%1,%2]", ((count _pos) isEqualTo 3), (_rad > -1)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
|
||||
_playerNear
|
||||
|
@ -12,21 +12,8 @@ if (VEMFrInvasionCount <= (([[_missionName],["maxInvasions"]] call VEMFr_fnc_get
|
||||
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;
|
||||
_grpCount = _settings select 0;
|
||||
_groupUnits = _settings select 1;
|
||||
_range = _settings select 2;
|
||||
_maxPref = _settings select 3;
|
||||
_skipDistance = _settings select 4;
|
||||
_useMissionMarker = _settings select 5;
|
||||
_useChute = (_settings select 6) select 0;
|
||||
_crateAltitude = (_settings select 6) select 1;
|
||||
_markCrateVisual = _settings select 7;
|
||||
_markCrateOnMap = _settings select 8;
|
||||
_announce = _settings select 9;
|
||||
_streetLights = _settings select 10;
|
||||
_streetLightsRestore = _settings select 11;
|
||||
_streetLightsRange = _settings select 12;
|
||||
_allowCrateLift = _settings select 13;
|
||||
_settings params ["_grpCount","_groupUnits","_range","_maxPref","_skipDistance","_useMissionMarker","","_markCrateVisual","_markCrateOnMap","_announce","_streetLights","_streetLightsRestore","_streetLightsRange","_allowCrateLift"];
|
||||
(_settings select 6) params ["_useChute","_crateAltitude"];
|
||||
|
||||
_loc = ["loc", false, position (selectRandom allPlayers), _skipDistance, _maxPref, _skipDistance, _missionName] call VEMFr_fnc_findPos;
|
||||
if (_loc isEqualType locationNull) then
|
||||
|
@ -13,9 +13,8 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
_target = param [0, objNull, [objNull]];
|
||||
_killer = param [1, objNull, [objNull]];
|
||||
if (_killer isKindOf "Man") then // Roadkill or regular kill
|
||||
params [["_target",objNull,[objNull]], ["_killer",objNull,[objNull]]];
|
||||
if ((_killer isKindOf "Man") AND (isPlayer _killer)) then // Roadkill or regular kill
|
||||
{
|
||||
if (vehicle _killer isEqualTo _killer) then // If on foot
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
_crate = param [0, objNull, [objNull]];
|
||||
params [["_crate",objNull,[objNull]], ["_locName","",[""]], ["_locPos",[],[[]]]];
|
||||
if not isNull _crate then
|
||||
{
|
||||
_crate setVariable ["isVEMFrCrate", 1, true];
|
||||
@ -23,8 +23,6 @@ if not isNull _crate then
|
||||
clearMagazineCargoGlobal _crate;
|
||||
clearWeaponCargoGlobal _crate;
|
||||
|
||||
_locName = param [1, "", [""]];
|
||||
_locPos = param [2, [], [[]]];
|
||||
_settings = [
|
||||
["crateLoot"],
|
||||
[
|
||||
@ -33,32 +31,8 @@ if not isNull _crate then
|
||||
"itemLoot","vestLoot","backpackLoot","headGearLoot","blackListLoot"
|
||||
]
|
||||
] call VEMFr_fnc_getSetting;
|
||||
|
||||
_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;
|
||||
_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
|
||||
|
@ -18,9 +18,7 @@ if ("debugMode" call VEMFr_fnc_getSetting > 0) then
|
||||
{
|
||||
scopeName "outer";
|
||||
private ["_prefix","_type","_line","_doLog"];
|
||||
_prefix = param [0, "", [""]];
|
||||
_type = param [1, 3, [0]];
|
||||
_line = param [2, "", [""]];
|
||||
params [["_prefix","",[""]], ["_type",3,[0]], ["_line","",[""]]];
|
||||
|
||||
_doLog = { diag_log text format["IT07: [exile_vemf_reloaded] %1 -- %2: %3", _prefix, _this, _line] };
|
||||
_debugMode = "debugMode" call VEMFr_fnc_getSetting;
|
||||
|
@ -14,10 +14,7 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
_missionType = param [0, -1, [-1]];
|
||||
_title = param [1, "", [""]];
|
||||
_msgLine = param [2, "", [""]];
|
||||
_sendTo = param [3, [], [[]]];
|
||||
params [["_missionType",-1,[-1]], ["_title","",[""]], ["_msgLine","",[""]], ["_sendTo",[],[[]]]];
|
||||
if (count _sendTo isEqualTo 0) then { _sendTo = allPlayers };
|
||||
{
|
||||
VEMFrMsgToClient = [[_missionType, _title, _msgLine], ""];
|
||||
|
@ -5,8 +5,7 @@
|
||||
handles the broadcast of a systemChat kill message
|
||||
*/
|
||||
|
||||
_target = param [0, objNull, [objNull]];
|
||||
_killer = param [1, objNull, [objNull]];
|
||||
params [["_target",objNull,[objNull]], ["_killer",objNull,[objNull]]];
|
||||
_curWeapon = "Weapon";
|
||||
if (vehicle _killer isEqualTo _killer) then // If on foot
|
||||
{
|
||||
|
@ -9,8 +9,7 @@
|
||||
nothing
|
||||
*/
|
||||
|
||||
_line = param [0, "", [""]];
|
||||
_sendTo = param [1, [], [[]]];
|
||||
params [["_line","",[""]], ["_sendTo",[],[[]]]];
|
||||
if (_sendTo isEqualTo []) then { _sendTo = allPlayers };
|
||||
{
|
||||
VEMFrMsgToClient = [_line, "sys"];
|
||||
|
Reference in New Issue
Block a user