Most changes for 6.92 in place

offloading to clients still to be done.
Needs extensive testing.
This commit is contained in:
Chris Cardozo 2019-07-11 23:07:26 -04:00
parent cfc22d4165
commit 778697d6ca
125 changed files with 3697 additions and 618 deletions

View File

@ -1,3 +1,14 @@
v 6.92
1. Added code needed to use Claim Vehicle scripts on Exile Servers.
2. Added simulation management for dead AI when blck_useBlckeaglsSimulationManagement == true;
3. Deleted unused files.
4. A monitor to catch wandering units and send them back to the mission was added.
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

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

@ -27,10 +27,11 @@ if (blck_modType isEqualTo "Exile") then
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
diag_log format["_fnc_addMoneyToOject: ExileMoney set to %1", _obj getVariable "ExileMoney"];
#endif
//#ifdef blck_debugMode
//#endif
};
//diag_log format["_fnc_addMoneyToOject: ExileMoney set to %1", _obj getVariable "ExileMoney"];
};
if (blck_modType isEqualTo "Epoch") then
@ -42,4 +43,5 @@ if (blck_modType isEqualTo "Epoch") then
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,56 @@
/*
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 (!blck_ai_offload_to_client) exitWith {};
if (blck_limit_ai_offload_to_blckeagls) then {_groups = blck_monitoredMissionAIGroups} else {_groups = allGroups};
{
if (((count (units _x))>1) && {!(_x getVariable ["blck_LockLocality",false])} && {!(blck_ai_offload_Only_blck_AI && {!(_x getVariable ["blck_SpawnedGroup",false])})}) then
{
private _leader = leader _x;
private _group = _x;
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
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;
};
// 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
_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

@ -21,4 +21,4 @@ for "_i" from 1 to (count blck_temporaryMarkers) do
blck_temporaryMarkers pushBack _m;
//diag_log format["_cleanupTemporaryMarkers: wait longer before deleting _marker = %1 | _deleteAt = %2",_marker, _deleteAt];
};
};
};

View File

@ -11,7 +11,7 @@
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
--------------------------

View File

@ -29,4 +29,4 @@ if (typeName _data isEqualTo "ARRAY") then
_value = _data;
};
};
_value
_value

View File

@ -18,4 +18,4 @@
//#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
_result

View File

@ -6,7 +6,7 @@
--------------------------
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/
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
@ -32,8 +32,7 @@ while {true} do
if (diag_tickTime > _timer5sec) then
{
_timer5sec = diag_tickTime + 5;
//[] call blck_fnc_missionGroupMonitor;
if (blck_simulationManager == blck_useBlckeaglsSimulationManagement) then {call blck_fnc_blckSimulationManager};
if (blck_simulationManager isEqualTo blck_useBlckeaglsSimulationManagement) then {[] call blck_fnc_simulationManager};
[] call blck_fnc_sm_staticPatrolMonitor;
[] call blck_fnc_vehicleMonitor;
};
@ -53,18 +52,33 @@ while {true} do
_timer1min = diag_tickTime + 60;
[] call blck_fnc_spawnPendingMissions;
[] call blck_fnc_cleanEmptyGroups;
//[] call blck_fnc_groupWaypointMonitor;
[] 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 SQFscripts include: %1",diag_activeSQFScripts];
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

@ -20,4 +20,4 @@ _MainMarker setMarkerType "HD_Arrow";
_MainMarker setMarkerColor "ColorBlack";
_MainMarker setMarkerText format["% Alive",_count];
//_MainMarker setMarkerDir 37;
//_MainMarker setMarkerDir 37;

View File

@ -10,4 +10,4 @@
*/
params["_killer"];
[["IED","",0,0],[_killer]] call blck_fnc_MessagePlayers;
[["IED","",0,0],[_killer]] call blck_fnc_MessagePlayers;

View File

@ -13,8 +13,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_result","_players"];
params[["_pos",[0,0,0]],["_dist",0],["_onFootOnly",false]];
if (_pos isEqualTo [0,0,0]) exitWith {false};
params["_pos","_dist",["_onFootOnly",false]];
_players = call blck_fnc_allPlayers;
_result = false;
if !(_onFootOnly) then

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]];
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

@ -46,4 +46,4 @@ for "_i" from 1 to (count blck_illuminatedCrates) do
} else {
//diag_log format["_updateCrateSignals: crate has been illuminated for enough time, no need to continue"];
};
};
};

View File

@ -10,4 +10,4 @@
*/
#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];
_marker setMarkerText format["%1 / %2 AI Alive",_rootText,{alive _x} count _missionAI];

View File

@ -1,92 +0,0 @@
/*
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: Which of the to versions is active; delete the inactive one.
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
};
blck_fnc_leastBurdened = {
params["_HC_List"];
private["_result","_fewestGroupsAssigned","_leastBurdened","_groupsAssigned"];
if (count _HC_List == 0) exitWith {_result = objNull; _result};
_fewestGroupsAssigned = [_HC_List select 0] call blck_fnc_countGroupsAssigned;
_leastBurdened = _HC_List select 0;
{
_groupsAssigned = [_x] call blck_fnc_countGroupsAssigned;
if (_groupsAssigned < _fewestGroupsAssigned) then
{
_leastBurdened = _x;
_fewestGroupsAssigned = _groupsAssigned;
};
}forEach _HC_List;
//diag_log format["_fnc_leastBurdened:: _fewestGroupsAssigned = %1 and _leastBurdened = %2",_fewestGroupsAssigned,_leastBurdened];
_leastBurdened
};
//diag_log format["_fnc_passToHCs:: function called at server time %1",diag_tickTime];
private["_numTransfered","_clientId","_allGroups","_groupsOwned","_idHC","_id","_swap","_rc"];
{
if !(_x in blck_connectedHCs) then {blck_connectedHCs pushBack _x};
}forEach 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 ((count blck_connectedHCs) > 0) then
{
_idHC = [blck_connectedHCs] call blck_fnc_leastBurdened;
//diag_log format["passToHCs: evaluating passTos for HC %1 || owner HC = %2",_idHC, owner _idHC];
{
// Pass the AI
_numTransfered = 0;
if (_x getVariable["blck_group",false]) then
{
if ((leader _x) != vehicle (leader _x)) then
{
private _v = vehicle (leader _x);
blck_monitoredVehicles = blck_monitoredVehicles - [_v];
];
//diag_log format["group belongs to blckeagls mission system so time to transfer it"];
if ((typeName _x) isEqualTo "GROUP") then
{
_id = groupOwner _x;
//diag_log format["Owner of group %1 is %2",_x,_id];
if (_id > 2) then
{
//diag_log format["group %1 is already assigned to an HC with _id of %2",_x,_id];
_swap = false;
} else {
diag_log format["group %1 should be moved to HC %2 with _idHC %3",_x,_idHC];
_x setVariable["owner",owner _idHC];
_rc = _x setGroupOwner (owner _idHC);
[_x] remoteExec["blck_fnc_HC_XferGroup",_idHC];
if ( _rc ) then
{
_numTransfered = _numTransfered + 1;
diag_log format["group %1 transferred to %2",_x, groupOwner _x];
} else {
diag_log format["something went wrong with the transfer of group %1",_x];
};
};
};
} else
{
//diag_log format["group %1 does not belong to blckeagls mission system",_x];
};
} forEach (allGroups);
diag_log format["_passToHCs:: %1 groups transferred to HC %2",_numTransfered,_idHC];
_numTransfered = 0;
// Note : the owner of a vehicle is the owner of the driver so vehicles are automatically transferred to the HC when the group to which the driver is assigned is transferred.
} else {
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log "_fnc_passToHCs:: No headless clients connected"};
#endif
};

View File

@ -1,5 +1,6 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
// TODO: Not uses? how to handle
// TODO: Not used?
// Keep in for now.
/*
for ghostridergaming
By Ghostrider [GRG]

View File

@ -14,10 +14,10 @@
*/
params["_group","_maxTime","_radius"];
if ((diag_tickTime > (_group getVariable "timeStamp") + _maxTime) || ( (getPos (leader)) distance2d (_group getVariable "patrolCenter") > _radius)) then
if (diag_tickTime > (_group getVariable "timeStamp") + _maxTime) then // || ( (getPos (leader)) distance2d (_group getVariable "patrolCenter") > _radius)) then
{
(leader _group) call blck_fnc_changeToMoveWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_checkGroupWaypointStatus: infantry group %1 stuck, waypoint reset",_group];};
#endif
//#ifdef blck_debugMode
if (blck_debugLevel > -1) then {diag_log format["_fnc_checkGroupWaypointStatus: group %1 stuck, waypoint reset",_group];};
//#endif
};

View File

