mirror of
https://github.com/IT07/a3_vemf_reloaded.git
synced 2024-08-30 16:52:11 +00:00
Deprecated
This commit is contained in:
parent
12f911c364
commit
fefe173e3d
@ -1,38 +0,0 @@
|
||||
/*
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
this function makes sure that AI spawned by VEMF does NOT become local to the server.
|
||||
On detection of a local group, it will reassign it to a client or Headless Client if enabled.
|
||||
|
||||
Params:
|
||||
none, this is a Standalone function
|
||||
|
||||
Returns:
|
||||
nothing
|
||||
*/
|
||||
|
||||
[] spawn
|
||||
{
|
||||
uiNamespace setVariable ["VEMFrHcLoad", []];
|
||||
uiNamespace setVariable ["vemfGroups", []];
|
||||
while {true} do
|
||||
{
|
||||
_groups = uiNamespace getVariable "vemfGroups";
|
||||
waitUntil { uiSleep 1; count _groups > 0 };
|
||||
{
|
||||
if (local _x) then
|
||||
{
|
||||
if ((count units _x) < 1) then
|
||||
{
|
||||
deleteGroup _x;
|
||||
};
|
||||
if (count (units _x) > 0) then
|
||||
{
|
||||
// Group still has units, check if there is anyone that can be the owner
|
||||
[_x] call VEMFr_fnc_transferOwner;
|
||||
};
|
||||
};
|
||||
} forEach _groups;
|
||||
};
|
||||
};
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
Handles the start and timeout of missions
|
||||
|
||||
Params:
|
||||
none
|
||||
|
||||
Returns:
|
||||
nothing
|
||||
*/
|
||||
|
||||
_minFPS = "minServerFPS" call VEMFr_fnc_getSetting;
|
||||
if (_minFPS > -1) then
|
||||
{
|
||||
_minPlayers = "minPlayers" call VEMFr_fnc_getSetting;
|
||||
if (_minPlayers > -1) then
|
||||
{
|
||||
_maxGlobalMissions = "maxGlobalMissions" call VEMFr_fnc_getSetting;
|
||||
if (_maxGlobalMissions > -2) then
|
||||
{
|
||||
_minNew = "minNew" call VEMFr_fnc_getSetting;
|
||||
if (_minNew > -1) then
|
||||
{
|
||||
_maxNew = "maxNew" call VEMFr_fnc_getSetting;
|
||||
if (_maxNew > 0) then
|
||||
{
|
||||
_missionList = "missionList" call VEMFr_fnc_getSetting;
|
||||
if (count _missionList > 0) then
|
||||
{
|
||||
waitUntil { uiSleep 5; (if (([_minPlayers] call VEMFr_fnc_playerCount) AND (diag_fps > _minFPS)) then { true } else { false }) };
|
||||
["missionTimer", 1, format["Minimal player count of %1 reached! Starting timer...", _minPlayers]] spawn VEMFr_fnc_log;
|
||||
|
||||
VEMFrMissionCount = 0;
|
||||
private ["_ignoreLimit"];
|
||||
_ignoreLimit = false;
|
||||
if (_maxGlobalMissions isEqualTo 0) then
|
||||
{
|
||||
_ignoreLimit = true;
|
||||
};
|
||||
while {true} do
|
||||
{
|
||||
// Wait random amount
|
||||
uiSleep ((_minNew*60)+ floor random ((_maxNew*60)-(_minNew*60)));
|
||||
|
||||
// Pick A Mission if enough players online
|
||||
if ([_minPlayers] call VEMFr_fnc_playerCount) then
|
||||
{
|
||||
if _ignoreLimit then
|
||||
{
|
||||
_missVar = selectRandom _missionList;
|
||||
[] execVM format["exile_vemf_reloaded\missions\%1.sqf", _missVar];
|
||||
_lastMission = serverTime;
|
||||
};
|
||||
if not _ignoreLimit then
|
||||
{
|
||||
if (VEMFrMissionCount <= _maxGlobalMissions) then
|
||||
{
|
||||
_missVar = selectRandom _missionList;
|
||||
[] execVM format["exile_vemf_reloaded\missions\%1.sqf", _missVar];
|
||||
VEMFrMissionCount = VEMFrMissionCount +1;
|
||||
_lastMission = serverTime;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_maxGlobalMissions < -1) then
|
||||
{
|
||||
["missionTimer", 0, format["Invalid maximum global missions number! it is: %1", _maxGlobalMissions]] spawn VEMFr_fnc_log;
|
||||
};
|
||||
};
|
||||
if (_minPlayers < 0) then
|
||||
{
|
||||
["missionTimer", 0, format["Invalid minimum player setting of %1", _minPlayers]] spawn VEMFr_fnc_log;
|
||||
};
|
||||
};
|
||||
if (_minFPS < 0) then
|
||||
{
|
||||
["missionTimer", 0, format["Invalid minimum server FPS setting of %1", _minFPS]] spawn VEMFr_fnc_log;
|
||||
};
|
@ -1,235 +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
|
||||
|
||||
Returns:
|
||||
ARRAY of UNITS
|
||||
*/
|
||||
|
||||
private // Make sure that the vars in this function do not interfere with vars in the calling script
|
||||
[
|
||||
"_pos","_grpCount","_unitsPerGrp","_sldrClass","_groups","_settings","_hc","_skills","_newPos","_return","_waypoints","_wp","_cyc","_units",
|
||||
"_accuracy","_aimShake","_aimSpeed","_stamina","_spotDist","_spotTime","_courage","_reloadSpd","_commanding","_general","_loadInv","_noHouses","_cal50sVehs","_mode"
|
||||
];
|
||||
|
||||
_spawned = [[],[]];
|
||||
_pos = param [0, [], [[]]];
|
||||
if (count _pos isEqualTo 3) then
|
||||
{
|
||||
_grpCount = param [1, 1, [0]];
|
||||
if (_grpCount > 0) then
|
||||
{
|
||||
_unitsPerGrp = param [2, 1, [0]];
|
||||
if (_unitsPerGrp > 0) then
|
||||
{
|
||||
_mode = param [3, -1, [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"], 200]; // 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 ["_unitSide","_grp","_unit"];
|
||||
_unitSide = getText (configFile >> "CfgVehicles" >> ("unitClass" call VEMFr_fnc_getSetting) >> "faction");
|
||||
switch _unitSide do
|
||||
{
|
||||
case "BLU_G_F":
|
||||
{
|
||||
_grp = createGroup WEST;
|
||||
};
|
||||
case "CIV_F":
|
||||
{
|
||||
_grp = createGroup civilian;
|
||||
};
|
||||
case "IND_F":
|
||||
{
|
||||
_grp = createGroup independent;
|
||||
};
|
||||
case "IND_G_F":
|
||||
{
|
||||
_grp = createGroup resistance;
|
||||
};
|
||||
case "OPF_F":
|
||||
{
|
||||
_grp = createGroup EAST;
|
||||
};
|
||||
default
|
||||
{
|
||||
["fn_spawnAI", 0, format["Unknown side %1", _unitSide]] spawn VEMFr_fnc_log;
|
||||
};
|
||||
};
|
||||
if not isNil"_grp" then
|
||||
{
|
||||
if not _noHouses then
|
||||
{
|
||||
_grp enableAttack false;
|
||||
};
|
||||
_grp setBehaviour "AWARE";
|
||||
_grp setCombatMode "RED";
|
||||
_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;
|
||||
};
|
||||
|
||||
_placed50 = false;
|
||||
for "_u" from 1 to _unitsPerGrp do
|
||||
{
|
||||
private ["_spawnPos","_hmg"];
|
||||
if not _noHouses then
|
||||
{
|
||||
_spawnPos = selectRandom _housePositions;
|
||||
if not _placed50 then
|
||||
{
|
||||
_placed50 = true;
|
||||
if (_cal50s > 0) then
|
||||
{
|
||||
_hmg = createVehicle ["B_HMG_01_high_F", _spawnPos, [], 0, "CAN_COLLIDE"];
|
||||
_hmg setVehicleLock "LOCKEDPLAYER";
|
||||
(_spawned select 1) pushBack _hmg;
|
||||
};
|
||||
};
|
||||
};
|
||||
if _noHouses then
|
||||
{
|
||||
_spawnPos = [_pos,20,250,1,0,200,0] call BIS_fnc_findSafePos; // Find Nearby Position
|
||||
};
|
||||
|
||||
_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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_houseIndex = _housePositions find _spawnPos;
|
||||
_housePositions deleteAt _houseIndex;
|
||||
};
|
||||
|
||||
_unit addMPEventHandler ["mpkilled","if (isDedicated) then { [_this select 0, _this select 1] spawn VEMFr_fnc_aiKilled }"];
|
||||
(_spawned select 0) pushBack _unit;
|
||||
// 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 setRank "Private"; // Set rank
|
||||
};
|
||||
_grp selectLeader _unit; // Leader Assignment
|
||||
_groups pushBack _grp; // Push it into the _groups array
|
||||
};
|
||||
};
|
||||
|
||||
_invLoaded = [_spawned select 0, "Invasion", _mode] call VEMFr_fnc_loadInv; // Load the AI's inventory
|
||||
if isNil"_invLoaded" then
|
||||
{
|
||||
["fn_spawnAI", 0, "failed to load AI's inventory..."] spawn VEMFr_fnc_log;
|
||||
};
|
||||
|
||||
if (count _groups isEqualTo _grpCount) then
|
||||
{
|
||||
if not _noHouses then
|
||||
{
|
||||
{
|
||||
[_x] spawn VEMFr_fnc_signAI;
|
||||
} forEach _groups;
|
||||
};
|
||||
if _noHouses then
|
||||
{
|
||||
_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
|
||||
{
|
||||
_wp = _x addWaypoint [(_waypoints select (_z-1)), 10];
|
||||
_wp setWaypointType "SAD";
|
||||
_wp setWaypointCompletionRadius 20;
|
||||
};
|
||||
_cyc = _x addWaypoint [_pos,10];
|
||||
_cyc setWaypointType "CYCLE";
|
||||
_cyc setWaypointCompletionRadius 20;
|
||||
[_x] spawn VEMFr_fnc_signAI;
|
||||
} forEach _groups;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
_spawned
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
spawns AI at all given locations in config file
|
||||
|
||||
Params:
|
||||
none
|
||||
|
||||
Returns:
|
||||
nothing
|
||||
*/
|
||||
|
||||
if ([["aiStatic"],["enabled"]] call VEMFr_fnc_getSetting isEqualTo 1) then
|
||||
{
|
||||
["spawnStaticAI", 3, "launching..."] spawn VEMFr_fnc_log;
|
||||
_settings = [["aiStatic"],["positions","amount"]] call VEMFr_fnc_getSetting;
|
||||
_positions = _settings select 0;
|
||||
if (count _positions > 0) then
|
||||
{
|
||||
["spawnStaticAI", 3, "spawning AI on positions..."] spawn VEMFr_fnc_log;
|
||||
_amounts = _settings select 1;
|
||||
{
|
||||
_amount = _amounts select _foreachindex;
|
||||
[_x, 2, _amount / 2, "aiMode" call VEMFr_fnc_getSetting] spawn VEMFr_fnc_spawnAI;
|
||||
} forEach _positions;
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user