Merge branch 'GMS-Testing'

This commit is contained in:
Zepheris 2020-02-18 12:10:25 -07:00
commit b4d690d949
341 changed files with 28413 additions and 2 deletions

View File

@ -0,0 +1 @@
q\addons\custom_server

View File

@ -0,0 +1 @@
q\addons\custom_server

View File

@ -0,0 +1,28 @@
1. Added new settings to specify the number of crew per vehhicle to blck_config.sqf and blck_config_mil.sqf
// global settings for this parameters
// Determine the number of crew plus driver per vehicle; excess crew are ignored.
// This can be a value or array of [_min, _max];
blck_vehCrew_blue = 3;
blck_vehCrew_red = 3;
blck_vehCrew_green = 3;
blck_vehCrew_orange = 3;
You can also define this value in missions by adding the following variable definition to the mission template:
_vehicleCrewCount = [3,6]; // min/max number of AI to load including driver. see the missions\blue\template.sqf and blck_configs.sqf for more info.
2. Lists of items to be excluded from dynamically generated loadouts has been moved to:
blck_config.sqf
blck_config_mil.sqf
3. Added a new setting that specifies whether logging of blacklisted items is done (handy for debugging)
blck_logBlacklistedItems = true; // set to false to disable logging
4. Hit and Killed event handlers extensively reworked. Methods for notification of nearby AI and Vehicles of the killers whereabouts were revised to be more inclusive of neighboring AI.
5. Issues with AIHit events fixed; AI now deploy smoke and heal.
6. Removed some unnecessary logging.
7. Other minor coding fixes and optimizations.

View File

@ -0,0 +1,71 @@
/*
by Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_mapCenter","_waterPos","_priorUMSpositions"];
switch (toLower worldName) do
{
case "altis": {_mapCenter = [15000,19000,0];_maxDistance = 20000};
case "tanoa": {_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");_maxDistance = 10000};
case "malden": {_mapCenter = [6000,7000,0];_maxDistance = 5500};
case "namalsk": {_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");_maxDistance = 5000};
case "taviana": {_mapCenter = [12000,12000,0];_maxDistance = 12000};
case "napf" : {_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");_maxDistance = 12000};
case "lythium": {_mapCenter = [10000,10000,0]; _maxDistance = 6000;};
default {_mapCenter = [6000,6000,0]; _maxDistance = 6000;};
};
_evaluate = true;
while {_evaluate} do
{
_waterPos = [
_mapCenter, // center of search area
2, // min distance to search
20000, // max distance to search
0, // distance to nearest object
2, // water mode [2 = water only]
25, // max gradient
0 // shoreMode [0 = anywhere]
] call BIS_fnc_findSafePos;
/*
_priorUMSpositions = +blck_priorDynamicUMS_Missions;
{
if (diag_tickTime > ((_x select 1) + 1800) then
{
blck_priorDynamicUMS_Missions = blck_priorDynamicUMS_Missions - _x;
} else {
if (_waterPos distance2D (_x select 0) < 2000) exitWith {_evaluate = false};
};
} forEach _priorUMSpositions;
*/
if (_evaluate) then
{
if (abs(getTerrainHeightASL _waterPos) < 30) then
{
if (abs(getTerrainHeightASL _waterPos) > 1) then
{
//_waterMarker = createMarker [format["water mission %1",getTerrainHeightASL _waterPos],_waterPos];
//_waterMarker setMarkerColor "ColorRed";
//_waterMarker setMarkerType "mil_triangle";
//_waterMarker setMarkerText format["Depth %1",getTerrainHeightASL _waterPos];
_evaluate = false;
};
};
};
};
_waterPos

View File

@ -0,0 +1,23 @@
/*
by Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_depth"];
params["_pos"];
_depth = (getTerrainHeightASL _pos);
//diag_log format["_fnc_findWaterDepth: _depth = %1",_depth];
_depth

View File

@ -0,0 +1,23 @@
//This script sends Message Information to allplayers
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if !(isServer) exitWith {};
params["_msg",["_players",allplayers]];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players];};
#endif
{
if (isPlayer _x) then {_msg remoteExec["fn_handleMessage",(owner _x)]};
} forEach _players;

View File

@ -0,0 +1,23 @@
/*
Determines the total number of spawned groups on the side used by the mission system and returns this value.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private _groups_AI_Side = 0;
{
//if ( (side _x) isEqualTo blck_AI_Side) then {_Groups_AI_Side = _Groups_AI_Side + 1;};
_groups_AI_Side = {(side _x) isEqualTo blck_AI_side} count allGroups;
}forEach allGroups;
//diag_log format["_fnc_groupsOnAISide:: -- >> allGroups = %1 | _Groups_AI_Side = %2",allGroups, _Groups_AI_Side];
_groups_AI_Side

View File

@ -0,0 +1,67 @@
/*
[_item,_crate] call blck_addItemToCrate;
where
_crate is a container such as ammo box or vehicle
_item is a string or array.
If _item is a string then add 1 of that item to the container.
If _item is an array with 2 elements ["itemName",3] then assume that the first element is a string and is the name of the item, and the second is the number to add.
if _item is an array with 3 elements ["itemName",2,6] assume that the first element is the item name (string), the second the min # to add and the third the max # to add.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_itemInfo","_crate",["_addAmmo",0]];
private["_isRifle","_isMagazine","_isBackpack"];
_isWeapon = false;
_isMagazine = false;
_isBackpack = false;
_quant = 0;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["blck_addItemToCrate:: -- >> itemInfo = %1 | _crate %2 | _addAmmo %3",_itemInfo, _crate, _addAmmo];
};
#endif
if (typeName _itemInfo isEqualTo "STRING") then {_item = _itemInfo; _quant = 1}; // case where only the item descriptor was provided
if (typeName _itemInfo isEqualTo "ARRAY") then {
if (count _itemInfo isEqualTo 2) then {_item = _itemInfo select 0; _quant = _itemInfo select 1;}; // case where item descriptor and quantity were provided
if (count _itemInfo isEqualto 3) then {
_item = _itemInfo select 0;
_quant = (_itemInfo select 1) + round(random((_itemInfo select 2) - (_itemInfo select 1)));
}; // case where item descriptor, min number and max number were provided.
};
if (((typeName _item) isEqualTo "STRING") && (_item != "")) then
{
if (isClass(configFile >> "CfgWeapons" >> _item)) then {
_crate addWeaponCargoGlobal [_item,_quant];
_isWeapon = true;
_count = 0;
if (typeName _addAmmo isEqualTo "SCALAR") then
{
_count = _addAmmo;
};
if (typeName _addAmmo isEqualto "ARRAY") then
{
_count = (_addAmmo select 0) + (round(random((_addAmmo select 1) - (_addAmmo select 0))));
};
_ammo = getArray (configFile >> "CfgWeapons" >> _item >> "magazines");
for "_i" from 1 to _count do
{
_crate addMagazineCargoGlobal [selectRandom _ammo,1];
};
};
if (_item isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) then {_crate addBackpackCargoGlobal [_item,_quant]; _isBackpack = true;};
if (isClass(configFile >> "CfgMagazines" >> _item)) then {_crate addMagazineCargoGlobal [_item,_quant]; _isMagazine = true;};
if (!_isWeapon && !_isMagazine && _isBackpack && isClass(configFile >> "CfgVehicles" >> _item)) then {_crate addItemCargoGlobal [_item,_quant]};
};

View File

@ -0,0 +1,47 @@
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_obj","_difficulty"];
#ifdef blck_debugMode
{
diag_log format["_fnc_addMoneyToOject: _this select %1 = %2",_foreachindex, _this select _foreachindex];
}forEach _this;
#endif
if (blck_modType isEqualTo "Exile") then
{
switch (_difficulty) do
{
case "blue":{_obj setVariable["ExileMoney", floor(random([blck_crateMoneyBlue] call blck_fnc_getNumberFromRange)),true];};
case "red":{_obj setVariable["ExileMoney", floor(random([blck_crateMoneyRed] call blck_fnc_getNumberFromRange)),true];};
case "green":{_obj setVariable["ExileMoney", floor(random([blck_crateMoneyGreen] call blck_fnc_getNumberFromRange)),true];};
case "orange":{_obj setVariable["ExileMoney", floor(random([blck_crateMoneyGreen] call blck_fnc_getNumberFromRange)),true];};
//#ifdef blck_debugMode
//#endif
};
//diag_log format["_fnc_addMoneyToOject: ExileMoney set to %1", _obj getVariable "ExileMoney"];
};
if (blck_modType isEqualTo "Epoch") then
{
switch (_difficulty) do
{
case "blue":{_obj setVariable["Crypto", floor(random([blck_crateMoneyBlue] call blck_fnc_getNumberFromRange)),true];};
case "red":{_obj setVariable["Crypto", floor(random([blck_crateMoneyRed] call blck_fnc_getNumberFromRange)),true];};
case "green":{_obj setVariable["Crypto", floor(random([blck_crateMoneyGreen] call blck_fnc_getNumberFromRange)),true];};
case "orange":{_obj setVariable["Crypto", floor(random([blck_crateMoneyGreen] call blck_fnc_getNumberFromRange)),true];};
};
//diag_log format["_fnc_addMoneyToOject: Crypto set to %1", _obj getVariable "Crypto"];
};

View File

@ -0,0 +1,71 @@
/*
blck_fnc_ai_offloadToClients
Addapted for blckeagls from:
DMS_fnc_AILocalityManager
Created by Defent and eraser1
https://github.com/Defent/DMS_Exile/wiki/DMS_fnc_AILocalityManager
Offloads AI groups to a nearby client in order to improve server performance.
*/
private ["_groups"];
if (isNil "blck_ai_offload_to_client") exitWith {blck_ai_offload_to_client = false};
if (!blck_ai_offload_to_client) exitWith {};
if (blck_limit_ai_offload_to_blckeagls) then {_groups = blck_monitoredMissionAIGroups} else {_groups = allGroups};
#ifdef blck_debugMode
diag_log format[
"_fnc_ai_offloadToClients: blck_ai_offload_to_client = %1 | blck_limit_ai_offload_to_blckeagls = %2 | count blck_monitoredMissionAIGroups = %3",
blck_ai_offload_to_client,
blck_limit_ai_offload_to_blckeagls,
count _groups
];
#endif
{
//diag_log format["_fnc_ai_offloadToClients(26): _x = %1 | units _x = %2 | blck_lockLocality = %3",_x, units _x, _x getVariable["blck_LockLocality",false]];
if (((count (units _x))>1) && {!(_x getVariable ["blck_LockLocality",false])}) then
{
private _leader = leader _x;
private _group = _x;
//diag_log format["_fnc_ai_offloadToClients(31): evaluating group _x = %1 | leader _x = %2 | blck_lockLocality = %3",_x, leader _x, _x getVariable["blck_LockLocality",false]];
if !(isPlayer _leader) then
{
// Ignore Exile flyovers.
//if (((side _group) isEqualTo independent) && {(count (units _group)) isEqualTo 1}) exitWith {};
#ifdef blck_debugMode
if (blck_debugOn) then
{
(format ["AILocalityManager :: Finding owner for group: %1",_group]) call blck_fnc_DebugLog;
};
#endif
//diag_log format["_fnc_ai_offloadToClients(42): _x =%1 with owner = %2 is not a player's group so look for a home for it if still on the server",_x, groupOwner _x];
private _groupOwner = groupOwner _group;
private _ownerObj = objNull;
private _isLocal = local _group;
if !(_isLocal) then // Only check for the group owner in players if it doesn't belong to the server.
{
{
if (_groupOwner isEqualTo (owner _x)) exitWith
{
_ownerObj = _x;
};
} forEach allPlayers;
};
//diag_log format["_fnc_ai_offloadToClients(56): _group = %1 | _groupOwner = %2 | _ownerObj = %3 | _isLocal = %4",_group,_groupOwner,_ownerObj,_isLocal];
// If the owner doesn't exist or is too far away... Attempt to set a new player owner, and if none are found... and if the group doesn't belong to the server...
if (((isNull _ownerObj) || {(_ownerObj distance2D _leader)>3500}) && {!([_group,_leader] call blck_fnc_SetAILocality)} && {!_isLocal}) then
{
// Reset locality to the server
//diag_log format["_fnc_ai_offloadToClients: setting locality of group %1 to server",_group];
_group setGroupOwner 2;
#ifdef blck_debugMode
if (blck_debugOn) then
{
(format ["AILocalityManager :: Current owner of group %1 is too far away and no other viable owner found; resetting ownership to the server.",_group]) call DMS_fnc_DebugLog;
};
#endif
};
};
};
} forEach _groups;

View File

@ -0,0 +1,16 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private _result = allPlayers;
_result

View File

@ -0,0 +1,19 @@
/*
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
blck_serverFPS = diag_FPS;
publicVariable "blck_serverFPS";

View File

@ -0,0 +1,20 @@
/*
call as [] call blck_fnc_cleanEmptyGroups;
Deletes any empty groups and thereby prevents errors resulting from createGroup returning nullGroup.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private _grp = +allGroups;
{
if ((count units _x) isEqualTo 0) then {deleteGroup _x};
}forEach _grp;

View File

@ -0,0 +1,24 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
for "_i" from 1 to (count blck_temporaryMarkers) do
{
if (_i > (count blck_temporaryMarkers)) exitWith {};
private _m = blck_temporaryMarkers deleteAt 0;
_m params["_marker","_deleteAt"];
//diag_log format["_cleanupTemporaryMarkers: _marker = %1 | _deleteAt = %2",_marker, _deleteAt];
if (diag_tickTime > _deleteAt) then
{
deleteMarker _marker;
} else {
blck_temporaryMarkers pushBack _m;
//diag_log format["_cleanupTemporaryMarkers: wait longer before deleting _marker = %1 | _deleteAt = %2",_marker, _deleteAt];
};
};

View File

@ -0,0 +1,27 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params ["_AIList",["_returnMode",0]];
private["_alive","_total","_return"];
_total = count _AIList;
_alive = {alive _x} count _AIList;
switch (_returnMode) do
{
case 0:{_return = (_alive / _total)};
case 1:{_return = [_alive,_total]};
};
_return

View File

@ -0,0 +1,15 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_markerName"];
deleteMarker _markerName;
deleteMarker ("label" + _markerName);

View File

@ -0,0 +1,20 @@
/*
Remove all inventory from an object.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_veh"];
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
clearBackpackCargoGlobal _veh;
clearItemCargoGlobal _veh;

View File

@ -0,0 +1,34 @@
/*
Generates an array of equidistant positions along the circle of diameter _radius
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_locs","_startDir","_currentDir","_Arc","_dist","_newpos"];
params["_center","_num","_minDistance","_maxDistance"];
_locs = [];
_startDir = round(random(360));
_currentDir = _startDir;
_Arc = 360/_num;
for "_i" from 1 to _num do
{
_currentDir = _currentDir + _Arc;
_dist = round(_minDistance + (random(_maxDistance - _minDistance)));
_newpos = _center getPos [_dist, _currentDir];
_locs pushback _newpos;
};
_locs

View File

@ -0,0 +1,15 @@
/*
blck_fnc_findRandomLocationWithinCircle
Params["_center","_min","_max"];
_center = center of the circle
_min = minimum distance from center of the position
_max = radius of the circle
private _pos
Return: _pos, the position generated
*/
params["_center","_min","_max"];
private _vector = random(359);
private _radius = _min + (_min + random(_max - _min));
private _pos = _center getPos[_radius,_vector];
_pos

View File

