Merge pull request #59 from Ghostrider-DbD-/Version-6.72-Build-87

See Changelog
This commit is contained in:
Ghostrider [GRG] 2017-10-24 07:20:37 -04:00 committed by GitHub
commit 340e35623e
345 changed files with 1417 additions and 15440 deletions

View File

@ -1,27 +0,0 @@
//This script sends Message Information to allplayers
// Last modified 1/4/17 by Ghostrider-DBD-
/*
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//blck_Message = _this;
params["_msg",["_players",playableUnits]];
if (blck_debugLevel > 1) then {diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players];};
blck_Message = _msg;
{
//diag_log format["AIM.sqf ===] _ = %2, and (owner _x) = %1", (owner _x), _x];
(owner _x) publicVariableClient "blck_Message";
} forEach _players;
/*
if (_modType isEqualTo "Exile") then
{
[_blck_Message] remoteExec["fn_blck_MessageHandler",0];
};
*/

View File

@ -1,32 +0,0 @@
/*
Check if an HC is connected and if so transfer some AI to it.
By Ghostrider-DbD-
Last modified 11-8-16
/*
By Ghostrider-DbD-
--------------------------
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 _hc = missionNamespace getVariable["HC1","null"];
diag_log format["monitorHC::->> _hc = %1",_hc];
if !( (typeName _hc isEqualTo "OBJECT" || _hc isEqualTo "null") ) exitWith {};
if (typeOf _hc isEqualTo "HeadlessClient_F") then // a valid headless client is connected
{
private _hcOwner = owner _hc;
private _xfered = 0;
{
if (!(isPlayer _x) && (groupOwner _x != _hcOwner) ) then {
_x setGroupOwner (_hcOwner);
_xfered = +1;
diag_log format["monitorHC::-->> group %1 transfered to HC1",_x];
};
if (_xfered isEqualTo 6) exitWith {};
}forEach allGroups;
};

View File

@ -1,93 +0,0 @@
// Changes type of waypont0 for the specified group to "MOVE" and updates time stamps, WP postion and Timout parameters accordinglyD.
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 4/23/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";
#ifdef blck_debugMode
//diag_log "_fnc_changeToMoveWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp","_wpPos","_dis","_arc","_dir","_newPos","_marker","_center","_minDis","_maxDis"];
_group = group _this;
_group setcombatmode "YELLOW";
_group setBehaviour "COMBAT";
_group setVariable["timeStamp",diag_tickTime];
_wp = [_group, 0];
_wpPos = getPos ((units _group) select 0);
_dir = _group getVariable["wpDir",0];
_center = _group getVariable ["patrolCenter",_wpPos];
if (_group getVariable["wpMode","random"] isEqualTo "random") then
{
_dir = random(360);
} else {
_dir = (_group getVariable["wpDir",0]) + 70;
_group setVariable["wpDir",_dir];
};
_minDis = _group getVariable["minDis",25];
_maxDis = _group getVariable["maxDis",30];
_dis = (_minDis) + random( (_maxDis) - (_minDis) );
_newPos = (_center) getPos[_dis,_dir];
_wp setWPPos [_newPos select 0, _newPos select 1];
_wp setWaypointCompletionRadius (_group getVariable["wpRadius",30]);
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "YELLOW";
_wp setWaypointTimeout [1,1.1,1.2];
_group setCurrentWaypoint _wp;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint (4/25/17): _this = %1", _this];
diag_log format["_fnc_changeToMoveWaypoint: typeName _this = %1", typeName _this];
diag_log format["_fnc_changeToMoveWaypoint:_group = %1",_group];
diag_log format["_fnc_changeToMoveWaypoint:_group timestamp updated to %1", _group getVariable "timeStamp"];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> wpMode %1 _dir %2 _dis %3 _center %4",_group getVariable["wpMode","random"], _dir, _dis,_center];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new position is %2",_group, _newPos];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new Waypoint position is %2",_group, getWPPos _wp];
diag_log format["_fnc_changeToMoveWaypoint:_group %1 basic waypoint parameters updates", _group getVariable "timeStamp"];
_marker =_group getVariable["wpMarker",""];
_marker setMarkerColor "ColorBlue";
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif
if (_group getVariable["wpPatrolMode",""] isEqualTo "SAD") then
{
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_changeToMoveWaypoint: seting waypoint script for group %1 to SAD Mode",_group];
};
_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a SAD Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint;"];
#endif
};
if (_group getVariable["wpPatrolMode",""] isEqualTo "SENTRY") then
{
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_changeToMoveWaypoint: seting waypoint script for group %1 to SENTRY Mode",_group];
};
_wp setWaypointStatements ["true","this call blck_fnc_changeToSentryWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a SENTRY Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToSentryWaypoint;"];
#endif
};
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
};
#endif

View File

@ -1,52 +0,0 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 4/29/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";
#ifdef blck_debugMode
diag_log "_fnc_changeToSADWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp"];
_group = group _this;
_group setVariable["timeStamp",diag_tickTime];
_group setcombatmode "RED";
_group setBehaviour "COMBAT";
_wp = [_group, 0];
_group setCurrentWaypoint _wp;
_wp setWaypointType "SAD";
_wp setWaypointName "sad";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,15,20];
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;"];
#endif
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
private ["_marker"];
_marker = _group getVariable["wpMarker",""];
_marker setMarkerColor "ColorRed";
diag_log format["_fnc_changeToSADWaypoint:: -- :: _this = %1 and typName _this %2",_this, typeName _this];
diag_log format["_fnc_changeToSADWaypoint:: -- >> group to update is %1 with typeName %2",_group, typeName _group];
diag_log format["_fnc_changeToSADWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_changeToSADWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif

View File

@ -1,49 +0,0 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 4/29/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";
#ifdef blck_debugMode
diag_log "_fnc_changeToSADWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp"];
_group = group _this;
_group setVariable["timeStamp",diag_tickTime];
_wp = [_group, 0];
_group setCurrentWaypoint _wp;
_group setcombatmode "RED";
_group setBehaviour "COMBAT";
_wp setWaypointType "SENTRY";
_wp setWaypointName "sentry";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,15,20];
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;"];
#endif
#ifdef blck_debugMode
if (blck_debugLevel >1) then
{
diag_log format["_fnc_changeToSentryWaypoint:: -- :: _this = %1 and typName _this %2",_this, typeName _this];
diag_log format["_fnc_changeToSentryWaypoint:: -- >> group to update is %1 with typeName %2",_group, typeName _group];
private ["_marker"];
_marker = _group getVariable["wpMarker",""];
_marker setMarkerColor "ColorYellow";
diag_log format["_fnc_changeToSentryWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_changeToSentryWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif

View File

@ -1,203 +0,0 @@
/*
[] call blck_fnc_waypointMonitor;
Scans all groups in for those that have been stuck in a particular waypoint for an excessive time and checks if they are in combat.
If not it directs them to the next waypoint.
It uses a timestamp attached to the group that is cleared upon waypoint completion.
By Ghostrider-DbD-
Last modified 3/14/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_missionGroupMonitor (4/29:4:09 PM)::-->> running function at diag_tickTime = %1 with blck_fnc_missionGroupMonitor = %2",diag_tickTime,blck_monitoredMissionAIGroups];
#ifdef blck_debugMode
//diag_log format["_fnc_missionGroupMonitor:: blck_debugMode defined"];
#endif
_fn_allPlayers = {
private ["_players"];
_players = [];
{
if (isPlayer _x) then {_players pushback _x};
}forEach playableUnits;
//diag_log format["_fn_allPlayers::-->> result s %1",_players];
_players
};
_fn_aliveGroupUnits = {
private["_grp","_aliveUnits"];
_grp = _this select 0;
_aliveUnits = [];
{
if ( alive _x) then {_aliveUnits pushback _x};
} forEach (units _grp);
_aliveUnits
};
_fn_inCombat = {
private["_grp","_targets","_players","_aliveUnits"];
_grp = _this select 0;
_players = [] call _fn_allPlayers;
_aliveUnits = [_grp] call _fn_aliveGroupUnits;
_inCombat = false;
{
_targets = _x findNearestEnemy (position _x);
if !(isNull _targets) exitWith {_inCombat = true};
} forEach _aliveUnits;
//diag_log format["_fn_inCombat::-->> _grp to test is %1 and result is %2",_grp,_inCombat];
_inCombat;
};
_fn_removeEmptyOrNullGroups = {
//diag_log format["_fn_removeEmptyOrNullGroups::-->> excuting function at %1",diag_tickTime];
// Remove any null groups (which will occur if all units in the group are dead) or groups with no alive AI.
for "_i" from 0 to ((count blck_monitoredMissionAIGroups) - 1) do
{
private["_grp"];
if (_i >= (count blck_monitoredMissionAIGroups)) exitWith {};
_grp = blck_monitoredMissionAIGroups select _i;
if (_grp isEqualTo grpNull) then {
blck_monitoredMissionAIGroups set[_i, -1];
blck_monitoredMissionAIGroups = blck_monitoredMissionAIGroups - [-1];
//diag_log "_fnc_waypointMonitor::-->> deleting a NULL-GROUP";
};
if ({alive _x} count units _grp < 1) then {
blck_monitoredMissionAIGroups = blck_monitoredMissionAIGroups - [_grp];
//diag_log "_fnc_waypointMonitor::-->> deleting an empty group";
};
};
};
_fn_monitorGroupWaypoints = {
{
private["_timeStamp","_index","_unit","_soldierType"];
_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];
if (_soldierType isEqualTo "infantry") then
{
if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
{
_units = [_x] call _fn_aliveGroupUnits;
if (count _units > 0) then
{
private _leader = leader _x;
(_leader) call blck_fnc_changeToMoveWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_missionGroupMonitor: infantry group %1 stuck, waypoint reset",_x];};
#endif
/*
if ( (getPos _leader) distance2d (_group getVariable "patrolCenter") > 200) then
{
};
*/
};
};
};
if (_soldierType isEqualTo "vehicle") then
{
if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
{
_units = [_x] call _fn_aliveGroupUnits;
if (count _units > 0) then
{
private _leader = leader _x;
(_leader) call blck_fnc_changeToMoveWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_missionGroupMonitor: vehicle group %1 stuck, waypoint reset",_x];};
#endif
/*
if ( (getPos _leader) distance2d (_group getVariable "patrolCenter") > 200) then
{
};
*/
};
};
};
if (_soldierType isEqualTo "helicopter") then
{
if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
{
_units = [_x] call _fn_aliveGroupUnits;
if (count _units > 0) then
{
private _leader = leader _x;
(_leader) call blck_fnc_changeToMoveWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_missionGroupMonitor: helicopter group %1 stuck, waypoint reset",_x];};
#endif
/*
if ( (getPos _leader) distance2d (_group getVariable "patrolCenter") > 200) then
{
};
*/
};
};
};
} forEach blck_monitoredMissionAIGroups;
};
_fn_simulationMonitor = {
_modType = call blck_fnc_getModType;
if (_modType isEqualTo "Exile") then
{
_playerType = ["Exile_Unit_Player"];
}else{
_playerType = ["Epoch_Male_F","Epoch_Female_F"];
};
{
// player nearEntities [["Car", "Motorcycle", "Tank"], 50];
_players = (leader _x) nearEntities [_playerType, 1800];
if (count _players > 0) then
{
// Be sure simulation is on for all units in the group
if !(_x getVariable["blck_simulationStatus",false]) then
{
_x setVariable["blck_simulationStatus",true];
{
_x enableSimulationGlobal true;
}forEach (units _x);
};
}else{
// Be sure simulation is off for all units in the group.
if !(_x getVariable["blck_simulationStatus",true]) then
{
_x setVariable["blck_simulationStatus",false];
{
_x enableSimulationGlobal false;
}forEach (units _x);
};
};
} forEach blck_monitoredMissionAIGroups;
};
////////
// Start of main function
////////
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_missionGroupMonitor: executing function at %1",diag_tickTime];};
#endif
[] call _fn_removeEmptyOrNullGroups;
uiSleep 0.1;
[] call _fn_monitorGroupWaypoints;
#ifndef useDynamicSimulation
[] call _fn_simulationMonitor;
#endif

View File

