Skip to content

Commit

Permalink
Updated version 1.3.4.2 + not used C-Ram
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshi-E committed Jul 5, 2018
1 parent 1a02713 commit 53c6586
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 11 deletions.
73 changes: 73 additions & 0 deletions Addons/C_Ram/cram.sqf
@@ -0,0 +1,73 @@
if(!isServer)exitWith{};

private["_chance","_rand","_cram"];

_cram = _this select 0;
_gatID = _this select 1;
_incoming = [];
_scanDis = FSG_CRAMRANGE;
_engageRange = FSG_ENGAGERANGE;
_radarOffset = FSG_RADAROFFSET;

sleep 1;
while{alive _cram}do{
sleep 1;
if(FSG_USE_MAINRADAR && alive FSG_MAINRADAR_NAME)then{
_incoming = +FSG_INCOMING;
}else{
if(FSG_USE_CRAMRADAR)then{
_incoming = _cram nearObjects ["MissileBase",_scanDis];
_incoming = _incoming + (_cram nearObjects ["RocketBase",_scanDis]);
_incoming = _incoming + (_cram nearObjects ["ShellBase",_scanDis]);
if(FSG_DEBUG)then{FSG_INCOMING = +_incoming;hint format["Incoming: %1 \n Using CRAM Radar \n CRAMs Online: %2 \n SAMs Online: %3",(count _incoming),FSG_CRAMCOUNT,FSG_SAMCOUNT]};
}else{
_incoming = [];
if(FSG_DEBUG)then{FSG_INCOMING = +_incoming;hint format["Incoming: %1 \n Using CRAM Radar \n CRAMs Online: %2 \n SAMs Online: %3",(count _incoming),FSG_CRAMCOUNT,FSG_SAMCOUNT]};
};
};

if(count _incoming > _gatID)then{
_cram disableAI "TARGET";
_cram disableAI "AUTOTARGET";
sleep 0.2;
_incomingRound = _incoming select _gatID;
_fromTarget = _incomingRound getDir _cram;
_targetDir = direction _incomingRound;
if(_targetDir < _fromTarget + (_radarOffset/2) && _targetDir > _fromTarget - (_radarOffset/2) && ((getPos _incomingRound) select 2) > 30 && alive _incomingRound)then{
_cram addMagazine FSG_MAG_OVERRIDE;
_cram addWeapon FSG_WEP_OVERRIDE;
_cram doWatch _incomingRound;
sleep 0.2;
_chance = 100;
_watchIdle = (getPos _cram);
_watchIdle set [2, (_watchIdle select 2) + 100];
_cram doWatch _watchIdle;
while{alive _incomingRound && ((getPos _incomingRound) select 2) > 50 && _chance > 0 && _cram distance _incomingRound < _engageRange}do{
_target = "Land_HelipadEmpty_F" createVehicle [0,0,0]; //Very bad but i have no idea how to do this otherwise, let me know
_leadPrediction = (((_cram distance _incomingRound) / 4032) * (speed _incomingRound)) / (_cram distance _incomingRound);
_zeroing = ((_cram distance _incomingRound) / 100) * 8;
_target attachTo [_incomingRound,[0,_leadPrediction,_zeroing]];
_cram doWatch _target;
if(alive _target && alive _incomingRound)then{
_cram fire FSG_WEP_OVERRIDE;
};
//_cram fire (currentWeapon _cram);
sleep 0.01;
deleteVehicle _target;
if(_cram distance _incomingRound < _engageRange && alive _incomingRound && _cram distance _incomingRound > 40)then{
_rand = random[0,1,2];
_chance = _chance - _rand;
};
};
if(alive _incomingRound && _incomingRound distance _cram < _engageRange && _cram distance _incomingRound > 40)then{
sleep 1;
_exp = "helicopterexplosmall" createVehicle getPos _incomingRound;
deleteVehicle _incomingRound;
};
};
_cram enableAI "TARGET";
_cram enableAI "AUTOTARGET";
};
Sleep FSG_SLEEPCYCLE;
};
FSG_CRAMCOUNT = FSG_CRAMCOUNT - 1;
68 changes: 68 additions & 0 deletions Addons/C_Ram/init.sqf
@@ -0,0 +1,68 @@
if(!isServer)exitWith{};
//EDIT THESE

FSG_CRAM_ENABLED = FALSE;
FSG_DEBUG = FALSE;
FSG_CRAM_GATLING_CN = "B_AAA_System_01_F"; //Classname of Gatling type CRAMs (def. Praetorian)
FSG_CRAM_SAM_CN = "B_SAM_System_02_F"; //Classname of Missile type CRAMs (def. Mk21 Centurion)