@ -0,0 +1,135 @@
// self explanatory. Checks to see if the position is in either a black listed location or near a player spawn.
// As written this relies on BIS_fnc_findSafePos to ensure that the spawn point is not on water or an excessively steep slope.
//
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_findNew","_tries","_coords","_dist","_xpos","_ypos","_newPos","_townPos","_pole"];
private["_minDistFromBases","_minDistFromMission","_minDistanceFromTowns","_minSistanceFromPlayers","_weightBlckList","_weightBases","_weightMissions","_weightTowns","_weightPlayers"];
_findNew = true;
_tries = 0;
_minDistFromBases = blck_minDistanceToBases;
_minDistFromMission = blck_MinDistanceFromMission;
_minDistanceFromTowns = blck_minDistanceFromTowns;
_minSistanceFromPlayers = blck_minDistanceToPlayer;
_weightBlckList = 0.95;
_weightBases = 0.9;
_weightMissions = 0.8;
_weightTowns = 0.7;
_weightPlayers = 0.6;
if (blck_modType isEqualTo "Epoch") then {_pole = "PlotPole_EPOCH"};
if (blck_modType isEqualTo "Exile") then {_pole = "Exile_Construction_Flag_Static"};
_recentMissionCoords = +blck_recentMissionCoords;
{
if (diag_tickTime > ((_x select 1) + 1200)) then // if the prior mission was completed more than 20 min ago then delete it from the list and ignore the check for this location.
{
blck_recentMissionCoords deleteAt (blck_recentMissionCoords find _x);
};
}forEach _recentMissionCoords;
while {_findNew} do
{
_findNew = false;
_coords = [blck_mapCenter,0,blck_mapRange,30,0,5,0] call BIS_fnc_findSafePos;
//diag_log format["_fnc_findSafePosn: _coords = %1 | _tries = %2",_coords,_tries];
{
if ( ((_x select 0) distance2D _coords) < (_x select 1)) exitWith
{
_findNew = true;
};
} forEach blck_locationBlackList;
if !(_findNew) then
{
{
if ((_x distance2D _coords) < _minDistFromMission) then {
_findNew = true;
};
}forEach blck_heliCrashSites;
};
if !(_findNew) then
{
{
if ( (_x distance2D _coords) < _minDistFromMission) exitWith
{
_FindNew = true;
};
} forEach blck_ActiveMissionCoords;
};
if !(_findNew) then
{
{
if ((_x distance2D _coords) < blck_minDistanceToBases) then
{
_findNew = true;
};
}forEach nearestObjects[blck_mapCenter, [_pole], blck_minDistanceToBases];
};
if !(_findNew) then
{
{
_townPos = [((locationPosition _x) select 0), ((locationPosition _x) select 1), 0];
if (_townPos distance2D _coords < blck_minDistanceFromTowns) exitWith {
_findNew = true;
};
} forEach blck_townLocations;
};
if !(_findNew) then
{
{
if (isPlayer _x && (_x distance2D _coords) < blck_minDistanceToPlayer) then
{
_findNew = true;
};
}forEach playableUnits;
};
if !(_findNew) then
{
// test for water nearby
_dist = 50;
for [{_i=0}, {_i<360}, {_i=_i+20}] do
{
_xpos = (_coords select 0) + sin (_i) * _dist;
_ypos = (_coords select 1) + cos (_i) * _dist;
_newPos = [_xpos,_ypos,0];
if (surfaceIsWater _newPos) then
{
_findNew = true;
_i = 361;
};
};
};
if (_findNew) then
{
if (_tries in [3,6,9,12,15,18,21]) then
{
_minDistFromMission = _minDistFromMission * _weightMissions;
_minDistFromBases = _minDistFromBases * _weightBases;
_minSistanceFromPlayers = _minSistanceFromPlayers * _minSistanceFromPlayers;
_minDistanceFromTowns = _minDistanceFromTowns * _weightTowns;
};
if (_tries > 25) then
{
_findNew = false;
};
};
};
if ((count _coords) > 2) then
{
private["_temp"];
_temp = [_coords select 0, _coords select 1];
_coords = _temp;
};
_coords;

View File

@ -0,0 +1,77 @@
/*
Determine the map name, set the map center and size, and return the map name.
Trader coordinates were pulled from the config.cfg
Inspired by the Vampire and DZMS
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_blck_WorldName"];
_blck_WorldName = toLower format ["%1", worldName];
_blck_worldSize = worldSize;
diag_log format["[blckeagls] Loading Map-specific settings with worldName = %1",_blck_WorldName];
switch (_blck_WorldName) do
{// These may need some adjustment - including a test for shore or water should help as well to avoid missions spawning on water.
case "altis":{
diag_log "[blckeagls] Altis-specific settings for Epoch loaded";
blck_mapCenter = [6322,7801,0];
blck_mapRange = 21000;
};
case "stratis":{
diag_log "[blckeagls] Stratis-specific settings loaded";
blck_mapCenter = [6322,7801,0];
blck_mapRange = 4500;
}; // Add Central, East and West respawns/traders
case "chernarus":{
diag_log "[blckeagls] Chernarus-specific settings loaded";
blck_mapCenter = [7100, 7750, 0]; //centerPosition = {7100, 7750, 300};
blck_mapRange = 5300;
};
case "chernarus_summer":{blck_mapCenter = [7100, 7750, 0]; blck_mapRange = 6000;};
case "bornholm":{
//diag_log "Bornholm-specific settings loaded";
blck_mapCenter = [11240, 11292, 0];
blck_mapRange = 14400;
};
case "esseker":{
diag_log "Esseker-specific settings loaded";
blck_mapCenter = [6049.26,6239.63,0]; //centerPosition = {7100, 7750, 300};
blck_mapRange = 6000;
};
case "taviana":{blck_mapCenter = [10370, 11510, 0];blck_mapRange = 14400;};
case "namalsk":{blck_mapCenter = [4352, 7348, 0];blck_mapRange = 10000;};
case "napf": {blck_mapCenter = [10240,10240,0]; blck_mapRange = 14000}; // {_centerPos = [10240, 10240, 0];_isMountainous = true;_maxHeight = 50;};
case "australia": {blck_mapCenter = [20480,20480, 150];blck_mapRange = 40960;};
case "panthera3":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;};
case "isladuala":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;};
case "sauerland":{blck_mapCenter = [12800, 12800, 0];blck_mapRange = 12800;};
case "trinity":{blck_mapCenter = [6400, 6400, 0];blck_mapRange = 6400;};
case "utes":{blck_mapCenter = [3500, 3500, 0];blck_mapRange = 3500;};
case "zargabad":{blck_mapCenter = [4096, 4096, 0];blck_mapRange = 4096;};
case "fallujah":{blck_mapCenter = [3500, 3500, 0];blck_mapRange = 3500;};
case "tavi":{blck_mapCenter = [10370, 11510, 0];blck_mapRange = 14090;};
case "lingor":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;};
case "takistan":{blck_mapCenter = [5500, 6500, 0];blck_mapRange = 5000;};
case "lythium":{blck_mapCenter = [10000,10000,0];blck_mapRange = 8500;};
default {_blck_WorldName = "default";blck_mapCenter = [6322,7801,0]; blck_mapRange = 6000};
};
blck_worldSet = true;

View File

@ -0,0 +1,19 @@
/*
Based on code by IT07 written for VEMF_r
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private "_mod";
_mod = "";
if not ( isNull ( configFile >> "CfgPatches" >> "exile_server" ) ) then { _mod = "Exile" };
if not ( isNull ( configFile >> "CfgPatches" >> "a3_epoch_server" ) ) then { _mod = "Epoch" };
_mod

View File

@ -0,0 +1,32 @@
// Last modified 8/13/17 by Ghostrider [GRG]
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_data"];
_value = 0;
if (typeName _data isEqualTo "ARRAY") then
{
_data params["_min","_max"];
if (_max > _min) then
{
_value = _min + round(random(_max - _min));
} else {
_value = _min;
};
} else {
if (typeName _data isEqualTo "SCALAR") then
{
_value = _data;
};
};
_value

View File

@ -0,0 +1,24 @@
// pull trader cities from config
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if !(blck_blacklistTraderCities) exitWith {};
diag_log format["[blckeagls] Adding Trader Cities to blacklisted locations based on setting for blck_blacklistTraderCities = %1",blck_blacklistTraderCities];
private _traderCites = allMapMarkers;
{
if (_x in ["center","respawn_east","respawn_west","respawn_north"] && blck_blacklistTraderCities) then
{
blck_locationBlackList pushback [getMarkerPos _x,1000];
//if (blck_debugON) then {diag_log format["[blckeagls] _fnc_getTraderCitiesEpoch:: -- >> Added epoch trader city location at %1", (getMarkerPos _x)];};
};
}forEach _traderCites;

View File

@ -0,0 +1,31 @@
// pull trader cities from config
/*
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private _traderCites = allMapMarkers;
_tc = [];
{
//if (blck_debugON) then {diag_log format["[blckeagls] _fnc_getExileLocations :: -- >> Evaluating Markertype of %1", (getMarkerType _x)];};
if (getMarkerType _x isEqualTo "ExileTraderZone" && blck_blacklistTraderCities) then {
blck_locationBlackList pushback [(getMarkerPos _x),1000];
if (blck_debugON) then {diag_log format["[blckeagls] _fnc_getExileLocations :: -- >> Added Exile Trader location at %1", (getMarkerPos _x)];};
};
if ((getMarkerType _x isEqualTo "ExileSpawnZone") && blck_blacklistSpawns) then {
blck_locationBlackList pushback [(getMarkerPos _x),1000];
if (blck_debugON) then {diag_log format["[blckeagls] _fnc_getExileLocations :: -- >> Added Exile Spawn location at %1", (getMarkerPos _x)];};
};
//
if (getMarkerType _x isEqualTo "ExileConcreteMixerZone" && blck_listConcreteMixerZones) then {
blck_locationBlackList pushback [(getMarkerPos _x),1000];
if (blck_debugON) then {diag_log format["[blckeagls] _fnc_getExileLocations :: -- >> Added Exile Concrete Mixer location at %1", (getMarkerPos _x)];};
};
}forEach _traderCites;

View File

@ -0,0 +1,11 @@
/*
Credit for this method goes to He-Man who first suggested it.
*/
//_player = _this select 0;
if ((_this select 0) isKindOf "Man" && isPlayer (_this select 0)) then
{
_this call EPOCH_server_effectCrypto;
};

View File

@ -0,0 +1,21 @@
/*
GMS_fnc_isClass
Purpose: determine if a string is a valid className
Parameters: _item, a string to be interrogated.
Returns: true if the string is a valid classname.
*/
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "GMSCore\init\GMS_defines.hpp" "\addons\GMSCore\init\GMS_defines.hpp"
params["_item"];
private _result = if ([_item] call GMS_fnc_getCfgType isEqualTo "") then {false} else {true};
_result

View File

@ -0,0 +1,44 @@
/*
Depends on blck_fnc_addItemToCrate
call as:
[_item,_crate] call blck_fnc_loadLootFromItemsArray;
where
_crate is a container such as ammo box or vehicle
_loadout is an array containing either 2 or 3 elements. The first array is always an array of items to add. Items can be formated as ["item1","item1"], as [["item1",3],["item2",2]] or as [["item1",2,4],["item2",3,5]].
See GMS_fnc_addItemToCrate for information about the acceptable formates for the items "item1" ... "itemN".
The second and optional third element in the array specify the number of times the script will randomly select an item from the array of items and load it into the crate.
For example:
case 1: [["item1",...,"itemN"],6]; The script will randomly select from the array of item names 6 times and call the loot loader each time.
case 2: [["item1",...,"itemN"],6, 9]; As above except that an item will be selected a minimum of 6 and maximum of 9 times.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_loadout","_crate",["_addAmmo",0]];
if ((_loadout select 0) isEqualTo []) exitWith {};
{
private["_tries","_q","_item"];
_tries = 0;
_q = _x select 1; // this can be a number or array.
_tries = [_q] call blck_fnc_getNumberFromRange;
for "_i" from 1 to _tries do
{
_item = selectRandom (_x select 0);
[_item,_crate,_addAmmo] call blck_fnc_addItemToCrate;
};
}forEach _loadout;

View File

@ -0,0 +1,84 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["starting _fnc_mainThread with time = %1",diag_tickTime];
private["_timer1sec","_timer5sec","_timer20sec","_timer5min","_timer5min"];
_timer1sec = diag_tickTime;
_timer5sec = diag_tickTime;
_timer20sec = diag_tickTime;
_timer1min = diag_tickTime;
_timer5min = diag_tickTime;
while {true} do
{
uiSleep 1;
if (diag_tickTime > _timer1sec) then
{
#ifdef GRGserver
[] call blck_fnc_broadcastServerFPS;
#endif
_timer1sec = diag_tickTime + 1;
};
if (diag_tickTime > _timer5sec) then
{
_timer5sec = diag_tickTime + 5;
if (blck_simulationManager isEqualTo blck_useBlckeaglsSimulationManagement) then {[] call blck_fnc_simulationManager};
[] call blck_fnc_sm_staticPatrolMonitor;
[] call blck_fnc_vehicleMonitor;
};
if (diag_tickTime > _timer20sec) then
{
[] call blck_fnc_cleanupAliveAI;
[] call blck_fnc_cleanupObjects;
[] call blck_fnc_cleanupDeadAI;
[] call blck_fnc_scanForPlayersNearVehicles;
[] call GMS_fnc_cleanupTemporaryMarkers;
[] call GMS_fnc_updateCrateSignals;
[] call blck_fnc_cleanEmptyGroups;
_timer20sec = diag_tickTime + 20;
};
if ((diag_tickTime > _timer1min)) then
{
_timer1min = diag_tickTime + 60;
[] call blck_fnc_spawnPendingMissions;
[] call blck_fnc_cleanEmptyGroups;
[] call blck_fnc_groupWaypointMonitor; // TODO: Test implementation of this function.
if (blck_dynamicUMS_MissionsRuning < blck_numberUnderwaterDynamicMissions) then {[] spawn blck_fnc_addDyanamicUMS_Mission};
if (blck_useHC) then {[] call blck_fnc_HC_passToHCs};
if (blck_useTimeAcceleration) then {[] call blck_fnc_timeAcceleration};
if (blck_ai_offload_to_client) then {[] call blck_fnc_ai_offloadToClients};
#ifdef blck_debugMode
diag_log format["_fnc_mainThread: active scripts include: %1",diag_activeScripts];
#endif
};
if (diag_tickTime > _timer5min) then
{
diag_log format["[blckeagls] Timstamp %8 |Dynamic Missions Running %1 | UMS Running %2 | Vehicles %3 | Groups %4 | Server FPS %5 | Server Uptime %6 Min | Missions Run %7",blck_missionsRunning,blck_dynamicUMS_MissionsRuning,count blck_monitoredVehicles,count blck_monitoredMissionAIGroups,diag_FPS,floor(diag_tickTime/60),blck_missionsRun, diag_tickTime];
#ifdef blck_debugMode
/*
Syntax:
diag_activeSQFScripts
Return Value:
Array of Arrays - to format [[scriptName, fileName, isRunning, currentLine], ...]:
*/
//private _activeScripts = call diag_activeSQFScripts;
{
if (_x select 2 /* isRunning */) then
{
//diag_log format["script name %1",_x select 0];
};
} forEach diag_activeSQFScripts;
#endif
_timer5min = diag_tickTime + 300;
};
};

View File

@ -0,0 +1,23 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_mArray","_count"];
_mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"];
_textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) + (_size select 0), 0];
_MainMarker = createMarker ["ai_count" + _name, _textPos];
_MainMarker setMarkerShape "Icon";
_MainMarker setMarkerType "HD_Arrow";
_MainMarker setMarkerColor "ColorBlack";
_MainMarker setMarkerText format["% Alive",_count];
//_MainMarker setMarkerDir 37;

View File

@ -0,0 +1,25 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_location","_MainMarker","_name"];
//diag_log format["blck_fnc_missionCompleteMarker:: _this = %1",_this];
_location = _this select 0;
_name = str(random(1000000)) + "MarkerCleared";
_MainMarker = createMarker [_name, _location];
_MainMarker setMarkerColor "ColorBlack";
_MainMarker setMarkerType "n_hq";
_MainMarker setMarkerText "Mission Cleared";
//uiSleep 300;
//deleteMarker _MainMarker;
blck_temporaryMarkers pushBack [_MainMarker, diag_tickTime + 300];
//diag_log format["missionCompleteMarker complete script for _this = %1",_this];