@ -1,94 +0,0 @@
// Sets up waypoints for a specified group.
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 6/1/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";
#ifdef blck_debugMode
diag_log "_fnc_setupWaypoints: blck_debugMode enabled";
#endif
private["_dir","_arc","_noWp","_newpos","_wpradius","_wp"];
params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_wpPatrolMode","SAD"],["_soldierType","null"] ];
_wp = [_group, 0];
#ifdef blck_debugMode
diag_log format["_fnc_setupWaypoints (4/29/17): configuring waypoints for group %1: _mode = %2 | _wpPatrolMode = %3 _soldierType = %4",_group, _mode, _wpPatrolMode,_soldierType];
#endif
if (_soldierType isEqualTo "emplaced") then
{
_wp setWaypointType "SENTRY";
_wp setWPPos (getPos leader _group);
_wp setWaypointCompletionRadius 100;
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [1,1.1,1.2];
//_wp setWaypointTimeout [0.1,0.1100,0.1200];
_group setCurrentWaypoint _wp;
_group setVariable["soldierType",_soldierType];
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_emplacedWeaponWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to an emplaced weapon Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_emplacedWeaponWaypoint;"];
#endif
if (blck_debugLevel > 1) then {diag_log format["_fnc_setupWaypoints: configuring weapoints for group %2 for emplaced weapon with _soldierType = %1",_soldierType,_group];};
};
if !(_soldierType isEqualTo "emplaced") then
{
_arc = 360/5;
_group setcombatmode "YELLOW";
_group setBehaviour "COMBAT";
_group setVariable["patrolCenter",_pos];
_group setVariable["minDis",_minDis];
_group setVariable["maxDis",_maxDis];
_group setVariable["timeStamp",diag_tickTime];
_group setVariable["wpRadius",30];
_group setVariable["wpMode",_mode];
_group setVariable["wpPatrolMode",_wpPatrolMode];
_group setVariable["wpDir",0];
_group setVariable["wpArc",_arc];
_group setVariable["soldierType",_soldierType];
_dir = 0;
_wpradius = 30;
_dis = (_minDis) + random( (_maxDis) - (_minDis) );
_newPos = _pos getPos[_dis,_dir];
_wp setWPPos [_newPos select 0, _newPos select 1];
_wp setWaypointCompletionRadius (_group getVariable["wpRadius",30]);
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [1,1.1,1.2];
_group setCurrentWaypoint _wp;
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;"];
#endif
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
_marker = createMarker [format["GroupMarker%1",_group],_newPos];
_group setVariable["wpMarker",_marker];
_marker setMarkerColor "ColorBlue";
_marker setMarkerText format["%1 %2",(_group getVariable["soldierType","null"]),_group];
_marker setMarkerType "mil_triangle";
//diag_log format["_fnc_setupWaypoints: configuring weapoints for group %2 mobile patrol with _soldierType = %1",_solderType,_group];
diag_log format["_fnc_setupWaypoints: soldier type for mobile _group %1 set to %2",_group, (_group getVariable["soldierType","null"])];
diag_log format["_fnc_setupWaypoints: all variables for the group have been set for group %1",_group];
diag_log format["_fnc_setupWaypoints:: -- >> wpMode %1 _dir %2 _dis 3",_group getVariable["wpMode","random"], _dir, _dis];
diag_log format["_fnc_setupWaypoints:: -- >> group to update is %1 and new position is %2",_group, _newPos];
diag_log format["_fnc_setupWaypoints:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_setupWaypoints:: -- >> Waypoint marker for group %1 have been configured as %2 with text set to %3",_group, _group getVariable "wpMarker", markerText (_group getVariable "wpMarker")];
};
#endif
};

View File

@ -1,101 +0,0 @@
/*
[_mines,_objects,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission] call blck_fnc_endMission;
schedules deletion of all remaining alive AI and mission objects.
Updates the mission que.
Updates mission markers.
By Ghostrider-DbD-
3/17/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["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_aborted",false],["_vehicles",[]]];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log format["_fnc_endMission: _blck_localMissionMarker %1 | _coords %2 | _mission %3 | _aborted %4",_blck_localMissionMarker,_coords,_mission,_aborted];
diag_log format["_fnc_endMission: _aborted = %1",_aborted];
};
#endif
private["_cleanupAliveAITimer","_cleanupCompositionTimer"];
if (blck_useSignalEnd && !_aborted) then
{
//diag_log format["**** Minor\SM1.sqf:: _crate = %1",_crates select 0];
[_crates select 0] spawn blck_fnc_signalEnd;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] _fnc_endMission:: (18) SignalEnd called: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
if (_aborted) then
{
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log format["_fnc_endMission: Mission Aborted, setting all timers to 0"];
};
#endif
_cleanupCompositionTimer = 0;
_cleanupAliveAITimer = 0;
} else {
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log format["_fnc_endMission: Mission Completed without errors, setting all timers to default values"];
};
#endif
_cleanupCompositionTimer = blck_cleanupCompositionTimer;
_cleanupAliveAITimer = blck_AliveAICleanUpTimer;
[["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;
[_blck_localMissionMarker select 1, _markerClass] execVM "debug\missionCompleteMarker.sqf";
};
// Using a variable attached to the crate rather than the global setting to be sure we do not fill a crate twice.
// the "lootLoaded" loaded should be set to true by the crate filler script so we can use that for our check.
{
//diag_log format["_fnc_endMission: for crate %1 lootLoaded = %2",_x,_x getVariable["lootLoaded",false]];
if !(_x getVariable["lootLoaded",false]) then
{
// _crateLoot,_lootCounts are defined above and carry the loot table to be used and the number of items of each category to load
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
{
private ["_v","_posnVeh"];
_posnVeh = blck_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count blck_monitoredVehicles -1)
if (_posnVeh >= 0) then
{
//diag_log format["_fnc_endMission: setting missionCompleted for vehicle %1 to %2",_x,diag_tickTime];
(blck_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime];
} else {
_x setVariable ["missionCompleted", diag_tickTime];
blck_monitoredVehicles pushback _x;
};
} forEach _vehicles;
[_mines] spawn blck_fnc_clearMines;
//diag_log format["_fnc_endMission: (23) _objects = %1",_objects];
[_objects, _cleanupCompositionTimer] spawn blck_fnc_addObjToQue;
//diag_log format["_fnc_endMission:: (26) _blck_AllMissionAI = %1",_blck_AllMissionAI];
[_blck_AllMissionAI, (_cleanupAliveAITimer)] spawn blck_fnc_addLiveAItoQue;
[_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf";
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
blck_recentMissionCoords pushback [_coords,diag_tickTime];
//diag_log format["_fnc_endMission:: (34) _mission = %1",_mission];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
blck_missionsRunning = blck_missionsRunning - 1;
_aborted

View File

@ -1,446 +0,0 @@
/*
Generic Mission Spawner
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 4/11/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";
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"];
params["_coords","_mission",["_allowReinforcements",true]];
diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements];
////////
// set all variables needed for the missions
// data is pulled either from the mission description or from the _mission variable passsed as a parameter
// Deal with situations where some of these variables might not be defined as well.
////////
// _mission params[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange];
_markerClass = _mission select 2;
_aiDifficultyLevel = _mission select 3;
if (blck_debugLevel > 0) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];};
[_mission,"active",_coords] call blck_fnc_updateMissionQue;
blck_ActiveMissionCoords pushback _coords;
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming"];
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
//if (isNil "_timeOut") then {_timeOut = -1;};
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"];
if (isNil "_useMines") then {_useMines = blck_useMines;};
_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
{
//diag_log "labeling map markers *****";
_blck_localMissionMarker set [2, _markerMissionName];
};
if !(blck_preciseMapMarkers) then
{
//diag_log "Map marker will be OFFSET from the mission position";
_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?
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";};
[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;
[_blck_localMissionMarker] execVM "debug\spawnMarker.sqf";
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (94) waiting for player to trigger the mission";};
#endif
////////
// All parameters are defined, lets wait until a player is nearby or the mission has timed out
////////
private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"];
_missionStartTime = diag_tickTime;
_playerInRange = false;
_missionTimedOut = false;
_wait = true;
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (105) starting mission trigger loop"};
while {_wait} do
{
#ifdef blck_debugMode
//diag_log "missionSpawner:: top of mission trigger loop";
if (blck_debugLevel > 2) exitWith {_playerInRange = true;};
#endif
if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;};
if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
uiSleep 5;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords];
diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers];
diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut];
};
#endif
};
if (_missionTimedOut) exitWith
{
/*
*/
// Deal with the case in which the mission timed out.
//["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers;
blck_recentMissionCoords pushback [_coords,diag_tickTime];
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
blck_missionsRunning = blck_missionsRunning - 1;
[_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf";
//_blck_localMissionMarker set [1,[0,0,0]];
//_blck_localMissionMarker set [2,""];
[_objects, 0.1] spawn blck_fnc_cleanupObjects;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (105) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
////////
// Spawn the mission objects, loot chest, and AI
////////
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (112) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
//uisleep 2;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (136) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
private ["_temp"];
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 = [];
if (_missionLandscapeMode isEqualTo "random") then
{
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
} else {
_temp = [_coords, floor(random(360)),_missionLandscape,true] call blck_fnc_spawnCompositionObjects;
//uiSleep 1;
};
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (170) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
uiSleep _delayTime;;
_temp = [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
//uisleep 1;
_crates append _temp;
uiSleep _delayTime;
_abort = false;
_temp = [[],[],false];
_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//[_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (185) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1;
};
_abort = _temp select 1;
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (190) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
};
#endif
if (_abort) exitWith
{
if (blck_debugLevel > 1) then {
diag_log "missionSpawner:: (194) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] 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] missionSpawner:: (202) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
_temp = [[],[],false];
_abort = false;
private["_patrolVehicles"];
if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then
{
_temp = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
//[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {
diag_log format["missionSpawner :: (216) 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] missionSpawner:: (272) 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 "missionSpawner:: (222) grpNull returned, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
uiSleep _delayTime;
_temp = [[],[],false];
_abort = false;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (234) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];};
#endif
if (blck_useStatic && (_noEmplacedWeapons > 0)) then
{
// params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
_temp = [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (232) 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 ["missionSpawner:: (241) _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] missionSpawner:: (253) 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 "missionSpawner:: (261) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission;
};
if (_allowReinforcements) then
{
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
_temp = [];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["[blckeagls] missionSpawner:: (268) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
private _noChoppers = 3;
switch (toLower _aiDifficultyLevel) do
{
case "blue":{_noChoppers = blck_noPatrolHelisBlue};
case "red":{_noChoppers = blck_noPatrolHelisRed};
case "green":{_noChoppers = blck_noPatrolHelisGreen};
case "orange":{_noChoppers = blck_noPatrolHelisOrange};
};
for "_i" from 1 to (_noChoppers) do
{
//params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"];
_temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear] call blck_fnc_spawnMissionReinforcements;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["missionSpawner:: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers];
diag_log format["missionSpawner:: _temp = %1",_temp];
};
#endif
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
_objects pushback (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
if (_abort) then
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission;
};
};
};
// Trigger for mission end
//diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition];
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"];
_missionComplete = -1;
_startTime = diag_tickTime;
switch (_endCondition) do
{
case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;};
case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;};
case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;};
};
//diag_log format["missionSpawner :: (269) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
private["_locations"];
_locations = [_coords];
{
_locations pushback (getPos _x);
} forEach _crates;
//diag_log format["missionSpawner:: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations];
//diag_log format["missionSpawner:: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled];
while {_missionComplete isEqualTo -1} do
{
//if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 300};
if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {};
if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1 /*[_blck_AllMissionAI] call blck_fnc_missionAIareDead*/ ) exitWith {};
//diag_log format["missionSpawner:: (283) missionCompleteLoop - > players near = %1 and ai alive = %2",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI];
uiSleep 4;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (414) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["missionSpawner :: (415) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
};
#endif
//diag_log format["[blckeagls] missionSpawner:: (418) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
private["_result"];
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false,_patrolVehicles] call blck_fnc_endMission;
//diag_log format["[blckeagls] missionSpawner:: (420)end of mission: blck_fnc_endMission returned value of %1","pending"];

View File