FSG_USE_WEPOVERRIDE = TRUE; //Use weapon override
FSG_WEP_OVERRIDE = "Gatling_30mm_Plane_CAS_01_F"; //Weapon override for Gatling weapons (def. 30mm CAS)
FSG_MAG_OVERRIDE = "1000Rnd_Gatling_30mm_Plane_CAS_01_F"; //Magazine override for Gatling weapons (def. 30mm CAS red tracer)

FSG_USE_MAINRADAR = FALSE; //Use a single radar for all CRAMs (Reduces lag by quite alot)
FSG_MAINRADAR_NAME = objNull; //Use objNull if not using. (Otherwise place radar on map and name it something)
FSG_USE_CRAMRADAR = TRUE; //Use CRAMs own radar if Main not in use/destroyed
FSG_INCOMING = []; //Main array to store incoming rounds (Main Radars)

FSG_MAINRADAR_SCANDIS = 3000; //Main radar range
FSG_CRAMRANGE = 2000; //CRAM Radar Range
FSG_ENGAGERANGE = 1700; //CRAM Engage Range
FSG_RADAROFFSET = 50; //Incoming must be pointing towards cram in this range to be shot down

FSG_SLEEPCYCLE = 1; //Sleep control for almost everything (Increase if heavy lag)

FSG_CRAMINDEX = 0;
FSG_CRAMCOUNT = 0;
FSG_SAMCOUNT = 0; //Counts how many Crams/Sams are online
FSG_TARGETCOUNT = 0;