View File

@ -0,0 +1,23 @@
/*
Check if an HC is connected and if so transfer some AI to it.
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
// blck_connectedHCs // list of connected HCs at last check.
_HCs = entities "HeadlessClient_F"; // currently connected HCs.
{
if ([_x] call _fn_HC_disconnected) then
{
// Remove any event handlers added by the HC
};
}forEach blck_connectedHCs;

View File

@ -0,0 +1,13 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
params["_killer"];
[["IED","",0,0],[_killer]] call blck_fnc_MessagePlayers;

View File

@ -0,0 +1,21 @@
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["_fnc_nearestPlayers: _this = %1",_this];
params["_coords","_range"];
private["_return","_playerClassNames","_epochClasses","_exileClasses"];
if (blck_modType isEqualTo "Epoch") then {_playerClassNames = ["Epoch_Female_F","Epoch_Male_F"]};
if (blck_modType isEqualTo "Exile") then {_playerClassNames = ["Exile_Unit_Player"]};
_return = nearestObjects[_coords,_playerClassNames,_range];
_return

View File

@ -0,0 +1,29 @@
//////////////////////////////////////////////////////
// Test whether one object (e.g., a player) is within a certain range of any of an array of other objects
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_result","_players"];
params["_pos","_dist",["_onFootOnly",false]];
_players = call blck_fnc_allPlayers;
_result = false;
if !(_onFootOnly) then
{
{
if ((_x distance2D _pos) < _dist) exitWith {_result = true;};
} forEach _players;
} else {
{
if ( ((_x distance2D _pos) < _dist) && (vehicle _x isEqualTo _x)) exitWith {_result = true;};
} forEach _players;
};
_result

View File

@ -0,0 +1,22 @@
//////////////////////////////////////////////////////
// Test whether one object (e.g., a player) is within a certain range of any of an array of other objects
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_result"];
params["_locations","_dist",["_onFootOnly",false]];
_result = false;
{
_result = [_x,_dist,_onFootOnly] call blck_fnc_playerInRange;
if (_result) exitWith {};
} forEach _locations;
_result

View File

@ -0,0 +1,22 @@
//////////////////////////////////////////////
// returns a position array at random position within a radius of _range relative to _pos.
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
////////////////////////////////////////////
private["_newX","_newY"];
params["_pos","_range"];
_newX = ((_pos select 0) + (random(_range)) * (selectRandom [1,-1]));
_newY = ((_pos select 1) + (random(_range)) * (selectRandom [1,-1]));
[_newX,_newY,0]

View File

@ -0,0 +1,77 @@
/*
blck_fnc_setAILocality
Addapted for blckeagls from:
DMS_fnc_SetAILocality
Created by Defent and eraser1
Usage:
[
_groupOrUnit,
_posOrObject // Does not have to be defined if element 1 is a unit
] call DMS_fnc_SetAILocality;
Makes a random player within 3 KM of the AI unit or group the owner.
Offloading AI will improve server performance, but the unit will no longer be local, which will limit the server's control over it.
Could however have negative effects if target player has a potato PC.
Returns true if a viable owner was found, false otherwise.
*/
private _AI = param [0,objNull,[objNull,grpNull]];
//diag_log format["_fnc_setAILocality: _this = %1",_this];
if (isNull _AI) exitWith
{
diag_log format ["blckeagls ERROR :: Calling blck_fnc_SetAILocality with null parameter; _this: %1",_this];
};
private _AIType = typeName _AI;
private _pos = if (_AIType isEqualTo "OBJECT") then {_AI} else {param [1,"",[objNull,[]],[2,3]]};
if (_pos isEqualTo "") exitWith
{
diag_log format ["blckeagls ERROR :: Calling blck_fnc_SetAILocality with invalid position; this: %1",_this];
};
private _client = objNull;
{
if ((alive _x) && {(_x distance2D _pos)<=3000}) exitWith
{
_client = _x;
};
} forEach allPlayers;
if (!isNull _client) then
{
private _swapped = if (_AIType isEqualTo "OBJECT") then {_AI setOwner (owner _client)} else {_AI setGroupOwner (owner _client)};
if (!_swapped) then
{
ExileServerOwnershipSwapQueue pushBack [_AI,_client];
};
if (blck_ai_offload_notifyClient) then
{
private _msg = format ["blckeagls :: AI %1 |%2| has been offloaded to you.",_AIType,_AI];
_msg remoteExecCall ["systemChat", _client];
_msg remoteExecCall ["diag_log", _client];
};
#ifdef blck_debugMode
if (blck_debugOn) then
{
diag_log format ["SetAILocality :: Ownership swap of %1 (%4) to %2 (%3) is initialized. Initial swap attempt successful: %5",_AI, name _client, getPlayerUID _client, _AIType, _swapped];
};
#endif
true
}
else
{
#ifdef blck_debugMode
if (blck_debugOn) then
{
diag_log format ["SetAILocality :: No viable client found for the ownership of %1! _pos: %2.",_AI,_pos];
};
#endif
false
};

View File

@ -0,0 +1,78 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_blck_fn_configureRoundMarker"];
_blck_fn_configureRoundMarker = {
private["_name","_pos","_color","_size","_MainMarker","_arrowMarker","_labelMarker","_labelType"];
params["_name","_pos","_color","_text","_size","_labelType","_mShape","_mBrush"];
if ((_pos distance [0,0,0]) < 10) exitWith {};
_MainMarker = createMarker [_name, _pos];
_MainMarker setMarkerColor _color;
_MainMarker setMarkerShape "ELLIPSE";
_MainMarker setMarkerBrush "Grid";
_MainMarker setMarkerSize _size; //
if (count toArray(_text) > 0) then
{
switch (_labelType) do {
case "arrow":
{
_name = "label" + _name;
_textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0];
_arrowMarker = createMarker [_name, _textPos];
_arrowMarker setMarkerShape "Icon";
_arrowMarker setMarkerType "HD_Arrow";
_arrowMarker setMarkerColor "ColorBlack";
_arrowMarker setMarkerText _text;
//_MainMarker setMarkerDir 37;
};
case "center":
{
_name = "label" + _name;
_labelMarker = createMarker [_name, _pos];
_labelMarker setMarkerShape "Icon";
_labelMarker setMarkerType "mil_dot";
_labelMarker setMarkerColor "ColorBlack";
_labelMarker setMarkerText _text;
};
};
};
if (isNil "_labelMarker") then {_labelMarker = ""};
_labelMarker
};
_blck_fn_configureIconMarker = {
private["_MainMarker"];
params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]];
_name = "label" + _name;
_MainMarker = createMarker [_name, _pos];
_MainMarker setMarkerShape "Icon";
_MainMarker setMarkerType _icon;
_MainMarker setMarkerColor _color;
_MainMarker setMarkerText _text;
_MainMarker
};
params["_mArray"];
private["_marker"];
_mArray params["_missionMarkerName","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerTypeInfo"];
_markerTypeInfo params["_mShape",["_mSize",[0,0]],["_mBrush","GRID"]];
if (toUpper(_mShape) in ["ELIPSE","ELLIPSE","RECTANGLE"]) then // not an Icon ....
{
_marker = [_missionMarkerName,_markerPos,_markerColor,_markerLabel, _mSize,_markerLabelType,_mShape,_mBrush] call _blck_fn_configureRoundMarker;
};
if !(toUpper(_mShape) in ["ELIPSE","ELLIPSE","RECTANGLE"]) then
{
_marker = [_missionMarkerName,_markerPos, _markerColor,_markerLabel,_mShape] call _blck_fn_configureIconMarker;
};
if (isNil "_marker") then {_marker = ""};
_marker

View File

@ -0,0 +1,22 @@
//////////////////////////////////////////////////////
// test if a timeout condition exists.
// [_startTime] call blck_fnc_timedOut
// Returns true (timed out) or false (not timed out)
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
/////////////////////////////////////////////////////
params["_startTime",["_timeoutTime",blck_MissionTimeout]];
private["_return"];
//if ((diag_tickTime - _startTime) > _timeoutTime) then {_return = true} else {_return = false};
_return = ((diag_tickTime - _startTime) > _timeoutTime) ;
_return;

View File

@ -0,0 +1,49 @@
/*
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
for "_i" from 1 to (count blck_illuminatedCrates) do
{
if (_i > (count blck_illuminatedCrates)) exitWith {};
private _c = blck_illuminatedCrates deleteAt 0;
_c params["_crate","_smoke","_light","_smokeShell","_lightSource","_refreshTime","_endAt"];
//diag_log format["_unpdateCrateSignals: [_crate %1 | _smoke %2 | _light %3 |_smokeShell %4 | _lightSource %5 | curr time %8 | _refreshTime %6 |_endAt %7",_crate,_smoke,_light,_smokeShell,_lightSource,_refreshTime,_endAt,diag_tickTime];
if (diag_tickTime < _endAt) then
{
if (diag_tickTime > _refreshTime) then
{
if !(isNull _smoke) then
{
detach _smoke;
deleteVehicle _smoke;
};
if !(isNull _light) then
{
detach _light;
deleteVehicle _light;
};
_smoke = _smokeShell createVehicle getPosATL _crate;
_smoke setPosATL (getPosATL _crate);
_smoke attachTo [_crate,[0,0,(0.5)]]; // put the smoke a fixed distance above the top of any object to make it as visible as possible
if(sunOrMoon < 0.2) then
{
_light = _lightSource createVehicle getPosATL _crate;
_light setPosATL (getPosATL _crate);
_light attachTo [_crate,[0,0,(0.55)]];
};
blck_illuminatedCrates pushBack [_crate,_smoke,_light,_smokeShell,_lightSource,diag_tickTime + 120,_endAt];
} else {
//diag_log format["_updateCrateSignals: refresh light at %1",_refreshTime];
//blck_illuminatedCrates pushBack [_crate,_smoke,_light,_smokeShell,_lightSource,_refreshTime,_endAt];
blck_illuminatedCrates pushBack _c;
};
} else {
//diag_log format["_updateCrateSignals: crate has been illuminated for enough time, no need to continue"];
};
};

View File

@ -0,0 +1,13 @@
/*
by Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_marker","_rootText","_missionAI"];
_marker setMarkerText format["%1 / %2 AI Alive",_rootText,{alive _x} count _missionAI];

View File

@ -0,0 +1,23 @@
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
Waits for a random period between _min and _max seconds
Call as
[_minTime, _maxTime] call blck_fnc_waitTimer
Returns true;
/*
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_wait","_Tstart"];
params["_min","_max"];
uiSleep round( _min + (_max - _min) );
true

View File

@ -0,0 +1,12 @@
/*
Based on code by IT07 written for VEMF_r
*/
private "_mod";
_mod = "";
if not ( isNull ( configFile >> "CfgPatches" >> "exile_server" ) ) then { _mod = "Exile" };
if not ( isNull ( configFile >> "CfgPatches" >> "a3_epoch_server" ) ) then { _mod = "Epoch" };
_mod

View File

@ -0,0 +1,98 @@
// Changes type of waypont0 for the specified group to "MOVE" and updates time stamps, WP postion and Timout parameters accordinglyD.
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
// TODO: used for 'unstuck' cases
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
//diag_log "_fnc_changeToMoveWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp","_wpPos","_dis","_arc","_dir","_newPos","_marker","_center","_minDis","_maxDis"];
_group = group _this;
_group setcombatmode "YELLOW";
_group setBehaviour "COMBAT";
_group setVariable["timeStamp",diag_tickTime];
_wp = [_group, 0];
_wpPos = getPos ((units _group) select 0);
_dir = _group getVariable["wpDir",0];
_center = _group getVariable ["patrolCenter",_wpPos];
if (_group getVariable["wpMode","random"] isEqualTo "random") then
{
_dir = random(360);
} else {
_dir = (_group getVariable["wpDir",0]) + 70;
_group setVariable["wpDir",_dir];
};
_minDis = _group getVariable["minDis",25];
_maxDis = _group getVariable["maxDis",30];
_dis = (_minDis) + random( (_maxDis) - (_minDis) );
_newPos = (_center) getPos[_dis,_dir];
_wp setWPPos [_newPos select 0, _newPos select 1];
_wp setWaypointCompletionRadius (_group getVariable["wpRadius",0]);
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,15,20];
_wp setWaypointLoiterRadius (_group getVariable["wpRadius",30]);
_wp setWaypointLoiterType "CIRCLE";
_wp setWaypointSpeed "LIMITED";
_group setCurrentWaypoint _wp;
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new Waypoint position is %2",_group, getWPPos _wp];
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint (4/25/17): _this = %1", _this];
diag_log format["_fnc_changeToMoveWaypoint: typeName _this = %1", typeName _this];
diag_log format["_fnc_changeToMoveWaypoint:_group = %1",_group];
diag_log format["_fnc_changeToMoveWaypoint:_group timestamp updated to %1", _group getVariable "timeStamp"];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> wpMode %1 _dir %2 _dis %3 _center %4",_group getVariable["wpMode","random"], _dir, _dis,_center];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new position is %2",_group, _newPos];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new Waypoint position is %2",_group, getWPPos _wp];
diag_log format["_fnc_changeToMoveWaypoint:_group %1 basic waypoint parameters updates", _group getVariable "timeStamp"];
_marker =_group getVariable["wpMarker",""];
_marker setMarkerColor "ColorBlue";
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif
if (_group getVariable["wpPatrolMode",""] isEqualTo "SAD") then
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint: seting waypoint script for group %1 to SAD Mode",_group];
};
_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a SAD Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint;"];
#endif
};
if (_group getVariable["wpPatrolMode",""] isEqualTo "SENTRY") then
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint: seting waypoint script for group %1 to SENTRY Mode",_group];
};
_wp setWaypointStatements ["true","this call blck_fnc_changeToSentryWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a SENTRY Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToSentryWaypoint;"];
#endif
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
};
#endif

View File

@ -0,0 +1,98 @@
// Changes type of waypont0 for the specified group to "MOVE" and updates time stamps, WP postion and Timout parameters accordinglyD.
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
// TODO: used for 'unstuck' cases
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
//diag_log "_fnc_changeToMoveWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp","_wpPos","_dis","_arc","_dir","_newPos","_marker","_center","_minDis","_maxDis"];
_group = group _this;
_group setcombatmode "YELLOW";
_group setBehaviour "COMBAT";
_group setVariable["timeStamp",diag_tickTime];
_wp = [_group, 0];
_wpPos = getPos ((units _group) select 0);
_dir = _group getVariable["wpDir",0];
_center = _group getVariable ["patrolCenter",_wpPos];
if (_group getVariable["wpMode","random"] isEqualTo "random") then
{
_dir = random(360);
} else {
_dir = (_group getVariable["wpDir",0]) + 70;
_group setVariable["wpDir",_dir];
};
_minDis = _group getVariable["minDis",25];
_maxDis = _group getVariable["maxDis",30];
_dis = (_minDis) + random( (_maxDis) - (_minDis) );
_newPos = (_center) getPos[_dis,_dir];
_wp setWPPos [_newPos select 0, _newPos select 1];
_wp setWaypointCompletionRadius (_group getVariable["wpRadius",0]);
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,15,20];
_wp setWaypointLoiterRadius (_group getVariable["wpRadius",30]);
_wp setWaypointLoiterType "CIRCLE";
_wp setWaypointSpeed "LIMITED";
_group setCurrentWaypoint _wp;
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new Waypoint position is %2",_group, getWPPos _wp];
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint (4/25/17): _this = %1", _this];
diag_log format["_fnc_changeToMoveWaypoint: typeName _this = %1", typeName _this];
diag_log format["_fnc_changeToMoveWaypoint:_group = %1",_group];
diag_log format["_fnc_changeToMoveWaypoint:_group timestamp updated to %1", _group getVariable "timeStamp"];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> wpMode %1 _dir %2 _dis %3 _center %4",_group getVariable["wpMode","random"], _dir, _dis,_center];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new position is %2",_group, _newPos];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new Waypoint position is %2",_group, getWPPos _wp];
diag_log format["_fnc_changeToMoveWaypoint:_group %1 basic waypoint parameters updates", _group getVariable "timeStamp"];
_marker =_group getVariable["wpMarker",""];
_marker setMarkerColor "ColorBlue";
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif
if (_group getVariable["wpPatrolMode",""] isEqualTo "SAD") then
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint: seting waypoint script for group %1 to SAD Mode",_group];
};
_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a SAD Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint;"];
#endif
};
if (_group getVariable["wpPatrolMode",""] isEqualTo "SENTRY") then
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint: seting waypoint script for group %1 to SENTRY Mode",_group];
};
_wp setWaypointStatements ["true","this call blck_fnc_changeToSentryWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a SENTRY Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToSentryWaypoint;"];
#endif
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
};
#endif