@ -1,470 +0,0 @@
/*
Generic Mission Spawner
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 8/13/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";
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"];
params["_coords","_mission",["_allowReinforcements",true]];
diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements];
////////
// set all variables needed for the missions
// data is pulled either from the mission description or from the _mission variable passsed as a parameter
// Deal with situations where some of these variables might not be defined as well.
////////
// _mission params[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange];
_markerClass = _mission select 2;
_aiDifficultyLevel = _mission select 3;
if (blck_debugLevel > 0) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];};
[_mission,"active",_coords] call blck_fnc_updateMissionQue;
blck_ActiveMissionCoords pushback _coords;
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming"];
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
//if (isNil "_timeOut") then {_timeOut = -1;};
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"];
if (isNil "_useMines") then {_useMines = blck_useMines;};
_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
{
//diag_log "labeling map markers *****";
_blck_localMissionMarker set [2, _markerMissionName];
};
if !(blck_preciseMapMarkers) then
{
//diag_log "Map marker will be OFFSET from the mission position";
_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?
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";};
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
//[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;
[_blck_localMissionMarker] execVM "debug\spawnMarker.sqf";
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (94) waiting for player to trigger the mission";};
#endif
////////
// All parameters are defined, lets wait until a player is nearby or the mission has timed out
////////
private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"];
_missionStartTime = diag_tickTime;
_playerInRange = false;
_missionTimedOut = false;
_wait = true;
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (105) starting mission trigger loop"};
while {_wait} do
{
#ifdef blck_debugMode
//diag_log "missionSpawner:: top of mission trigger loop";
if (blck_debugLevel > 2) exitWith {_playerInRange = true;};
#endif
if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;};
if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
uiSleep 5;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords];
diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers];
diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut];
};
#endif
};
if (_missionTimedOut) exitWith
{
/*
*/
// Deal with the case in which the mission timed out.
//["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers;
blck_recentMissionCoords pushback [_coords,diag_tickTime];
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
blck_missionsRunning = blck_missionsRunning - 1;
[_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf";
//_blck_localMissionMarker set [1,[0,0,0]];
//_blck_localMissionMarker set [2,""];
[_objects, 0.1] spawn blck_fnc_cleanupObjects;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (105) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
////////
// Spawn the mission objects, loot chest, and AI
////////
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (112) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
//uisleep 2;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (136) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
private ["_temp"];
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 = [];
if (_missionLandscapeMode isEqualTo "random") then
{
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
} else {
_temp = [_coords, floor(random(360)),_missionLandscape,true] call blck_fnc_spawnCompositionObjects;
//uiSleep 1;
};
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (170) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
uiSleep _delayTime;;
_temp = [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
//uisleep 1;
_crates append _temp;
uiSleep _delayTime;
_abort = false;
_temp = [[],[],false];
_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//[_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (185) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1;
};
_abort = _temp select 1;
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (190) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
};
#endif
if (_abort) exitWith
{
if (blck_debugLevel > 1) then {
diag_log "missionSpawner:: (194) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] 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] missionSpawner:: (202) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
uiSleep 3;
_temp = [[],[],false];
_abort = false;
private["_patrolVehicles","_vehToSpawn"];
_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn];
if (blck_useVehiclePatrols && (_vehToSpawn > 0)) then
{
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
//[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {
diag_log format["missionSpawner :: (216) 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] missionSpawner:: (272) 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 "missionSpawner:: (222) grpNull returned, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
uiSleep _delayTime;
_temp = [[],[],false];
_abort = false;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (234) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];};
#endif
uiSleep 3;
private["_noEmplacedToSpawn"];
_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
diag_log format["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn];
if (blck_useStatic && (_noEmplacedToSpawn > 0)) then
{
// params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
_temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (232) 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 ["missionSpawner:: (241) _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] missionSpawner:: (253) 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 "missionSpawner:: (261) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission;
};
uiSleep 3;
if (_allowReinforcements) then
{
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
_temp = [];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["[blckeagls] missionSpawner:: (268) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
private _noChoppers = 0;
private _chancePara = 0.5;
switch (toLower _aiDifficultyLevel) do
{
case "blue":{
_noChoppers = [blck_noPatrolHelisBlue] call blck_fnc_getNumberFromRange;
_chancePara = [blck_chanceParaBlue] call blck_fnc_getNumberFromRange;
};
case "red":{
_noChoppers = [blck_noPatrolHelisRed] call blck_fnc_getNumberFromRange;
_chancePara = [blck_chanceParaRed] call blck_fnc_getNumberFromRange;
};
case "green":{
_noChoppers = [blck_noPatrolHelisGreen] call blck_fnc_getNumberFromRange;
_chancePara = [blck_chanceParaGreen] call blck_fnc_getNumberFromRange;
};
case "orange":{
_noChoppers = [blck_noPatrolHelisOrange] call blck_fnc_getNumberFromRange;
_chancePara = [blck_chanceParaOrange] call blck_fnc_getNumberFromRange;
};
};
diag_log format["_missionSpawner:: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara];
for "_i" from 1 to (_noChoppers) do
{
//params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"];
_temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear,_chancePara] call blck_fnc_spawnMissionReinforcements;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["missionSpawner:: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers];
diag_log format["missionSpawner:: _temp = %1",_temp];
};
#endif
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
_objects pushback (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
if (_abort) then
{
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission;
};
};
};
// Trigger for mission end
//diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition];
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"];
_missionComplete = -1;
_startTime = diag_tickTime;
switch (_endCondition) do
{
case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;};
case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;};
case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;};
};
//diag_log format["missionSpawner :: (269) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
private["_locations"];
_locations = [_coords];
{
_locations pushback (getPos _x);
} forEach _crates;
//diag_log format["missionSpawner:: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations];
//diag_log format["missionSpawner:: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled];
while {_missionComplete isEqualTo -1} do
{
//if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180};
if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {};
if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1 /*[_blck_AllMissionAI] call blck_fnc_missionAIareDead*/ ) exitWith {};
//diag_log format["missionSpawner:: (283) missionCompleteLoop - > players near = %1 and ai alive = %2",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI];
uiSleep 4;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (414) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["missionSpawner :: (415) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
};
#endif
//diag_log format["[blckeagls] missionSpawner:: (418) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
private["_result"];
// Force passing the mission name for informational purposes.
_blck_localMissionMarker set [2, _markerMissionName];
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false,_patrolVehicles] call blck_fnc_endMission;
//diag_log format["[blckeagls] missionSpawner:: (420)end of mission: blck_fnc_endMission returned value of %1","pending"];

View File

@ -1,36 +0,0 @@
/*
Spawn objects from an array using offsects from a central location.
The code provided by M3Editor EDEN has been addapted to add checks for vehicles, should they be present.
Returns an array of spawned objects.
version of 1/13/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["_center","_azi","_objects","_setVector"];
private ["_newObjs"];
_newObjs = [];
{
//diag_log format["_fnc_spawnBaseObjects::-->> _x = %1",_x];
private _obj = (_x select 0) createVehicle [0,0,0];
_newObjs pushback _obj;
_obj setDir ( (_x select 2) + _azi);
_obj setPosATL (_center vectorAdd (_x select 1));
_obj enableSimulationGlobal true;
_obj allowDamage true;
// Lock any vehicles placed as part of the mission landscape. Note that vehicles that can be taken by players can be added via the mission template.
if ( (typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Sea") then
{
[_obj] call blck_fnc_configureMissionVehicle;
};
} forEach _objects;
_newObjs

View File

@ -1,32 +0,0 @@
/*
spawn a crate at a specific location and protect it against cleanup by Epoch
returns the object (crate) that was created.
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last updated 9-4-16
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_crate","_px","_py","_defaultCrate"];
_defaultCrate = "Box_NATO_Wps_F";
params["_coords",["_crateType",_defaultCrate]];
_px = _coords select 0;
_py = _coords select 1;
_crate = objNull;
_crate = createVehicle [_crateType,_coords,[], 0, "CAN_COLLIDE"];
_crate setVariable ["LAST_CHECK", 100000];
_crate setPosATL [_px, _py, 0.5];
_crate allowDamage false;
_crate enableRopeAttach true;
[_crate] call blck_fnc_emptyObject;
_crate;

View File

@ -1,72 +0,0 @@
// GMS_fnc_time.sqf
// by Ghostrider-DBD_
// Last Updated 12/21/16
// Creds to AWOL, A3W, LouD and Creampie for insights.
//if (!isServer) exitWith {};
/*
blck_timeAcceleration = true; // When true, time acceleration will be periodically updated based on amount of daylight at that time according to the values below
// which can be set using the corresponding variables in the config file for that mod.
blck_timeAccelerationDay = 1; // Daytime time accelearation
blck_timeAccelerationDusk = 3; // Dawn/dusk time accelearation
blck_timeAccelerationNight = 6; // Nighttim time acceleration
--------------------------
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 ["_arr","_sunrise","_sunset","_time"];
_arr = date call BIS_fnc_sunriseSunsetTime;
_sunrise = _arr select 0;
_sunset = _arr select 1;
_time = dayTime;
// blck_debugMode3
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log "fnc_Time:: Debug settings ON";
diag_log format["_fnc_Time:: -- > _sunrise = %1 | _sunset = %2 | _time = %3",_sunrise,_sunset,_time];
};
#endif
// Night
if (_time > (_sunset + 0.5) || _time < (_sunrise - 0.5)) exitWith {
setTimeMultiplier blck_timeAccelerationNight;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["NIGHT TIMGE ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
};
#endif
};
// Day
if (_time > (_sunrise + 0.5) && _time < (_sunset - 0.5)) exitWith {
setTimeMultiplier blck_timeAccelerationDay;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["DAYTIME ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
};
#endif
};
// default
setTimeMultiplier blck_timeAccelerationDusk;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["DUSK ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
};
#endif

View File

@ -1,51 +0,0 @@
/*
By Ghostrider-DbD-
Last Modified 7-27-17
Handles the case where a unit is hit.
--------------------------
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 ["_unit","_instigator","_group","_wp"];
//diag_log format["_EH_AIHit::-->> _this = %1",_this];
_unit = _this select 0 select 0;
_instigator = _this select 0 select 3;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["EH_AIHit:: _units = %1 and _instigator = %2 units damage is %3",_unit,_instigator, damage _unit];
};
#endif
if (!(alive _unit)) exitWith {};
if (!(isPlayer _instigator)) exitWith {};
[_unit,_instigator] call blck_fnc_alertGroupUnits;
[_instigator] call blck_fnc_alertNearbyVehicles;
_group = group _unit;
//_group setBehavior "COMBAT";
_wp = [_group, currentWaypoint _group];
_wp setWaypointBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";
if (_unit getVariable ["hasHealed",false]) exitWith {};
if ((damage _unit) > 0.1 ) then
{
//diag_log format["_EH_AIHit::-->> Healing unit %1",_unit];
_unit setVariable["hasHealed",true,true];
_unit addMagazine "SmokeShellOrange";
_unit fire "SmokeShellMuzzle";
_unit addItem "FAK";
_unit action ["HealSoldierSelf", _unit];
_unit setDamage 0;
_unit removeItem "FAK";
};

View File

@ -1,24 +0,0 @@
/*
by Ghostrider
7-27-17
Alerts the leader of a group of the location of an enemy.
--------------------------
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["_knowsAbout","_intelligence","_group"];
params["_unit","_target"];
_intelligence = _unit getVariable ["intelligence",1];
_group = group _unit;
{
_knowsAbout = _x knowsAbout _target;
_x reveal [_target,_knowsAbout + _intelligence];
}forEach units _group;

View File

@ -1,38 +0,0 @@
/*
by Ghostrider
4-5-17
Alerts the units of nearby vehicles of the location of an enemy.
--------------------------
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["_target"];
_fn_alertGroupUnits = {
params["_group","_target"];
private["_intelligence","_knowsAbout"];
_intelligence = (leader _group) getVariable ["intelligence",1];
{
_knowsAbout = _x knowsAbout _target;
_x reveal [_target,_knowsAbout + _intelligence];
}forEach (units _group);
};
_fn_allertNearbyVehicleGroups = {
params["_vehicles","_target"];
private["_vehGroup"];
{
_vehGroup = _x getVariable["vehicleGroup",grpNull];
if (_target distance2D (leader _vehGroup) < 1000) then {[_vehGroup,_target] call _fn_alertGroupUnits;};
}forEach _vehicles;
};
[blck_monitoredVehicles,_target] call _fn_allertNearbyVehicleGroups;

View File

@ -1,74 +0,0 @@
/*
Handle AI Deaths
Last Modified 7/27/17
By Ghostrider-DBD-
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_group","_isLegal","_weapon","_lastkill","_kills","_message","_killstreakMsg"];
params["_unit","_killer","_isLegal"];
_unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer, true];
blck_deadAI pushback _unit;
_group = group _unit;
[_unit] joinSilent grpNull;
if (count(units _group) < 1) then {
#ifdef useDynamicSimulation
_group enableDynamicSimulation false;
#endif
deleteGroup _group;
};
if (blck_launcherCleanup) then {[_unit] spawn blck_fnc_removeLaunchers;};
if (blck_removeNVG) then {[_unit] spawn blck_fnc_removeNVG;};
if !(isPlayer _killer) exitWith {};
[_unit,_killer] call blck_fnc_alertGroupUnits;
[_killer] call blck_fnc_alertNearbyVehicles;
_group = group _unit;
_wp = [_group, currentWaypoint _group];
_wp setWaypointBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";
{
_unit removeAllEventHandlers _x;
}forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear","Hit"];
_isLegal = [_unit,_killer] call blck_fnc_processIlleagalAIKills;
if !(_isLegal) exitWith {};
_lastkill = _killer getVariable["blck_lastkill",diag_tickTime];
_killer setVariable["blck_lastkill",diag_tickTime];
_kills = (_killer getVariable["blck_kills",0]) + 1;
if ((diag_tickTime - _lastkill) < 240) then
{
_killer setVariable["blck_kills",_kills];
} else {
_killer setVariable["blck_kills",0];
};
if (blck_useKillMessages) then
{
_weapon = currentWeapon _killer;
_killstreakMsg = format[" %1X KILLSTREAK",_kills];
if (blck_useKilledAIName) then
{
_message = format["[blck] %2: killed by %1 from %3m",name _killer,name _unit,round(_unit distance _killer)];
}else{
_message = format["[blck] %1 killed with %2 from %3 meters",name _killer,getText(configFile >> "CfgWeapons" >> _weapon >> "DisplayName"), round(_unit distance _killer)];
};
_message =_message + _killstreakMsg;
//diag_log format["[blck] unit killed message is %1",_message,""];
[["aikilled",_message,"victory"],playableUnits] call blck_fnc_messageplayers;
};
[_unit,_killer] call blck_fnc_rewardKiller;

View File

@ -1,19 +0,0 @@
/*
Killed handler for _units
By Ghostrider-DbD
Last Modified 4-11-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["_unit","_killer"];
//diag_log format["EH_AIKilled:: _units = %1 and _killer = %2",_unit,_killer];
[_unit,_killer] remoteExec ["blck_fnc_processAIKill",2];

View File

@ -1,114 +0,0 @@
/*
AI Mission for Epoch Mod for Arma 3
By Ghostrider
Functions and global variables used by the mission system.
Last modified 3/20/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";
//blck_functionsCompiled = false;
// General functions
blck_fnc_waitTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_waitTimer.sqf";
blck_fnc_timedOut = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_timedOut.sqf";
blck_fnc_FindSafePosn = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_findSafePosn.sqf";
blck_fnc_randomPosition = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_randomPosn.sqf";// find a randomPosn. see script for details.
blck_fnc_findPositionsAlongARadius = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_findPositionsAlongARadius.sqf";
blck_fnc_giveTakeCrypto = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_giveTakeCrypto.sqf";
blck_fnc_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_monitorHC.sqf";
blck_fnc_timeAcceleration = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\TimeAccel\GMS_fnc_Time.sqf";
blck_fnc_getModType = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getModType.sqf"; // Test if Epoch or Exile is loaded
blck_fnc_groupsOnAISide = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_GroupsOnAISide.sqf"; // Returns the number of groups on the side used by AI
blck_fnc_emptyObject = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_emptyObject.sqf";
blck_fnc_playerInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_playerInRange.sqf";
blck_fnc_playerInRangeArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_playerInRangeArray.sqf"; // GMS_fnc_playerInRangeArray
blck_fnc_mainThread = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_mainThread.sqf";
blck_fnc_allPlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_allPlayers.sqf";
blck_fnc_addItemToCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_addItemToCrate.sqf";
blck_fnc_loadLootItemsFromArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_loadLootItemsFromArray.sqf";
blck_fnc_getNumberFromRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getNumberFromRange.sqf";
#ifdef DBDserver
blck_fnc_broadcastServerFPS = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_broadcastServerFPS.sqf";
diag_log "blck_functions loaded using DBDServer settings ---- >>>> ";
#endif
// Player-related functions
blck_fnc_rewardKiller = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_rewardKiller.sqf";
blck_fnc_MessagePlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_AIM.sqf"; // Send messages to players regarding Missions
// Mission-related functions
blck_fnc_selectAILoadout = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAILoadout.sqf";
blck_fnc_addMissionToQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addMissionToQue.sqf"; //
blck_fnc_updateMissionQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_updateMissionQue.sqf"; //
blck_fnc_spawnPendingMissions = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnPendingMissions.sqf"; //
blck_fnc_addLiveAItoQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addLiveAItoQue.sqf";
blck_fnc_addObjToQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addObjToQue.sqf"; //
//blck_fnc_missionTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTimer.sqf";
blck_fnc_spawnCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnCrate.sqf"; // Simply spawns a crate of a specified type at a specific position.
blck_fnc_spawnMissionCrates = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionCrates.sqf";
blck_fnc_cleanupObjects = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_cleanUpObjects.sqf";
blck_fnc_spawnCompositionObjects = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnBaseObjects.sqf";
blck_fnc_spawnRandomLandscape = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnRandomLandscape.sqf";
blck_fnc_spawnMissionVehiclePatrols = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionVehiclePatrols.sqf";
blck_fnc_spawnEmplacedWeaponArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnEmplacedWeaponArray.sqf";
blck_fnc_spawnMissionAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionAI.sqf";
blck_fnc_spawnMissionLootVehicles = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionLootVehicles.sqf";
blck_fnc_fillBoxes = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_fillBoxes.sqf"; // Adds items to an object according to passed parameters. See the script for details.
blck_fnc_smokeAtCrates = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_smokeAtCrates.sqf"; // Spawns a wreck and adds smoke to it
blck_fnc_spawnMines = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMines.sqf"; // Deploys mines at random locations around the mission center
blck_fnc_clearMines = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_clearMines.sqf"; // clears mines in an array passed as a parameter
blck_fnc_signalEnd = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_signalEnd.sqf"; // deploy smoke grenades at loot crates at the end of the mission.
blck_fnc_endMission = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_endMission.sqf";
blck_fnc_missionAIareDead = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionAIareDead.sqf";
// Group-related functions
blck_fnc_spawnGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_spawnGroup.sqf"; // Spawn a single group and populate it with AI units]
blck_fnc_setupWaypoints = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_setupWaypoints.sqf"; // Set default waypoints for a group
blck_fnc_missionGroupMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_missionGroupMonitor.sqf"; // Monitors active groups for those that are stuck in an SAD waypoint but not in combat
blck_fnc_changeToSADWaypoint = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_changeToSADWaypoint.sqf";
blck_fnc_changeToMoveWaypoint = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_changeToMoveWaypoint.sqf";
blck_fnc_changeToSentryWaypoint = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_changeToSentryWaypoint.sqf"; //
//blck_fnc_setNextWaypoint = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_setNextWaypoint.sqf";
blck_fnc_cleanEmptyGroups = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_cleanEmptyGroups.sqf"; // GMS_fnc_cleanEmptyGroups
// Functions specific to vehicles, whether wheeled, aircraft or static
blck_fnc_spawnVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehicle.sqf";
blck_fnc_spawnVehiclePatrol = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehiclePatrol.sqf";
blck_fnc_protectVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_protectVehicle.sqf";
blck_fnc_configureMissionVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_configureMissionVehicle.sqf";
blck_fnc_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_vehicleMonitor.sqf";
blck_fnc_spawnMissionReinforcements = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnReinforcements.sqf";
blck_fnc_spawnMissionHeli = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnMissionHeli.sqf";
blck_fnc_spawnMissionParatroops = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnMissionParatroops.sqf"; // Lumped here because these 'jump' from aircraft
blck_fnc_spawnParaUnits = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnParaUnits.sqf"; // Lumped here because these 'jump' from aircraft
blck_fnc_releaseVehicleToPlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_releaseVehicleToPlayers.sqf"; // GMS_fnc_releaseVehicleToPlayers
blck_EH_AIVehicle_HandleDamage = "\q\addons\custom_server\Compiles\Vehicles\GMS_EH_AIVehicle_HandleDamage.sqf";
// functions to support Units
blck_fnc_removeGear = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeGear.sqf"; // Strip an AI unit of all gear.
blck_fnc_spawnAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_spawnUnit.sqf"; // spawn individual AI
blck_EH_AIKilled = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIKilled.sqf"; // Event handler to process AI deaths
blck_EH_AIHit = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIHit.sqf";
blck_EH_AIFiredNear = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIFiredNear.sqf";
blck_EH_unitWeaponReloaded = "\q\addons\custom_server\Compiles\Units\GMS_EH_unitWeaponReloaded.sqf";
blck_fnc_processAIKill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_processAIKill.sqf";
blck_fnc_removeLaunchers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeLaunchers.sqf";
blck_fnc_removeNVG = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeNVG.sqf";
blck_fnc_alertNearbyUnits = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_alertNearbyUnits.sqf";
blck_fnc_alertGroupUnits = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_alertGroupUnits.sqf";
blck_fnc_alertNearbyVehicles = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_alertNearbyVehicles.sqf";
blck_fnc_processIlleagalAIKills = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_processIlleagalAIKills.sqf";
blck_fnc_cleanupDeadAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_cleanupDeadAI.sqf"; // handles deletion of AI bodies and gear when it is time.
blck_fnc_setSkill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_setSkill.sqf";
blck_fnc_cleanupAliveAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_cleanupAliveAI.sqf";
blck_fnc_deleteAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_deleteAI.sqf";
diag_log "[blckeagls] Functions Loaded";
blck_functionsCompiled = true;

View File

@ -1,3 +0,0 @@
private ["_version","_versionDate"];
_blck_version = "6.71 Build 77";
_blck_versionDate = "9-24-17 4:00 PM";

View File

@ -1,23 +0,0 @@
/*
by Ghostrider-DbD-
Last Modified 3/14/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";
///////////////////////////////////////////////
// prevent the system from being started twice
//////////////////////////////////////////////
if !(isNil "blck_missionSystemRunning") exitWith {};
blck_missionSystemRunning = true;
/////////////////////////////////////////////
// Run the initialization routinge
////////////////////////////////////////////
execVM "\q\addons\custom_server\init\blck_init.sqf";

View File

@ -10,18 +10,13 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//blck_Message = _this;
params["_msg",["_players",playableUnits]];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players];};
blck_Message = _msg;
#endif
{
//diag_log format["AIM.sqf ===] _ = %2, and (owner _x) = %1", (owner _x), _x];
(owner _x) publicVariableClient "blck_Message";
if (isPlayer _x) then {_msg remoteExec["fn_handleMessage",(owner _x)]};
} forEach _players;
/*
if (_modType isEqualTo "Exile") then
{
[_blck_Message] remoteExec["fn_blck_MessageHandler",0];
};
*/

View File

@ -49,10 +49,17 @@ while {true} do
_timer20sec = diag_tickTime;
//diag_log format["_mainThread::-->> diag_tickTime = %1",diag_tickTime];
};
if (diag_tickTime - _timer1min > 60) then
if ((diag_tickTime - _timer1min) > 60) then
{
_timer1min = diag_tickTime;
[] call blck_fnc_timeAcceleration;
[] call blck_fnc_spawnPendingMissions;
;
if !(blck_useHC) then
{
diag_log format["_mainThread:: calling blck_fnc_passToHCs at diag_tickTime = %1",diag_tickTime];
[] call blck_fnc_passToHCs;
};
//[] call blck_fnc_missionGroupMonitor;
/*
// No longer needed
@ -64,8 +71,8 @@ while {true} do
};
if (blck_useTimeAcceleration) then
{
if (diag_tickTime - _timer5min > 30) then {
[] call blck_fnc_timeAcceleration;
if (diag_tickTime - _timer5min > 300) then {
_timer5min = diag_tickTime;
};
};

View File

@ -49,10 +49,17 @@ while {true} do
_timer20sec = diag_tickTime;
//diag_log format["_mainThread::-->> diag_tickTime = %1",diag_tickTime];
};
if (diag_tickTime - _timer1min > 60) then
if ((diag_tickTime - _timer1min) > 60) then
{
_timer1min = diag_tickTime;
[] call blck_fnc_timeAcceleration;
[] call blck_fnc_spawnPendingMissions;
;
if !(blck_useHC) then
{
diag_log format["_mainThread:: calling blck_fnc_passToHCs at diag_tickTime = %1",diag_tickTime];
[] call blck_fnc_passToHCs;
};
//[] call blck_fnc_missionGroupMonitor;
/*
// No longer needed
@ -64,8 +71,8 @@ while {true} do
};
if (blck_useTimeAcceleration) then
{
if (diag_tickTime - _timer5min > 30) then {
[] call blck_fnc_timeAcceleration;
if (diag_tickTime - _timer5min > 300) then {
_timer5min = diag_tickTime;
};
};

View File

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

View File

@ -0,0 +1,98 @@
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 with count _HCs = %2",blck_connectedHCs,count blck_connectedHCs];
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
{
//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;
/*
{
if (typeName _x isEqualTo "GROUP") then {_idHC = groupOwner _x};
if (typeName _x isEqualTo "OBJECT") then {_idHC = owner _x};
if (_idHC > 2) then
{
//diag_log format["vehicle %1 is already assigned to an HC with _id of %2",_x,_id];
_swap = false;
} else {
//diag_log format["vehicle %1 should be moved to an HC",_x];
_x setVariable["owner",_idHC];
if (typeOf _x isEqualTo "GROUP") then {_rc = _x setGroupOwner _idHC};
if (typeOf _x isEqualTo "OBJECT") then {_rc = _x setOwner _idHC};
[_x] remoteExec["blck_fnc_HC_XferVehicle",_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];
};
};
}forEach blck_monitoredVehicles;
*/
diag_log format["_passToHCs:: %1 vehicles transferred",_numTransfered];
} else {
diag_log "_fnc_passToHCs:: No headless clients connected";
};