@ -1,4 +1,5 @@
/*
[] call blck_fnc_createGroup
By Ghostrider [GRG]
Copyright 2016
--------------------------
@ -9,17 +10,20 @@
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
private["_groupSpawned"];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{diag_log format["_fnc_createGroup: _this = %1",_this]};
#endif
_groupSpawned = createGroup [blck_AI_Side, true];
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;

View File

@ -13,41 +13,42 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
// TODO: Add pushBack for groups spawned at static missions.
#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];
/*
#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;};
};
};
_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 GMS_fnc_checkGroupWaypointStatus;};
case "vehicle": {[_x, 90, 800] call GMS_fnc_checkGroupWaypointStatus;};
case "aircraft": {_[_x, 90, 1000] call GMS_fnc_checkGroupWaypointStatus;};
};
_private _updateNeeded = if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
//private _updateNeeded = if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
} forEach blck_monitoredMissionAIGroups;

View File

@ -81,4 +81,4 @@ if !(_soldierType isEqualTo "emplaced") then
#else
_wp setWaypointStatements ["true","this call blck_fnc_emplacedWeaponWaypoint;"];
#endif
};
};

View File

@ -12,6 +12,7 @@
#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];
switch (toLower(blck_modType)) do
{
case "exile": {_playerType = _playerType + ["Exile_Unit_Player"]};
@ -39,3 +40,25 @@ switch (toLower(blck_modType)) do
}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

@ -12,9 +12,23 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_numbertospawn","_groupSpawned","_safepos","_launcherType","_infantryType"];
// _newGroup = [_groupSpawnPos,_minAI,_maxAI,_skillLevel,_coords,_minPatrolRadius,_maxPatrolRadius,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,true,_isScubaGroup]
params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",30], ["_maxDist",45],["_configureWaypoints",true], ["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_scuba",false]];
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]];
#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};
@ -24,10 +38,7 @@ if (_backpacks isEqualTo []) then {_backpacks = [_skillLevel] call blck_fnc_sele
_numbertospawn = [_numai1,_numai2] call blck_fnc_getNumberFromRange;
//_groupSpawned = createGroup [blck_AI_Side, true]; // true here causes any empty group to be automatically deleted within 1 sec or so. https://community.bistudio.com/wiki/createGroup
_groupSpawned = call blck_fnc_create_AI_Group;
if !(isNull _groupSpawned) then
if !(isNull _group) then
{
if (_weaponList isEqualTo []) then
{
@ -47,17 +58,23 @@ if !(isNull _groupSpawned) then
_launcherType = "none";
};
//params["_pos","_aiGroup",_skillLevel,_uniforms, _headGear,_vests,_backpacks,_Launcher,_weaponList,_sideArms,_scuba];
[_pos,_groupSpawned,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba] call blck_fnc_spawnUnit;
[_pos,_group,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba] call blck_fnc_spawnUnit;
};
_groupSpawned selectLeader ((units _groupSpawned) select 0);
_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"};
[_pos,_minDist,_maxDist,_groupSpawned,"random","SAD",_infantryType] spawn blck_fnc_setupWaypoints;
[_pos,_minDist,_maxDist,_group,"random","SAD",_infantryType] spawn blck_fnc_setupWaypoints;
};
} else
{
diag_log "_fnc_spawnGroup:: ERROR CONDITION : NULL GROUP CREATED";
};
_groupSpawned
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnGroup:_group = %1",_group];
};
#endif
_group

View File

@ -25,7 +25,6 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
// TODO: Check file name which seems to have an extra _ in it.
#include "\q\addons\custom_server\Configs\blck_defines.hpp";

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

@ -38,4 +38,4 @@ for "_i" from 1 to _noMissions do
#ifdef blck_debugMode
if (blck_debugLevel >= 4) then {diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions];};
#endif
#endif

View File

@ -31,4 +31,4 @@ for "_i" from 1 to (count blck_oldMissionObjects) do {
blck_oldMissionObjects pushback _oldObjs;
};
};
};
};

View File

@ -133,4 +133,4 @@ _fn_missionCleanup = {
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
_endCondition

View File

@ -161,4 +161,4 @@
};
//diag_log "_fnc_fillBoxes <END>";
//diag_log format["testCrateLoading: crate inventory = %1",getItemCargo _crate];
//diag_log "_fnc_fillBoxes <END>";
//diag_log "_fnc_fillBoxes <END>";

View File

@ -10,7 +10,8 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_center","_garrisonedBuilding_ATLsystem",
params["_center",
"_garrisonedBuilding_ATLsystem",
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
@ -36,21 +37,27 @@ if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_
private["_group","_buildingsSpawned","_staticsSpawned","_g","_building","_return"];
_buildingsSpawned = [];
_staticsSpawned = [];
_group = call blck_fnc_create_AI_Group;
_group = [] 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;
_staticsSpawned = [_building,_group,_statics,_men,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_ATL;
}forEach _garrisonedBuilding_ATLsystem;
{
_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"]];

View File

@ -32,18 +32,21 @@ if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_
private["_group","_buildingsSpawned","_staticsSpawned","_g","_building","_return"];
_buildingsSpawned = [];
_staticsSpawned = [];
_group = call blck_fnc_create_AI_Group;
_group = 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;
{
_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

@ -10,7 +10,7 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
// TODO: Make sure all groups are captured in the list o factive groups
#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",
@ -199,6 +199,7 @@ if !(_abort) then
};
#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];
@ -250,6 +251,11 @@ if (_noChoppers > 0) then
};
};
#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
{
@ -259,6 +265,12 @@ if (count _garrisonedBuilding_ATLsystem > 0) then
_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
{
@ -268,6 +280,11 @@ if (count _garrisonedBuildings_BuildingPosnSystem > 0) then
_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;
@ -287,6 +304,11 @@ if (blck_useStatic && (_noEmplacedToSpawn > 0)) then
};
};
#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
{
@ -302,6 +324,12 @@ if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles
_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
{
@ -322,6 +350,11 @@ if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
};
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;
@ -346,10 +379,20 @@ if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then
};
};
#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;};

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];

View File

@ -0,0 +1,73 @@
/*
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["_mission"];
// Spawn landscape
// params["_objects"];
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
if (isNil "_missionLandscape") then {_missionLandscape = []};
if (isNil "_garrisonedBuilding_ASLsystem") then {_garrisonedBuilding_ASLsystem = []};
if (isNil "_garrisonedBuildings_BuildingPosnSystem") then {_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["_fnc_sm_initializeUMSStaticMission: count _airPatrols = %1 | _airPatrols = %2", count _airPatrols, _airPatrols];
{
[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_scubaGroups,_x] call blck_fnc_sm_AddGroupToArray;
}forEach _aiScubaGroupParameters;
{
[blck_sm_Emplaced,_x] call blck_fnc_sm_AddGroupToArray;
}forEach _missionEmplacedWeapons;
{
[blck_sm_surfaceShips,_x] call blck_fnc_sm_AddGroupToArray;
}forEach _vehiclePatrolParameters;
{
[blck_sm_submarines,_x] call blck_fnc_sm_AddGroupToArray;
} forEach _submarinePatrolParameters;
//uiSleep 30;
// spawn loot chests
[_missionLootBoxes,_missionCenter] call blck_fnc_sm_spawnLootContainers;
diag_log format["[blckeagls] UMS Mission Spawner: Static UMS Mission %1 spawned",_mission];

View File

@ -0,0 +1,93 @@
/*
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["_mode","_sm_groups"];
//_sm_groups = +blck_sm_Aircraft;
//diag_log format["_fnc_monitorAircraft: time %2 | blck_sm_Aircraft %1",blck_sm_Aircraft,diag_tickTime];
for "_i" from 1 to (count blck_sm_Aircraft) do
{
if (_i == (count blck_sm_Aircraft)) exitWith {};
private _element = blck_sm_Aircraft deleteAt 0;
_element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"];
//diag_log format["_fnc_monitorAircraft: _x %1",_element];
//diag_log format["_fnc_monitorAircraft: _groupParameters = %1",_groupParameters];
//diag_log format["_fnc_monitorAircraft (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt];
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"];
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnTime"];
//diag_log format["_fnc_monitorAircraft: _aircraftType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_aircraftType,_pos,_difficulty,_patrolRadius,_respawnTime];
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {};
case 1: {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli;
_group = group (driver (_return select 0));
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned + 1];
_element set[respawnAt,0];
};
blck_sm_Aircraft pushBack _element;
};
case 2: {
_element set[respawnAt,diag_tickTime + _respawnTime];
_element set[groupSpawned,0];
blck_sm_Aircraft pushBack _element;
//diag_log format["_fnc_monitorAircraft: update respawn time to %1",_respawnAt];
};
default {};
};
//diag_log format["_fnc_monitorAircraft(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned];
} else {
//diag_log format["_fnc_monitorAircraft: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]];
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
//diag_log format["_fnc_monitorAircraft: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]];
blck_sm_Aircraft pushBack _element;
} else {
if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
//diag_log format["_fnc_monitorAircraft: despanwing patrol for _element %1",_element];
//_groupParameters set [2, {alive _x} count (units _group)];
private _veh = vehicle (leader _group);
{deleteVehicle _x} forEach (units _group);
deleteGroup _group;
[_veh] call blck_fnc_destroyVehicleAndCrew;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
};
blck_sm_Aircraft pushBack _element;
};
};
};

View File

@ -0,0 +1,92 @@
/*
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["_fnc_monitorEmplaced: time %2 | blck_sm_Emplaced %1",blck_sm_Emplaced,diag_tickTime];
for "_i" from 0 to (count blck_sm_Emplaced) do
{
if (_i >= (count blck_sm_Emplaced)) exitWith {};
private _element = blck_sm_Emplaced deleteAt 0;
_element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"];
//diag_log format["_fnc_monitorEmplaced: _element %1",_element];
//diag_log format["_fnc_monitorEmplaced: _groupParameters = %1",_groupParameters];
//diag_log format["_fnc_monitorEmplaced (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt];
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"];
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime"];
//diag_log format["_fnc_monitorEmplaced: _vehicleType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_vehicleType,_pos,_difficulty,_patrolRadius,_respawnTime];
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {};
case 1: {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]]];
private _return = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
_group = group( (_return select 1) select 0);
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned + 1];
_element set[respawnAt,0];
};
blck_sm_Emplaced pushBack _element;
};
case 2: {
_element set[respawnAt,diag_tickTime + _respawnTime];
_element set[groupSpawned,0];
blck_sm_Emplaced pushBack _element;
//diag_log format["_fnc_monitorEmplaced: update respawn time to %1",_respawnAt];
};
default {};
};
//diag_log format["_fnc_monitorEmplaced(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned];
} else {
//diag_log format["_fnc_monitorEmplaced: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]];
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
//diag_log format["_fnc_monitorEmplaced: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]];
blck_sm_Emplaced pushBack _element;
} else {
if (diag_tickTime >= (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
//diag_log format["_fnc_monitorEmplaced: despanwing patrol for _element %1",_element];
//_groupParameters set [2, {alive _x} count (units _group)];
private _veh = vehicle (leader _group);
{deleteVehicle _x} forEach (units _group);
deleteGroup _group;
[_veh] call blck_fnc_destroyVehicleAndCrew;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
};
blck_sm_Emplaced pushBack _element;
};
};
};

View File

@ -0,0 +1,97 @@
/*
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["_mode","_sm_groups"];
//diag_log format["_fnc_sm_monitorGarrisonASL: blck_fnc_spawnGarrisonInsideBuilding_ATL = %1",blck_sm_garrisonBuildings_ASL];
if (blck_sm_garrisonBuildings_ASL isEqualTo []) exitWith {};
for "_i" from 0 to (count blck_sm_garrisonBuildings_ASL) do
{
if (_i >= (count blck_sm_garrisonBuildings_ASL)) exitWith {};
private _element = blck_sm_garrisonBuildings_ASL deleteAt 0;
_element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt"];
// ["_building","_aiDifficultyLevel","_staticsATL","_unitsATL"];
_groupParameters params['_building','_aiDifficulty','_staticsASL','_unitsASL','_respawnTime','_maxRespawns'];
//diag_log format["_fnc_sm_monitorGarrisonASL: _group = %1 | _timesSpawned = %2 | _respawnTime = %3 | _respawnAt = %4 | _groupSpawned = %5",_group,_timesSpawned,_respawnTime,_respawnAt,_groupSpawned];
private _pos = position _building;
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {};
case 1: {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
// ["_building","_aiDifficultyLevel","_staticsATL","_unitsATL"]
//diag_log format
private _group = [_building,_aiDifficulty,_staticsASL,_unitsASL] call blck_fnc_sm_spawnBuildingGarrison_ASL;
_timesSpawned = _timesSpawned + 1;
_groupSpawned = 1;
_respawnAt = 0;
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned];
_element set[respawnAt,_respawnAt];
//blck_sm_garrisonBuildings_ASL set[blck_sm_garrisonBuildings_ASL find _x,_element];
};
blck_sm_garrisonBuildings_ASL pushBack _element;
};
case 2: {
_groupSpawned = 0;
_respawnAt = diag_tickTime + _respawnTime;
_element set[respawnAt,_respawnAt];
_element set[groupSpawned,_groupSpawned];
//blck_sm_garrisonBuildings_ASL set[blck_sm_garrisonBuildings_ASL find _x,_element];
blck_sm_garrisonBuildings_ASL pushBack _element;
};
default {};
};
} else {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
blck_sm_garrisonBuildings_ASL pushBack _element;
} else {
if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
//_groupParameters set [2, {alive _x} count (units _group)];
private _veh = vehicle (leader _group);
{deleteVehicle _x} forEach (units _group);
deleteGroup _group;
[_veh] call blck_fnc_destroyVehicleAndCrew;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
//blck_sm_garrisonBuildings_ASL set[(blck_sm_garrisonBuildings_ASL find _x), _element];
};
blck_sm_garrisonBuildings_ASL pushBack _element;
};
};
};

View File

@ -0,0 +1,89 @@
/*
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["_mode","_sm_groups","_pos","_element"];
if (blck_fnc_sm_spawnBuildingGarrison_relPos isEqualTo []) exitWith {};
_sm_groups = +blcl_sm_garrisonBuilding_relPos;
{
_x params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt"];
// [_building,_aiDifficulty,_noStatics,_typesStatics,_noUnits,_respawn]
_groupParameters params['_building','_aiDifficulty','_noStatics','_typesStatics','_noUnits','_respawnTime','_maxRespawns'];
_element = +_x;//
_pos = position _building;
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {blcl_sm_garrisonBuilding_relPos deleteAt (blcl_sm_garrisonBuilding_relPos find _x)};
case 1: {
if (true /*[_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange*/) then
{
// ["_building","_skillLevel","_noStatics","_typesStatics","_noUnits"];
private _group = [_building,_aiDifficulty,_noStatics,_typesStatics,_noUnits] call blck_fnc_sm_spawnBuildingGarrison_relPos;
_timesSpawned = _timesSpawned + 1;
_groupSpawned = 1;
_respawnAt = 0;
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned];
_element set[respawnAt,_respawnAt];
blcl_sm_garrisonBuilding_relPos set[blcl_sm_garrisonBuilding_relPos find _x,_element];
};
};
case 2: {
_groupSpawned = 0;
_respawnAt = diag_tickTime + _respawnTime;
_element set[respawnAt,_respawnAt];
_element set[groupSpawned,_groupSpawned];
blcl_sm_garrisonBuilding_relPos set[blcl_sm_garrisonBuilding_relPos find _x,_element];
};
default {};
};
} else {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
} else {
if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
_groupParameters set [2, {alive _x} count (units _group)];
private _veh = vehicle (leader _group);
[_veh] call blck_fnc_destroyVehicleAndCrew;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
blcl_sm_garrisonBuilding_relPos set[(blcl_sm_garrisonBuilding_relPos find _x), _element];
};
};
};
}forEach _sm_groups;

View File