/*
if(FSG_USE_MAINRADAR)then{
_null=[FSG_MAINRADAR_NAME]spawn{
private["_radar","_scanDis","_incoming"];
_radar = _this select 0;
_scanDis = FSG_MAINRADAR_SCANDIS;
while{alive _radar}do{
_incoming = _radar nearObjects ["MissileBase",_scanDis];
_incoming = _incoming + (_radar nearObjects ["RocketBase",_scanDis]);
_incoming = _incoming + (_radar nearObjects ["ShellBase",_scanDis]);
FSG_INCOMING = +_incoming;
if(FSG_DEBUG)then{hint format["Incoming: %1 \n Using Main Radar \n CRAMs Online: %2 \n SAMs Online: %3",(count FSG_INCOMING),FSG_CRAMCOUNT,FSG_SAMCOUNT]}; //Show incoming (all crams)
Sleep FSG_SLEEPCYCLE;
};
};
};
{
if(_x isKindOf FSG_CRAM_GATLING_CN)then{
if((side _x) == West)then{
private["_gatID"];
_gatID = FSG_CRAMCOUNT;
FSG_CRAMCOUNT = FSG_CRAMCOUNT + 1;
_null = [_x,_gatID] execVM "scripts\cram\cram.sqf";
};
};
} forEach vehicles;
{
if(_x isKindOf FSG_CRAM_SAM_CN)then{
if((side _x) == West)then{
private["_gatID"];
_gatID = FSG_CRAMCOUNT + FSG_SAMCOUNT;
FSG_SAMCOUNT = FSG_SAMCOUNT + 1;
_null = [_x,_gatID] execVM "scripts\cram\sam.sqf";
};
};
} forEach vehicles;*/
4 changes: 2 additions & 2 deletions Addons/Strat_mode/Functions/SM_MapEntities.sqf
Expand Up @@ -157,7 +157,7 @@ _ug=units player;
if(count ((_side) call CTI_CO_FNC_GetSideUpgrades) >= CTI_UPGRADE_DATA) then {
if(((_side) call CTI_CO_FNC_GetSideUpgrades) select CTI_UPGRADE_DATA == 1) then {
//If the vehicle is detected by enemy diffrent color is used.
if(_object getvariable["CTI_HUD_Detected_east", false]) then {
if(_side == east && _object getvariable["CTI_HUD_Detected_east", false]) then {
_color = switch (_side) do
{
case west:{ [0,0,1,1] }; ///remains unchanged
Expand All @@ -167,7 +167,7 @@ _ug=units player;
};
};

if(_object getvariable["CTI_HUD_Detected_west", false]) then {
if(_side == west && _object getvariable["CTI_HUD_Detected_west", false]) then {
_color = switch (_side) do
{
case west:{ [0,0.3,0.6,1] }; //color when detected by enenmy
Expand Down
4 changes: 2 additions & 2 deletions Rsc/Game.hpp
Expand Up @@ -4,11 +4,11 @@ respawnDelay = 10;
respawnDialog = false;

//--- Require briefing.html to show up.
onLoadMission = "BECTI - Zerty/HTom/Yoshi_E 1.3.4.1";
onLoadMission = "BECTI - Zerty/HTom/Yoshi_E 1.3.4.2";
onLoadMissionTime = false;
onLoadName = "BECTI - Zerty/HTom/Yoshi_E";

briefingName = "BECTI - Zerty/HTom/Yoshi_E 1.3.4.1";
briefingName = "BECTI - Zerty/HTom/Yoshi_E 1.3.4.2";

//--- ArmA 3 Specifics
dev = "Benny";
Expand Down
5 changes: 5 additions & 0 deletions Server/Functions/Server_BuildDefense.sqf
Expand Up @@ -138,6 +138,11 @@ if (_defense isKindOf "B_AAA_System_01_F" || _defense isKindOf "B_SAM_System_01_
_defense setVehicleLock "LOCKED";
sleep 30;
_defense setPos [_def_pos select 0,_def_pos select 1,(_def_pos select 2) +0.1];

if (_defense isKindOf "B_AAA_System_01_F" && FSG_CRAM_ENABLED) then {
FSG_CRAMINDEX = FSG_CRAMINDEX +1;
_null = [_defense, FSG_CRAMINDEX] execVM "Addons\C_Ram\cram.sqf";
};
};


Expand Down
1 change: 1 addition & 0 deletions Server/Init/Init_Server.sqf
Expand Up @@ -60,6 +60,7 @@ call compile preprocessFileLineNumbers "Server\Functions\FSM\Functions_FSM_Updat

execVM "Server\Init\Init_Prison.sqf";
execVM "Addons\Strat_mode\Functions\TUTORIAL_Init.sqf";
execVM "Addons\C_Ram\init.sqf";

CTI_Structure_Lock=False;
CTI_Worker_Lock=False;
Expand Down
4 changes: 2 additions & 2 deletions changelog.sqf
@@ -1,6 +1,6 @@

player createDiarySubject ["TS", "TeamSpeak"];
player createDiaryRecord ["TS",["JMW","ts.jammywarfare.eu"]];
player createDiarySubject ["DS", "Discord"];
player createDiaryRecord ["DS",["JMW","https://discord.gg/YhBUUSr"]];

player createDiarySubject ["Dev", "Mission Homepage"];
player createDiaryRecord ["Dev",["Licencing","The mission is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.<br/><br/>
Expand Down
19 changes: 15 additions & 4 deletions mission.sqm
Expand Up @@ -8,11 +8,11 @@ class EditorData
toggles=1025;
class ItemIDProvider
{
nextID=177;
nextID=178;
};
class MarkerIDProvider
{
nextID=61;
nextID=62;
};
class Camera
{
Expand Down Expand Up @@ -105,7 +105,7 @@ class Mission
{
class Intel
{
briefingName="BECTI BE 0.97 - Zerty 1.3.4.1";
briefingName="BECTI BE 0.97 - Zerty 1.3.4.2";
overviewText="By Benny - Adapted from OFP era MFCTI (Mike Melvin)";
resistanceWest=0;
timeOfChanges=24720;
Expand All @@ -123,7 +123,7 @@ class Mission
};
class Entities
{
items=123;
items=124;
class Item0
{
dataType="Marker";
Expand Down Expand Up @@ -3009,6 +3009,17 @@ class Mission
id=172;
type="Logic";
};
class Item123
{
dataType="Marker";
position[]={505.74133,0,30224.15};
name="marker_61";
text="Visit our Discord: https://discord.gg/YhBUUSr";
type="mil_warning";
colorName="ColorWEST";
id=177;
atlOffset=191.07422;
};
};
class Connections
{
Expand Down
2 changes: 1 addition & 1 deletion mission.sqm.oldBackup
Expand Up @@ -26,7 +26,7 @@ class Mission
randomSeed=7374927;
class Intel
{
briefingName="BECTI BE 0.97 - Zerty 1.3.2.1";
briefingName="BECTI BE 0.97 - Zerty 1.3.4.2";
overviewText="By Benny - Adapted from OFP era MFCTI (Mike Melvin)";
resistanceWest=0;
timeOfChanges=24720;
Expand Down

0 comments on commit 53c6586

Please sign in to comment.