View File

@ -0,0 +1,287 @@
/*
* passToHCs.sqf
*
* In the mission editor, name the Headless Clients "HC", "HC2", "HC3" without the quotes
*
* In the mission init.sqf, call passToHCs.sqf with:
* execVM "passToHCs.sqf";
*
* It seems that the dedicated server and headless client processes never use more than 20-22% CPU each.
* With a dedicated server and 3 headless clients, that's about 88% CPU with 10-12% left over. Far more efficient use of your processing power.
*
*/
PassToHC_ReceiveMessage = compileFinal "
if (hasInterface && (serverCommandAvailable '#kick' || isServer)) then {
player globalChat (_this select 0);
};
";
if (!isServer) exitWith {};
waitUntil{!isNil "f_param_headlessClient"};
if (f_param_headlessClient == 0) exitWith {};
private ["_HC_ID","_HC2_ID","_HC3_ID","_rebalanceTimer","_cleanUpThreshold","_maxWait","_loadBalance","_currentHC","_numTransfered","_swap","_rc","_numHC","_numHC2","_numHC3","_numDeleted"];
PassToHC_SendMessage = compileFinal "
diag_log text _this;
if (isServer && hasInterface) then {
[_this] call PassToHC_ReceiveMessage;
} else {
[[_this], 'PassToHC_ReceiveMessage', true, false] call BIS_fnc_MP;
};
";
"passToHCs: Started" call PassToHC_SendMessage;
waitUntil {!isNil "HC"};
waitUntil {!isNull HC};
_HC_ID = -1; // Will become the Client ID of HC
_HC2_ID = -1; // Will become the Client ID of HC2
_HC3_ID = -1; // Will become the Client ID of HC3
_rebalanceTimer = 60; // Rebalance sleep timer in seconds
_cleanUpThreshold = 50; // Threshold of number of dead bodies + destroyed vehicles before forcing a clean up
PassToHC_NumTransfered = 0;
"passToHCs: Waiting for init scripts to settle before starting first pass..." call PassToHC_SendMessage;
sleep 15;
// If DAC is initializing after start delay wait until it finishes or timeout
if (!isNil "DAC_Basic_Value") then {
_maxWait = time + 30;
waituntil {sleep 1; (DAC_Basic_Value > 0) || time > _maxWait};
};
// If UPSMON is initializing after start delay wait until it finishes or timeout
if (!isNil "UPSMON_INIT") then {
_maxWait = time + 30;
waituntil {sleep 1; (UPSMON_INIT > 0) || time > _maxWait};
};
// Wait a bit more just in-case they scripts have not settled/synced yet
sleep 3;
format["passToHCs: First pass beginning now..."] call PassToHC_SendMessage;
while {true} do {
// Do not enable load balancing unless more than one HC is present
// Leave this variable false, we'll enable it automatically under the right conditions
_loadBalance = false;
// Get HC Client ID else set variables to null
try {
_HC_ID = owner HC;
if (_HC_ID > 2) then {
diag_log format ["passToHCs: Found HC with Client ID %1", _HC_ID];
} else {
diag_log "passToHCs: [WARN] HC disconnected";
HC = objNull;
_HC_ID = -1;
};
} catch { diag_log format ["passToHCs: [ERROR] [HC] %1", _exception]; HC = objNull; _HC_ID = -1; };
// Get HC2 Client ID else set variables to null
if (!isNil "HC2") then {
try {
_HC2_ID = owner HC2;
if (_HC2_ID > 2) then {
diag_log format ["passToHCs: Found HC2 with Client ID %1", _HC2_ID];
} else {
diag_log "passToHCs: [WARN] HC2 disconnected";
HC2 = objNull;
_HC2_ID = -1;
};
} catch { diag_log format ["passToHCs: [ERROR] [HC2] %1", _exception]; HC2 = objNull; _HC2_ID = -1; };
} else {
HC2 = objNull;
};
// Get HC3 Client ID else set variables to null
if (!isNil "HC3") then {
try {
_HC3_ID = owner HC3;
if (_HC3_ID > 2) then {
diag_log format ["passToHCs: Found HC2 with Client ID %1", _HC3_ID];
} else {
diag_log "passToHCs: [WARN] HC3 disconnected";
HC3 = objNull;
_HC3_ID = -1;
};
} catch { diag_log format ["passToHCs: [ERROR] [HC3] %1", _exception]; HC3 = objNull; _HC3_ID = -1; };
} else {
HC3 = objNull;
};
// If no HCs present, wait for HC to rejoin
if ( (isNull HC) && (isNull HC2) && (isNull HC3) ) then { waitUntil {!isNull HC}; };
// Check to auto enable Round-Robin load balancing strategy
if ( (!isNull HC && !isNull HC2) || (!isNull HC && !isNull HC3) || (!isNull HC2 && !isNull HC3) ) then { _loadBalance = true; };
if ( _loadBalance ) then {
diag_log "passToHCs: Starting load-balanced transfer of AI groups to HCs";
} else {
// No load balancing
diag_log "passToHCs: Starting transfer of AI groups to HC";
};
// Determine first HC to start with
_currentHC = 0;
if (!isNull HC) then { _currentHC = 1; } else {
if (!isNull HC2) then { _currentHC = 2; } else { _currentHC = 3; };
};
// Pass the AI
_numTransfered = 0;
{
_syncGroup = _x;
_swap = true;
_ownerID = _HC_ID;
if ( _loadBalance ) then {
_ownerID = switch (_currentHC) do {
case 1: { if (!isNull HC2) then { _currentHC = 2; } else { _currentHC = 3; }; _HC_ID };
case 2: { if (!isNull HC3) then { _currentHC = 3; } else { _currentHC = 1; }; _HC2_ID };
case 3: { if (!isNull HC) then { _currentHC = 1; } else { _currentHC = 2; }; _HC3_ID };
default {-1};
};
} else {
_ownerID = switch (_currentHC) do {
case 1: {_HC_ID};
case 2: {_HC2_ID};
case 3: {_HC3_ID};
default {-1};
};
};
// Check if group has already been transfered
if (_syncGroup getVariable ["hc_transfered", false]) then {
_swap = false;
} else {
if (groupOwner _syncGroup == _ownerID) then {
_x setVariable ["hc_transfered", true];
_swap = false;
};
};
// Check if group is blacklisted
if (_syncGroup getVariable ["hc_blacklist", false]) then {
_swap = false;
};
if ( _swap ) then {
{
// If a player is in this group, don't swap to an HC
if (isPlayer _x) exitWith { _swap = false; };
// If a unit has 'hc_blacklist' set to true and is in this group, don't swap to an HC.
if (_x getVariable ["hc_blacklist", false]) exitWith { _swap = false; };
// If unit is in a vehicle check if vehicle or crew is blacklisted
if (vehicle _x != _x) then {
if ((vehicle _x) getVariable ["hc_blacklist", false]) exitWith { _swap = false; };
};
} forEach (units _syncGroup);
};
// Check if group has any waypoints synced to triggers and auto blacklist
if ( _swap ) then {
{
if (count (synchronizedTriggers _x) > 0) exitWith {
_syncGroup setVariable ["hc_blacklist", true];
_swap = false;
};
} forEach (waypoints _syncGroup);
};
// If load balance enabled, round robin between the HCs - else pass all to HC
if ( _swap ) then {
_rc = false;
_syncTrigArray = [];
_syncWayArray = [];
{
_wayNum = _forEachIndex;
_syncedTrigs = synchronizedTriggers _x;
_syncTrigArray set [_wayNum,_syncedTrigs];
_syncedWays = synchronizedWaypoints _x;
_syncWayArray set [_wayNum,_syncedWays];
} forEach waypoints _x;
if (_ownerID >= 0) then {
_rc = _x setGroupOwner _ownerID;
} else {
diag_log format["passToHCs: [ERROR] No Valid HC to pass to. _currentHC = %1", _currentHC];
};
// If the transfer was successful, count it for accounting and diagnostic information
if ( _rc ) then {
_x setVariable ["hc_transfered", true];
PassToHC_NumTransfered = PassToHC_NumTransfered + 1;
};
};
} forEach (allGroups);
if (PassToHC_NumTransfered > 0) then {
// More accounting and diagnostic information
diag_log format ["passToHCs: Transfered %1 AI groups to HC(s)", PassToHC_NumTransfered];
_numHC = 0;
_numHC2 = 0;
_numHC3 = 0;
{
switch (owner ((units _x) select 0)) do {
case _HC_ID: { _numHC = _numHC + 1; };
case _HC2_ID: { _numHC2 = _numHC2 + 1; };
case _HC3_ID: { _numHC3 = _numHC3+ 1; };
};
} forEach (allGroups);
diag_log if (_numHC > 0) then { format ["passToHCs: %1 AI groups currently on HC", _numHC]; };
diag_log if (_numHC2 > 0) then { format ["passToHCs: %1 AI groups currently on HC2", _numHC2]; };
diag_log if (_numHC3 > 0) then { format ["passToHCs: %1 AI groups currently on HC3", _numHC3]; };
diag_log format ["passToHCs: %1 AI groups total across all HC(s)", (_numHC + _numHC2 + _numHC3)];
} else {
diag_log "passToHCs: No rebalance or transfers required this round";
};
// Force clean up dead bodies and destroyed vehicles
if (count allDead > _cleanUpThreshold) then {
_numDeleted = 0;
{
deleteVehicle _x;
_numDeleted = _numDeleted + 1;
} forEach allDead;
diag_log format ["passToHCs: Cleaned up %1 dead bodies/destroyed vehicles", _numDeleted];
};
// Rebalance every rebalanceTimer seconds to avoid hammering the server
sleep _rebalanceTimer;
};