View File

@ -0,0 +1,53 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
// TODO: Still needed?
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
diag_log "_fnc_changeToSADWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp"];
_group = group _this;
_group setVariable["timeStamp",diag_tickTime];
_group setcombatmode "RED";
_group setBehaviour "COMBAT";
_wp = [_group, 0];
_group setCurrentWaypoint _wp;
_wp setWaypointType "SAD";
_wp setWaypointName "sad";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,15,20];
diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"]};
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;"];
#endif
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
private ["_marker"];
_marker = _group getVariable["wpMarker",""];
_marker setMarkerColor "ColorRed";
diag_log format["_fnc_changeToSADWaypoint:: -- :: _this = %1 and typName _this %2",_this, typeName _this];
diag_log format["_fnc_changeToSADWaypoint:: -- >> group to update is %1 with typeName %2",_group, typeName _group];
diag_log format["_fnc_changeToSADWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_changeToSADWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif

View File

@ -0,0 +1,50 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
// TODO: Not used?
// Keep in for now.
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
diag_log "_fnc_changeToSADWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp"];
_group = group _this;
_group setVariable["timeStamp",diag_tickTime];
_wp = [_group, 0];
_group setCurrentWaypoint _wp;
_group setcombatmode "RED";
_group setBehaviour "COMBAT";
_wp setWaypointType "SENTRY";
_wp setWaypointName "sentry";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,15,20];
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;"];
#endif
#ifdef blck_debugMode
if (blck_debugLevel >1) then
{
diag_log format["_fnc_changeToSentryWaypoint:: -- :: _this = %1 and typName _this %2",_this, typeName _this];
diag_log format["_fnc_changeToSentryWaypoint:: -- >> group to update is %1 with typeName %2",_group, typeName _group];
private ["_marker"];
_marker = _group getVariable["wpMarker",""];
_marker setMarkerColor "ColorYellow";
diag_log format["_fnc_changeToSentryWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_changeToSentryWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif

View File

@ -0,0 +1,23 @@
/*
Checks for groups that have not reached their waypoints within a proscribed period
and redirects them.
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
params["_group","_maxTime","_radius"];
if (diag_tickTime > (_group getVariable "timeStamp") + _maxTime) then // || ( (getPos (leader)) distance2d (_group getVariable "patrolCenter") > _radius)) then
{
(leader _group) call blck_fnc_setNextWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["_fnc_checkGroupWaypointStatus: group %1 stuck, waypoint reset",_group];};
#endif
};

View File

@ -0,0 +1,19 @@
/*
removes empty or null groups from blck_monitoredMissionAIGroups
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
for "_i" from 0 to ((count blck_monitoredMissionAIGroups) - 1) do
{
if (_i >= (count blck_monitoredMissionAIGroups)) exitWith {};
_grp = blck_monitoredMissionAIGroups deleteat 0;
if ({alive _x} count units _grp > 0) then { blck_monitoredMissionAIGroups pushBack _grp};
};

View File

@ -0,0 +1,32 @@
/*
[] call blck_fnc_createGroup
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params[["_side",blck_AI_Side],["_deleteWhenEmpty",true]];
// for information about the _deleteWhenEmpty parameter see: https://community.bistudio.com/wiki/createGroup
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["_fnc_createGroup: _this = %1",_this]};
#endif
private _groupSpawned = createGroup [_side, true];
if (isNull _groupSpawned) exitWith{"ERROR:-> Null Group created by blck_fnc_spawnGroup";};
if (blck_simulationManager == blck_useDynamicSimulationManagement) then
{
_groupSpawned enableDynamicSimulation true;
};
_groupSpawned setcombatmode "RED";
_groupSpawned setBehaviour "COMBAT";
_groupSpawned allowfleeing 0;
_groupSpawned setspeedmode "FULL";
_groupSpawned setFormation blck_groupFormation;
_groupSpawned setVariable ["blck_group",true];
_groupSpawned

View File

@ -0,0 +1,21 @@
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_group","_wp"];
_group = group _this;
_group setVariable["timeStamp",diag_tickTime];
_wp = [_group, 0];
_group setCurrentWaypoint _wp;

View File

@ -0,0 +1,19 @@
/*
by Ghostrider
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
params["_pos"];
private["_units"];
if (blck_modType == "Epoch") then {_units = (nearestObjects[_pos,["I_Soldier_EPOCH"], 1000]) select {vehicle _x isEqualTo _x}};
if (blck_modType == "Exile") then {_units = (nearestObjects[_pos ,["i_g_soldier_unarmed_f"], 1000]) select {vehicle _x isEqualTo _x}};
private _nearestGroup = group(_units select 0);
_nearestGroup

View File

@ -0,0 +1,54 @@
/*
Checks for groups that have not reached their waypoints within a proscribed period
and redirects them.
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
// TODO: Test functionality of this
_fn_waypointComplete = {
private _group = _this select 0;
private _wp = currentWaypoint _group;
private _done = if (currentWaypoint _group) > (count (waypoints _group)) then {true} else {false};
_done
};
//diag_log format["_fnc_groupWaypointMonitor called at %1 with %2 groups to monitor",diag_tickTime,count blck_monitoredMissionAIGroups];
{
private["_timeStamp","_index","_unit","_soldierType"];
if ( !(_x isEqualTo grpNull) && ({alive _x} count (units _x) > 0) ) then
{
/*
#define blck_turnBackRadiusInfantry 800
#define blck_turnBackRadiusVehicles 1000
#define blck_turnBackRadiusHelis 1000
#define blck_turnBackRadiusJets 1500
*/
//diag_log format["_fn_monitorGroupWaypoints - radii: on foot %1 | vehicle %2 | heli %3 | jet %4",blck_turnBackRadiusInfantry,blck_turnBackRadiusVehicles,blck_turnBackRadiusHelis,blck_turnBackRadiusJets];
_timeStamp = _x getVariable ["timeStamp",0];
if (_timeStamp isEqualTo 0) then
{
_x setVariable["timeStamp",diag_tickTime];
//diag_log format["_fn_monitorGroupWaypoints::--> updating timestamp for group %1 at time %2",_x,diag_tickTime];
};
_soldierType = _x getVariable["soldierType","null"];
//diag_log format["_fn_monitorGroupWaypoints::--> soldierType for group %1 = %2 and timeStamp = %3",_x,_soldierType,_timeStamp];
switch (_soldierType) do
{
case "infantry": {[_x, 60] call blck_fnc_checkgroupwaypointstatus;};
case "vehicle": {[_x, 90, 800] call blck_fnc_checkgroupwaypointstatus;};
case "aircraft": {[_x, 90, 1000] call blck_fnc_checkgroupwaypointstatus;};
};
};
//private _updateNeeded = if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
} forEach blck_monitoredMissionAIGroups;

View File

@ -0,0 +1,118 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
TODO: Replaces changeToMoveWaypoint
and
Replaces changeToSADWaypoint
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_group","_wp","_index","_pattern","_mode","_arc","_dis","_wpPos"];
private _group = group _this;
private _leader = _this;
private _pos = _group getVariable "patrolCenter"; // Center of the area to be patroleld.
private _minDis = _group getVariable "minDis"; // minimum distance between waypoints
private _maxDis = _group getVariable "maxDis"; // maximum distance between waypoints
// _group getVariable "timeStamp"; // used to check that waypoints are being completed
//private _wpRadisu _group getVariable "wpRadius"; // Always set to 0 to force groups to move a bit
private _patrolRadius = _group getVariable "patrolRadius"; // radius of the area to be patrolled
private _wpMode = _group getVariable "wpMode"; // The default mode used when the waypoint becomes active https://community.bistudio.com/wiki/AI_Behaviour
//_group getVariable "wpPatrolMode"; // Not used; the idea is to allow two algorythms: randomly select waypoints so groups move back and forth along the perimiter of the patrool area or sequenctioal, hoping along the perimeter
private _wpTimeout = _group getVariable "wpTimeout"; // Here to alow you to have the game engine pause before advancing to the next waypoing. a timout of 10-20 sec is recommended for infantry and land vehicles, and 1 sec for aircraft
private _wpDir = _group getVariable "wpDir"; // Used to note the degrees along the circumference of the patrol area at which the last waypoint was positioned.
private _arc = _group getVariable "wpArc"; // Increment in degrees to be used when advancing the position of the patrol to the next position along the patrol perimeter
//_group getVariable "soldierType"; // infantry, vehicle, air or emplaced. Note that there is no need to have more than one waypoint for emplaced units.
private _wp = [_group,0];
private _nearestEnemy = _leader findNearestEnemy (getPosATL _leader);
private _maxTime = _group getVariable["maxTime",300];
// Extricate stuck group.
if (diag_tickTime > (_group getVariable "timeStamp") + _maxTime) exitWith
{ // try to get unit to move and do antiStuck actions
_group setBehaviour "CARELESS"; // We need them to forget about enemies and move
_group setCombatMode "BLUE"; // We need them to disengage and move
private _vector = _wpDir + _arc + 180; // this should force units to cross back and forth across the zone being patrolled
_group setVariable["wpDir",_vector,true];
private _newWPPos = _pos getPos[_patrolRadius,_vector];
_wp setWaypointPosition [_newWPPos,0];
_wp setWaypointBehaviour "SAFE";
_wp setWaypointCompletionRadius 0;
_wp setWaypointTimeout _wpTimeout;
_wp setWaypointType "MOVE";
_group setCurrentWaypoint _wp;
//diag_log format["_fnc_setNextWaypoint[antiSticking]: _group = %1 | _newPos = %2 | waypointStatements = %3",_group,_newWPPos,waypointStatements _wp];
};
// Move when no enemies are nearby
if (isNull _nearestEnemy) then
{
// Use standard waypoint algorythms
/*
Have groups zig-zag back and forth their patrol area
Setting more relaxed criteria for movement and rules of engagement
*/
private _vector = _wpDir + _arc + 180; // this should force units to cross back and forth across the zone being patrolled
_group setVariable["wpDir",_vector,true];
_group setCombatMode "YELLOW";
private _newWPPos = _pos getPos[_patrolRadius,_vector];
_wp setWaypointPosition [_newWPPos,0];
_group setBehaviour "SAFE"; // no enemies detected so lets put the group in a relaxed mode
_wp setWaypointBehaviour "SAFE";
_wp setWaypointCombatMode "YELLOW";
_wp setWaypointCompletionRadius 0;
_wp setWaypointTimeout _wpTimeout;
_group setCurrentWaypoint _wp;
//diag_log format["_fnc_setNextWaypoint[no enemies]: _group = %1 | _newPos = %2 | waypointStatements = %3",_group,_newWPPos,waypointStatements _wp];
} else {
// move toward nearest enemy using hunting logic
// set mode to SAD / COMBAT
/*
_vector set to relative direction from leader to enemy +/- random adjustment of up to 33 degrees
_distance can be up to one patrol radius outside of the normal perimeter closer to enemy
_timout set to longer period
when coupled with SAD behavior should cause interesting behaviors
*/
// [point1, point2] call BIS_fnc_relativeDirTo
private _vector = ([_leader,_nearestEnemy] call BIS_fnc_relativeDirTo) + (random(33)*selectRandom[-1,1]);
_group setVariable["wpDir",_vector];
private ["_huntDistance"];
if ((leader _group) distance _nearestEnemy > (_patrolRadius * 2)) then
{
if (((leader _group) distance _pos) > (2 * _patrolRadius)) then
{
_huntdistance = 0;
} else {
_huntDistance = _patrolRadius;
};
} else {
_huntDistance = ((leader _group) distance _nearestEnemy) / 2;
};
private _newWPPos = _pos getPos[_huntDistance,_vector];
//diag_log format["_fnc_setextWaypoint: _pos = %1 | _patrolRadius = %5 | _newWPPos = %2 | _huntDistance = %3 | _vector = %4",_pos,_newWPPos,_huntDistance,_vector,_patrolRadius];
_wp setWaypointPosition [_newWPPos,0];
_wp setWaypointBehaviour "SAD";
_group setBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout[30,45,60];
_wp setWaypointCompletionRadius 0;
_group setCurrentWaypoint _wp;
// Assume the same waypoint statement will be available
//diag_log format["_fnc_setNextWaypoint[enemies]t: _group = %1 | _newPos = %2 | _nearestEnemy = 54 | waypointStatements = %3",_group,_newWPPos,waypointStatements _wp,_nearestEnemy];
};

View File

@ -0,0 +1,85 @@
// Sets up waypoints for a specified group.
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_dir","_arc","_noWp","_newpos","_wpradius","_wp"];
params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_wpPatrolMode","SAFE"],["_soldierType","null"],["_patrolRadius",30],["_wpTimeout",[5.0,7.5,10]]];
_wp = [_group, 0];
if !(_soldierType isEqualTo "emplaced") then
{
_arc = 360/5;
_group setcombatmode "RED";
_group setBehaviour "SAFE";
_group setVariable["patrolCenter",_pos,true]; // Center of the area to be patroleld.
_group setVariable["minDis",_minDis,true]; // minimum distance between waypoints
_group setVariable["maxDis",_maxDis,true]; // maximum distance between waypoints
_group setVariable["timeStamp",diag_tickTime]; // used to check that waypoints are being completed
_group setVariable["wpRadius",0]; // Always set to 0 to force groups to move a bit
_group setVariable["patrolRadius",_patrolRadius,true]; // radius of the area to be patrolled
_group setVariable["wpMode",_mode,true]; // The default mode used when the waypoint becomes active https://community.bistudio.com/wiki/AI_Behaviour
_group setVariable["wpPatrolMode",_wpPatrolMode]; // Not used; the idea is to allow two algorythms: randomly select waypoints so groups move back and forth along the perimiter of the patrool area or sequenctioal, hoping along the perimeter
_group setVariable["wpTimeout",_wpTimeout,true]; // Here to alow you to have the game engine pause before advancing to the next waypoing. a timout of 10-20 sec is recommended for infantry and land vehicles, and 1 sec for aircraft
_group setVariable["wpDir",0,true]; // Used to note the degrees along the circumference of the patrol area at which the last waypoint was positioned.
_group setVariable["wpArc",_arc,true]; // Increment in degrees to be used when advancing the position of the patrol to the next position along the patrol perimeter
_group setVariable["soldierType",_soldierType]; // infantry, vehicle, air or emplaced. Note that there is no need to have more than one waypoint for emplaced units.
_dir = 0;
_dis = (_minDis) + random( (_maxDis) - (_minDis) );
_newPos = _pos getPos[_dis,_dir];
_wp setWPPos [_newPos select 0, _newPos select 1];
_wp setWaypointCompletionRadius 0; //(_group getVariable["wpRadius",30]);
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "SAFE";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout _wpTimeout;
_group setCurrentWaypoint _wp;
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_setNextWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_setNextWaypoint;"];
#endif
#ifdef blck_debugMode
if (blck_debugLevel >= 3) then
{
_marker = createMarker [format["GroupMarker%1",_group],_newPos];
_group setVariable["wpMarker",_marker,true];
_marker setMarkerColor "ColorBlue";
_marker setMarkerText format["%1 %2",(_group getVariable["soldierType","null"]),_group];
_marker setMarkerType "mil_triangle";
//diag_log format["_fnc_setupWaypoints: configuring weapoints for group %2 mobile patrol with _soldierType = %1",_solderType,_group];
diag_log format["_fnc_setupWaypoints: soldier type for mobile _group %1 set to %2",_group, (_group getVariable["soldierType","null"])];
diag_log format["_fnc_setupWaypoints: all variables for the group have been set for group %1",_group];
diag_log format["_fnc_setupWaypoints:: -- >> wpMode %1 _dir %2 _dis %3",_group getVariable["wpMode","random"], _dir, _dis];
diag_log format["_fnc_setupWaypoints:: -- >> group to update is %1 and new position is %2",_group, _newPos];
diag_log format["_fnc_setupWaypoints:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_setupWaypoints:: -- >> Waypoint marker for group %1 have been configured as %2 with text set to %3",_group, _group getVariable "wpMarker", markerText (_group getVariable "wpMarker")];
};
#endif
} else {
_wp setWaypointType "SENTRY";
_wp setWPPos (getPos leader _group);
_wp setWaypointCompletionRadius 100;
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [1,1.1,1.2];
//_wp setWaypointTimeout [0.1,0.1100,0.1200];
_group setCurrentWaypoint _wp;
_group setVariable["soldierType",_soldierType,true];
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_emplacedWeaponWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to an emplaced weapon Waypoint',group this];"];
if (blck_debugLevel > 2) then {diag_log format["_fnc_setupWaypoints: configuring weapoints for group %2 for emplaced weapon with _soldierType = %1",_soldierType,_group];};
#else
_wp setWaypointStatements ["true","this call blck_fnc_emplacedWeaponWaypoint;"];
#endif
};