@ -0,0 +1,114 @@
/*
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["_fnc_monitorInfantry(12): time %2 | blck_sm_Infantry %1",blck_sm_Infantry,diag_tickTime];
if (blck_sm_Infantry isEqualTo []) exitWith {};
private["_element"];
for "_i" from 0 to (count blck_sm_Infantry) do
{
if (_i >= count(blck_sm_Infantry)) exitWith {};
_element = blck_sm_Infantry deleteAt 0;
//diag_log format["(18) element = %1",_element];
//diag_log format["_fnc_monitorInfantry(20): _element %1 | _i = %2",_element,_i];
if !(_element isEqualTo []) then
{
_element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"];
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime","_maxRespawns"];
//diag_log format["_fnc_monitorInfantry(21): _groupParameters = %1",_groupParameters];
//diag_log format["_fnc_monitorInfantry (22): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt];
//diag_log format["_fnc_monitorInfantry(28): _pos = %1 | _difficulty = 2 | _units = %3 | _patrolRadius = %4 | _respawnTime = %5",_pos,_difficulty,_units,_patrolRadius,_respawnTime];
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {
//diag_log format["_fnc_sm_monitorInfantry(46): no further respawns requested for %1",_element];
};
case 1: { // Spawn Group Now
//diag_log format["_fnc_sm_monitorInfantry(49): spawning infantry group with element = %1",_element];
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
private _numAI = [_units] call blck_fnc_getNumberFromRange;
//params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ];
_group = [] call blck_fnc_createGroup;
if !(isNull _group) then
{
[
_group,_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-1,_patrolRadius,true,
[_difficulty] call blck_fnc_selectAIUniforms,
[_difficulty] call blck_fnc_selectAIHeadgear,
[_difficulty] call blck_fnc_selectAIVests,
[_difficulty] call blck_fnc_selectAIBackpacks,
[_difficulty] call blck_fnc_selectAILoadout,
[_difficulty] call blck_fnc_selectAISidearms
] call blck_fnc_spawnGroup;
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned + 1];
_element set[respawnAt,0];
//diag_log format["_fnc_monitorInfantry (67): _element %1",_element];
//diag_log format["_fnc_monitorInfantry (69): blck_sm_Infantry %1",blck_sm_Infantry];
};
};
blck_sm_Infantry pushBack _element;
};
case 2: { // Spawn Group at a Later Time.
blck_liveMissionAI pushBack[units _group,diag_tickTime]; // schedule units of group for deletion now.
_element set[respawnAt,diag_tickTime + _respawnTime];
_element set[groupSpawned,0];
blck_sm_Infantry pushBack _element;
//diag_log format["_fnc_monitorInfantry(77): update respawn time to %1",_respawnAt];
};
default {};
};
//diag_log format["_fnc_monitorInfantry(81) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned];
} else {
//diag_log format["_fnc_monitorInfantry(83): diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]];
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
//diag_log format["_fnc_monitorInfantry(87): playerNearAt updated to %1",_group getVariable["playerNearAt",-1]];
blck_sm_Infantry pushBack _element;
} else {
if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
//diag_log format["_fnc_monitorInfantry(92): despanwing patrol for _element %1",_element];
_groupParameters set [2, {alive _x} count (units _group)];
{[_x] call blck_fnc_deleteAI} forEach (units _group);
deleteGroup _group;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
//diag_log format["_fnc_monitorInfantry (101): _element %1",_element];
//diag_log format["_fnc_monitorInfantry (102): blck_sm_Infantry %1",blck_sm_Infantry];
};
blck_sm_Infantry pushBack _element;
};
};
};
};

View File

@ -0,0 +1,92 @@
/*
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["_fnc_monitorScubaGroups: time %2 | blck_sm_scubaGroups %1",blck_sm_scubaGroups,diag_tickTime];
if (blck_sm_scubaGroups isEqualTo []) exitWith {};
for "_i" from 0 to (count blck_sm_scubaGroups) do
{
if (_i >= (count blck_sm_scubaGroups)) exitWith {};
private _element = blck_sm_scubaGroups deleteAt 0;
_element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"];
//diag_log format["_fnc_monitorScubaGroups: _element %1 | _i = %2",_element,_i];
//diag_log format["_fnc_monitorScubaGroups: _groupParameters = %1",_groupParameters];
//diag_log format["_fnc_monitorScubaGroups (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt];
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime","_maxRespawns"];
//diag_log format["_fnc_monitorScubaGroups: _pos = %1 | _difficulty = 2 | _units = %3 | _patrolRadius = %4 | _respawnTime = %5",_pos,_difficulty,_units,_patrolRadius,_respawnTime];
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {
//diag_log format["_fnc_sm_monitorInfantry(46): no further respawns requested for %1",_element];
};
case 1: {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
private _numAI = [_units] call blck_fnc_getNumberFromRange;
//params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ];
_group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup;
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned + 1];
_element set[respawnAt,0];
};
blck_sm_scubaGroups pushBack _element;
};
case 2: {
blck_liveMissionAI pushBack[units _group,diag_tickTime]; // schedule units of group for deletion now.
_element set[respawnAt,diag_tickTime + _respawnTime];
_element set[groupSpawned,0];
blck_sm_scubaGroups pushBack _element;
//diag_log format["_fnc_monitorScubaGroups: update respawn time to %1",_respawnAt];
};
default {};
};
//diag_log format["_fnc_monitorScubaGroups(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned];
} else {
//diag_log format["_fnc_monitorScubaGroups: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]];
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
blck_sm_scubaGroups pushBack _element;
//diag_log format["_fnc_monitorScubaGroups: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]];
} else {
if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
//diag_log format["_fnc_monitorScubaGroups: despanwing patrol for _element %1",_element];
_groupParameters set [2, {alive _x} count (units _group)];
{[_x] call blck_fnc_deleteAI} forEach (units _group);
deleteGroup _group;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
};
blck_sm_scubaGroups pushBack _element;
};
};
};

View File

@ -0,0 +1,94 @@
/*
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["_fnc_monitorShips: time %2 | blck_sm_surfaceShips %1",blck_sm_surfaceShips,diag_tickTime];
for "_i" from 0 to (count blck_sm_surfaceShips) do
{
if (_i >= (count blck_sm_surfaceShips)) exitWith {};
private _element = blck_sm_surfaceShips deleteAt 0;
_element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"];
//diag_log format["_fnc_monitorShips: _element %1",_element];
//diag_log format["_fnc_monitorShips: _groupParameters = %1",_groupParameters];
//diag_log format["_fnc_monitorShips (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt];
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"];
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime","_maxRespawns"];
//diag_log format["_fnc_monitorVehicles: _vehicleType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_vehicleType,_pos,_difficulty,_patrolRadius,_respawnTime];
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {};
case 1: {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
//diag_log format["_fnc_monitorShips: _return = %1",_return];
_group = group ((_return select 1) select 0);
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned + 1];
_element set[respawnAt,0];
//blck_sm_surfaceShips pushBack _element;
};
blck_sm_surfaceShips pushBack _element;
};
case 2: {
_element set[respawnAt,diag_tickTime + _respawnTime];
_element set[groupSpawned,0];
blck_sm_surfaceShips pushBack _element;
//diag_log format["_fnc_monitorShips: update respawn time to %1",_respawnAt];
};
default {};
};
//diag_log format["_fnc_monitorShips(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned];
} else {
//diag_log format["_fnc_monitorShips: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]];
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
//diag_log format["_fnc_monitorShips: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]];
blck_sm_surfaceShips pushBack _element;
} else {
if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
//diag_log format["_fnc_monitorShips: despanwing patrol for _element %1",_element];
//_groupParameters set [2, {alive _x} count (units _group)];
private _veh = vehicle (leader _group);
{deleteVehicle _x} forEach (units _group);
deleteGroup _group;
[_veh] call blck_fnc_destroyVehicleAndCrew;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
};
blck_sm_surfaceShips pushBack _element;
};
};
};

View File

@ -0,0 +1,94 @@
/*
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["_fnc_monitorSubs: time %2 | blck_sm_submarines %1",blck_sm_submarines,diag_tickTime];
for "_i" from 0 to (count blck_sm_submarines) do
{
if (_i >= (count blck_sm_submarines)) exitWith {};
private _element = blck_sm_submarines deleteAt 0;
_element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"];
//diag_log format["_fnc_monitorSubs: _element %1",_element];
//diag_log format["_fnc_monitorSubs: _groupParameters = %1",_groupParameters];
//diag_log format["_fnc_monitorSubs (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt];
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"];
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime","_maxRespawns"];
//diag_log format["_fnc_monitorVehicles: _vehicleType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_vehicleType,_pos,_difficulty,_patrolRadius,_respawnTime];
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {};
case 1: {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols;
//diag_log format["_fnc_monitorSubs: _return = %1",_return];
_group = group ((_return select 1) select 0);
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned + 1];
_element set[respawnAt,0];
//blck_sm_submarines pushBack _element;
};
blck_sm_submarines pushBack _element;
};
case 2: {
_element set[respawnAt,diag_tickTime + _respawnTime];
_element set[groupSpawned,0];
bblck_sm_submarines pushBack _element;
//diag_log format["_fnc_monitorSubs: update respawn time to %1",_respawnAt];
};
default {};
};
//diag_log format["_fnc_monitorSubs(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned];
} else {
//diag_log format["_fnc_monitorSubs: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]];
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
//diag_log format["_fnc_monitorSubs: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]];
blck_sm_submarines pushBack _element;
} else {
if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
//diag_log format["_fnc_monitorSubs: despanwing patrol for _element %1",_element];
//_groupParameters set [2, {alive _x} count (units _group)];
private _veh = vehicle (leader _group);
{deleteVehicle _x} forEach (units _group);
deleteGroup _group;
[_veh] call blck_fnc_destroyVehicleAndCrew;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
};
blck_sm_submarines pushBack _element;
};
};
};

View File

@ -0,0 +1,96 @@
/*
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["_fnc_monitorVehicles: time %2 | blck_sm_Vehicles %1",blck_sm_Vehicles,diag_tickTime];
for "_i" from 0 to (count blck_sm_Vehicles) do
{
if (_i >= (count blck_sm_Vehicles)) exitWith {};
private _element = blck_sm_Vehicles deleteAt 0;
//diag_log format["_fnc_monitorVehicles(18): _element %1",_element];
_element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"];
//diag_log format["_fnc_monitorVehicles: _groupParameters = %1",_groupParameters];
//diag_log format["_fnc_monitorVehicles (21): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt];
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime","_maxRespawns"];
//diag_log format["_fnc_monitorVehicles(23): _vehicleType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_vehicleType,_pos,_difficulty,_patrolRadius,_respawnTime];
if (!(isNull _group) && {alive _x} count (units _group) == 0) then
{
deleteGroup _group;
_group = grpNull;
};
if (isNull _group) then
{
_mode = -1;
if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn
if (_timesSpawned > 0) then
{
if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation
if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0};
if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time
if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1};
};
switch (_mode) do
{
case 0: {};
case 1: {
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
// params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_isScubaGroup",false]];
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
//diag_log format["_fnc_monitorVehicles(50): _return = %1",_return];
_group = group ((_return select 1) select 0);
// _element [[""Exile_Car_Offroad_Armed_Guerilla02"",[22809.5,16699.2,8.78706],""green"",600,90],O Alpha 1-1,1,1,0,-1]"
// _groupParameters = [""Exile_Car_Offroad_Armed_Guerilla02"",[22809.5,16699.2,8.78706],""green"",600,90]"
_element set[patrolGroup,_group];
_element set[groupSpawned,1];
_element set[timesSpawned,_timesSpawned + 1];
_element set[respawnAt,0];
};
blck_sm_Vehicles pushBack _element;
};
case 2: {
_element set[respawnAt,diag_tickTime + _respawnTime];
_element set[groupSpawned,0];
blck_sm_Vehicles pushBack _element;
//diag_log format["_fnc_monitorVehicles(63): update respawn time to %1",_respawnAt];
};
default {};
};
//diag_log format["_fnc_monitorVehicles(67) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned];
} else {
//diag_log format["_fnc_monitorVehicles(69): diag_tickTime = %1 | playerNearAt = %2 | _playerInRange = %3",diag_tickTime,_group getVariable["playerNearAt",-1],[_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange];
if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then
{
_group setVariable["playerNearAt",diag_tickTime];
//diag_log format["_fnc_monitorVehicles(73): playerNearAt updated to %1",_group getVariable["playerNearAt",-1]];
blck_sm_Vehicles pushBack _element;
} else {
if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then
{
//diag_log format["_fnc_monitorVehicles(78): despanwing patrol for _element %1",_element];
// _element [[""Exile_Car_Offroad_Armed_Guerilla02"",[22809.5,16699.2,8.78706],""green"",600,90],O Alpha 1-1,1,1,0,-1]"
// _groupParameters = [""Exile_Car_Offroad_Armed_Guerilla02"",[22809.5,16699.2,8.78706],""green"",600,90]"
//_groupParameters set [2, {alive _x} count (units _group)];
private _veh = vehicle (leader _group);
{deleteVehicle _x} forEach (units _group);
deleteGroup _group;
[_veh] call blck_fnc_destroyVehicleAndCrew;
_element set[groupParameters,_groupParameters];
_element set[patrolGroup ,grpNull];
_element set[timesSpawned,(_timesSpawned - 1)];
_element set[groupSpawned,0];
};
blck_sm_Vehicles pushBack _element;
};
};
};

View File

@ -0,0 +1,31 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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_sm_spawnAirPatrols: _this = %1",_this];
params["_airPatrols"];
private["_aircraft","_pos","_difficulty","_uniforms","_headGear"];
_aircraft = _x select 0;
_pos = _x select 1;
_difficulty = _x select 2;
_uniforms = blck_SkinList;
_headGear = blck_headgearList;
switch (_difficulty) do
{
case "blue": {_weapons = blck_WeaponList_Blue;};
case "red": {_weapons = blck_WeaponList_Red};
case "green": {_weapons = blck_WeaponList_Green};
case "orange": {_weapons = blck_WeaponList_Orange};
};
_return = [_pos,_difficulty,_weapons,_uniforms,_headGear,_aircraft] call blck_fnc_spawnMissionHeli;
_group = group (_return select 1 select 0);
_group

View File

@ -0,0 +1,50 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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";
/*
_coords = _this select 0;
_skillAI = _this select 1;
_weapons = _this select 2;
_uniforms = _this select 3;
_headGear = _this select 4;
_helis = _this select 5;
*/
params["_airPatrols","_noAirPatrols","_heliTypes","_center","_difficulty","_uniforms","_headGear","_weapons"];
diag_log format["_sm_spawnAirPatrols:: _this = %1",_this];
diag_log format["_sm_spawnAirPatrols:: _airPatrols = %1",_airPatrols];
if (_airPatrols isEqualTo []) then
{
for "_i" from 1 to _noAirPatrols do
{
/*
_coords = _this select 0;
_skillAI = _this select 1;
_weapons = _this select 2;
_uniforms = _this select 3;
_headGear = _this select 4;
_helis = _this select 5;
*/
[_center,_difficulty,_weapons,_uniforms,_headGear,_heliTypes,0] call blck_fnc_spawnMissionHeli;
};
} else {
{
/*
/*[aircraft classname, position, difficulty(blue, red etc)]*/
_aircraft = _x select 0;
_pos = _x select 1;
_difficulty = _x select 2;
[_pos,_difficulty,_weapons,_uniforms,_headGear,_aircraft] call blck_fnc_spawnMissionHeli;
}forEach _airPatrols;
};