View File

@ -0,0 +1,102 @@
// Changes type of waypont0 for the specified group to "MOVE" and updates time stamps, WP postion and Timout parameters accordinglyD.
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 4/23/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";
#ifdef blck_debugMode
//diag_log "_fnc_changeToMoveWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp","_wpPos","_dis","_arc","_dir","_newPos","_marker","_center","_minDis","_maxDis"];
_group = group _this;
if (isServer) then
{
if (groupOwner _group > 2) exitWith
{
diag_log format["blck_fnc_changeToMoveWaypoint:: Running function on headless client %1 for group %2",groupOwner _group,_group];
[_group] remoteExec["blck_fnc_changeToMoveWaypoint",groupOwner _group];
};
}else{
_group setcombatmode "YELLOW";
_group setBehaviour "COMBAT";
_group setVariable["timeStamp",diag_tickTime,true];
_wp = [_group, 0];
_wpPos = getPos ((units _group) select 0);
_dir = _group getVariable["wpDir",0];
_center = _group getVariable ["patrolCenter",_wpPos];
if (_group getVariable["wpMode","random"] isEqualTo "random") then
{
_dir = random(360);
} else {
_dir = (_group getVariable["wpDir",0]) + 70;
_group setVariable["wpDir",_dir,true];
};
_minDis = _group getVariable["minDis",25];
_maxDis = _group getVariable["maxDis",30];
_dis = (_minDis) + random( (_maxDis) - (_minDis) );
_newPos = (_center) getPos[_dis,_dir];
_wp setWPPos [_newPos select 0, _newPos select 1];
_wp setWaypointCompletionRadius (_group getVariable["wpRadius",30]);
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "YELLOW";
_wp setWaypointTimeout [1,1.1,1.2];
_group setCurrentWaypoint _wp;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint (4/25/17): _this = %1", _this];
diag_log format["_fnc_changeToMoveWaypoint: typeName _this = %1", typeName _this];
diag_log format["_fnc_changeToMoveWaypoint:_group = %1",_group];
diag_log format["_fnc_changeToMoveWaypoint:_group timestamp updated to %1", _group getVariable "timeStamp"];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> wpMode %1 _dir %2 _dis %3 _center %4",_group getVariable["wpMode","random"], _dir, _dis,_center];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new position is %2",_group, _newPos];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new Waypoint position is %2",_group, getWPPos _wp];
diag_log format["_fnc_changeToMoveWaypoint:_group %1 basic waypoint parameters updates", _group getVariable "timeStamp"];
_marker =_group getVariable["wpMarker",""];
_marker setMarkerColor "ColorBlue";
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif
if (_group getVariable["wpPatrolMode",""] isEqualTo "SAD") then
{
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_changeToMoveWaypoint: seting waypoint script for group %1 to SAD Mode",_group];
};
_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a SAD Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint;"];
#endif
};
if (_group getVariable["wpPatrolMode",""] isEqualTo "SENTRY") then
{
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_changeToMoveWaypoint: seting waypoint script for group %1 to SENTRY Mode",_group];
};
_wp setWaypointStatements ["true","this call blck_fnc_changeToSentryWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a SENTRY Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToSentryWaypoint;"];
#endif
};
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
};
#endif
};

View File

@ -0,0 +1,61 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 4/29/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";
#ifdef blck_debugMode
diag_log "_fnc_changeToSADWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp"];
_group = group _this;
if (isServer) then
{
if (groupOwner _group > 2) exitWith
{
diag_log format["blck_fnc_changeToSADWaypoint:: Running function on headless client %1 for group %2",groupOwner _group,_group];
[_group] remoteExec["blck_fnc_changeToSADWaypoint",groupOwner _group];
};
}else{
_group setVariable["timeStamp",diag_tickTime,true];
_group setcombatmode "RED";
_group setBehaviour "COMBAT";
_wp = [_group, 0];
_group setCurrentWaypoint _wp;
_wp setWaypointType "SAD";
_wp setWaypointName "sad";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,15,20];
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;"];
#endif
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
private ["_marker"];
_marker = _group getVariable["wpMarker",""];
_marker setMarkerColor "ColorRed";
diag_log format["_fnc_changeToSADWaypoint:: -- :: _this = %1 and typName _this %2",_this, typeName _this];
diag_log format["_fnc_changeToSADWaypoint:: -- >> group to update is %1 with typeName %2",_group, typeName _group];
diag_log format["_fnc_changeToSADWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_changeToSADWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif
};

View File