View File

@ -0,0 +1,65 @@
/*
Managages simulation using blckeagls logic
By Ghostrider-GRG-
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_playerType","_players"];
_playerType = ["LandVehicle","SHIP","AIR","TANK"];
//diag_log format["_fnc_simulationMonitor Called at %1",diag_tickTime];
// TODO: establish if vehicles are sometimes frozen because they are not properly activated.
switch (toLower(blck_modType)) do
{
case "exile": {_playerType = _playerType + ["Exile_Unit_Player"]};
case "epoch": {_playerType = _playerType + ["Epoch_Male_F","Epoch_Female_F"]};
};
{
private _group = _x;
_players = ((leader _group) nearEntities [_playerType, blck_simulationEnabledDistance]) select {isplayer _x};
if !(_players isEqualTo []) then
{
{
if !(simulationEnabled _x) then
{
_x enableSimulationGlobal true;
(_players select 0) reveal _x; // Force simulation on
};
}forEach (units _group);
}else{
{
if (simulationEnabled _x) then
{
_x enableSimulationGlobal false;
};
}forEach (units _x);
};
} forEach blck_monitoredMissionAIGroups;
{
if (simulationEnabled _x) then
{
if !([_x,25,true] call blck_fnc_playerInRange) then
{
#ifdef blck_debugMode
diag_log format['_fnc_simulationManager: disabling simulation for dead AI %1',_x];
#endif
_x enableSimulationGlobal false;
};
} else {
if ([_x,25,true] call blck_fnc_playerInRange) then
{
#ifdef blck_debugMode
diag_log format['_fnc_simulationManager: enabling simulation for dead AI %1',_x];
#endif
_x enableSimulationGlobal true;
};
};
} forEach blck_deadAI;
// TODO: Add check for dead AI.
// TODO: Can this be run less often, say every 5 sec?

View File

@ -0,0 +1,86 @@
/*
blck_fnc_spawnGroup
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_numbertospawn","_safepos","_launcherType","_infantryType"];
params[["_group","Error"],"_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",30], ["_maxDist",45],["_configureWaypoints",true], ["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_scuba",false],["_patrolRadius",30]];
#ifdef blck_debugMode
if (blck_debugLevel > 3) then
{
{
diag_log format["_fnc_spawnGroup: _this select %1 = %2",_forEachIndex,_this select _forEachIndex];
}forEach _this;
};
#endif
if !(typeName _group isEqualTo "GROUP") exitWith {
if (_group isEqualTo "Error") exitWith {diag_log format["_fnc_spawnGroup [ERROR]: no parameter was passed for _group"]};
diag_log format["_fnc_spawnGroup {ERROR]}: parameter %2 of type %1 passed, 'GROUP expected",typeName _group,_group];
};
//if (isNull _group) exitWith {diag_log format["ERROR: No valid value _group was passed to blck_fnc_spawnGroup"]};
if (_weaponList isEqualTo []) then {_weaponList = [_skillLevel] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_skillLevel] call blck_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_skillLevel] call blck_fnc_selectAIUniforms};
if (_headGear isEqualTo []) then {_headGear = [_skillLevel] call blck_fnc_selectAIHeadgear};
if (_vests isEqualTo []) then {_vests = [_skillLevel] call blck_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_skillLevel] call blck_fnc_selectAIBackpacks};
_numbertospawn = [_numai1,_numai2] call blck_fnc_getNumberFromRange;
if !(isNull _group) then
{
if (_weaponList isEqualTo []) then
{
_weaponList = [_skillLevel] call blck_fnc_selectAILoadout;
};
//Spawns the correct number of AI Groups, each with the correct number of units
//Counter variable
_i = 0;
while {_i < _numbertospawn} do
{
_i = _i + 1;
if (blck_useLaunchers && _i <= blck_launchersPerGroup) then
{
_launcherType = selectRandom blck_launcherTypes;
} else {
_launcherType = "none";
};
private _unitPos = [_pos,3,6] call blck_fnc_findRandomLocationWithinCircle;
//params["_pos","_aiGroup",_skillLevel,_uniforms, _headGear,_vests,_backpacks,_Launcher,_weaponList,_sideArms,_scuba];
[_unitPos,_group,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba] call blck_fnc_spawnUnit;
//private _unit = [_unitPos,_group,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba] call blck_fnc_spawnUnit;
//diag_log format["_fnc_spawnGroup: _unit %1 spawned at %2 at a distance from the group center of %3 and _vector of %4",_unit,_unitPos,_unitPos distance _pos,_pos getRelDir _unitPos];
};
_group selectLeader ((units _group) select 0);
// params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_pattern",["MOVE","SAD"]]];
if (_configureWaypoints) then
{
if (_scuba) then {_infantryType = "scuba"} else {_infantryType = "infantry"};
// params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_wpPatrolMode","SAFE"],["_soldierType","null"],["_patrolRadius",30],["_wpTimeout",[5.0,7.5,10]]];
#define infantryPatrolRadius 30
#define infantryWaypointTimeout [5,7.5,10]
[_pos,_minDist,_maxDist,_group,"random","SAD",_infantryType,_patrolRadius,infantryWaypointTimeout] spawn blck_fnc_setupWaypoints;
};
} else
{
diag_log "_fnc_spawnGroup:: ERROR CONDITION : NULL GROUP CREATED";
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnGroup:_group = %1",_group];
};
#endif
_group

View File

@ -0,0 +1,21 @@
/*
By Ghostrider-GRG-
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
// todo: No longer needed ?
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_group","_unit","_tempEH"];
_group = _this select 0;
{
_unit = _x;
_tempEH = _unit addEventHandler ["Reloaded", {_this call blck_EH_unitWeaponReloaded;}]; //Fires locally so add this again.
diag_log format["blckHC:: reloaded EH added to unit %1 after transfer to HC %2",_x,clientOwner];
}forEach (units _group);
diag_log format["blckHC:: group %1 transferred to HC %2",_group,clientOwner];

View File

@ -0,0 +1,18 @@
/*
Killed handler for _units
By Ghostrider-GRG-
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_HC"];
private["_result"];
_result = {(groupOwner _x) == (owner _HC)} count allGroups;
//diag_log format["_fnc_countGroupsAssigned = %1",_result];
_result

View File

@ -0,0 +1,30 @@
/*
Killed handler for _units
By Ghostrider-GRG-
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_HC_List"];
if (count _HC_List == 0) exitWith {_result = objNull; _result};
if (count _HC_List == 1) exitWith {_result = _HC_List select 0; _result}:
private["_result","_fewestGroupsAssigned","_leastBurdened","_groupsAssigned"];
_fewestGroupsAssigned = 1000000;
{
_ownerHC = owner _x;
_groupsAssigned = {(groupOwner _x) isEqualTo _ownerHC} count allGroups;
diag_log format["_fnc_HC_leastBurdened: HC %1 | groupsAssigned %2",_x,_groupsAssigned];
if ([_x] call blck_fnc_HC_countGroupsAssigned < _fewestGroupsAssigned) then
{
_leastBurdened = _x;
_fewestGroupsAssigned = _groupsAssigned;
};
}forEach _HC_List;
diag_log format["_fnc_leastBurdened:: _fewestGroupsAssigned = %1 and _leastBurdened = %2",_fewestGroupsAssigned,_leastBurdened];
_leastBurdened

View File

@ -0,0 +1,49 @@
/*
By Ghostrider-GRG-
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if (!isServer) exitWith {};
blck_fnc_countGroupsAssigned = {
params["_HC"];
private["_result"];
_result = {(groupOwner _x) == (owner _HC)} count allGroups;
//diag_log format["_fnc_countGroupsAssigned = %1",_result];
_result
};
private["_numTransfered","_clientId","_allGroups","_groupsOwned","_groups","_idHC","_id","_swap","_rc"];
_numTransfered = 0;
_idHC = -2;
if (blck_limit_ai_offload_to_blckeagls) then {_groups = blck_monitoredMissionAIGroups} else {_groups = allGroups};
blck_connectedHCs = entities "HeadlessClient_F";
diag_log format["_fnc_passToHCs:: blck_connectedHCs = %1 | count _HCs = %2 | server FPS = %3",blck_connectedHCs,count blck_connectedHCs,diag_fps];
if !(blck_connectedHCs isEqualTo []) then
{
_idHC = [blck_connectedHCs] call blck_fnc_HC_leastBurdened;
{
//diag_log format["_fnc_passToHCs: group = %1 | owner = %2 | blck_group = %3",_x, groupOwner _x, _x getVariable ["blck_group","undefined"]];
//if (_x getVariable["blck_group",false]) then
//{
if ((groupOwner _x) == 2) then
{
private _sgor = _x setGroupOwner (owner _idHC);
//diag_log format["_fnc_passToHCs: group = %1 | _sgor = %2 | _idHC = %3",_x,_sgor,_idHC];
if (_sgor) then
{
[_x] remoteExec["blck_fnc_HC_XferGroup",_idHC];
_numTransfered = _numTransfered + 1;
//diag_log format["_fnc_passToHCs: group %1 Passed to HC %2",_x,_idHC];
};
};
//};
} forEach (_groups);
//diag_log format["[blckeagls] _passToHCs:: %1 groups transferred to HC %2",_numTransfered,_idHC];
};

View File

@ -0,0 +1,52 @@
/*
Depends on blck_fnc_addItemToCrate
call as:
[_item,_crate] call blck_fnc_loadLootFromItemsArray;
where
_crate is a container such as ammo box or vehicle
_loadout is an array containing either 2 or 3 elements. The first array is always an array of items to add. Items can be formated as ["item1","item1"], as [["item1",3],["item2",2]] or as [["item1",2,4],["item2",3,5]].
See GMS_fnc_addItemToCrate for information about the acceptable formates for the items "item1" ... "itemN".
The second and optional third element in the array specify the number of times the script will randomly select an item from the array of items and load it into the crate.
For example:
case 1: [["item1",...,"itemN"],6]; The script will randomly select from the array of item names 6 times and call the loot loader each time.
case 2: [["item1",...,"itemN"],6, 9]; As above except that an item will be selected a minimum of 6 and maximum of 9 times.
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_loadout","_crate",["_addAmmo",0]];
if ((_loadout select 0) isEqualTo []) exitWith {};
{
private["_tries","_q","_item"];
_tries = 0;
//diag_log format["_fn_loadLoot:: -- >> now loading for %1",_x];
_q = _x select 1; // this can be a number or array.
if ( (typeName _q) isEqualTo "ARRAY") then // Assume the array contains a min/max number to add
{
if ((count _q) isEqualTo 2) then {_tries = (_q select 0) + round(random(((_q select 1) - (_q select 0))));} else {_tries = 0;};
};
if ((typeName _q) isEqualTo "SCALAR") then
{
_tries = _q;
};
for "_i" from 1 to _tries do
{
_item = selectRandom (_x select 0);
[_item,_crate,_addAmmo] call blck_fnc_addItemToCrate;
};
}forEach _loadout;

View File

@ -0,0 +1,33 @@
/*
by Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//params["_pos"];
private["_UMS_mission","_waitTime","_mission","_pos"];
if (count blck_dynamicUMS_MissionList == 0) exitWith
{
blck_numberUnderwaterDynamicMissions = -1;
diag_log "No Dynamic UMS Missions Listed <spawning disabled>";
};
_UMS_mission = selectRandom blck_dynamicUMS_MissionList;
_waitTime = (blck_TMin_UMS) + random(blck_TMax_UMS - blck_TMin_UMS);
_mission = format["%1%2","Mafia Pirates",floor(random(1000000))];
_pos = call blck_fnc_findShoreLocation;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then {diag_log format["_fnc_addDynamicUMS_Mission: blck_dynamicUMS_MissionsRuning = %1 | blck_missionsRunning = %2 | blck_UMS_ActiveDynamicMissions = %3",blck_dynamicUMS_MissionsRuning,blck_missionsRunning,blck_UMS_ActiveDynamicMissions]};;
#endif
blck_UMS_ActiveDynamicMissions pushBack _pos;
blck_missionsRunning = blck_missionsRunning + 1;
blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning + 1;
//diag_log format["[blckeagls] UMS Spawner:-> waiting for %1",_waitTime];
uiSleep _waitTime;
//diag_log format["[blckeagls] UMS Spawner:-> spawning mission %1",_UMS_mission];
[_pos,_mission] call compileFinal preprocessFileLineNumbers format["q\addons\custom_server\Missions\UMS\dynamicMissions\%1",_UMS_mission];

View File

@ -0,0 +1,61 @@
/*
[_item,_crate] call blck_addItemToCrate;
where
_crate is a container such as ammo box or vehicle
_item is a string or array.
If _item is a string then add 1 of that item to the container.
If _item is an array with 2 elements ["itemName",3] then assume that the first element is a string and is the name of the item, and the second is the number to add.
if _item is an array with 3 elements ["itemName",2,6] assume that the first element is the item name (string), the second the min # to add and the third the max # to add.
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_itemInfo","_crate",["_addAmmo",0]];
private["_isRifle","_isMagazine","_isBackpack"];
_isWeapon = false;
_isMagazine = false;
_isBackpack = false;
_quant = 0;
//diag_log format["_fn_addItemToCrate:: -- >> itemInfor = %1",_itemInfo];
if (typeName _itemInfo isEqualTo "STRING") then {_item = _itemInfo; _quant = 1}; // case where only the item descriptor was provided
if (typeName _itemInfo isEqualTo "ARRAY") then {
if (count _itemInfo isEqualTo 2) then {_item = _itemInfo select 0; _quant = _itemInfo select 1;}; // case where item descriptor and quantity were provided
if (count _itemInfo isEqualto 3) then {
_item = _itemInfo select 0;
_quant = (_itemInfo select 1) + round(random((_itemInfo select 2) - (_itemInfo select 1)));
}; // case where item descriptor, min number and max number were provided.
};
if (((typeName _item) isEqualTo "STRING") && (_item != "")) then
{
if (isClass(configFile >> "CfgWeapons" >> _item)) then {
_crate addWeaponCargoGlobal [_item,_quant];
_isWeapon = true;
_count = 0;
if (typeName _addAmmo isEqualTo "SCALAR") then
{
_count = _addAmmo;
};
if (typeName _addAmmo isEqualto "ARRAY") then
{
_count = (_addAmmo select 0) + (round(random((_addAmmo select 1) - (_addAmmo select 0))));
};
_ammo = getArray (configFile >> "CfgWeapons" >> _item >> "magazines");
for "_i" from 1 to _count do
{
_crate addMagazineCargoGlobal [selectRandom _ammo,1];
};
};
if (_item isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) then {_crate addBackpackCargoGlobal [_item,_quant]; _isBackpack = true;};
if (isClass(configFile >> "CfgMagazines" >> _item)) then {_crate addMagazineCargoGlobal [_item,_quant]; _isMagazine = true;};
if (!_isWeapon && !_isMagazine && _isBackpack && isClass(configFile >> "CfgVehicles" >> _item)) then {_crate addItemCargoGlobal [_item,_quant]};
};

View File

@ -0,0 +1,22 @@
/*
Adds a list of live AI associated with a mission to a que of live AI that will be deleted at a later time by the main thread
call as [ [list of AI], time] call blck_fnc_addLiveAItoQue; where time is the time delay before deletion occurs
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["_fnc_addLiveAIToQue:: -> when called, blck_liveMissionAI = %1",blck_liveMissionAI];
params["_aiList","_timeDelay"];
//diag_log format["_fnc_addLiveAIToQue:: -->> _aiList = %1 || _timeDelay = %2",_aiList,_timeDelay];
blck_liveMissionAI pushback [_aiList, (diag_tickTime + _timeDelay)];
//diag_log format["_fnc_addLiveAIToQue:: -> blck_fnc_addLiveAI updated to %1",blck_liveMissionAI];

View File

@ -0,0 +1,41 @@
/*
Adds the basic list of parameters that define a mission such as the marker name, mission list, mission path, AI difficulty, and timer settings, to the arrays that the main thread inspects.
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//params["_missionList","_compiledMission","_compiledMissionsList","_waitTime","_mission","_path","_marker","_difficulty","_tMin","_tMax",["_noMissions",1]];
params["_missionList","_path","_marker","_difficulty","_tMin","_tMax",["_noMissions",1]];
private["_compiledMission","_compiledMissionsList"];
_compiledMissionsList = [];
for "_i" from 1 to _noMissions do
{
_waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
// 0 1 2 3 4 5 6 7 8
//_mission = [_missionList,_path,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0],_allowReinforcements];
{
//diag_log format["_fnc_addMissionToQue: _x = %1",_x];
_compiledMission = compilefinal preprocessFileLineNumbers format["\q\addons\custom_server\Missions\%1\%2.sqf",_path,_x];
_compiledMissionsList pushBack _compiledMission;
}forEach _missionList;
_mission = [_compiledMissionsList,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]];
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then {
diag_log format["-fnc_addMissionToQue::-->> _mission = %1",[/*_mission select 0, */_mission select 1, _mission select 2, _mission select 3, _mission select 4, _mission select 5, _mission select 6]];
};
#endif
//diag_log format["-fnc_addMissionToQue::-->> _mission = %1",[ _mission select 1, _mission select 2, _mission select 3, _mission select 4, _mission select 5, _mission select 6]];
blck_pendingMissions pushback _mission;
};
#ifdef blck_debugMode
if (blck_debugLevel >= 4) then {diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions];};
#endif