View File

@ -0,0 +1,11 @@
params["_building","_aiDifficultyLevel","_statics","_units"];
diag_log format["_fnc_sm_spawnBuildingGarrisonASL: handling _building = %1 | at location = %2",_building,position _building];
private _group = [] call blck_fnc_createGroup;
if !(isNull _group) then
{
//params["_building","_group","_statics","_men","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks",["_launcher","none"],"_weaponList","_sideArms"];
[_building,_group,_statics,_units,_aiDifficultyLevel] call blck_fnc_spawnGarrisonInsideBuilding_ATL;
};
_group

View File

@ -0,0 +1,11 @@
params["_building","_skillLevel","_noStatics","_typesStatics","_noUnits"];
diag_log format["_fnc_sm_spawnBuildingGarrison_relPos: handling _building = %1 | at location = %2",_building,position _building];
private _group = [] call blck_fnc_createGroup;
if !(isNull _group) then
{
// ["_building","_group","_noStatics","_typesStatics","_noUnits",["_aiDifficultyLevel","Red"],
[_building,_group,_noStatics,[],_noUnits,_skillLevel] call blck_fnc_spawnGarrisonInsideBuilding_relPos;
};
_group

View File

@ -0,0 +1,62 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode"];
_emplacedWeps = [];
_emplacedAI = [];
_units = [];
_abort = false;
_pos = [];
//diag_log format["_sm_spawnEmplaced <Line 26>:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons];
// Define _missionEmplacedWeapons if not already configured.
if (_missionEmplacedWeapons isEqualTo []) then
{
_missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
{
_static = selectRandom blck_staticWeapons;
//diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x];
_missionEmplacedWeapons pushback [_static,_coords vectorAdd _x,_aiDifficultyLevel];
//diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons];
} forEach _missionEmplacedWeaponPositions;
};
//diag_log format["_sm_spawnEmplaced<Line 38>:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons];
{
_wepnClassName = _x select 0;
_pos = _x select 1;
_difficulty = _x select 2;
// params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ];
private _empGroup = [] call blck_fnc_createGroup;
if !(_empGroup) then
{
[_empGroup,_pos,1,1,_difficulty,_pos,1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup;
_empGroup setcombatmode "RED";
_empGroup setBehaviour "COMBAT";
[_pos,0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints;
//if (isNull _empGroup) exitWith {_abort = _true};
_wep = [_wepnClassName,[0,0,0],false] call blck_fnc_spawnVehicle;
//_empGroup setVariable["groupVehicle",_wep];
_wep setVariable["vehicleGroup",_empGroup];
_wep setVariable["GRG_vehType","emplaced"];
_wep setPosATL _pos;
[_wep,false] call blck_fnc_configureMissionVehicle;
_units = units _empGroup;
_gunner = _units select 0;
_gunner moveingunner _wep;
};
} forEach _missionEmplacedWeapons;
blck_monitoredVehicles append _emplacedWeps;
true

View File

@ -0,0 +1,58 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode"];
_emplacedWeps = [];
_emplacedAI = [];
_units = [];
_abort = false;
_pos = [];
//diag_log format["_sm_spawnEmplaced <Line 26>:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons];
// Define _missionEmplacedWeapons if not already configured.
if (_missionEmplacedWeapons isEqualTo []) then
{
_missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
{
_static = selectRandom blck_staticWeapons;
//diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x];
_missionEmplacedWeapons pushback [_static,_coords vectorAdd _x,_aiDifficultyLevel];
//diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons];
} forEach _missionEmplacedWeaponPositions;
};
//diag_log format["_sm_spawnEmplaced<Line 38>:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons];
{
_wepnClassName = _x select 0;
_pos = _x select 1;
_difficulty = _x select 2;
/// params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
__empGroup = [_pos,_pos,1,1,_difficulty,1,2,false,_uniforms,_headGear] call blck_fnc_spawnGroup;
_empGroup setcombatmode "RED";
_empGroup setBehaviour "COMBAT";
[_pos,0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints;
//if (isNull _empGroup) exitWith {_abort = _true};
_wep = [_wepnClassName,[0,0,0],false] call blck_fnc_spawnVehicle;
//_empGroup setVariable["groupVehicle",_wep];
_wep setVariable["vehicleGroup",_empGroup];
_wep setVariable["GRG_vehType","emplaced"];
_wep setPosATL _pos;
[_wep,false] call blck_fnc_configureMissionVehicle;
_units = units _empGroup;
_gunner = _units select 0;
_gunner moveingunner _wep;
} forEach _missionEmplacedWeapons;
blck_monitoredVehicles append _emplacedWeps;
true

View File

@ -0,0 +1,41 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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: Used?
// params["_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]];
params["_patrols","_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_weapons",blck_WeaponList_Orange],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]];
//diag_log format["_sm_spawnInfantryPatrols:: _this = %1",_this];
//diag_log format["_sm_spawnInfantryPatrols:: patrols = %1",_patrols];
if (_patrols isEqualTo []) then
{
// Use the random spawn logic from the regular dyanmic mission system.
//params[_coords,"_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weapons,sideArms,_isScubaGroup];
[_coords,_minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI
} else {
{
//diag_log format["_sm_spawnInfantryPatrols.sqf:: _x = %1",_x];
// Use the pre-defined spawn positions and other parameters for each group.
// [[22819.4,16929.5,5.33892],"red",4, 75]
private["_pos","_difficulty","_noAI","_patrolRadius"];
_pos = _x select 0; // Position at which to spawn the group
_difficulty = _x select 1; // AI difficulty setting (blue, green etc)
_noAI = _x select 2; // Number of AI to spawn with the group
_patrolRadius = _x select 3; // Radius within which AI should patrol
private _group = [] call blck_fnc_createGroup;
// params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_configureWaypoints",true] ];
if !(isNull _group) then
{
[_group,_pos,_pos,_noAI,_noAI,_difficulty,_patrolRadius,_patrolRadius,true,_uniforms,_headGear] call blck_fnc_spawnGroup;
};
}forEach _patrols;
};

View File

@ -0,0 +1,40 @@
/*
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["_objects","_coords"];
private["_object"];
if !(_objects isEqualTo []) exitWith
{ // Spawn loot crates where specified in _objects using the information for loot parameters provided for each location.
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_sm_spawnLootContainers (21):-> _x = %1",_x];
};
#endif
//diag_log format["_fnc_sm_spawnLootContainers (21):-> _x = %1",_x];
// [selectRandom blck_crateTypes,[22904.8,16742.5,6.30195],[[0,1,0],[0,0,1]],[true,false], _crateLoot, _lootCounts]
_x params["_crateClassName","_cratePosASL","_vectorDirUp","_allowDamageSim","_crateLoot","_lootCounts"];
_crate = [_cratePosASL, _crateClassName] call blck_fnc_spawnCrate;
[_crate, _crateLoot,_lootCounts] call blck_fnc_fillBoxes;
} forEach _objects;
};
// In the case where no loot crate parameters are defined in _objects just spawn 1 at the center of the mission.
if (_objects isEqualTo []) then
{
_crateType = selectRandom blck_crateTypes;
_crate = [_coords,_crateType] call blck_fnc_spawnCrate;
[_crate,blck_BoxLoot_Red,blck_lootCountsGreen] call blck_fnc_fillBoxes;
};

View File

@ -0,0 +1,51 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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"];
[_missionLandscape] call blck_fnc_sm_spawnObjects;
uiSleep 10; // Let the objects 'settle' before placing anything on or around them.
// Spawn Air Patrols
// params["_airPatrols","_noAirPatrols","_heliTypes","_center","_difficulty","_uniforms","_headGear"];
[_airPatrols,_noAirPatrols,_aircraftTypes,_missionCenter,_difficulty,_uniforms,_headgear,_weapons] call blck_fnc_sm_spawnAirPatrols;
//uiSleep 1;
// Spawn Vehicle Patrols
// params["_coords","_noVehiclePatrols","_vehiclePatrolSpawns","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]];
[_missionCenter,_noVehiclePatrols,_vehiclePatrolParameters,_difficulty,_uniforms,_headGear] call blck_fnc_sm_spawnVehiclePatrols;
//uiSleep 1;
// spawn infantry
// params["_patrols","_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_weapons",blck_WeaponList_Orange],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]];
[_aiGroupParameters, _missionCenter,_minNoAI,_maxNoAI,_difficulty,_weapons,_uniforms,_headGear] call blck_fnc_sm_spawnInfantryPatrols;
//uiSleep 1;
// spawn loot vehicles
// params["_objects","_coords","_loot","_lootCounts"];
[_missionLootVehicles,_missionCenter,_crateLoot,_lootCounts] call blck_fnc_sm_spawnLootContainers;
// Spawn static weapons
// params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
[_missionEmplacedWeapons,_noEmplacedWeapons,_difficulty,_missionCenter,_uniforms,_headGear] call blck_fnc_sm_spawnEmplaceds;
// spawn loot chests
[_missionLootBoxes,_missionCenter,_crateLoot,_lootCounts] call blck_fnc_sm_spawnLootContainers;
_blck_localMissionMarker = ["",_missionCenter,"","",_markerColor,_markerType];
[_blck_localMissionMarker] call blck_fnc_spawnMarker;
diag_log format["[blckeagls] Static Mission Spawner: Mission %1 spawned",_mission];

View File

@ -0,0 +1,21 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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["_buildingClassName","_posASL","_vectorDirUp","_enableDamSim"];
_object = createVehicle [_buildingClassName, [0,0,0], [], 0, "CAN_COLLIDE"];
_object setPosASL _posASL;
_object setVectorDirAndUp _vectorDirUp;
_object enableSimulationGlobal (_enableDamSim select 0);
_object allowDamage (_enableDamSim select 1);
_object

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";
params["_objects"];
private["_objects","_object"];
{
_object = [_x select 0, _x select 1, _x select 2, _x select 3] call blck_fnc_sm_spawnObjectASLVectorDirUp;
} forEach _objects;

View File

@ -0,0 +1,56 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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["_coords","_noVehiclePatrols","_vehiclePatrolSpawns","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]];
//diag_log format["_sm_spawnVehiclePatrols:: _vehiclePatrolSpawns = %1",_vehiclePatrolSpawns];
private["_vehGroup","_patrolVehicle","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_randomVehicle","_return","_abort"];
//if (count _weapons isEqualTo 0) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
if (_vehiclePatrolSpawns isEqualTo []) then
{
private["_spawnPoints","_vehType"];
_spawnPoints = [_coords,_noVehiclePatrols,75,100] call blck_fnc_findPositionsAlongARadius;
{
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red", 600],
_vehType = selectRandom blck_AIPatrolVehicles;
_vehiclePatrolSpawns pushBack [_vehType, _x, _aiDifficultyLevel, 150];
} forEach _spawnPoints;
};
{
private ["_vehicle","_spawnPos","_difficulty","_patrolRadius"];
_vehicle = _x select 0;
_spawnPos = _x select 1;
_difficulty = _x select 2;
_patrolRadius = _x select 3;
//_newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,_minDist,_maxDist,_uniforms,_headGear,true,_weapons,_vests,_isScubaGroup] call blck_fnc_spawnGroup;
private _vehGroup = [] call blck_fnc_createGroup;
_vehGroup setVariable["soldierType","vehicle"];
if !(isNull _vehGroup) then
{
[_vehGroup,_spawnPos,_spawnPos,3,3,_difficulty,1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup;
//params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]];
_patrolVehicle = [_spawnPos,_spawnPos,_vehicle,_patrolRadius,_patrolRadius,_vehGroup] call blck_fnc_spawnVehiclePatrol; // Check whether we should pass the group; looks like we should.
// Nope, not necessary
//_vehGroup setVariable["groupVehicle",_vehicle];
if !(isNull _patrolVehicle) then
{
_patrolVehicle setVariable["vehicleGroup",_vehGroup];
};
};
} forEach _vehiclePatrolSpawns;
true

View File

@ -0,0 +1,27 @@
/*
by Ghostrider [GRG]
for ghostridergaming
12/5/17
--------------------------
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";
// GMS_fnc_sm_missionPatrolMonitor
[] call blck_fnc_sm_monitorInfantry;
[] call blck_fnc_sm_monitorScuba;
//uiSleep 0.1;
[] call blck_fnc_sm_monitorVehicles;
[] call blck_fnc_sm_monitorAircraft;
[] call blck_fnc_sm_monitorEmplaced;
[] call blck_fnc_sm_monitorShips;
[] call blck_fnc_sm_monitorSubs;
//[] call blck_fnc_sm_monitorGarrisonsASL;
//[] call blck_fnc_sm_monitorGarrisons_relPos;

View File

@ -33,6 +33,17 @@ _newObjs pushBack _obj;
_sim = _x select 3;
_dam = _x select 4;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
if !(count (_x select 1) isEqualTo 3) then
{
diag_log format["_fnc_spawnBaseObjects [ERROR, invalid object offset provided]: offset = %1 | 3 parameters exected | object definition = %2",_x select 1,1];
};
};
#endif
_obj = createVehicle[(_x select 0),_center vectorAdd (_x select 1),[],0,"CAN_COLLIDE"];
//diag_log format["_fnc_spawnBaseObjects::-->> _x = %1 | _obj = %2",_x,_obj];
_newObjs pushback _obj;

View File

@ -0,0 +1,636 @@
/*
Dynamic Underwater Mission Spawner
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 isScubaMission true
#define delayTime 1
private ["_abort","_crates","_aiGroup","_objects","_mines","_blck_AllMissionAI","_blck_localMissionMarker",
"_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned",
"_blck_AllMissionAI","_delayTime","_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_marker"];
params["_coords","_mission",["_allowReinforcements",false]];
_markerClass = _mission;
_aiDifficultyLevel = _difficulty; // _difficulty is defined in the mission description file. see \addons\custom_server\Missions\UMS\dynamicMissions\default.sqf for an example
diag_log format["[blckeagls Dynamic UMS] dynamicUMSspawner (34):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
//if (isNil "_timeOut") then {_timeOut = -1;};
if (isNil "_missionGroups") then {_missionGroups = []};
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 "_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 = 0};
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Blue};
if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed};
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];
_delayTime = 1;
_groupPatrolRadius = 50;
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 "dynamicUMSspawner:: (91) message players and spawn a mission marker";};
if (blck_debugLevel > 0) then {diag_log "dynamicUMSspawner:: (77) waiting for player to trigger the mission";};
#endif
////////
// All parameters are defined, let's 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 "dynamicUMSspawner:: (90) starting mission trigger loop"};
if (blck_debugLevel > 2) then {_wait = false};
#endif
while {_wait} do
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) exitWith {_playerInRange = true;};
#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["dynamicUMSspawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords];
diag_log format["dynamicUMSspawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers];
diag_log format["dynamicUMSspawner:: Trigger Loop - timeout = %1", [_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut];
};
#endif
};
if (_missionTimedOut) exitWith
{
// Deal with the case in which the mission timed out.
blck_priorDynamicUMS_Missions pushback [_coords,diag_tickTime];
blck_UMS_ActiveDynamicMissions = blck_UMS_ActiveDynamicMissions - [_coords];
blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning - 1;
diag_log format["_fnc_dynamicUMSSpawner (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] dynamicUMSspawner:: (142) -- >> 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;;
};
uiSleep delayTime;
_temp = [];
//diag_log format["_dynamicUMSspawner"" _missionLandscape = %1 | _missionLandscapeMode = %2",_missionLandscape, _missionLandscapeMode];
if (_missionLandscapeMode isEqualTo "random") then
{
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
};
if (_missionLandscapeMode isEqualTo "precise") then
{
//params["_center","_objects"];
_temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects;
//uiSleep 1;
};
//diag_log format["_fnc_dynamicUMSspawner: _temp = %1, typeName _temp = %2",_temp, typeName _temp];
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
//diag_log format["_fnc_dynamicUMSspawner:: (176)->> _objects = %1",_objects];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] dynamicUMSspawner:: (190) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
uiSleep delayTime;;
_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
//uisleep 1;
_crates append _temp;
uiSleep _delayTime;
_abort = false;
_temp = [[],[],false];
//diag_log format["_fnc_dynamicUMSspawner: spawning infantry using data in _missionGroups with _missionGroups = %1",_missionGroups];
// Require that the server admin define the location of any infantry patrols given that missions will be off-shore.
// AI could be spawned on a platform or floating structure.
if (count _missionGroups > 0) then
{
// params["_coords",["_minNoAI",3],["_maxNoAI",6],"_missionGroups",["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],["_vests",blck_vests],["_backpacks",[]],["_weapons",[]],["_sideArms",blck_Pistols],["_isScubaGroup",false]];
_temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false] call blck_fnc_spawnMissionAI;
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["dynamicUMSspawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1;
};
_abort = _temp select 1;
if (blck_debugLevel > 2) then
{
diag_log format["dynamicUMSspawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
};
#endif
if (count _scubaGroupParameters > 0) then
{
//diag_log format["_fnc_dynamicUMSspawner: spawning scuba groups with _scubaGroupParameters = %1",_scubaGroupParameters];
// params["_coords",["_minNoAI",3],["_maxNoAI",6],"_missionGroups",["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],["_vests",blck_vests],["_backpacks",[]],["_weapons",[]],["_sideArms",blck_Pistols],["_isScubaGroup",false]];
_temp = [_coords, _minNoAI,_maxNoAI,_scubaGroupParameters,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnMissionAI;
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["dynamicUMSspawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1;
};
_abort = _temp select 1;
if (blck_debugLevel > 2) then
{
diag_log format["dynamicUMSspawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
};
#endif
if (_abort) exitWith
{
if (blck_debugLevel > 1) then {
diag_log "dynamicUMSspawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission;
};
if !(_abort) then
{
_blck_AllMissionAI append (_temp select 0);
};
uiSleep _delayTime;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] dynamicUMSspawner:: (235) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
uiSleep _delayTime;
_temp = [[],[],false];
_abort = false;
private["_patrolVehicles","_vehToSpawn"];
//diag_log format["_fnc_dynamicUMSspawner (258): _noVehiclePatrols = %1",_noVehiclePatrols];
_vehToSpawn = 0;
//diag_log format["_dynamicUMSspawner:: _vehToSpawn = %1",_vehToSpawn];
// Spawn any surface patrols
if (blck_useVehiclePatrols && count _vehiclePatrolParameters > 0) then
{
// params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_vehiclePatrolParameters,true,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount /*,blck_UMS_weapons,blck_UMS_vests,isScubaMission*/ ] call blck_fnc_spawnMissionVehiclePatrols;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {
diag_log format["dynamicUMSspawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp];
};
#endif
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
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] dynamicUMSspawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
};
// Spawn any submarine patrols
if (blck_useVehiclePatrols && count _submarinePatrolParameters > 0) then
{
// params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_submarinePatrolParameters,true,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnMissionVehiclePatrols;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {
diag_log format["dynamicUMSspawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp];
};
#endif
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if !(_abort) then
{
_patrolVehicles = _temp select 0;
//diag_log format["[blckeagls] dynamicUMSspawner:: Patrol vehicles = %1",_patrolVehicles];
_blck_AllMissionAI append (_temp select 1);
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] dynamicUMSspawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
};
if (_abort) exitWith
{
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log "dynamicUMSspawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission;
};
uiSleep delayTime;
_temp = [[],[],false];
_abort = false;
_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange;
_noPara = [_noPara] call blck_fnc_getNumberFromRange;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["_dynamicUMSspawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]};
#endif
if (_noChoppers > 0) then
{
for "_i" from 1 to (_noChoppers) do
{
if (random(1) < _chanceHeliPatrol) then
{
//_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements;
_temp = [_coords,_aiDifficultyLevel,_missionHelis] call blck_fnc_spawnMissionHeli;
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
blck_monitoredVehicles pushBack (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
if (_abort) then
{
_objects pushback (_temp select 0);
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
};
};
};
};
//////////////////////////
// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects.
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log format["dynamicUMSspawner:: (361) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];};
#endif
uiSleep 15;
private["_noEmplacedToSpawn"];
_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
//diag_log format["_dynamicUMSspawner:: _noEmplacedToSpawn = %1",_vehToSpawn];
if (blck_useStatic && ((_noEmplacedToSpawn > 0)) || count _missionEmplacedWeapons > 0) then
{
// params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
//_temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
_temp = [_coords,_missionEmplacedWeapons,true,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format ["dynamicUMSspawner:: (375) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp];
};
#endif
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format ["dynamicUMSspawner:: (387) _abort = %1",_abort];
};
#endif
if !(_abort) then
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] dynamicUMSspawner:: (400) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
};
if (_abort) exitWith
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log "dynamicUMSspawner:: (410) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission;
};
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;
};
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then
{
//diag_log format["_fnc_missionSpawner (435): spawning %1 paraunits at mission spawn",_noPara];
//private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits;
// blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission
private _paratroops = [_coords,_noPara,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] 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 2;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] dynamicUMSspawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
// Trigger for mission end
#ifdef blck_debugMode
diag_log format["[blckeagls] mission Spawner(436) _endCondition = %1",_endCondition];
#endif
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"];
_missionComplete = -1;
_startTime = diag_tickTime;
if (blck_showCountAliveAI) then
{
//diag_log format["_dynamicUMSspawner(441): Adding Number Alive AI: _marker = %1 | _markerMissionName = %2",_marker,_markerMissionName];
//diag_log format["_dynamicUMSspawner(442): Alive AI = %1 | Current Marker Text = %2",{alive _x} count _blck_AllMissionAI, markerText _marker];
if !(_marker isEqualTo "") then
{
[_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI];
//diag_log format["_dynamicUMSspawner: blck_missionMarkers = %1",blck_missionMarkers];
};
};
switch (_endCondition) do
{
case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;};
case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;};
case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;};
};
#ifdef blck_debugMode
diag_log format["dynamicUMSspawner :: (449) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
#endif
private["_locations"];
_locations = [_coords];
{
_locations pushback (getPos _x);
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
#ifdef blck_debugMode
diag_log format["dynamicUMSspawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations];
#endif
private _crateStolen = false;
#ifdef blck_debugMode
diag_log format["dynamicUMSspawner(462):: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled];
#endif
if (blck_showCountAliveAI) then
{
if !(_marker isEqualTo "") then
{
[_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI];
};
};
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
_missionComplete = -1;
while {_missionComplete isEqualTo -1} do
{
#ifdef blck_debugMode
if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 10; diag_log "_fnc_dynamicUMSSpawner (574): scripted mission end";};
#endif
if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {};
if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1) exitWith {};
if (_spawnCratesTiming isEqualTo "atMissionSpawn") then
{
{
if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith
{
_missionComplete = 1;
_crateStolen = true;
};
}forEach _crates;
};
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 //
{
// blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnParaUnits;] call blck_fnc_spawnParaUnits;
private _paratroops = [_coords,_noPara,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] 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;
};
};
};
};
};
//diag_log format["dynamicUMSspawner:: (483) missionCompleteLoop - > players near = %1 and ai alive = %2 and crates stolen = %3",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI, _crateStolen];
uiSleep 4;
};
if (_crateStolen) exitWith
{
//diag_log format["dynamicUMSspawner:: (542) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen];
[_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_mission,2,isScubaMission] call blck_fnc_endMission;
};
if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) 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_dynamicUMSspawner (531): _crates = %1", _crates]};
#endif
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log format["[blckeagls] dynamicUMSspawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]};
#endif
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then
{
{
[_x] call blck_fnc_loadMissionCrate;
} forEach _crates;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] dynamicUMSspawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["dynamicUMSspawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
diag_log format["[blckeagls] dynamicUMSspawner:: (498) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
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;
};
// params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_endCondition",0],["_vehicles",[]],["_isScubaMission",false]];
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0,_missionAIVehicles,isScubaMission] call blck_fnc_endMission;
#ifdef blck_debugMode
diag_log format["[blckeagls] dynamicUMSspawner:: (559) end of mission: blck_fnc_endMission has returned control to _fnc_dynamicUMSspawner"];
#endif
blck_missionsRun = blck_missionsRun + 1;
diag_log format["[blckeagls] dynamicUMSspawner:: Total Dyanamic Land and UMS Run = %1", blck_missionsRun];

View File

@ -88,30 +88,33 @@ if (blck_debugLevel > 1) then
#define maxDist 2
/// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
_empGroup = [(_x select 1),_pos,minAI,maxAI,_aiDifficultyLevel,minDist,maxDist,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnGroup;
_empGroup setcombatmode "RED";
_empGroup setBehaviour "COMBAT";
[(_x select 1),0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints;
if (isNull _empGroup) exitWith {_abort = true};
// params["_vehType","_pos",["_clearInventory",true]];
private _wep = [(_x select 0),[0,0,0],false,true] call blck_fnc_spawnVehicle;
_wep addMPEventHandler ["MPHit",{[_this] call blck_EH_AIVehicle_HandleDamage}];
_wep addEventHandler["GetOut",{_this remoteExec["blck_EH_vehicleGetOut",2]}];
//_wep setVariable["vehicleGroup",_empGroup];
_wep setVariable["GRG_vehType","emplaced"];
_wep setPos _pos;
_wep setdir (random 359);
[_wep,false] call blck_fnc_configureMissionVehicle;
_emplacedWeps pushback _wep;
_units = units _empGroup;
_gunner = _units select 0;
_gunner moveingunner _wep;
_gunner setVariable["GRG_vehType","emplaced"];
_gunner setVariable["GRG_vehicle",_wep];
//_gunner addEventHandler["GetOutMan",{_this remoteExec["blck_EH_vehcleManGetOut",2]}];
_emplacedAI append _units;
private _empGroup = [] call blck_fnc_createGroup;
if !(isNull _empGroup) then
{
[_empGroup,(_x select 1),_pos,minAI,maxAI,_aiDifficultyLevel,minDist,maxDist,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnGroup;
_empGroup setcombatmode "RED";
_empGroup setBehaviour "COMBAT";
_empGroup setVariable ["soldierType","emplaced"];
[(_x select 1),0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints;
//if (isNull _empGroup) exitWith {_abort = true};
// params["_vehType","_pos",["_clearInventory",true]];
private _wep = [(_x select 0),[0,0,0]] call blck_fnc_spawnVehicle;
//_wep addMPEventHandler ["MPHit",{[_this] call blck_EH_AIVehicle_HandleDamage}];
//_wep addEventHandler["GetOut",{_this remoteExec["blck_EH_vehicleGetOut",2]}];
//_wep setVariable["vehicleGroup",_empGroup];
_wep setVariable["GRG_vehType","emplaced"];
_wep setPos _pos;
_wep setdir (random 359);
[_wep,2] call blck_fnc_configureMissionVehicle;
_emplacedWeps pushback _wep;
_units = units _empGroup;
_gunner = _units select 0;
_gunner moveingunner _wep;
_gunner setVariable["GRG_vehType","emplaced"];
//_gunner setVariable["GRG_vehicle",_wep];
//_gunner addEventHandler["GetOutMan",{_this remoteExec["blck_EH_vehcleManGetOut",2]}];
_emplacedAI append _units;
};
} forEach _missionEmplacedWeapons;
blck_monitoredVehicles append _emplacedWeps;
_return = [_emplacedWeps,_emplacedAI,_abort];

View File

@ -23,7 +23,7 @@ private["_staticsSpawned","_return","_obj","_unit","_u"];
_staticsSpawned = [];
{
_x params["_staticClassName","_staticRelPos","_staticDir"];
_obj = [_staticClassName, [0,0,0], true] call blck_fnc_spawnVehicle;
_obj = [_staticClassName, [0,0,0]] call blck_fnc_spawnVehicle;
_obj setVariable["GRG_vehType","emplaced"];
_staticsSpawned pushBack _obj;
//diag_log format["_fnc_spawnGarrisonInsideBuilding_ATL: _obj = %1 | _staticsSpawned = %2",_obj,_staticsSpawned];

View File

@ -13,7 +13,8 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#define configureWaypoints true
// TODO: consolidate code where possible, for example the recurring code to create the group and add units to the list of units spawned.
// TODO: find reason that this sometimes throws errors because it passes an array rather than group.
params["_coords",["_minNoAI",3],["_maxNoAI",6],"_missionGroups",["_aiDifficultyLevel","red"],["_uniforms",[]],["_headGear",blck_BanditHeadgear],["_vests",[]],["_backpacks",[]],["_weapons",[]],["_sideArms",[]],["_isScubaGroup",false]];
#ifdef blck_debugMode
if (blck_debugLevel >=2) then
@ -38,24 +39,22 @@ _ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups);
};
_blck_AllMissionAI = [];
_abort = false;
if (count _weapons == 0) then
{
_weapons = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
};
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (30):: _unitsToSpawn %1 ; _unitsPerGroup %2 _ResidualUnits %3",_unitsToSpawn,_unitsPerGroup,_ResidualUnits];
};
#endif
private _newGroup = grpNull;
//_newGroup setVariable ["soldierType","infantry"];
if ( (count _missionGroups > 0) && _noAIGroups > 0) then
{
{
_x params["_position","_minAI","_maxAI","_skillLevel","_minPatrolRadius","_maxPatrolRadius"];
_groupSpawnPos = _coords vectorAdd _position;
_newGroup = [_groupSpawnPos,_coords,_minAI,_maxAI,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newGroup = [] call blck_fnc_createGroup;
_newGroup setVariable ["soldierType","infantry"];
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
@ -63,18 +62,16 @@ if ( (count _missionGroups > 0) && _noAIGroups > 0) then
};
#endif
if (isNull _newGroup) then
{
_abort = true;
}
else
if !(isNull _newGroup) then
{
[_newGroup,_groupSpawnPos,_coords,_minAI,_maxAI,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newGroup setVariable ["soldierType","infantry"];
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(41): Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
diag_log format["_fnc_spawnMissionAI(41): Spawning Groups for defined array of group positions: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
};
#endif
@ -95,24 +92,21 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1"];
diag_log format["missionSpawner: Spawning Groups: case 1: _noAIGroups=1"];
};
#endif
_newGroup = [_coords,_coords,_unitsToSpawn,_unitsToSpawn,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newGroup = [] call blck_fnc_createGroup;
_newGroup setVariable ["soldierType","infantry"];
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (37):: case 1 - > _newGroup = %1",_newGroup];
};
#endif
if (isNull _newGroup) then
{
_abort = true;
}
else
if !(isNull _newGroup) then
{
[_newGroup,_coords,_coords,_unitsToSpawn,_unitsToSpawn,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newGroup setVariable ["soldierType","infantry"];
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
@ -131,7 +125,7 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(47): Spawning Groups: _noAIGroups=2"]; // spawn groups on either side of the mission area
diag_log format["_fnc_spawnMissionAI(47): Spawning Groups: case 2: _noAIGroups=2"]; // spawn groups on either side of the mission area
};
#endif
_groupLocations = [_coords,_noAIGroups,15,30] call blck_fnc_findPositionsAlongARadius;
@ -143,15 +137,12 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then
} else {
_adjusttedGroupSize = _unitsPerGroup;
};
_newGroup = [_x,_coords,_adjusttedGroupSize,_adjusttedGroupSize,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
if (isNull _newGroup) then
{
_abort = true;
}
else
_newGroup = [] call blck_fnc_createGroup;
_newGroup setVariable ["soldierType","infantry"];
if !(isNull _newGroup) then
{
[_newGroup,_x,_coords,_adjusttedGroupSize,_adjusttedGroupSize,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
@ -170,18 +161,15 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (68): Spawning Groups: _noAIGroups=3"];
diag_log format["_fnc_spawnMissionAI (68): Spawning Groups: case 3: _noAIGroups=3"];
};
#endif
_newGroup = [_coords,_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
if (isNull _newGroup) then
{
_abort = true;
}
else
_newGroup = [] call blck_fnc_createGroup;
_newGroup setVariable ["soldierType","infantry"];
if !(isNull _newGroup) then
{
[_newGroup,_coords,_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
@ -189,20 +177,15 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then
diag_log format["_fnc_spawnMissionAI (73): Case 3: _newGroup=%1",_newGroup];
};
#endif
_blck_AllMissionAI append _newAI;
_groupLocations = [_coords,2,20,35] call blck_fnc_findPositionsAlongARadius;
{
_newGroup = [_x,_coords,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
if (isNull _newGroup) then
{
_abort = true;
}
else
_newGroup = [] call blck_fnc_createGroup;
_newGroup setVariable ["soldierType","infantry"];
if !(isNull _newGroup) then
{
[_newGroup,_x,_coords,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
@ -210,7 +193,6 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then
diag_log format["_fnc_spawnMissionAI(78): Case 3: line 81: _newGroup = %1",_newGroup];
};
#endif
_blck_AllMissionAI append _newAI;
};
}forEach _groupLocations;
@ -221,41 +203,38 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (88): default:"];
diag_log format["_fnc_spawnMissionAI (88) spawning groups: Case default:"];
};
#endif
_newGroup = [_coords,_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newGroup = [] call blck_fnc_createGroup;
_newGroup setVariable ["soldierType","infantry"];
if (isNull _newGroup) then
{
_abort = true;
[_newGroup,_coords,_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(92): Spawning Groups: Default - > Center Position: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
};
#endif
_blck_AllMissionAI append _newAI;
};
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(92): Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
};
#endif
_blck_AllMissionAI append _newAI;
_groupLocations = [_coords,(_noAIGroups - 1),20,40] call blck_fnc_findPositionsAlongARadius;
{
_newGroup = [_x,_coords,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
if (isNull _newGroup) then
{
_abort = true;
}
else
_newGroup = [] call blck_fnc_createGroup;
_newGroup setVariable ["soldierType","infantry"];
if !(isNull _newGroup) then
{
[_newGroup,_x,_coords,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI(99): _newGroup=%1",_newGroup];
diag_log format["_fnc_spawnMissionAI(99): Default: Radial Positions: _newGroup=%1",_newGroup];
};
#endif
_blck_AllMissionAI append _newAI;
@ -264,6 +243,7 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then
};
};
};
#ifdef blck_debugMode
if (blck_debugLevel >= 1) then
{

View File

@ -11,7 +11,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_coords","_missionLootVehicles",["_loadCrateTiming","atMissionSpawn"]];
params["_coords","_missionLootVehicles",["_loadCrateTiming","atMissionSpawn"],["_lock",0]];
if (count _coords == 2) then {_coords pushBack 0};
private _vehs = [];
{
@ -21,11 +21,9 @@ private _vehs = [];
_pos = _coords vectorAdd _vehOffset;
_veh = [_vehType, _pos] call blck_fnc_spawnVehicle;
_veh setDir _dir;
[_veh] call blck_fnc_emptyObject;
_veh setVehicleLock "UNLOCKED";
{
_veh removeAllEventHandlers _x;
}forEach ["getin","getout"];
//[_veh] call blck_fnc_emptyObject;
//_veh setVehicleLock "UNLOCKED";
_veh lock _lock;
if (_loadCrateTiming isEqualTo "atMissionSpawn") then
{
//diag_log format["blck_fnc_spawnMissionLootVehicles::-> loading loot at mission spawn for veh %1",_x];

View File

@ -51,28 +51,25 @@ if (_missionPatrolVehicles isEqualTo []) then
_spawnPos = _x select 1;
};
_vehicle = _x select 0;
//private _crewCount = [skillAI] call GMS_fnc_selectVehicleCrewCount;
// params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
_vehGroup = [_spawnPos,_coords,_crewCount,_crewCount,_skillAI,1,2,false,_uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
if (isNull _vehGroup) exitWith
_vehGroup = [] call blck_fnc_createGroup;
_vehGroup setVariable["soldierType","vehicle"];
if !(isNull _vehGroup) then
{
_abort = true;
};
[_vehGroup,_spawnPos,_coords,_crewCount,_crewCount,_skillAI,1,2,false,_uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
blck_monitoredMissionAIGroups pushBack _vehGroup;
//params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",40],["_maxDis",60],["_group",grpNull],["_setWaypoints",true],["_crewCount",4]];
_patrolVehicle = [_coords,_spawnPos,_vehicle,40,60,_vehGroup,true,_crewCount] call blck_fnc_spawnVehiclePatrol;
blck_monitoredMissionAIGroups pushBack _vehGroup;
//params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",40],["_maxDis",60],["_group",grpNull],["_setWaypoints",true],["_crewCount",4]];
_patrolVehicle = [_coords,_spawnPos,_vehicle,40,60,_vehGroup,true,_crewCount] call blck_fnc_spawnVehiclePatrol; //
if !(isNull _patrolVehicle) then
{
_patrolVehicle setVariable["vehicleGroup",_vehGroup];
_vehicles pushback _patrolVehicle;
blck_monitoredVehicles pushBack _patrolVehicle;
_missionAI append (units _vehGroup);
if !(isNull _patrolVehicle) then
{
_patrolVehicle setVariable["vehicleGroup",_vehGroup];
_vehicles pushback _patrolVehicle;
//blck_monitoredVehicles pushBack _patrolVehicle;
_missionAI append (units _vehGroup);
};
};
} forEach _missionPatrolVehicles;
blck_monitoredVehicles append _vehicles;
_return = [_vehicles, _missionAI, _abort];
_return

View File

@ -56,7 +56,7 @@ if (count _readyToSpawnQue > 0) then
{
if (blck_debugLevel > 2) then
{
if (_foreachindex > 0) then {diag_log format["_fnc_spawnPendingMissions: _missionToSpawn %1 = %2",_foreachindex, _missionToSpawn select _foreachindex]};
//if (_foreachindex > 0) then {diag_log format["_fnc_spawnPendingMissions: _missionToSpawn %1 = %2",_foreachindex, _missionToSpawn select _foreachindex]};
};
}forEach _missionToSpawn;
#endif

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/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
// ["B_SDV_01_F",[22584.9,15304.8,-6.14801],"red",4, 75,0],
params["_SDV","_pos","_difficulty","_numAI","_patrolRadius","_respawnTime"];
//diag_log format["_fnc_spawnSDVPatrol: _this = %1",_this];
private["_vehicle","_group","_diveDepth"];
_group = [] call blck_fnc_createGroup;
if !(isNull _group) then
{
[_group,_pos,_numAI,_numAI,_difficulty,_pos,_patrolRadius - 2,_patrolRadius,blck_UMS_uniforms,blck_UMS_headgear,true,blck_UMS_weapons,blck_UMS_vests,true] call blck_fnc_spawnGroup;
_vehicle = [[_pos select 0, _pos select 1,0],[_pos select 0, _pos select 1,0],_vehType,_patrolRadius - 2,_patrolRadius,_group] call blck_fnc_spawnVehiclePatrol;
_diveDepth = 0.5 * [_pos] call blck_fnc_findWaterDepth;
(driver _vehicle) swiminDepth (_diveDepth select 2);
};
_group

View File

@ -0,0 +1,30 @@
/*
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 configureWaypoints true
#define isScubaGroup true
// [_pos,_difficulty,_units,_patrolRadius]
params["_pos",["_skillLevel","red"],["_numUnits",6],["_patrolRadius",15]];
//diag_log format["_fnc_spawnScubaGroup: _this = %1",_this];
private["_group","_diveDepth"];
_group = [] call blck_fnc_createGroup;
if !(isNull _group) then
{
//params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ];
[_group,_pos,_pos,_numUnits,_numUnits,_skillLevel, _patrolRadius - 2, _patrolRadius, configureWaypoints, blck_UMS_uniforms, blck_UMS_headgear, blck_UMS_vests, [], blck_UMS_weapons, [], isScubaGroup] call blck_fnc_spawnGroup;
//diag_log format["_fnc_spawnScubaGroup (14): -> value returned for group = %1",_group];
//private _waterDepth = [_pos] call blck_fnc_findWaterDepth;
_diveDepth = [_pos] call blck_fnc_findWaterDepth * 0.5;
{
_x swimInDepth (_diveDepth);
} forEach units _group;
};
_group;

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";
// ["B_SDV_01_F",[22584.9,15304.8,-6.14801],"red",4, 75,0],
params["_SDV","_pos","_difficulty","_numAI","_patrolRadius","_respawnTime"];
//diag_log format["_fnc_spawnSurfacePatrol: _this = %1",_this];
private _group = [] call blck_fnc_createGroup;
private _vehicle = objNull;
if !(isNull _group) then
{
[_group,_pos,_numAI,_numAI,_difficulty,_pos,_patrolRadius - 2,_patrolRadius,blck_UMS_uniforms,blck_UMS_headgear,true,blck_UMS_weapons,blck_UMS_vests,true] call blck_fnc_spawnGroup;
// params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]];
_vehicle = [_pos,_pos,_vehType,_minDis,_maxDis,_group] call blck_fnc_spawnVehiclePatrol;
};
_vehicle

View File

@ -1,17 +1,15 @@
// TODO: Delete?
/*
by Ghostrider
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/
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
_this call blck_fnc_nextAnim;
params["_vehicle"];
blck_sm_submarines pushBack [_vehicle,grpNull,0];
true

View File

@ -0,0 +1,16 @@
/*
by Ghostrider [GRG]
Copyright 20167
--------------------------
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_scubaGroups pushBack [_group,grpNull,0];
//diag_log format["_sm_AddScubaGroup:: blck_sm_scubaGroups = %1",blck_sm_scubaGroups];
true

View File

@ -1,18 +1,15 @@
// Probably not used -
// TODO: delete ?
/*
by Ghostrider
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/
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
(_this select 0) switchMove selectRandom (_unit getVariable["GMSAnimations",[]]);
params["_vehicle"];
blck_sm_surfaceShips pushBack [_vehicle,grpNull,0];
true

View File

@ -8,6 +8,6 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//diag_log format["_EH_AIHit: _this = %1",_this];
_this remoteExec["blck_fnc_processAIHit",2];
if (isServer) then {_this remoteExec["blck_fnc_processAIHit",2]};

View File

@ -11,4 +11,4 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
_this remoteExec ["blck_fnc_processAIKill",2];
if (isServer) then {_this remoteExec ["blck_fnc_processAIKill",2]};

View File

@ -17,6 +17,8 @@ if (isNull _unit) exitWith {};
//diag_log format["_fnc_alertGroupUnits: _unit = %1 | _target = %2",_unit,_target];
{
_x reveal [_target,(_x knowsAbout _target) + (_unit getVariable ["intelligence",1])];
_x doSuppressiveFire _target;
}forEach (units (group _unit));
//leader(group _target) doSuppressiveFire _target;

View File

@ -27,4 +27,4 @@ for "_i" from 1 to (count blck_liveMissionAI) do {
blck_liveMissionAI pushback _units;
};
};
};
};

View File

@ -52,7 +52,10 @@ if ((damage _unit) > 0.2 ) then
{
//diag_log format["_EH_AIHit::-->> Healing unit %1",_unit];
_unit setVariable["hasHealed",true,true];
"SmokeShellRed" createVehicle (position _unit);
if (blck_useSmokeWhenHealing) then
{
"SmokeShellRed" createVehicle (position _unit getPos[1,random(359)]);
};
_unit addItem "FAK";
_unit action ["HealSoldierSelf", _unit];
_unit setDamage 0;

View File

@ -17,6 +17,10 @@ params["_unit","_killer","_instigator"];
//diag_log format["_fnc_processAIKill: _unit = %1 | _killer = %2",_unit,_killer];
if (_unit getVariable["blck_cleanupAt",-1] > 0) exitWith {}; // this is here so that the script is not accidently run more than once for each MPKilled occurrence.
_unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer];
_unit disableAI "ALL";
{
_unit removeAllMPEventHandlers _x;
}forEach["MPHit","MPKilled"];
blck_deadAI pushback _unit;
if (count(units (group _unit)) isEqualTo 0) then
{
@ -25,18 +29,8 @@ if (count(units (group _unit)) isEqualTo 0) then
[_unit] joinSilent grpNull;
if !(_unit isKindOf "Man") then
{
//diag_log format["_fnc_processAIKill: unit linked to crew of vehicle %1 | typeOf (vehicle _unit = %2)",vehicle _unit,typeOf (vehicle _unit)];
diag_log format["_fnc_processAIKill: unit linked to crew of vehicle %1 | typeOf (vehicle _unit = %2)",vehicle _unit,typeOf (vehicle _unit)];
[_unit, ["Eject", vehicle _unit]] remoteExec ["action",(owner _unit)];
//[vehicle _unit,_unit] call blck_fnc_checkForEmptyVehicle;
/*
} else {
if !(_unit getVariable["GRG_vehicle","none"] isEqualTo "none") then
{
diag_log format["_fnc_processAIKill: unit linked to crew of vehicle %1",vehicle _unit];
[_unit, ["Eject", vehicle _unit]] remoteExec ["action",(owner _unit)];
[vehicle _unit,_unit] call blck_fnc_checkForEmptyVehicle;
};
*/
};
if (blck_launcherCleanup) then {[_unit] call blck_fnc_removeLaunchers};
@ -58,4 +52,4 @@ if (blck_showCountAliveAI) then
if ([_unit,_killer] call blck_fnc_processIlleagalAIKills) then {
[_unit,_killer] call GMS_fnc_handlePlayerUpdates;
};
};

View File

@ -10,4 +10,4 @@
*/
params["_ai"];
{deleteVehicle _x}forEach nearestObjects [(getPosATL _ai), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 3]; //Adapted from the AI cleanup logic by KiloSwiss
[_ai] call blck_fnc_removeGear;
[_ai] call blck_fnc_removeGear;

View File

@ -29,7 +29,7 @@ private _params = ["_pos","_numAI","_skillAI"];
diag_log format["_fnc_spawnParaUnits: %1 = %2",_x, _this select _forEachIndex];
}forEach _params;
#endif
_paraGroup = call blck_fnc_create_AI_Group;
_paraGroup = [] call blck_fnc_createGroup;
//diag_log format["_fnc_spawnParaUnits: _paraGroup = %1",_paraGroup];
// [_pos,_minDist,_maxDist,_groupSpawned,"random","SAD"] spawn blck_fnc_setupWaypoints;
[_pos,20,30,_paraGroup,"random","SAD","paraUnits"] call blck_fnc_setupWaypoints;

View File

@ -46,6 +46,7 @@ if (blck_modType isEqualTo "Epoch") then
case "green":{_unit setVariable["Crypto",6 + floor(random(blck_maxMoneyGreen)),true];};
case "orange":{_unit setVariable["Crypto",8 + floor(random(blck_maxMoneyOrange)),true];};
};
//diag_log format["_fnc_spawnUnit: for unit %1 Crypto set to %2",_unit,_unit getVariable "Crypto"];
};
if (blck_modType isEqualTo "Exile") then
{
@ -57,6 +58,7 @@ if (blck_modType isEqualTo "Exile") then
case "green":{_unit setVariable["ExileMoney",6 + floor(random(blck_maxMoneyGreen)),true];};
case "orange":{_unit setVariable["ExileMoney",8 + floor(random(blck_maxMoneyOrange)),true];};
};
//diag_log format["_fnc_spawnUnit: for unit %1 ExileMoney set to %2",_unit,_unit getVariable "ExileMoney"];
};
// findEmptyPosition [minDistance, maxDistance, vehicleType]
private _tempPos = _pos findEmptyPosition [0.1, 3, typeOf _unit];
@ -82,7 +84,12 @@ if (_scuba) then
_skin = "";
_counter = 1;
//diag_log format["_fnc_spawnUnit: _uniforms = %1",_uniforms];
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnUnit: _uniforms = %1",_uniforms];
};
#endif
while {_skin isEqualTo "" && _counter < 10} do
{
_unit forceAddUniform (selectRandom _uniforms);
@ -93,7 +100,7 @@ while {_skin isEqualTo "" && _counter < 10} do
diag_log format["_fnc_spawnUnit::-->> for unit _unit % uniform is %2",_unit, uniform _unit];
};
#endif
_counter =+1;
_counter = _counter + 1;
};
//Sets AI Tactics
_unit enableAI "ALL";

View File

@ -11,7 +11,6 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if !(isServer) exitWith {};
_this call blck_fnc_HandleAIVehicleHit;
if (isServer) then {_this call blck_fnc_HandleAIVehicleHit};

View File

@ -12,5 +12,4 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if !(isServer) exitWith {};
_this call blck_fnc_processAIVehicleKill;
if (isServer) then {_this call blck_fnc_processAIVehicleKill};

View File

@ -0,0 +1,18 @@
/*
_EH_vehicleGetOut
By Ghostrider [GRG]
Handles the case where a unit gets out of a vehiclet.
--------------------------
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/
*/
//diag_log format["_EH_vehicleGetOut: _this = %1",_this];
_this remoteExec["blck_fnc_handleVehicleGetOut",2];

View File

@ -0,0 +1,20 @@
// NOT USED AT PRESENT
/*
this addEventHandler ["GetOutMan", {
params ["_unit", "_role", "_vehicle", "_turret"];
}];
unit: Object - unit the event handler is assigned to
role: String - Can be either "driver", "gunner" or "cargo"
vehicle: Object - Vehicle that the unit left
turret: Array - turret path
*/
diag_log format["EH_vehicleManGetOut: _this = %1",_this];
params["_unit","_role","_veh"];
[_veh,_unit] remoteExec["blck_fnc_handleAIgetOut",2];

View File

@ -13,4 +13,4 @@
private["_vd"];
params["_vk"];
_vd = damage _vk;
_vk setDamage (_vd + blck_RunGearDamage);
_vk setDamage (_vd + blck_RunGearDamage);

View File

@ -0,0 +1,21 @@
/*
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["_veh"];
//diag_log format["_fnc_checkForEmptyVehicle: _veh = %1 | count (crew _veh) = %2",_veh, count(crew _veh)];
if (crew(_veh) isEqualTo []) then
{
[_veh] call blck_fnc_handleEmptyVehicle;
} else {
if ({alive _x} count (crew _veh) isEqualTo 0) then
{
[_veh] call blck_fnc_handleEmptyVehicle;
};
};

View File

@ -14,31 +14,23 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_veh",["_clearInventory",true]];
params["_veh",["_locked",0]];
private["_unit"];
if (_clearInventory) then
{
[_veh] call blck_fnc_emptyObject;
};
//_veh setVehicleLock "LOCKEDPLAYER";
_veh lock 0;
_veh lock _locked;
_veh addMPEventHandler["MPHit",{ _this call blck_EH_AIVehicle_HandleHit}];
_veh addMPEventHandler["MPKilled",{_this call blck_EH_vehicleKilled}];
_veh addEventHandler["GetOut",{_this remoteExec["blck_EH_vehicleGetOut",2]}];
if (blck_modType isEqualTo "Epoch") then
{
if (blck_allowSalesAtBlackMktTraders) then {_veh setVariable["HSHALFPRICE",1,true]};
};
_veh addEventHandler ["GetIn",{ // Note: only fires when vehicle is local to player
private["_unit","_veh"];
if (_veh getVariable["blck_releasedAt",0] > 0) then {{ _veh removeAllEventHandlers _x} forEach["getin","getout"]};
if !(_veh getVariable["blck_releasedAt",0] > 0) then
if (blck_modType isEqualTo "Exile") then
{
if (blck_allowClaimVehicle) then
{
_unit = _this select 2;
_veh = _this select 0;
if (isPlayer _unit) then
{
_unit action ["eject",_veh];
titleText ["You are not allowed to enter that vehicle at this time","PLAIN DOWN"];
};
_veh setVariable ["ExileIsPersistent", false];
};
}];
};
_veh

View File

@ -20,4 +20,4 @@
diag_log format["_processAIKill: releasing static %1 to players and setting a default delete timer",_veh];
[_veh] call blck_fnc_releaseVehicleToPlayers; //Call this from _processAIKill
_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true];
};
};

View File

@ -0,0 +1,47 @@
/*
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/
*/
//diag_log format["_fnc_handleEmptyVehicle: _this = %1",_this];
params["_veh"];
//diag_log format["_fnc_handleEmptyVehicle: vehicle %1 | count(crew _veh) = %2 | typoeOf _veh = %3 | description _veh = %4",_veh,count(crew _veh),typeOf _veh,gettext(configFile >> 'cfgWeapons' >> typeOf _veh >> 'displayName')];
if ({alive _x} count (crew _veh) == 0 || crew(_veh) isEqualTo []) then
{
diag_log format["_fnc_handleEmptyVehicle: no units alive in vehicle %1",_veh, typeOf _veh,gettext (configFile >> 'cfgWeapons' >> typeOf _veh >> 'displayName')];
if (_veh getVariable["GRG_vehType","none"] isEqualTo "emplaced") then
{
//diag_log format["_fnc_handleEmptyVehicle: emplaced weapon %1 being handled",_veh];
if (blck_killEmptyStaticWeapons) then
{
//diag_log format["_fnc_handleEmptyVehicle: disabling static %1 and setting its delete time",_veh];
_veh setDamage 1;
_veh setVariable["blck_deleteAtTime",diag_tickTime + 60,true];
}else {
//diag_log format["_fnc_handleEmptyVehicle: releasing static %1 to players and setting a default delete timer",_veh];
[_veh] call blck_fnc_releaseVehicleToPlayers; //Call this from _processAIKill
_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true];
};
} else {
if (blck_killEmptyAIVehicles) then
{
//diag_log format["_fnc_handleEmptyVehicle: disabling vehicle %1 and setting a delete time",_veh];
_veh setDamage 0.7;
_veh setFuel 0;
_veh setVariable["blck_deleteAtTime",diag_tickTime + 60];
} else {
diag_log format["_fnc_handleEmptyVehicle: releasing vehicle %1 to players and setting a default delete timer",_veh];
_veh setVariable["blck_deleteAtTime",diag_tickTime + blck_vehicleDeleteTimer,true];
[_veh] call blck_fnc_releaseVehicleToPlayers;
};
};
};

View File

@ -0,0 +1,27 @@
/*
By Ghostrider [GRG]
_fnc_handleVehicleGetOut
Processes an event that fires when a unit gets out of a vehicle
--------------------------
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/
*/
/*
this addEventHandler ["GetOut", {
params ["_vehicle", "_role", "_unit", "_turret"];
}];
vehicle: Object - Vehicle the event handler is assigned to
role: String - Can be either "driver", "gunner" or "cargo"
unit: Object - Unit that left the vehicle
Introduced with Arma 3 version 1.36
turret: Array - turret path
*/
//diag_log format["_fnc_handleAIgetOut: _this = %1",_this];
private _veh = _this select 0;
private _unit = _this select 2;
[_veh] call blck_fnc_checkForEmptyVehicle;

View File

@ -0,0 +1,53 @@
/*
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/
*/
/*
_loadVehicleCrew
Expects the group has units and they are configured
*/
if (isNil "blck_blacklisted_vehicle_weapons") then {blck_blacklisted_vehicle_weapons = []};
params["_veh","_group",["_crewCount",4]];
private _units = units _group;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_loadVehicleCrew: _veh = %1 | _group = %2 | group units = %4 | _crewCount = %3",_veh,_group,_crewCount, units _group];
};
#endif
for "_i" from 1 to _crewCount do
{
if (_units isEqualTo []) exitWith {};
_crew = _units deleteAt 0;
/*
Note that in documentation for the moveinAny command the order seats are filled is:
driver
commander
gunner
other turrets
cargo
https://community.bistudio.com/wiki/moveInAny
*/
_crew moveInAny _veh;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_loadVehicleCrew: loaded unit %1 into vehicle %2",_crew,_veh];
diag_log format["_fnc_loadVehicleCrew: new crew for vehicle %1 = %2",_veh, crew _veh];
};
#endif
};
{deleteVehicle _x} forEach _units;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_loadVehicleCrew: _veh = %1 | crew = %2 | driver = %3",_veh,crew _veh,driver _veh];
};
#endif