@ -0,0 +1,58 @@
// Sets the WP type for WP for the specified group and updates other atributes accordingly.
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 4/29/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";
#ifdef blck_debugMode
diag_log "_fnc_changeToSADWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp"];
_group = group _this;
if (isServer) then
{
if (groupOwner _group > 2) exitWith
{
diag_log format["blck_fnc_changeToSentryWaypoint:: Running function on headless client %1 for group %2",groupOwner _group,_group];
[_group] remoteExec["blck_fnc_changeToSentryWaypoint",groupOwner _group];
};
} else {
_group setVariable["timeStamp",diag_tickTime,true];
_wp = [_group, 0];
_group setCurrentWaypoint _wp;
_group setcombatmode "RED";
_group setBehaviour "COMBAT";
_wp setWaypointType "SENTRY";
_wp setWaypointName "sentry";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,15,20];
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to a Move Waypoint',group this];"];
#else
_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;"];
#endif
#ifdef blck_debugMode
if (blck_debugLevel >1) then
{
diag_log format["_fnc_changeToSentryWaypoint:: -- :: _this = %1 and typName _this %2",_this, typeName _this];
diag_log format["_fnc_changeToSentryWaypoint:: -- >> group to update is %1 with typeName %2",_group, typeName _group];
private ["_marker"];
_marker = _group getVariable["wpMarker",""];
_marker setMarkerColor "ColorYellow";
diag_log format["_fnc_changeToSentryWaypoint:: -- >> Waypoint statements for group %1 have been configured as %2",_group, waypointStatements _wp];
diag_log format["_fnc_changeToSentryWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif
};

View File

@ -19,7 +19,7 @@ private["_group","_wp"];
diag_log format["_fnc_changeToSADWaypoint:: -- :: _this = %1 and typName _this %2",_this, typeName _this];
_group = group _this;
diag_log format["_fnc_emplacedWeaponWaypoint:: -- >> group to update is %1 with typeName %2",_group, typeName _group];
_group setVariable["timeStamp",diag_tickTime];
_group setVariable["timeStamp",diag_tickTime,true];
_wp = [_group, 0];
_group setCurrentWaypoint _wp;
diag_log format["_fnc_emplacedWeaponWaypoint:: -- >> group to update is %1 waypoints updated at %2",_group, (_group getVariable["timeStamp",diag_tickTime])];

View File

@ -82,10 +82,10 @@ _fn_monitorGroupWaypoints = {
_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];
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];
diag_log format["_fn_monitorGroupWaypoints::--> soldierType for group %1 = %2 and timeStamp = %3",_x,_soldierType,_timeStamp];
if (_soldierType isEqualTo "infantry") then
{
@ -95,6 +95,8 @@ _fn_monitorGroupWaypoints = {
if (count _units > 0) then
{
private _leader = leader _x;
if (owner _x == 2) then
{
(_leader) call blck_fnc_changeToMoveWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_missionGroupMonitor: infantry group %1 stuck, waypoint reset",_x];};
@ -102,10 +104,13 @@ _fn_monitorGroupWaypoints = {
/*
if ( (getPos _leader) distance2d (_group getVariable "patrolCenter") > 200) then
{
};
*/
};
} else {
[_x] remoteExec ["blck_fnc_changeToMoveWaypoint", owner _x];// [<params>] remoteExec ["someScriptCommand", targets, JIP];
};
};
};
@ -117,27 +122,8 @@ _fn_monitorGroupWaypoints = {
if (count _units > 0) then
{
private _leader = leader _x;
(_leader) call blck_fnc_changeToMoveWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_missionGroupMonitor: vehicle group %1 stuck, waypoint reset",_x];};
#endif
/*
if ( (getPos _leader) distance2d (_group getVariable "patrolCenter") > 200) then
if (owner _x == 2) then
{
};
*/
};
};
};
if (_soldierType isEqualTo "helicopter") then
{
if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
{
_units = [_x] call _fn_aliveGroupUnits;
if (count _units > 0) then
{
private _leader = leader _x;
(_leader) call blck_fnc_changeToMoveWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_missionGroupMonitor: helicopter group %1 stuck, waypoint reset",_x];};
@ -148,6 +134,36 @@ _fn_monitorGroupWaypoints = {
};
*/
} else {
[_x] remoteExec ["blck_fnc_changeToMoveWaypoint", owner _x];// [<params>] remoteExec ["someScriptCommand", targets, JIP];
};
};
};
};
if (_soldierType isEqualTo "helicopter") then
{
if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
{
_units = [_x] call _fn_aliveGroupUnits;
if (count _units > 0) then
{
private _leader = leader _x;
if (owner _x == 2) then
{
(_leader) call blck_fnc_changeToMoveWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_missionGroupMonitor: helicopter group %1 stuck, waypoint reset",_x];};
#endif
/*
if ( (getPos _leader) distance2d (_group getVariable "patrolCenter") > 200) then
{
};
*/
} else {
[_x] remoteExec ["blck_fnc_changeToMoveWaypoint", owner _x];// [<params>] remoteExec ["someScriptCommand", targets, JIP];
};
};
};
@ -171,7 +187,7 @@ _fn_simulationMonitor = {
// Be sure simulation is on for all units in the group
if !(_x getVariable["blck_simulationStatus",false]) then
{
_x setVariable["blck_simulationStatus",true];
_x setVariable["blck_simulationStatus",true,true];
{
_x enableSimulationGlobal true;
}forEach (units _x);
@ -180,7 +196,7 @@ _fn_simulationMonitor = {
// Be sure simulation is off for all units in the group.
if !(_x getVariable["blck_simulationStatus",true]) then
{
_x setVariable["blck_simulationStatus",false];
_x setVariable["blck_simulationStatus",false,true];
{
_x enableSimulationGlobal false;
}forEach (units _x);

View File

@ -18,7 +18,7 @@ private["_group","_wp","_index","_pattern","_mode","_arc","_dis","_wpPos"];
_group = group _this;
_group setVariable["timeStamp",diag_tickTime];
_group setVariable["timeStamp",diag_tickTime,true];
_group setcombatmode "YELLOW";
_group setBehaviour "COMBAT"
_wp = [_group, 0];
@ -29,7 +29,7 @@ _index = _index + 1;
_minDis = _group getVariable["minDis",0];
_maxDis = _group getVariable["maxDis",0];
dir = (_group getVariable["wpDir",0]) + _group getVariable["wpArc",360/5];
_group setVariable["wpDir",_dir];
_group setVariable["wpDir",_dir,true];
diag_log format["_fnc_setNextWaypoint: -> _minDis = %1 | _maxDis = %2 | _arc = %3",_minDis,_maxDis,_arc];
if (_index >= (count _pattern)) then
@ -39,7 +39,7 @@ if (_index >= (count _pattern)) then
diag_log format["_fnc_setNextWaypoint: -> waypoint index for group %1 is currently %2 with _pattern = %4 and count _pattern = %3",_group,_index, count _pattern,_pattern];
};
_group setVariable["wpIndex",_index];
_group setVariable["wpIndex",_index,true];
_type = _pattern select _index;
#ifdef blck_debugMode
@ -60,7 +60,7 @@ if (_type isEqualTo (toLower "move")) then
} else {
_dir = _group getVariable["wpDir",0] + _group getVariable["wpArc",360/5];
};
_group setVariable["wpDir",_dir];
_group setVariable["wpDir",_dir,true];
_oldPos = waypointPosition _wp;
_newPos = (_group getVariable ["patrolCenter",_wpPos]) getPos[_dis,_arc];

View File

@ -33,7 +33,7 @@ if (_soldierType isEqualTo "emplaced") then
_wp setWaypointTimeout [1,1.1,1.2];
//_wp setWaypointTimeout [0.1,0.1100,0.1200];
_group setCurrentWaypoint _wp;
_group setVariable["soldierType",_soldierType];
_group setVariable["soldierType",_soldierType,true];
#ifdef blck_debugMode
_wp setWaypointStatements ["true","this call blck_fnc_emplacedWeaponWaypoint; diag_log format['====Updating timestamp for group %1 and changing its WP to an emplaced weapon Waypoint',group this];"];
#else
@ -46,16 +46,16 @@ if !(_soldierType isEqualTo "emplaced") then
_arc = 360/5;
_group setcombatmode "YELLOW";
_group setBehaviour "COMBAT";
_group setVariable["patrolCenter",_pos];
_group setVariable["minDis",_minDis];
_group setVariable["maxDis",_maxDis];
_group setVariable["timeStamp",diag_tickTime];
_group setVariable["wpRadius",30];
_group setVariable["wpMode",_mode];
_group setVariable["wpPatrolMode",_wpPatrolMode];
_group setVariable["wpDir",0];
_group setVariable["wpArc",_arc];
_group setVariable["soldierType",_soldierType];
_group setVariable["patrolCenter",_pos,true];
_group setVariable["minDis",_minDis,true];
_group setVariable["maxDis",_maxDis,true];
_group setVariable["timeStamp",diag_tickTime,true];
_group setVariable["wpRadius",30,true];
_group setVariable["wpMode",_mode,true];
_group setVariable["wpPatrolMode",_wpPatrolMode,true];
_group setVariable["wpDir",0,true];
_group setVariable["wpArc",_arc,true];
_group setVariable["soldierType",_soldierType,true];
_dir = 0;
_wpradius = 30;
@ -78,7 +78,7 @@ if !(_soldierType isEqualTo "emplaced") then
if (blck_debugLevel > 1) then
{
_marker = createMarker [format["GroupMarker%1",_group],_newPos];
_group setVariable["wpMarker",_marker];
_group setVariable["wpMarker",_marker,true];
_marker setMarkerColor "ColorBlue";
_marker setMarkerText format["%1 %2",(_group getVariable["soldierType","null"]),_group];
_marker setMarkerType "mil_triangle";

View File

@ -13,11 +13,18 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
if (blck_debugLevel >=2) then
{
{
diag_log format["_fnc_spawnGroup:: _this select %1 = %2",_forEachIndex,_x];
}forEach _this;
};
#endif
private["_numbertospawn","_groupSpawned","_safepos","_weaponList","_useLauncher","_launcherType"];
params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_configureWaypoints",true] ];
if (blck_debugLevel > 1) then
if (blck_debugLevel >= 1) then
{
diag_log format["[blckeagls] _fnc_spawnGroup called parameters: _numai1 %1, _numbai2 %2, _skillLevel %3, _center %4",_numai1,_numai2,_skillLevel,_center];
};
@ -30,7 +37,7 @@ if (_numai2 > _numai1) then
};
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
if (blck_debugLevel >= 1) then
{
diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn];
};
@ -39,7 +46,7 @@ if (blck_debugLevel > 1) then
_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
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
if (blck_debugLevel >= 1) then
{
diag_log format["spawnGroup.sqf: _groupSpawned = %1",_groupSpawned];
};
@ -47,7 +54,7 @@ if (blck_debugLevel > 1) then
if !(isNull _groupSpawned) then
{
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["_fnc_spawnGroup:: -- >> Group created = %1",_groupSpawned]};
if (blck_debugLevel >= 1) then {diag_log format["_fnc_spawnGroup:: -- >> Group created = %1",_groupSpawned]};
#endif
_groupSpawned setVariable["groupVehicle",objNull];
@ -60,7 +67,7 @@ if !(isNull _groupSpawned) then
_groupSpawned allowfleeing 0;
_groupSpawned setspeedmode "FULL";
_groupSpawned setFormation blck_groupFormation;
_groupSpawned setVariable ["blck_group",true];
_groupSpawned setVariable ["blck_group",true,true];
//diag_log format["spawnGroup:: group is %1",_groupSpawned];
// Determines whether or not the group has launchers
@ -105,7 +112,7 @@ if !(isNull _groupSpawned) then
//[_pos,_minDist,_maxDist,_groupSpawned,"random","SENTRY"] spawn blck_fnc_setupWaypoints;
//diag_log format["_fnc_spawnGroup: blck_fnc_setupWaypoints called for group %1",_groupSpawned];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
if (blck_debugLevel >= 1) then
{
diag_log format["fnc_spawnGroup:: Group spawned was %1 with units of %2",_groupSpawned, units _groupSpawned];
};

View File

@ -0,0 +1,17 @@
diag_log format["_fnc_HC_XferGroup:: _this = %1",_this];
private["_group","_client","_unit","_localEH","_tempEH"];
_group = _this select 0;
_client = clientOwner;
{
_unit = _x;
_localEH = [];
{
_unit removeAllEventHandlers _x;
}forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear","Hit"];
_tempEH = ["reloaded",_unit addEventHandler ["reloaded", {_this call compile preprocessfilelinenumbers blck_EH_unitWeaponReloaded;}]];
_localEH pushBack _tempEH;
//_unit addMPEventHandler ["mpkilled", {[(_this select 0), (_this select 1)] call compile preprocessfilelinenumbers blck_EH_AIKilled;}]; // changed to reduce number of concurrent threads, but also works as spawn blck_AIKilled; }];
_tempEH = ["Hit",_unit addEventHandler ["Hit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIHit;}]];
_localEH pushBack _tempEH;
_x setVariable["localEH",_tempEH,true];
}forEach (units _group);

View File

@ -0,0 +1,6 @@
diag_log format["_fnc_HC_XferVehicle:: _this = %1",_this];
private["_veh","_tempEH","_localEH"];
_veh = _this select 0;
_tempEH = ["HandleDamage",_veh addMPEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}]];
_localEH = [_tempEH];
_veh setVariable["localEH",_tempEH,true];

View File

@ -0,0 +1,18 @@
/*
* passToHCs.sqf
*
* In the mission editor, name the Headless Clients "HC", "HC2", "HC3" without the quotes
*
* In the mission init.sqf, call passToHCs.sqf with:
* execVM "passToHCs.sqf";
*
* It seems that the dedicated server and headless client processes never use more than 20-22% CPU each.
* With a dedicated server and 3 headless clients, that's about 88% CPU with 10-12% left over. Far more efficient use of your processing power.
*
*/
_clientId = clientOwner;
_allGroups = allGroups;
_groupsOwned = {groupOwner _x isEqualTo _clientId)} count allGroups;
[_clientId,_groupsOwned] remoteExec ["blck_fnc_updateClientGroupCounts",2];
diag_log format["_fnc_HC_groupsAssigned:: %1 groups running on client %2",_groupsOwned,_clientId];

View File

@ -0,0 +1,16 @@
/*
*/
diag_log "_fnc_HCmonitor.sqf";
_blckGroups = 0;
_otherGroups = 0;
_totalGroups = 0;
while {true} do
{
_blckGroups = {_x getVariable["blck_group",false] && (groupOwner _x isEqualTo clientOwner)} count allGroups;
_totalGroups = {(groupOwner _x) isEqualTo clientOwner} count allGroups;
_totalGroups = _blckGroups + _otherGroups;
diag_log format["blckHC:: headless client %1 at diag_tickTime running %3 fps",clientOwner,diag_tickTime,diag_fps];
uiSleep 60;
};

View File

@ -0,0 +1,47 @@
params["_name","_owner"];
diag_log format["_fnc_onPlayerDisconnected triggered with _name = %1 and _owner = %2",_name,_owner];
private["_HCownerids","_groupLocalEH","_vehicleLocalEH"];
// Remove the name of the HC from the list of active, connected HCs
if (toLower(_name) isEqualTo "headlessclient") then
{
diag_log "_fnc_onPlayerDisconnected: a headless client disconnected, time to deal with the damage";
_entities = entities "Headlessclient_F";
_blck_connectedHCs = +blck_connectedHCs;
_HCownerids = [];
{
if !(_x in _entities) then
{
// If the HC is not in the list of connected SC then delete it from the list maintained separately by blckeagls.
blck_connectedHCs = blck_connectedHCs - [_x];
} else {
// Grab the owner ids for currently connected HCs.
_HCownerids pushBack (owner _x);
};
}forEach _blck_connectedHCs;
// Check whether there are any groups assigned to an owner that is not connected and deal with it
{
if !(_x getVariable["owner",0] in _HCownerids) then
{
diag_log format["_fnc_onPlayerDisconnected:: reseting eventHandlers for group %1",_x];
// do any cleanup; at present this is simply removing locally added event handlers
_groupLocalEH = _x getVariable["localEH",[]];
{
_x removeEventHandler _x;
}forEach _groupLocalEH;
_x setVariable["localEH",nil,true];
};
}forEach allGroups;
{
if !(_x getVariable["owner",0] in _HCownerids) then
{
diag_log format["_fnc_onPlayerDisconnected:: reseting eventHandlers for vehicle %1",_x];
// do any cleanup; at present this is simply removing locally added event handlers
_vehicleLocalEH = _x getVariable["localEH",[]];
{
_x removeEventHandler _x;
}forEach _vehicleLocalEH;
_x setVariable["localEH",nil,true];
};
}forEach blck_monitoredVehicles;
};

View File

@ -0,0 +1,116 @@
/*
[_mines,_objects,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission] call blck_fnc_endMission;
schedules deletion of all remaining alive AI and mission objects.
Updates the mission que.
Updates mission markers.
By Ghostrider GRG
10/9/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"
_fn_missionCleanup = {
params["_mines","_objects","_blck_AllMissionAI","_mission","_cleanupAliveAITimer","_cleanupCompositionTimer"];
[_mines] spawn blck_fnc_clearMines;
//diag_log format["_fnc_endMission: (103) _objects = %1",_objects];
[_objects, _cleanupCompositionTimer] spawn blck_fnc_addObjToQue;
//diag_log format["_fnc_endMission:: (106) _blck_AllMissionAI = %1",_blck_AllMissionAI];
[_blck_AllMissionAI, (_cleanupAliveAITimer)] spawn blck_fnc_addLiveAItoQue;
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
blck_recentMissionCoords pushback [_coords,diag_tickTime];
//diag_log format["_fnc_endMission:: (109) _mission = %1",_mission];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
blck_missionsRunning = blck_missionsRunning - 1;
};
params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_aborted",false],["_vehicles",[]]];
private["_cleanupAliveAITimer","_cleanupCompositionTimer"];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["_fnc_endMission: _blck_localMissionMarker %1 | _coords %2 | _mission %3 | _aborted %4",_blck_localMissionMarker,_coords,_mission,_aborted];
diag_log format["_fnc_endMission: _aborted = %1",_aborted];
};
#endif
if (_aborted > 0) exitWith
{
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log format["_fnc_endMission: Mission Aborted, setting all timers to 0"];
};
#endif
if (_aborted == 2) then
{
[["abort",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;
};
[_blck_localMissionMarker select 0] call blck_fnc_deleteMarker;
_cleanupCompositionTimer = 0;
_cleanupAliveAITimer = 0;
[_mines,_objects,_blck_AllMissionAI,_mission,_cleanupAliveAITimer,_cleanupCompositionTimer] call _fn_missionCleanup;
{
deleteVehicle _x;
}forEach _crates;
{
deleteVehicle _x;
}forEach _vehicles;
};
if (_aborted == 0) then
{
private["_cleanupAliveAITimer","_cleanupCompositionTimer"];
if (blck_useSignalEnd) then
{
[_crates select 0] spawn blck_fnc_signalEnd;
{
_x enableRopeAttach true;
}forEach _crates;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] _fnc_endMission:: (18) SignalEnd called: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log format["_fnc_endMission: Mission Completed without errors, setting all timers to default values"];
};
#endif
_cleanupCompositionTimer = blck_cleanupCompositionTimer;
_cleanupAliveAITimer = blck_AliveAICleanUpTimer;
[["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;
[_blck_localMissionMarker select 0] call blck_fnc_deleteMarker;
[_blck_localMissionMarker select 1, _markerClass] spawn blck_fnc_missionCompleteMarker;
// Using a variable attached to the crate rather than the global setting to be sure we do not fill a crate twice.
// the "lootLoaded" loaded should be set to true by the crate filler script so we can use that for our check.
{
//diag_log format["_fnc_endMission (82): for crate %1 lootLoaded = %2",_x,_x getVariable["lootLoaded",false]];
if !(_x getVariable["lootLoaded",false]) then
{
// _crateLoot,_lootCounts are defined above and carry the loot table to be used and the number of items of each category to load
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
{
private ["_v","_posnVeh"];
_posnVeh = blck_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count blck_monitoredVehicles -1)
if (_posnVeh >= 0) then
{
//diag_log format["_fnc_endMission: setting missionCompleted for vehicle %1 to %2",_x,diag_tickTime];
(blck_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime];
} else {
_x setVariable ["missionCompleted", diag_tickTime];
blck_monitoredVehicles pushback _x;
};
} forEach _vehicles;
[_mines,_objects,_blck_AllMissionAI,_mission,_cleanupAliveAITimer,_cleanupCompositionTimer] call _fn_missionCleanup;
};
_aborted

View File

@ -1,9 +1,8 @@
/*
Generic Mission Spawner
for DBD Clan
By Ghostrider-DBD-
By Ghostrider GRG
Copyright 2016
Last modified 8/13/17
Last modified 10/9/17
--------------------------
License
@ -14,9 +13,9 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"];
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups"];
params["_coords","_mission",["_allowReinforcements",true]];
diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements];
//diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements];
////////
// set all variables needed for the missions
@ -28,8 +27,6 @@ diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinfo
_markerClass = _mission select 2;
_aiDifficultyLevel = _mission select 3;
if (blck_debugLevel > 0) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];};
[_mission,"active",_coords] call blck_fnc_updateMissionQue;
blck_ActiveMissionCoords pushback _coords;
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
@ -40,7 +37,12 @@ if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
//if (isNil "_timeOut") then {_timeOut = -1;};
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
if (isNil "_missionPatrolVehicles") then {
//diag_log format["_missionSpawner (44):: _missionPatrolVehicles isNil, Definining it as an empty array"];
_missionPatrolVehicles = [];
//diag_log format["_missionSpawner (46):: _missionPatrolVehicles is %1",_missionPatrolVehicles];
};
if (isNil "_missionGroups") then {_missionGroups = []};
private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"];
if (isNil "_useMines") then {_useMines = blck_useMines;};
@ -66,13 +68,11 @@ 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?
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";};
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
//[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;
[_blck_localMissionMarker] execVM "debug\spawnMarker.sqf";
[_blck_localMissionMarker] call blck_fnc_spawnMarker;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (94) waiting for player to trigger the mission";};
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";};
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) waiting for player to trigger the mission";};
#endif
////////
// All parameters are defined, lets wait until a player is nearby or the mission has timed out
@ -83,7 +83,10 @@ _missionStartTime = diag_tickTime;
_playerInRange = false;
_missionTimedOut = false;
_wait = true;
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (105) starting mission trigger loop"};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (90) starting mission trigger loop"};
#endif
while {_wait} do
{
@ -125,7 +128,7 @@ if (_missionTimedOut) exitWith
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (105) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (133) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
};
@ -136,30 +139,7 @@ if (_missionTimedOut) exitWith
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (112) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
//uisleep 2;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (136) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (142) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
@ -181,11 +161,13 @@ if (_useMines) then
};
uiSleep _delayTime;
_temp = [];
diag_log format["_missionSpawner"" _missionLandscape = %1",_missionLandscape];
if (_missionLandscapeMode isEqualTo "random") then
{
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
} else {
_temp = [_coords, floor(random(360)),_missionLandscape,true] call blck_fnc_spawnCompositionObjects;
params["_center","_objects"];
_temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects;
//uiSleep 1;
};
if (typeName _temp isEqualTo "ARRAY") then
@ -197,7 +179,7 @@ if (typeName _temp isEqualTo "ARRAY") then
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (170) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (190) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
@ -211,26 +193,25 @@ uiSleep _delayTime;
_abort = false;
_temp = [[],[],false];
_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//[_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear,_missionGroups] call blck_fnc_spawnMissionAI;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (185) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1;
diag_log format["missionSpawner :: (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["missionSpawner :: (190) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
diag_log format["missionSpawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
};
#endif
if (_abort) exitWith
{
if (blck_debugLevel > 1) then {
diag_log "missionSpawner:: (194) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
diag_log "missionSpawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission;
};
if !(_abort) then
{
@ -242,23 +223,24 @@ uiSleep _delayTime;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (202) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (235) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
uiSleep 3;
uiSleep _delayTime;
_temp = [[],[],false];
_abort = false;
private["_patrolVehicles","_vehToSpawn"];
_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn];
if (blck_useVehiclePatrols && (_vehToSpawn > 0)) then
//diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn];
//diag_log format["_missionSpawner (245):: _missionPatrolVehicles = %1",_missionPatrolVehicles];
if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then
{
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols;
//[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {
diag_log format["missionSpawner :: (216) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp];
diag_log format["missionSpawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp];
};
#endif
@ -274,7 +256,7 @@ if (blck_useVehiclePatrols && (_vehToSpawn > 0)) then
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (272) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
@ -285,76 +267,17 @@ if (_abort) exitWith
{
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {
diag_log "missionSpawner:: (222) grpNull returned, mission termination criteria met, calling blck_endMission";
diag_log "missionSpawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission;
};
uiSleep _delayTime;
_temp = [[],[],false];
_abort = false;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (234) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];};
#endif
uiSleep 3;
private["_noEmplacedToSpawn"];
_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
diag_log format["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn];
if (blck_useStatic && (_noEmplacedToSpawn > 0)) then
{
// params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
_temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (232) 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 ["missionSpawner:: (241) _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] missionSpawner:: (253) 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 "missionSpawner:: (261) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission;
};
uiSleep 3;
if (_allowReinforcements) then
{
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
@ -363,7 +286,7 @@ if (_allowReinforcements) then
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["[blckeagls] missionSpawner:: (268) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (298) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
private _noChoppers = 0;
@ -387,7 +310,9 @@ if (_allowReinforcements) then
_chancePara = [blck_chanceParaOrange] call blck_fnc_getNumberFromRange;
};
};
diag_log format["_missionSpawner:: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara];
#ifdef blck_debugMode
diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara];
#endif
for "_i" from 1 to (_noChoppers) do
{
//params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"];
@ -397,8 +322,8 @@ if (_allowReinforcements) then
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
diag_log format["missionSpawner:: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers];
diag_log format["missionSpawner:: _temp = %1",_temp];
diag_log format["missionSpawner(334):: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers];
diag_log format["missionSpawner(335):: _temp = %1",_temp];
};
#endif
@ -410,20 +335,105 @@ if (_allowReinforcements) then
};
if (_abort) then
{
#ifdef blck_debugMode
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission";
diag_log "missionSpawner:: (349) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission";
};
#endif
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission;
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,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["missionSpawner:: (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["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn];
if (blck_useStatic && (_noEmplacedToSpawn > 0)) then
{
// params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
_temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (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 ["missionSpawner:: (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] missionSpawner:: (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 "missionSpawner:: (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] call blck_fnc_endMission;
};
uiSleep _delayTime;
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
//uisleep 2;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
// Trigger for mission end
//diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition];
#ifdef blck_debugMode
diag_log format["[blckeagls] mission Spawner(436) _endCondition = %1",_endCondition];
#endif
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"];
_missionComplete = -1;
_startTime = diag_tickTime;
@ -434,37 +444,61 @@ switch (_endCondition) do
case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;};
case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;};
};
//diag_log format["missionSpawner :: (269) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
#ifdef blck_debugMode
diag_log format["missionSpawner :: (449) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
#endif
private["_locations"];
_locations = [_coords];
{
_locations pushback (getPos _x);
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
//diag_log format["missionSpawner:: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations];
//diag_log format["missionSpawner:: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled];
while {_missionComplete isEqualTo -1} do
#ifdef blck_debugMode
diag_log format["missionSpawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations];
#endif
private _crateStolen = false;
#ifdef blck_debugMode
diag_log format["missionSpawner(462):: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled];
#endif
_fn_crateMoved = {
params["_crate"];
private _result = (_x distance (_x getVariable["crateSpawnPos",[0,0,0]])) > 10;
//diag_log format["_fn_crateMoved:: _result = %1",_result];
_result;
};
while {_missionComplete isEqualTo -1} do
{
//if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180};
if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {};
if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1 /*[_blck_AllMissionAI] call blck_fnc_missionAIareDead*/ ) exitWith {};
//diag_log format["missionSpawner:: (283) missionCompleteLoop - > players near = %1 and ai alive = %2",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI];
if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1) exitWith {};
{
if ({[_x] call _fn_crateMoved} count _crates > 0) exitWith
{
_missionComplete = 1;
_crateStolen = true;
};
}forEach _crates;
//diag_log format["missionSpawner:: (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["missionSpawner:: (491) 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] call blck_fnc_endMission;
};
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (414) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["missionSpawner :: (415) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
diag_log format["[blckeagls] missionSpawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["missionSpawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
diag_log format["[blckeagls] missionSpawner:: (498) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
#endif
//diag_log format["[blckeagls] missionSpawner:: (418) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
private["_result"];
// Force passing the mission name for informational purposes.
_blck_localMissionMarker set [2, _markerMissionName];
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false,_patrolVehicles] call blck_fnc_endMission;
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0] call blck_fnc_endMission;
//diag_log format["[blckeagls] missionSpawner:: (420)end of mission: blck_fnc_endMission returned value of %1","pending"];
diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"];

View File

@ -2,7 +2,7 @@
Spawn objects from an array using offsects from a central location.
The code provided by M3Editor EDEN has been addapted to add checks for vehicles, should they be present.
Returns an array of spawned objects.
version of 1/13/17
version of 10/13/17
--------------------------
License
@ -13,19 +13,20 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_center","_azi","_objects","_setVector"];
params["_center","_objects"];
//diag_log format["_spawnBaseObjects:: -> _objects = %1",_objects];
private ["_newObjs"];
_newObjs = [];
{
//diag_log format["_fnc_spawnBaseObjects::-->> _x = %1",_x];
private _obj = (_x select 0) createVehicle [0,0,0];
_newObjs pushback _obj;
_obj setDir ( (_x select 2) + _azi);
_obj setDir (_x select 2);
_obj setPosATL (_center vectorAdd (_x select 1));
_obj enableSimulationGlobal true;
_obj enableDynamicSimulation true;
_obj allowDamage true;
// Lock any vehicles placed as part of the mission landscape. Note that vehicles that can be taken by players can be added via the mission template.
if ( (typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Sea") then

View File

@ -27,6 +27,6 @@ _crate = createVehicle [_crateType,_coords,[], 0, "CAN_COLLIDE"];
_crate setVariable ["LAST_CHECK", 100000];
_crate setPosATL [_px, _py, 0.5];
_crate allowDamage false;
_crate enableRopeAttach true;
_crate enableRopeAttach false;
[_crate] call blck_fnc_emptyObject;
_crate;

View File

@ -16,13 +16,12 @@
params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
//diag_log format["_fnc_spawnEmplacedWeaponArray:: _this = %1",_this];
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode"];
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode","_useRelativePos","_useRelativePos"];
_emplacedWeps = [];
_emplacedAI = [];
_units = [];
_abort = false;
_pos = [];
_mode = "vector";
#ifdef blck_debugMode
//diag_log "_fnc_spawnEmplacedWeaponArray start";
@ -31,12 +30,12 @@ _mode = "vector";
// Define _missionEmplacedWeapons if not already configured.
if (_missionEmplacedWeapons isEqualTo []) then
{
_mode = "world";
_useRelativePos = false;
_missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray: creating random spawn locations: _missionEmplacedWeaponsPositions = %1", _missionEmplacedWeaponPositions];
diag_log format["_fnc_spawnEmplacedWeaponArray(38): creating random spawn locations: _missionEmplacedWeaponsPositions = %1", _missionEmplacedWeaponPositions];
};
#endif
{
@ -45,17 +44,19 @@ if (_missionEmplacedWeapons isEqualTo []) then
_missionEmplacedWeapons pushback [_static,_x];
//diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons];
} forEach _missionEmplacedWeaponPositions;
};
} else {
_useRelativePos = true;
};;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray:: starting static weapon spawner with _missionEmplacedWeapons = %1", _missionEmplacedWeapons];
diag_log format["_fnc_spawnEmplacedWeaponArray(52):: starting static weapon spawner with _missionEmplacedWeapons = %1", _missionEmplacedWeapons];
};
#endif
{
if (_mode isEqualTo "vector") then
if (_useRelativePos) then
{
_pos = _coords vectorAdd (_x select 1);
} else {
@ -65,12 +66,12 @@ if (blck_debugLevel > 1) then
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray: _coords = %1 | offset = %2 | final _pos = 53",_coords,_x select 1, _pos];
diag_log format["_fnc_spawnEmplacedWeaponArray(67):: _coords = %1 | offset = %2 | final _pos = %3",_coords,_x select 1, _pos];
};
#endif
// params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ];
_empGroup = [(_x select 1),1,1,_aiDifficultyLevel,(_x select 1),1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup;
_empGroup = [_pos,1,1,_aiDifficultyLevel,(_x select 1),1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup;
_empGroup setcombatmode "RED";
_empGroup setBehaviour "COMBAT";
@ -80,10 +81,10 @@ if (blck_debugLevel > 1) then
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray:: typeName _empGroup = %1 and _empGroup = %2 and _x = %3",typeName _empGroup, _empGroup,_x];
diag_log format["_fnc_spawnEmplacedWeaponArray(82):: typeName _empGroup = %1 and _empGroup = %2 and _x = %3",typeName _empGroup, _empGroup,_x];
};
#endif
// params["_vehType","_pos",["_clearInventory",true]];
_wep = [(_x select 0),[0,0,0],false] call blck_fnc_spawnVehicle;
_wep addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
@ -92,12 +93,12 @@ if (blck_debugLevel > 1) then
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray (23) spawnVehicle returned value of _wep = %1",_wep];
diag_log format["_fnc_spawnEmplacedWeaponArray (94) spawnVehicle returned value of _wep = %1",_wep];
};
#endif
_wep setVariable["DBD_vehType","emplaced"];
_wep setPosATL _pos;
_wep setPos _pos;
[_wep,false] call blck_fnc_configureMissionVehicle;
_emplacedWeps pushback _wep;
_units = units _empGroup;
@ -108,8 +109,8 @@ if (blck_debugLevel > 1) then
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray:: position of emplaced weapon = %1 and targetd position is %2",getPos _wep, _pos];
diag_log format["_fnc_spawnEmplacedWeaponArray:: _gunner = %1 and crew _wep = %2",_gunner, crew _wep];
diag_log format["_fnc_spawnEmplacedWeaponArray(110):: position of emplaced weapon = %1 and targetd position is %2",getPos _wep, _pos];
diag_log format["_fnc_spawnEmplacedWeaponArray(111):: _gunner = %1 and crew _wep = %2",_gunner, crew _wep];
};
#endif

View File

@ -19,8 +19,16 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
if (blck_debugLevel >=2) then
{
{
diag_log format["_fnc_spawnMissionAI:: _this select %1 = %2",_forEachIndex,_x];
}forEach _this;
};
#endif
params["_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]];
params["_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],"_missionGroups"];
private["_unitsToSpawn","_unitsPerGroup","_ResidualUnits","_newGroup","_blck_AllMissionAI","_abort"];
_unitsToSpawn = [[_minNoAI,_maxNoAI]] call blck_fnc_getNumberFromRange; //round(_minNoAI + round(random(_maxNoAI - _minNoAI)));
_unitsPerGroup = floor(_unitsToSpawn/_noAIGroups);
@ -29,19 +37,59 @@
_abort = false;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (30):: _unitsToSpawn %1 ; _unitsPerGroup %2 _ResidualUnits %3",_unitsToSpawn,_unitsPerGroup,_ResidualUnits];
};
#endif
if (count _missionGroups > 0) then
{
{
_x params["_position","_minAI","_maxAI","_skillLevel","_minPatrolRadius","_maxPatrolRadius"];
_groupSpawnPos = _coords vectorAdd _position;
diag_log format["_fnc_spawnMissionAI:: _x= %1",_x];
diag_log format["_fnc_spawnMissionAI:: _coords = %1 | _groupSpawnPos = %2 | _position = %3",_coords,_groupSpawnPos,_position];
// player modelToWorld [0,-1,3];
// params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_configureWaypoints",true] ];
_newGroup = [_groupSpawnPos,_minAI,_maxAI,_skillLevel,_coords,_minPatrolRadius,_maxPatrolRadius,_uniforms,_headGear,true] call blck_fnc_spawnGroup;
#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
{
_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];
};
#endif
_blck_AllMissionAI append _newAI;
};
}forEach _missionGroups;
};
if (_missionGroups isEqualTo []) then
{
switch (_noAIGroups) do
{
case 1: { // spawn the group near the mission center
#ifdef blck_debugMode
//params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ];
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1"];
};
@ -50,7 +98,7 @@
_newGroup = [_coords,_unitsToSpawn,_unitsToSpawn,_aiDifficultyLevel,_coords,25,30,_uniforms,_headGear,true] call blck_fnc_spawnGroup;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (37):: case 1 - > _newGroup = %1",_newGroup];
};
@ -65,7 +113,7 @@
_newAI = units _newGroup;
blck_monitoredMissionAIGroups pushback _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(41): Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
};
@ -78,7 +126,7 @@
case 2: {
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(47): Spawning Groups: _noAIGroups=2"]; // spawn groups on either side of the mission area
};
@ -104,7 +152,7 @@
_newAI = units _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(61): case 2: _newGroup=%1",_newGroup];
};
@ -118,7 +166,7 @@
case 3: { // spawn one group near the center of the mission and the rest on the perimeter
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (68): Spawning Groups: _noAIGroups=3"];
};
@ -135,7 +183,7 @@
_newAI = units _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (73): Case 3: _newGroup=%1",_newGroup];
};
@ -155,7 +203,7 @@
_newAI = units _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(78): Case 3: line 81: _newGroup = %1",_newGroup];
};
@ -169,7 +217,7 @@
default { // spawn one group near the center of the mission and the rest on the perimeter
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI (88): case 4:"];
};
@ -183,7 +231,7 @@
_newAI = units _newGroup;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel >= 2) then
{
diag_log format["_fnc_spawnMissionAI(92): Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
};
@ -209,14 +257,14 @@
}forEach _groupLocations;
};
};
};
#ifdef blck_debugMode
if (blck_debugLevel >= 1) then
{
diag_log format["_fnc_spawnMissionAI(133): _abort = %1 | _blck_AllMissionAI = %2",_abort,_blck_AllMissionAI];
};
#endif
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionAI(133): _abort = %1 | _blck_AllMissionAI = %2",_abort,_blck_AllMissionAI];
};
#endif
private["_return"];
_return = [_blck_AllMissionAI,_abort];
_return
private["_return"];
_return = [_blck_AllMissionAI,_abort];
_return