View File

@ -0,0 +1,22 @@
/*
Adds a list of live AI associated with a mission to a que of live AI that will be deleted at a later time by the main thread
call as [ [list of AI], time] call blck_fnc_addLiveAItoQue; where time is the time delay before deletion occurs
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_objList","_timeDelay"];
//diag_log format["_fnc_addObjToQue:: -- >> _objList = %1 || _timeDelay = %2",_objList,_timeDelay];
//diag_log format["_fnc_addObjToQue:: (11) -- >> blck_oldMissionObjects prior to update = %1",blck_oldMissionObjects];
blck_oldMissionObjects pushback [_objList, (diag_tickTime + _timeDelay)];
//diag_log format["_fnc_addObjToQue:: (11) -- >> blck_oldMissionObjects after update = %1",blck_oldMissionObjects];

View File

@ -0,0 +1,34 @@
// Delete objects in a list after a certain time.
// code to delete any smoking or on fire objects adapted from kalania
//http://forums.bistudio.com/showthread.php?165184-Delete-Fire-Effect/page1
// http://forums.bistudio.com/showthread.php?165184-Delete-Fire-Effect/page2
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_oldObjs"];
for "_i" from 1 to (count blck_oldMissionObjects) do {
if (_i <= count blck_oldMissionObjects) then {
_oldObjs = blck_oldMissionObjects deleteat 0;
_oldObjs params ["_objarr","_timer"];
if (diag_tickTime > _timer) then {
{
deleteVehicle _x;
} forEach _objarr;
//uiSleep 0.1;
}
else {
blck_oldMissionObjects pushback _oldObjs;
};
};
};

View File

@ -0,0 +1,22 @@
// removes mines in a region centered around a specific position.
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params ["_mines"];
//_mines = _this select 0; // array containing the mines to be deleted
//diag_log format["deleting %1 mines----- >>>> ", count _mines];
{
deleteVehicle _x;
} forEach _mines;

View File

@ -0,0 +1,18 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
// can probably hook this onto signalEnd as they do the same things
// Left here for legacy compatability with some GRG addons.
params["_crate"];
[_crate] call blck_fnc_signalEnd;

View File

@ -0,0 +1,17 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_crate"];
private _result = if ((_crate distance (_crate getVariable["crateSpawnPos",[0,0,0]])) > 10) then {true} else {false};
//diag_log format["_fn_crateMoved:: _crate %1 | crateSpawnPos %2 | _result = %3",_crate,_result];
_result;

View File

@ -0,0 +1,136 @@
/*
schedules deletion of all remaining alive AI and mission objects.
Updates the mission que.
Updates mission markers.
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp"
private["_cleanupAliveAITimer","_cleanupCompositionTimer","_isScubaMission"];
_fn_missionCleanup = {
params["_mines","_objects","_blck_AllMissionAI","_mission","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
//diag_log format["_fn_missionCleanup: blck_missionsRunning Started at %1", blck_missionsRunning];
[_mines] call blck_fnc_clearMines;
[_objects, _cleanupCompositionTimer] call blck_fnc_addObjToQue;
[_blck_AllMissionAI, (_cleanupAliveAITimer)] call blck_fnc_addLiveAItoQue;
blck_missionsRunning = blck_missionsRunning - 1;
//diag_log format["_fn_missionCleanup: blck_missionsRunning reset to %1", blck_missionsRunning];
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
if !(_isScubaMission) then
{
blck_recentMissionCoords pushback [_coords,diag_tickTime];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
};
if (_isScubaMission) then
{
blck_priorDynamicUMS_Missions pushback [_coords,diag_tickTime];
blck_UMS_ActiveDynamicMissions = blck_UMS_ActiveDynamicMissions - [_coords];
blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning - 1;
};
};
///////////////////////////////////////////////////////////////////////
// MAIN FUNCTION STARTS HERE
//////////////////////////////////////////////////////////////////////
#ifdef blck_debugMode
diag_log format["_fnc_endMission: _this = %1",_this];
#endif
params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_endCondition",0],["_vehicles",[]],["_isScubaMission",false]];
//diag_log format["_fnc_endMission (44): _blck_localMissionMarker %1 | _coords %2 | _mission %3 | _endCondition %4",_blck_localMissionMarker,_coords,_mission,_endCondition];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["_fnc_endMission: _blck_localMissionMarker %1 | _coords %2 | _mission %3 | _endCondition %4",_blck_localMissionMarker,_coords,_mission,_endCondition];
diag_log format["_fnc_endMission: _endCondition = %1",_endCondition];
diag_log format["_fnc_endMission: _isScubaMission = %1",_isScubaMission];
diag_log format["_fnc_endMission: prior to running mission end functions -> blck_missionsRunning = %1 | blck_dynamicUMS_MissionsRuning = %2",blck_missionsRunning,blck_dynamicUMS_MissionsRuning];
};
#endif
if (_endCondition > 0) exitWith // Mision aborted for some reason
{
//diag_log format["_fnc_endMission: mission end condition > 0 | setting all timers to 0"];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log format["_fnc_endMission: Mission Aborted, setting all timers to 0"];
};
#endif
[_blck_localMissionMarker select 0] call blck_fnc_deleteMarker;
_cleanupCompositionTimer = 0;
_cleanupAliveAITimer = 0;
[_mines,_objects,_blck_AllMissionAI,_mission,_cleanupAliveAITimer,_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
{
//if (local _x) then {deleteVehicle _x};
}forEach _crates;
{
deleteVehicle _x;
}forEach _vehicles;
};
if (_endCondition <= 0) then // Normal Mission End State
{
//diag_log format["_fnc_endMission: mission end condition == 0 | setting all timers to 0"];
private["_cleanupAliveAITimer","_cleanupCompositionTimer"];
if (blck_useSignalEnd) then
{
[_crates select 0] spawn blck_fnc_signalEnd;
{
_x enableRopeAttach true;
}forEach _crates;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] _fnc_endMission:: (18) SignalEnd called: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log format["_fnc_endMission: Mission Completed without errors, setting all timers to default values"];
};
#endif
_cleanupCompositionTimer = blck_cleanupCompositionTimer;
_cleanupAliveAITimer = blck_AliveAICleanUpTimer;
if (_endCondition == 0) then {[["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;};
if (_endCondition == -1) then {[["warning",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;};
[_blck_localMissionMarker select 0] call blck_fnc_deleteMarker;
[_blck_localMissionMarker select 1, _markerClass] spawn blck_fnc_missionCompleteMarker;
// Using a variable attached to the crate rather than the global setting to be sure we do not fill a crate twice.
// the "lootLoaded" loaded should be set to true by the crate filler script so we can use that for our check.
{
if !(_x getVariable["lootLoaded",false]) then
{
// _crateLoot,_lootCounts are defined above and carry the loot table to be used and the number of items of each category to load
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
{
private ["_v","_posnVeh"];
_posnVeh = blck_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count blck_monitoredVehicles -1)
if (_posnVeh >= 0) then
{
#ifdef blck_debugMode
diag_log format["_fnc_endMission: setting missionCompleted for vehicle %1 to %2",_x,diag_tickTime];
#endif
(blck_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime];
} else {
_x setVariable ["missionCompleted", diag_tickTime];
blck_monitoredVehicles pushback _x;
};
} forEach _vehicles;
[_mines,_objects,_blck_AllMissionAI,_mission,_cleanupAliveAITimer,_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
};
#ifdef blck_debugMode
diag_log format["_fnc_endMission: after to running mission end functions -> blck_missionsRunning = %1 | blck_dynamicUMS_MissionsRuning = %2",blck_missionsRunning,blck_dynamicUMS_MissionsRuning];
#endif
//diag_log format["_fnc_endMission (138): after to running mission end functions -> blck_missionsRunning = %1 | blck_dynamicUMS_MissionsRuning = %2",blck_missionsRunning,blck_dynamicUMS_MissionsRuning];
_endCondition

View File

@ -0,0 +1,164 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_a1","_item","_diff","_tries"];
params["_crate","_boxLoot","_itemCnts"];
//diag_log format["_fnc_fillBoxes: _this = %1",_this];
#ifdef blck_debugMode
{
diag_log format["_fnc_fillBoxes: _this select %1 = %2",_foreachindex, _this select _foreachindex];
}foreach _this;
#endif
_itemCnts params["_wepCnt","_magCnt","_opticsCnt","_materialsCnt","_itemCnt","_bkcPckCnt"];
_boxLoot params["_weapons","_magazines","_optics","_materials","_items","_backpacks"];
//diag_log format["_fnc_fillBoxes: _weapons = %1",_weapons];
if !(_weapons isEqualTo []) then
{
_tries = [_wepCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (31): loading %1 weapons",_tries];
// Add some randomly selected weapons and corresponding magazines
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _weapons;
//diag_log format["_fnc_fillBoxes with weapons: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then // Check whether weapon name is part of an array that might also specify an ammo to use
{
_crate addWeaponCargoGlobal [_item select 0,1]; // if yes then assume the first element in the array is the weapon name
if (count _item >1) then { // if the array has more than one element assume the second is the ammo to use.
_crate addMagazineCargoGlobal [_item select 1, 1 + round(random(3))];
} else { // if the array has only one element then lets load random ammo for it
_crate addMagazineCargoGlobal [selectRandom (getArray (configFile >> "CfgWeapons" >> (_item select 0) >> "magazines")), 1 + round(random(3))];
};
} else {
if (_item isKindOf ["Rifle", configFile >> "CfgWeapons"]) then
{
_crate addWeaponCargoGlobal [_item, 1];
_crate addMagazineCargoGlobal [selectRandom (getArray (configFile >> "CfgWeapons" >> _item >> "magazines")), 1 + round(random(3))];
};
};
};
};
//diag_log format["_fnc_fillBoxes: _magazines = %1",_magazines];
if !(_magazines isEqualTo []) then
{
_tries = [_magCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (26): loading %1 magazines",_tries];
// Add Magazines, grenades, and 40mm GL shells
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _magazines;
//diag_log format["_fnc_fillBoxes with magazines: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1); // Take difference between max and min number of items to load and randomize based on this value
_crate addMagazineCargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (typeName _item isEqualTo "STRING") then
{
_crate addMagazineCargoGlobal [_item, 1];
};
};
};
//diag_log format["_fnc_fillBoxes: _optics = %1",_optics];
if !(_optics isEqualTo []) then
{
_tries = [_opticsCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (72): loading %1 optics",_tries];
// Add Optics
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _optics;
//diag_log format["_fnc_fillBoxes with optics: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1);
_crate additemCargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (typeName _item isEqualTo "STRING") then
{
_crate addItemCargoGlobal [_item,1];
};
};
};
//diag_log format["_fnc_fillBoxes: _materials = %1",_materials];
if !(_materials isEqualTo []) then
{
_tries = [_materialsCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (92): loading %1 materials",_materialsCnt];
// Add materials (cindar, mortar, electrical parts etc)
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _materials;
//diag_log format["_fnc_fillBoxes with materials: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1);
_crate additemCargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (typeName _item isEqualTo "STRING") then
{
_crate addItemCargoGlobal [_item, 1];
};
};
};
//diag_log format["_fnc_fillBoxes: _items = %1",_items];
if !(_items isEqualTo []) then
{
_tries = [_itemCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (112): loading %1 items",_itemCnt];
// Add Items (first aid kits, multitool bits, vehicle repair kits, food and drinks)
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _items;
//diag_log format["_fnc_fillBoxes with items: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1);
_crate additemCargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (typeName _item isEqualTo "STRING") then
{
_crate addItemCargoGlobal [_item, 1];
};
};
};
//diag_log format["_fnc_fillBoxes: _backpacks = %1",_backpacks];
if !(_backpacks isEqualTo []) then
{
_tries = [_bkcPckCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (132): loading %1 backpacks",_tries];
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _backpacks;
//diag_log format["_fnc_fillBoxes with backpacks: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1);
_crate addbackpackcargoGlobal [_item select 0, (_item select 1) + round(random(_diff))];
};
if (typeName _item isEqualTo "STRING") then
{
_crate addbackpackcargoGlobal [_item, 1];
};
};
};
//diag_log "_fnc_fillBoxes <END>";
//diag_log format["testCrateLoading: crate inventory = %1",getItemCargo _crate];
//diag_log "_fnc_fillBoxes <END>";

View File

@ -0,0 +1,65 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_center",
"_garrisonedBuilding_ATLsystem",
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_weaponList",[]],
["_sideArms",[]]
];
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
if (_headGear isEqualTo []) then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear};
if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
/*
{
diag_log format["_fnc_garrisonBuilding_ATLsystem: _this %1 = %2",_forEachIndex,_this select _forEachIndex];
}forEach _this;
*/
private["_group","_buildingsSpawned","_staticsSpawned","_g","_building","_return"];
_buildingsSpawned = [];
_staticsSpawned = [];
_group = [blck_AI_Side,true] call blck_fnc_createGroup;
if !(isNull _group) then
{
{
_g = _x;
/*
{
diag_log format["_g %1 = %2",_forEachIndex,_g select _forEachIndex];
}forEach _g;
*/
// ["Land_Unfinished_Building_02_F",[-28.3966,34.8145,-0.00268841],0,true,true,[["B_HMG_01_high_F",[-5.76953,1.16504,7.21168],360]],[]],
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_statics","_men"];
//diag_log format["_bldClassName = %1 | _bldRelPos = %2 | _bldDir = %3",_bldClassName,_bldRelPos,_bldDir];
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_building setPosATL (_bldRelPos vectorAdd _center);
_building setDir _bldDir;
_buildingsSpawned pushBack _building;
// params["_building","_group","_statics","_men",["_aiDifficultyLevel","Red"], ["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]]];
_staticsSpawned = [_building,_group,_statics,_men,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_ATL;
}forEach _garrisonedBuilding_ATLsystem;
};
//{
//diag_log format["__fnc_garrisonBuilding_ATLsystem: %2 = %1",_x select 1, _x select 0];
//}forEach [ [_buildingsSpawned,"Buildings"],[_staticsSpawned,"Statics"]];
_return = [_group,_buildingsSpawned,_staticsSpawned];
_return

View File

@ -0,0 +1,54 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_center","_garrisonedBuilding_relPosSystem",
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_weaponList",[]],
["_sideArms",[]]
];
/*
{
diag_log format["_fnc_garrisonBuilding_relPosSystem: _this %1 = %2",_forEachIndex,_this select _forEachIndex];
}forEach _this;
*/
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
if (_headGear isEqualTo []) then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear};
if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
private["_group","_buildingsSpawned","_staticsSpawned","_g","_building","_return"];
_buildingsSpawned = [];
_staticsSpawned = [];
_group = [blck_AI_Side,true] call blck_fnc_createGroup;
if !(isNull _group) then
{
{
_g = _x;
// ["Land_Unfinished_Building_02_F",[-21.8763,-45.978,-0.00213432],0,true,true,0.67,3,[],4],
_g params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
if (_typesStatics isEqualTo []) then {_typesStatics = ["B_HMG_01_high_F"]};
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_buildingsSpawned pushBack _building;
_building setPosATL (_bldRelPos vectorAdd _center);
_building setDir _bldDir;
_staticsSpawned = [_building,_group,_noStatics,_typesStatics,_noUnits,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_relPos;
}forEach _garrisonedBuilding_relPosSystem;
};
_return = [_group,_buildingsSpawned,_staticsSpawned];
_return

View File

@ -0,0 +1,19 @@
/*
By Ghostrider-GRG-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private _crate = _this select 0;
[_crate,(_crate getVariable "lootArray"),(_crate getVariable "lootCounts")] call blck_fnc_fillBoxes;
[_crate, _crate getVariable "difficulty"] call blck_fnc_addMoneyToObject;
_crate setVariable["lootLoaded",true];

View File

@ -0,0 +1,597 @@
/*
Dynamic Mission Spawner (over-ground missions)
By Ghostrider GRG
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#define delayTime 1
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig",
"_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig",
"_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius",
"_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_marker","_vehicleCrewCount"];
params["_coords","_markerClass","_aiDifficultyLevel"];
[_markerClass, "active",_coords] call blck_fnc_updateMissionQue;
blck_ActiveMissionCoords pushback _coords;
blck_missionsRunning = blck_missionsRunning + 1;
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""};
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
//if (isNil "_timeOut") then {_timeOut = -1;};
if (isNil "_endCondition") then {_endCondition = blck_missionEndCondition}; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear"};
if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir".
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []};
if (isNil "_missionGroups") then {_missionGroups = []};
if (isNil "_hostageConfig") then {_hostageConfig = []};
if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []};
if (isNil "_useMines") then {_useMines = blck_useMines;};
if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
if (isNil "_sideArms") then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
if (isNil "_uniforms") then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
if (isNil "_headGear") then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear};
if (isNil "_vests") then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests};
if (isNil "_backpacks") then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = [_aiDifficultyLevel] call blck_fnc_selectChanceHeliPatrol};
if (isNil "_noChoppers") then {_noChoppers = [_aiDifficultyLevel] call blck_fnc_selectNumberAirPatrols};
if (isNil "_chancePara") then {_chancePara = [_aiDifficultyLevel] call blck_fnc_selectChanceParatroops};
if (isNil "_missionHelis") then {_missionHelis = [_aiDifficultyLevel] call blck_fnc_selectMissionHelis};
if (isNil "_noPara") then {_noPara = [_aiDifficultyLevel] call blck_fnc_selectNumberParatroops};
if (isNil "_chanceLoot") then {_chanceLoot = 1.0}; //0.5};
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Green}; // Add diffiiculty based settings
if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed}; // Add difficulty based settings
if (isNil "_missionLootVehicles") then {_missionLootVehicles = []};
if (isNil "_garrisonedBuilding_ATLsystem") then {_garrisonedBuilding_ATLsystem = []};
if (isNil "_garrisonedBuildings_BuildingPosnSystem") then {_garrisonedBuildings_BuildingPosnSystem = []};
if (isNil "_vehicleCrewCount") then {_vehicleCrewCount = [_aiDifficultyLevel] call GMS_fnc_selectVehicleCrewCount};
_objects = [];
_mines = [];
_crates = [];
_aiGroup = [];
_missionAIVehicles = [];
_blck_AllMissionAI = [];
_AI_Vehicles = [];
_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType];
#define delayTime 1
#define useRelativePos true
#ifdef blck_debugMode
diag_log "_missionSpawner: All variables initialized";
#endif
if (blck_labelMapMarkers select 0) then
{
_blck_localMissionMarker set [2, _markerMissionName];
};
if !(blck_preciseMapMarkers) then
{
_blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition];
};
_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name?
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (145) message players and spawn a mission marker";};
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (146) _marker = %1",_marker];};
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (147) waiting for player to trigger the mission";};
#endif
////////
// All parameters are defined, lets wait until a player is nearby or the mission has timed out
////////
_missionStartTime = diag_tickTime;
_playerInRange = false;
_missionTimedOut = false;
_wait = true;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log "missionSpawner:: (90) starting mission trigger loop"};
diag_log format["missionSpawner (163) blck_MissionTimeout = %1", blck_MissionTimeout];
#endif
while {_wait} do
{
//ifdef blck_debugMode
if (blck_debugLevel > 2) exitWith {_playerInRange = true;diag_log "_fnc_missionSpawner (168): player trigger loop triggered by scripting";};
//endif
if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;};
if ([_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
uiSleep 5;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords];
diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers];
diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut];
};
#endif
};
if (_missionTimedOut) exitWith
{
diag_log format["_fnc_missionSpawner (187): mission timed out"];
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
};
////////////////////////////////////////////////
// Spawn the mission objects, loot chest, and AI
///////////////////////////////////////////////
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (200) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate
{
_temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates;
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
};
uiSleep delayTime;
if (_useMines) then
{
_mines = [_coords] call blck_fnc_spawnMines;
};
uiSleep delayTime;
_temp = [];
if (_missionLandscapeMode isEqualTo "random") then
{
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
} else {
params["_center","_objects"];
_temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects;
};
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (237) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
uiSleep delayTime;
_abort = false;
_temp = [[],[],false];
#ifdef blck_debugMode
private _params = [_coords,_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms];
{
diag_log format["_fnc_missionSpawner: _param %1 label %2 = %3",_forEachIndex, _x, _params select _forEachIndex];
}forEach ["_coords","_minNoAI","_maxNoAI","_missionGroups","_aiDifficultyLevel","_uniforms","_headgear","_vests","_backpacks","_weaponList","_sideArms"];
#endif
_temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI;
_abort = _temp select 1;
if !(_abort) then
{
_blck_AllMissionAI append (_temp select 0);
};
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (288) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
_assetSpawned = objNull;
if !(_hostageConfig isEqualTo []) then
{
_temp = [_coords,_hostageConfig] call blck_fnc_spawnHostage;
_assetSpawned = _temp select 0;
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
if !(_enemyLeaderConfig isEqualTo []) then
{
_temp = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader;
_assetSpawned = _temp select 0;
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
uiSleep delayTime;
_temp = [[],[],false];
_abort = false;
// Deal with helicopter patrols
_temp = [];
_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange;
if (_noChoppers > 0) then
{
for "_i" from 1 to (_noChoppers) do
{
if (random(1) < _chanceHeliPatrol) then
{
_temp = [_coords,_aiDifficultyLevel,_missionHelis,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms,"none"] call blck_fnc_spawnMissionHeli;
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
if !(_abort) then
{
blck_monitoredVehicles pushBack (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
};
};
};
};
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (256) helipatrols spawned"};
#endif
uisleep 3;
if (count _garrisonedBuilding_ATLsystem > 0) then
{
_temp = [_coords, _garrisonedBuilding_ATLsystem, _aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_ATLsystem;
_objects append (_temp select 1);
blck_monitoredVehicles append (_temp select 2);
_blck_AllMissionAI append (units (_temp select 0));
};
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (271) garrisons (ATL) spawned"};
#endif
uiSleep 3;
if (count _garrisonedBuildings_BuildingPosnSystem > 0) then
{
_temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_RelPosSystem;
_objects append (_temp select 1);
blck_monitoredVehicles append (_temp select 2);
_blck_AllMissionAI append (units (_temp select 0));
};
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (285) garrisons (building position system) spawned"};
#endif
uiSleep 15;
private["_noEmplacedToSpawn"];
_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
if (blck_useStatic && (_noEmplacedToSpawn > 0)) then
{
_temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if !(_abort) then
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
};
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (309) emplaced weapons spawned"};
#endif
_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then
{
//diag_log format["_missionSpawner(315): _vehToSpawn = %1 | _missionPatrolVehicles = %2",_vehToSpawn,_missionPatrolVehicles];
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_missionPatrolVehicles,useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
//diag_log format["_missionSpawner(317): _temp = %1",_temp];
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if !(_abort) then
{
_patrolVehicles = _temp select 0;
_blck_AllMissionAI append (_temp select 1);
};
};
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (330) vehicle patrols spawned"};
#endif
uiSleep delayTime;
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
{
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
};
uiSleep delayTime;;
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (355) loot crate(s) spawned"};
#endif
if (count _missionLootVehicles > 0) then
{
_temp = [_coords,_missionLootVehicles,_loadCratesTiming] call blck_fnc_spawnMissionLootVehicles;
_crates append _temp;
};
if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then
{
diag_log format["_fnc_missionSpawner (436): spawning %1 paraunits at mission spawn",_noPara];
private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits;
if !(isNull _paratroops) then
{
_blck_AllMissionAI append (units _paratroops);
};
if (random(1) < _chanceLoot) then
{
diag_log format["_fnc_missionSpawner (446): spawning supplemental loot with _chanceLoot = %1",_chanceLoot];
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
if (blck_cleanUpLootChests) then
{
_objects append _extraCrates;
};
};
};
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (384) mission loot vehicles spawned"};
#endif
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"];
_missionComplete = -1;
_startTime = diag_tickTime;
#ifdef blck_debugMode
uiSleep 10;
if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (393) waiting for mission end contitions to be met"};
#endif
switch (_endCondition) do
{
case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;};
case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;};
case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;};
case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;};
};
if (blck_showCountAliveAI) then
{
if !(_marker isEqualTo "") then
{
[_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI];
};
};
_crateStolen = false;
_locations = [_coords];
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
{
_locations pushback (getPos _x);
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
private["_minNoAliveForCompletion","_result","_minPercentageKilled"];
_minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI)));
if (_secureAsset) then {_minNoAliveForCompletion = _minNoAliveForCompletion + 1};
while {_missionComplete isEqualTo -1} do
{
#ifdef blck_debugMode
if (blck_debugLevel > 3) exitWith {uiSleep blck_triggerLoopCompleteTime;diag_log "_missionSpawner (492) scripted Mission End blck_debugLevel = 3";};
#endif
if (_endIfPlayerNear) then
{
if ([_locations,20,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1};
};
if (_endIfAIKilled) then
{
if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {_missionComplete = 1};
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
{
{
private _d = _x distance (_x getVariable ["crateSpawnPos",_coords]);
//diag_log format["crate %1 moved %2 at %3",_x,_d,diag_tickTime];
if (_d > 25) exitWith
{
_missionComplete = 1;
_crateStolen = true;
};
}forEach _crates;
};
if (_secureAsset) then
{
if !(alive _assetSpawned) then
{
_missionComplete = 1;
[_assetSpawned] remoteExec["GMS_fnc_clearAllActions",-2, true];
} else {
if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then
{
if ((_assetSpawned getVariable["blck_unguarded",0]) isEqualTo 0) then
{
_assetSpawned setVariable["blck_unguarded",1,true];
};
if ((_assetSpawned getVariable["blck_AIState",0]) isEqualTo 1) then
{
_missionComplete = 1;
_assetSpawned allowdamage false;
[_assetSpawned] remoteExec["GMS_fnc_clearAllActions",-2, true];
};
};
};
};
if (_spawnPara) then
{
if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then
{
_spawnPara = false; // The player gets one try to spawn these.
if (random(1) < _chancePara) then //
{
private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits;
if !(isNull _paratroops) then
{
_blck_AllMissionAI append (units _paratroops);
};
if (random(1) < _chanceLoot) then
{
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
if (blck_cleanUpLootChests) then
{
_objects append _extraCrates;
};
};
};
};
};
uiSleep 1;
};
if (_crateStolen) exitWith
{
[_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission;
};
if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then
{
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]};
#endif
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]};
#endif
};
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then
{
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
{
[_x] call blck_fnc_loadMissionCrate;
} forEach _crates;
};
};
private["_result"];
// Force passing the mission name for informational purposes.
_blck_localMissionMarker set [2, _markerMissionName];
if (blck_showCountAliveAI) then
{
_marker setMarkerText format["%1: All AI Dead",_markerMissionName];
{
if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex};
}forEach blck_missionMarkers;
};
if (_secureAsset && (alive _assetSpawned)) then
{
if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then
{
_assetSpawned setVariable["GMSAnimations",[""],true];
[_assetSpawned,""] remoteExec["switchMove",-2];;
uiSleep 0.1;
_assetSpawned enableAI "ALL";
private _newPos = (getPos _assetSpawned) getPos [1000, random(360)];
(group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0];
[group _assetSpawned,0] setWaypointPosition [_newPos,0];
[group _assetSpawned,0] setWaypointType "MOVE";
};
if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then
{
[_assetSpawned,""] remoteExec["switchMove",-2];
_assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true];
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
};
};
if (_secureAsset && !(alive _assetSpawned)) then
{
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, -1] call blck_fnc_endMission;
};
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission;
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]};
#endif
diag_log format["_fnc_missionSpawner (643) Mission Completed | _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
blck_missionsRun = blck_missionsRun + 1;
diag_log format["_fnc_missionSpawner (644): Total Dyanamic Land and UMS Run = %1", blck_missionsRun];

View File

@ -0,0 +1,25 @@
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_pos","_crate",["_crateVisualMarker",true],["_dropHeight", 150]];
private _chute = createVehicle ["I_Parachute_02_F", _pos, [], 0, "FLY"];
[_chute] call blck_fnc_protectVehicle;
_crate setVariable["chute",_chute];
_chute setPos [getPos _chute select 0, getPos _chute select 1, _dropHeight];
_crate setPos (getPos _chute);
_crate attachTo [_chute, [0,0,0]];
if (_crateVisualMarker) then {[_crate] spawn blck_fnc_crateMarker};
_chute

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_chancePara"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_chancePara = blck_chanceParaBlue};
case "red": {_chancePara = blck_chanceParaRed};
case "green": {_chancePara = blck_chanceParaGreen};
case "orange": {_chancePara = blck_chanceParaOrange};
default {_chancePara = blck_chanceParaRed};
};
_chancePara

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_backpacks"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_backpacks = blck_backpacks_blue};
case "red": {_backpacks = blck_backpacks_red};
case "green": {_backpacks = blck_backpacks_green};
case "orange": {_backpacks = blck_backpacks_orange};
default {_backpacks = blck_backpacks};
};
_backpacks

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_headgear"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_headGear = blck_headgear_blue};
case "red": {_headGear = blck_headgear_red};
case "green": {_headGear = blck_headgear_green};
case "orange": {_headGear = blck_headgear_orange};
default {_headGear = blck_headgear};
};
_headgear

View File

@ -0,0 +1,29 @@
/*
[
_missionColor // ["blue","red","green","orange"]
] call blck_fnc_selectAILoadout;
returns:
_lootarray
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_weaponList","_missionColor"];
_missionColor = _this select 0;
switch (_missionColor) do {
case "blue": {_weaponList = blck_WeaponList_Blue;};
case "red": {_weaponList = blck_WeaponList_Red;};
case "green": {_weaponList = blck_WeaponList_Green;};
case "orange": {_weaponList = blck_WeaponList_Orange;};
default {_weaponList = blck_WeaponList_Blue;};
};
_weaponList

View File

@ -0,0 +1,25 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"]; //[["_aiDifficultyLevel",selectRandom["Red","Green"]]];
//diag_log format["_fnc_selectAISidearms: _aiDifficultyLevel = %1",_aiDifficultyLevel];
private["_sideArms"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_sideArms = blck_Pistols_blue};
case "red": {_sideArms = blck_Pistols_red};
case "green": {_sideArms = blck_Pistols_green};
case "orange": {_sideArms = blck_Pistols_orange};
default {_sideArms = blck_Pistols};
};
_sideArms

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_uniforms"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_uniforms = blck_SkinList_blue};
case "red": {_uniforms = blck_SkinList_red};
case "green": {_uniforms = blck_SkinList_green};
case "orange": {_uniforms = blck_SkinList_orange};
default {_uniforms = blck_SkinList};
};
_uniforms

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_vests"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_vests = blck_vests_blue};
case "red": {_vests = blck_vests_red};
case "green": {_vests = blck_vests_green};
case "orange": {_vests = blck_vests_orange};
default {_vests = blck_vests};
};
_vests

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_chanceHeliPatrol"];
switch (toLower(_aiDifficultyLevel)) do
{
case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue};
case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed};
case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen};
case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange};
default {_chanceHeliPatrol = 0};
};
_chanceHeliPatrol

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_missionHelis"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_missionHelis = blck_patrolHelisBlue};
case "red": {_missionHelis = blck_patrolHelisRed};
case "green": {_missionHelis = blck_patrolHelisGreen};
case "orange": {_missionHelis = blck_patrolHelisOrange};
default {_missionHelis = blck_patrolHelisBlue};
};
_missionHelis

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_noChoppers"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_noChoppers = blck_noPatrolHelisBlue};
case "red": {_noChoppers = blck_noPatrolHelisRed};
case "green": {_noChoppers = blck_noPatrolHelisGreen};
case "orange": {_noChoppers = blck_noPatrolHelisOrange};
default {_noChoppers = 0};
};
_noChoppers

View File

@ -0,0 +1,24 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_noPara"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_noPara = blck_noParaBlue};
case "red": {_noPara = blck_noParaRed};
case "green": {_noPara = blck_noParaGreen};
case "orange": {_noPara = blck_noParaOrange};
default {_noPara = 0};
};
_noPara

View File

@ -0,0 +1,23 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_diff"];
private ["_count"];
switch (toLower(_diff)) do
{
case "blue": {_count = blck_vehCrew_blue};
case "red": {_count = blck_vehCrew_red};
case "green": {_count = blck_vehCrew_green};
case "orange": {_count = blck_vehCrew_orange};
};
///diag_log format["_fnc_selectVehicleCrewCount: _count set to %1",_count];
_count

View File

@ -0,0 +1,32 @@
//////////////////////////////////////////////////////
// Attach a marker of type _marker to an object _crate
// by Ghostrider [GRG] based on code from Wicked AI for Arma 2 Dayz Epoch
/////////////////////////////////////////////////////
/*
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_start","_maxHeight","_smokeShell","_light","_lightSource"];
params[["_crate",objNull],["_time",60]];
if (isNull _crate) exitWith {};
_start = diag_tickTime;
//diag_log format["signalEnd.sqf: _this = %1, _crate = %2",_this, _crate];
_smokeShell = selectRandom ["SmokeShellOrange","SmokeShellBlue","SmokeShellPurple","SmokeShellRed","SmokeShellGreen","SmokeShellYellow"];
_lightSource = selectRandom ["Chemlight_green","Chemlight_red","Chemlight_yellow","Chemlight_blue"];
_light = objNull;
_smoke = _smokeShell createVehicle getPosATL _crate;
_smoke setPosATL (getPosATL _crate);
_smoke attachTo [_crate,[0,0,(0.5)]]; // put the smoke a fixed distance above the top of any object to make it as visible as possible
if(sunOrMoon < 0.2) then
{
_light = _lightSource createVehicle getPosATL _crate;
_light setPosATL (getPosATL _crate);
_light attachTo [_crate,[0,0,(0.55)]];
};
blck_illuminatedCrates pushBack [_crate,_smoke,_light,_smokeShell,_lightSource,diag_tickTime + 120, diag_tickTime + 300];

View File

@ -0,0 +1,17 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["_sm_addAircraft: _this = %5",_this];
params["_aircraftPatrol"];
//diag_log format["_sm_addAircraft: _aircraftPatrol = %1",_aircraftPatrol];
blck_sm_Aircraft pushBack [_aircraftPatrol,grpNull,0];
//diag_log format["_sm_addAircraft: updated blck_sm_Aircraft = %1",blck_sm_Aircraft];
true

View File

@ -0,0 +1,16 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_emplacedWeapon"];
blck_sm_Emplaced pushBack [_emplacedWeapon,grpNull,0];
diag_log format["_sm_AddEmplaced::-> _emplacedWeapon = %1, blck_sm_Emplaced = %2",_emplacedWeapon,blck_sm_Emplaced];
true

View File

@ -0,0 +1,16 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_group"];
blck_sm_Groups pushBack [_group,grpNull,0];
diag_log format["_sm_AddGroup:: blck_sm_Groups = %1",blck_sm_Groups];
true

View File

@ -0,0 +1,22 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_array","_patrolInformation",["_timesToRespawn",-1]];
waitUntil {blck_sm_monitoring isEqualTo 0};
_array pushBack [
_patrolInformation,
grpNull,
0, // groupSpawned
0, // times Spawned
0, // Respawn At
_timesToRespawn // Max Times to Respawn
];
_array

View File

@ -0,0 +1,16 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_vehicle"];
blck_sm_Vehicles pushBack [_vehicle,grpNull,0];
//diag_log format["_fnc_sm_AddVehicle: _vehicle = %1",_vehicle];
true

View File

@ -0,0 +1,81 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log "[blckeagls] GMS_fnc_sm_init_functions.sqf <Defining Variables and Compiling Functions>";
//blck_sm_Groups = [];
blck_sm_Infantry = [];
blck_sm_Vehicles = [];
blck_sm_Aircraft = [];
blck_sm_Emplaced = [];
blck_sm_scubaGroups = [];
blck_sm_surfaceShips = [];
blck_sm_submarines = [];
blck_sm_lootContainers = [];
blck_sm_garrisonBuildings_ASL = [];
blcl_sm_garrisonBuilding_relPos = [];
blck_fnc_sm_AddGroupToArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddGroupToArray.sqf";
/*
blck_fnc_sm_AddGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddGroup.sqf";
blck_fnc_sm_AddVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddVehicle.sqf";
blck_fnc_sm_AddAircraft = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddAircraft.sqf";
blck_fnc_sm_AddEmplaced = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddEmplaced.sqf";
*/
// TODO: Delte soon
private _functions = [
//["blck_fnc_sm_monitorStaticUnits","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorStaticPatrols.sqf"],
["blck_fnc_sm_monitorInfantry","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorInfantry.sqf"],
["blck_fnc_sm_monitorScuba","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorScuba.sqf"],
["blck_fnc_sm_monitorVehicles","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorVehicles.sqf"],
["blck_fnc_sm_monitorAircraft","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorAircraft.sqf"],
["blck_fnc_sm_monitorShips","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorShips.sqf"],
["blck_fnc_sm_monitorSubs","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorSubs.sqf"],
["blck_fnc_sm_monitorEmplaced","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorEmplaced.sqf"],
["blck_fnc_sm_monitorGarrisonsASL","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorGarrisonsASL.sqf"],
["blck_fnc_sm_monitorGarrisons_relPos","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorGarrisons_relPos.sqf"],
["blck_fnc_sm_spawnVehiclePatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnVehiclePatrol.sqf"],
["blck_fnc_sm_spawnAirPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnAirPatrol.sqf"],
["blck_fnc_sm_spawnEmplaced","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnEmplaced.sqf"],
// ["blck_fnc_sm_spawnInfantryPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_sm_spawnInfantryPatrol.sqf"],
["blck_fnc_sm_staticPatrolMonitor","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_staticPatrolMonitor.sqf"],
// ["blck_fnc_sm_checkForPlayerNearMission","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_checkForPlayerNearMission.sqf"],
["blck_fnc_sm_spawnAirPatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnAirPatrols.sqf"],
["blck_fnc_sm_spawnEmplaceds","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnEmplaced.sqf"],
["blck_fnc_sm_spawnInfantryPatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnInfantryPatrols.sqf"],
["blck_fnc_sm_spawnLootContainers","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnLootContainers.sqf"],
["blck_fnc_sm_spawnObjects","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnObjects.sqf"],
["blck_fnc_sm_spawnVehiclePatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnVehiclePatrols.sqf"],
["blck_fnc_sm_spawnBuildingGarrison_ASL","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnBuildingGarrisonASL.sqf"],
["blck_fnc_sm_spawnBuildingGarrison_relPos","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnBuildingGarrison_relPos.sqf"],
["blck_fnc_sm_spawnObjectASLVectorDirUp","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnObjectASLVectorDirUp.sqf"],
["blck_fnc_spawnScubaGroup","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnScubaGroup.sqf"],
["blck_fnc_spawnSDVPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnSDVPatrol.sqf"],
["blck_fnc_spawnSurfacePatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnSurfacePatrol.sqf"],
//["blck_fnc_sm_AddScubaGroup","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddScubaGroup.sqf"],
//["blck_fnc_sm_AddSurfaceVehicle","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddSurfaceVehicle.sqf"],
["blck_fnc_sm_AddSDVVehicle","\q\addons\custom_server\Missions\Static\Code\GMS_sm_AddSDVVehicle.sqf"]
];
{
_x params ["_name","_path"];
missionnamespace setvariable [_name,compileFinal preprocessFileLineNumbers _path];
} foreach _functions;
diag_log "[blckeagls] GMS_sm_init_functions.sqf <Variables Defined and Functions Loaded>";
/*
blck_fnc_spawnScubaGroup = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnScubaGroup.sqf";
blck_fnc_spawnSDVPatrol = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnSDVPatrol.sqf";
blck_fnc_spawnSurfacePatrol = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnSurfacePatrol.sqf";
blck_fnc_sm_AddScubaGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddScubaGroup.sqf";
blck_fnc_sm_AddSurfaceVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddSurfaceVehicle.sqf";
blck_fnc_sm_AddSDVVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddSDVVehicle.sqf";

View File

@ -0,0 +1,88 @@
/*
by Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_mission"];
// Spawn landscape
// params["_objects"];
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
if (isNil "_missionLandscape") then {_missionLandscape = []};
if (isNil "_garrisonedBuilding_ASLsystem") then {
//diag_log "_fnc_sm_initializeMission: _garrisonedBuilding_ASLsystem set to []";
_garrisonedBuilding_ASLsystem = [];
};
if (isNil "_garrisonedBuildings_BuildingPosnSystem") then {
//diag_log "_fnc_sm_initializeMission: _garrisonedBuildings_BuildingPosnSystem set to []";
_garrisonedBuildings_BuildingPosnSystem = [];
};
if (isNil "_airPatrols") then {_airPatrols = []};
if (isNil "_aiGroupParameters") then {_aiGroupParameters = []};
if (isNil "_missionEmplacedWeapons") then {_missionEmplacedWeapons = []};
if (isNil "_vehiclePatrolParameters") then {_vehiclePatrolParameters = []};
if (isNil "_missionLootVehicles") then {_missionLootVehicles = []};
_markerClass = format["static%1",floor(random(1000000))];
_blck_localMissionMarker = [_markerClass,_missionCenter,"","",_markerColor,_markerType];
if (blck_labelMapMarkers select 0) then
{
_blck_localMissionMarker set [2, _markerMissionName];
};
if !(blck_preciseMapMarkers) then
{
_blck_localMissionMarker set [1,[_missionCenter,75] call blck_fnc_randomPosition];
};
_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name?
[_blck_localMissionMarker] call blck_fnc_spawnMarker;
[_missionLandscape] call blck_fnc_sm_spawnObjects;
{
//diag_log format["processing _garrisonedBuilding_ASL %1 which = %2",_forEachIndex,_x];
// ["Land_i_House_Big_02_V2_F",[23650.3,18331.9,3.19],[[0,1,0],[0,0,1]],[true,true],"Red",
_x params["_buildingClassName","_buildingPosnASL","_buildingVectorDirUp","_buildingDamSim","_aiDifficulty","_staticsASL","_unitsASL","_respawnTimer","_noRespawns"];
private _building = [_buildingClassName,_buildingPosnASL,_buildingVectorDirUp,_buildingDamSim] call blck_fnc_sm_spawnObjectASLVectorDirUp;
[blck_sm_garrisonBuildings_ASL,[_building,_aiDifficulty,_staticsASL,_unitsASL,_respawnTimer,_noRespawns]] call blck_fnc_sm_AddGroupToArray;
//diag_log format["_fnc_sm_initializeMission: blck_sm_garrisonBuildings_ASL updated to: %1",blck_sm_garrisonBuildings_ASL];
}forEach _garrisonedBuilding_ASLsystem;
// blcl_sm_garrisonBuilding_relPos
{
//diag_log format["processing _garrisonedBuilding_relPos %1 which = %2",_forEachIndex,_x];
_x params["_buildingClassName","_buildingPosnASL","_buildingVectorDirUp","_buildingDamSim","_aiDifficulty","_p","_noStatics","_typesStatics","_noUnits","_respawnTimer","_noRespawns"];
private _building = [_buildingClassName,_buildingPosnASL,_buildingVectorDirUp,_buildingDamSim] call blck_fnc_sm_spawnObjectASLVectorDirUp;
[blcl_sm_garrisonBuilding_relPos,[_building,_aiDifficulty,_noStatics,_typesStatics,_noUnits,_respawnTimer,_noRespawns]] call blck_fnc_sm_AddGroupToArray;
//diag_log format["_fnc_sm_initializeMission: blcl_sm_garrisonBuilding_relPos updated to: %1",blcl_sm_garrisonBuilding_relPos];
}forEach _garrisonedBuildings_BuildingPosnSystem;
{
[blck_sm_Aircraft,_x] call blck_fnc_sm_AddGroupToArray;
}forEach _airPatrols;
//uiSleep 1;
{
[blck_sm_Infantry,_x] call blck_fnc_sm_AddGroupToArray;
}forEach _aiGroupParameters;
{
[blck_sm_Emplaced,_x] call blck_fnc_sm_AddGroupToArray;
}forEach _missionEmplacedWeapons;
{
[blck_sm_Vehicles,_x] call blck_fnc_sm_AddGroupToArray;
}forEach _vehiclePatrolParameters;
uiSleep 30;
// spawn loot chests
[_missionLootBoxes,_missionCenter] call blck_fnc_sm_spawnLootContainers;
[_missionLootVehicles,_missionCenter] call blck_fnc_sm_spawnLootContainers;
diag_log format["[blckeagls] Static Mission Spawner: Mission %1 spawned",_mission];

Some files were not shown because too many files have changed in this diff Show More