Sarge-AI/sarge/code/init_base_guards.sqf

71 lines
2.8 KiB
Plaintext
Raw Normal View History

2017-10-26 01:36:31 +00:00
/*
# Original #
Sarge AI System 1.5
Created for Arma 2: DayZ Mod
Author: Sarge
https://github.com/Swiss-Sarge
# Fork #
Sarge AI System 2.0+
Modded for Arma 3: Exile Mod
Changes: Dango
https://www.hod-servers.com
*/
private["_sizeX","_sizeY","_snipers","_rifleMen","_sizeOfBase","_marker","_markername","_tMark","_flagPoles","_baseLevel","_baseName"];
//if (!isServer) exitWith {};
_flagPoles = nearestObjects [getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition"), ["Exile_Construction_Flag_Static"], 25000];
diag_log format ["Sarge AI System: Starting territory guards for %1!",worldName];
{
_baseName = _x getVariable ["ExileTerritoryName",""];
_sizeOfBase = _x getVariable ["ExileTerritorySize",0];
_fakeFlag = _x getVariable ["ExileDatabaseID", 0];
if (_fakeFlag == 0) then {
} else {
_padding = 5;
_spawnRadius = _sizeOfBase + _padding;
switch (_sizeOfBase) do {
case default {_rifleMen = 1; _snipers = 0; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 15: {_rifleMen = 1; _snipers = 0; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 30: {_rifleMen = 1; _snipers = 0; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 45: {_rifleMen = 2; _snipers = 0; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 60: {_rifleMen = 2; _snipers = 0; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 75: {_rifleMen = 1; _snipers = 1; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 90: {_rifleMen = 1; _snipers = 1; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 105: {_rifleMen = 2; _snipers = 1; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 120: {_rifleMen = 2; _snipers = 1; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 135: {_rifleMen = 2; _snipers = 2; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
case 150: {_rifleMen = 2; _snipers = 2; _sizeX = _spawnRadius; _sizeY = _spawnRadius;};
};
if (SAR_debug) then {
diag_log format ["Sarge AI System: Now Processing Territory %1 at Location %2 with a size of %3.",_baseName,(getPosATL _x),_sizeOfBase];
};
_baseMarker = format["Gaurd_Marker_%1",_baseName];
_spawnMark = createMarkerLocal [_baseMarker,(getPosATL _x)];
_spawnMark setMarkerShape "ELLIPSE";
_spawnMark setMarkerType "Flag";
_spawnMark setMarkerBrush "Solid";
_spawnMark setMarkerSize [_sizeX,_sizeY];
_spawnMark setMarkeralpha 0;
_behaviors = ["fortify"];
_behavior = _behaviors call BIS_fnc_selectRandom;
[_x,_spawnMark,2,_snipers,_rifleMen,_behavior,false,5200] call SAR_fnc_AI_guards;
s_player_guardToggle = _x addaction [format[("<t color=""#FFFFFF"">" + ("Make guards hostile") +"</t>"),""],"\addons\sarge\code\scripts\toggle_base_guards.sqf",_x,1,false,true,"",""];
};
} forEach _flagPoles;
diag_log format ["Sarge AI System: Territory guards have completed successfully!",worldName,(count _flagPoles)];