View File

@ -14,25 +14,48 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]];
params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_uniforms","_headGear","_missionPatrolVehicles"];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols:: _coords = %1 | _noVehiclePatrols = %2 | _aiDifficultyLevel = %3 | _missionType = %4",_coords,_noVehiclePatrols,_aiDifficultyLevel,_missionType];
diag_log format["_fnc_spawnMissionVehiclePatrols:: _coords = %1 | _noVehiclePatrols = %2 | _aiDifficultyLevel = %3",_coords,_noVehiclePatrols,_aiDifficultyLevel];
};
#endif
private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_randomVehicle","_return","_abort"];
private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_vehicle","_return","_abort"];
_vehicles = [];
_missionAI = [];
_abort = false;
_vehiclePatrolSpawns = [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius;
_useRelativePos = false;
if (_missionPatrolVehicles isEqualTo []) then
{
_vehiclePatrolSpawns = [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius;
{
private _v = selectRandom blck_AIPatrolVehicles;
//diag_log format["_fnc_spawnMissionVehiclePatrols (36):: position = %1 and vehicle = %2",_x, _v];
_missionPatrolVehicles pushBack [_v, _x];
}forEach _vehiclePatrolSpawns;
} else {
_useRelativePos = true;
};
{
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols:: _x = %1 and _coords = %2",_x,_coords];
};
#endif
private ["_spawnPos"];
_spawnPos = _x;
if (_useRelativePos) then
{
_spawnPos = _coords vectorAdd (_x select 1)
} else {
_spawnPos = _x select 1;
};
_vehicle = _x select 0;
_vehGroup = [_spawnPos,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup;
if (isNull _vehGroup) exitWith
{
@ -48,27 +71,24 @@ _vehiclePatrolSpawns = [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPosit
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols: group spawned = %1",_vehGroup];
diag_log format["_fnc_spawnMissionVehiclePatrols (40):: -> _missionType = %3 _vehGroup = %1 and units _vehGroup = %2",_vehGroup, units _vehGroup,_missionType];
//diag_log format["_fnc_spawnMissionVehiclePatrols (40):: -> _missionType = %3 _vehGroup = %1 and units _vehGroup = %2",_vehGroup, units _vehGroup,_missionType];
};
#endif
_randomVehicle = selectRandom blck_AIPatrolVehicles;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols: _randomVehicle = %1",_randomVehicle];
diag_log format["_fnc_spawnMissionVehiclePatrols:: -> randomly selected vehicle = %1",_randomVehicle];
diag_log format["_fnc_spawnMissionVehiclePatrols(66): will spawn vehicle %1 at position %2",_vehicle,_spawnPos];
};
#endif
//params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]];
_patrolVehicle = [_coords,_spawnPos,_randomVehicle,35,45,_vehGroup] call blck_fnc_spawnVehiclePatrol;
_vehGroup setVariable["groupVehicle",_randomVehicle];
_patrolVehicle = [_coords,_spawnPos,_vehicle,35,45,_vehGroup] call blck_fnc_spawnVehiclePatrol;
_vehGroup setVariable["groupVehicle",_vehicle];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols (65):: - > patrol vehicle spawned was %1",_patrolVehicle];
diag_log format["_fnc_spawnMissionVehiclePatrols (76):: - > patrol vehicle spawned was %1",_patrolVehicle];
};
#endif
@ -82,11 +102,11 @@ _vehiclePatrolSpawns = [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPosit
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols:: -- > _vehicles updated to %1",_vehicles];
diag_log format["_fnc_spawnMissionVehiclePatrols(91):: -- > _vehicles updated to %1",_vehicles];
};
#endif
} forEach _vehiclePatrolSpawns;
} forEach _missionPatrolVehicles;
blck_monitoredVehicles append _vehicles;
_return = [_vehicles, _missionAI, _abort];

View File

@ -51,10 +51,10 @@ if (_time > (_sunset + 0.5) || _time < (_sunrise - 0.5)) exitWith {
// Day
if (_time > (_sunrise + 0.5) && _time < (_sunset - 0.5)) exitWith {
setTimeMultiplier blck_timeAccelerationDay;
diag_log format["DAYTIME ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["DAYTIME ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
};
#endif

View File

@ -14,7 +14,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_unit","_instigator","_group","_wp"];
//diag_log format["_EH_AIHit::-->> _this = %1",_this];
diag_log format["_EH_AIHit::-->> _this = %1",_this];
_unit = _this select 0 select 0;
_instigator = _this select 0 select 3;
@ -39,7 +39,7 @@ _wp setWaypointCombatMode "RED";
if (_unit getVariable ["hasHealed",false]) exitWith {};
if ((damage _unit) > 0.1 ) then
{
//diag_log format["_EH_AIHit::-->> Healing unit %1",_unit];
diag_log format["_EH_AIHit::-->> Healing unit %1",_unit];
_unit setVariable["hasHealed",true,true];
_unit addMagazine "SmokeShellOrange";
_unit fire "SmokeShellMuzzle";

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