View File

@ -10,11 +10,10 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_veh","_instigator","_group","_wp"];
_veh = _this select 0 select 0;
_instigator = _this select 0 select 3;
//params["_veh","_instigator"];
private ["_veh","_killer","_group","_wp"];
//diag_log format["_fnc_processAIVehicleKill: _this = %1",_this];
params["_veh","_killer","_killer"];
//params["_veh","_killer"];
{
_veh removealleventhandlers _x;
@ -23,21 +22,22 @@ _instigator = _this select 0 select 3;
_veh removeAllMPEventHandlers _x;
} forEach ["MPHit","MPKilled"];
diag_log format["_fnc_processAIVehicleKill: _this = %1",_this];
diag_log format["_fnc_processAIVehicleKill:: _units = %1 and _instigator = %2 units damage is %3",_veh,_instigator, damage _veh];
//diag_log format["_fnc_processAIVehicleKill: _this = %1",_this];
//diag_log format["_fnc_processAIVehicleKill:: _veh = %1 and _killer = %2 units damage is %3",_veh,_killer, damage _veh];
if (!(isPlayer _instigator)) exitWith {};
if (!(isPlayer _killer)) exitWith {};
if !(count(crew _veh) isEqualTo 0) then
{
[_crew select 0,_instigator] call blck_fnc_alertGroupUnits;
[_crew select 0,_killer] call blck_fnc_alertGroupUnits;
private _group = group (_crew select 0);
_group setBehaviour "COMBAT";
_wp = [_group, currentWaypoint _group];
_wp setWaypointBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";
};
[_instigator] call blck_fnc_alertNearbyVehicles;
[_killer] call blck_fnc_alertNearbyVehicles;

View File

@ -55,4 +55,4 @@ switch blck_revealMode do {
};
}forEach _nearbyPlayers;
};
};
};

View File

@ -9,11 +9,10 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
// GMS_fnc_vehiclePlayerSensingLogic.sqf
// No params
private["_searchRadius","_detectionOdds"];
{
_searchRadius = _x getVariable["blck_vehicleSearchRadius",800];
_detectionOdds = _x getVariable["blck_vehiclePlayerDetectionOdds",0.5];
[_x,_searchRadius,_detectionOdds] call blck_fnc_revealNearbyPlayers;
}forEach blck_monitoredVehicles;
}forEach blck_monitoredVehicles;

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