Animated Heli Crashes

This commit is contained in:
He-Man 2019-09-24 21:23:46 +02:00
parent 8a412c0da1
commit 05ececddc1
6 changed files with 180 additions and 6 deletions

View File

@ -26,6 +26,7 @@ forceRestartTime = 14400; // 4 hour restarts
},
// { 1800, "PaydayEvent", 0, 2},
// { 1200, "MessageServer", 0, 2},
{ 1200, "HeliCrash", 0 , 2, -1, {} ,{"VR"}},
{ 2700, "AirDrop", 0 , 2, -1, {} ,{"VR"}},
{ 2400, "EarthQuake", 0 , 2, -1, {} ,{"VR"}},
{ 2700, "Satellite", 0 , 2, -1, {} ,{"VR"}},

View File

@ -216,9 +216,9 @@ class CfgMarkerSets
};
class HeliCrash {
markerArray[] = {
{"","ICON","EpochActive_Circle","ColorOrange",1,{0.6,0.6}},
{"","ICON","EpochActive_Circle","ColorYellow",1,{0.6,0.6}},
{"","ICON","EpochBG_Circle","ColorWhite",0.15,{0.6,0.6}},
{"","ICON","EpochHeli2","ColorOrange",1,{0.5,0.5}}
{"","ICON","EpochHeli2","ColorYellow",1,{0.5,0.5}}
};
};
};

View File

@ -15,7 +15,7 @@
//[[[cog import generate_private_arrays ]]]
private ["_config","_debug","_exit","_loop","_lootItemArray","_lootItemWeightedArray","_lootTable","_lootTableClass","_lootTableIndex","_loots","_magazineSize","_mags","_maxLoot","_maxPayout","_minLoot","_pricingConfig","_quan","_randomItem","_randomItemArray","_randomizeMagazineAmmoCount","_weightedItemArray"];
//[[[end]]]
params ["_object","_type",["_forceSpawn",false],["_pos",[]] ];
params ["_object","_type",["_forceSpawn",false],["_pos",[]],["_scatter",[]]];
_debug = true;
_pricingConfig = 'CfgPricing' call EPOCH_returnConfig;
@ -25,11 +25,12 @@ if !(EPOCH_forcedLootSpawnTable isEqualTo "") then {
_lootTableClass = EPOCH_forcedLootSpawnTable;
};
_randomizeMagazineAmmoCount = ["CfgEpochClient", "randomizeMagazineAmmoCount", true] call EPOCH_fnc_returnConfigEntryV2;
if (isnull _object && !(_pos isequalto [])) then {
if (isnull _object && !(_pos isequalto []) && (_scatter isequalto [])) then {
_object = createVehicle ["groundWeaponHolder",_pos,[],0,"CAN_COLLIDE"];
_object setPosATL _pos;
};
if !(isNull _object) then{
if (!isNull _object || !(_scatter isequalto [])) then{
_scatter params [["_doScatter",false],["_ScatterRadiusArr",[6,12]]];
_lootTable = ["CfgMainTable", _type, "tables"] call EPOCH_fnc_weightedArray;
if !(_lootTable isEqualTo []) then {
_loots = [];
@ -41,6 +42,11 @@ if !(isNull _object) then{
_loots pushBack (selectRandomWeighted _lootTable);
};
{
if (_doScatter) then {
_randomPos = [_pos,_ScatterRadiusArr call BIS_fnc_randomInt,[0,359] call BIS_fnc_randomInt] call BIS_fnc_relPos;
_object = createVehicle ["groundweaponholder",_randomPos,[],0,"CAN_COLLIDE"];
_object setPosATL [_randomPos select 0, _randomPos select 1, 0.1];
};
_lootItemWeightedArray = [_lootTableClass, _x, "items"] call EPOCH_fnc_weightedArray;
if !(_lootItemWeightedArray isEqualTo[]) then {
_randomItemArray = selectRandomWeighted _lootItemWeightedArray;

View File

@ -0,0 +1,141 @@
_cfgEpoch = configFile >> "CfgEpoch" >> worldname;
_debug = if(getNumber(_cfgEpoch >> "debugHeliCrashes") isEqualTo 1)then{true}else{false};
_limit = getNumber(_cfgEpoch >> "maxSpawnedHeliCrashes");
_counter = missionNameSpace getVariable["EPOCH_HeliCrashCounter",0];
_others = missionNameSpace getVariable["EPOCH_HeliCrashes", [[0,0,0]] ];
_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherHeliCrashes");
//STOP THE SCRIPT AND EXIT IF THE COUNTER IS TOO HIGH.
if (_counter >= _limit) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed HELICRASH spawn over limit"};
};
// decrease chance with more players
if (count (allplayers select {alive _x}) == 0) exitwith {};
_chance = 0.1 + (linearConversion [1, 100, (count allPlayers), 0, 0.5, true]);
if ((random 1) < _chance) then {
_position = [0,0,0];
for "_i" from 0 to 100 step 1 do {
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 5, 0, 1000, 0] call BIS_fnc_findSafePos;
_goodPos = true;
_goodPos = [_position, true, true, false, _others, _distFromOthers] call EPOCH_server_isNearChecks;
if(_goodPos)then{
_i = 100;
}else{
_position = [];
};
};
if ((count _position) == 2) then{
_values = getArray(_cfgEpoch >> "availableHeliCrashes");
if (_values isEqualTo []) exitwith {
if (_debug) then {diag_log "DEBUG: suppressed HELICRASH no HeliClasses defined"};
};
_veharray = selectrandom _values;
_startpos = [_position, 0, 3000, 5, 0, 1000, 0] call BIS_fnc_findSafePos;
if ((count _startpos) > 2) then {
_startpos = [3000,3000];
};
_startpos set [2,600];
_veh = createVehicle [_veharray select 0, _startpos, [], 0, "FLY"];
_veh setpos _startpos;
_veh call EPOCH_server_setVToken;
_group = creategroup east;
_unit = _group createUnit["I_Soldier_EPOCH", [0,0,0], [], 0, "FORM"];
_unit moveInDriver _veh;
_veh flyinheight 200;
for '_i' from 0 to 3 do {
_group move _position;
uisleep 30;
};
_time = diag_ticktime;
waituntil {uisleep 0.5; !(surfaceiswater (getpos _veh)) || diag_ticktime - _time > 60};
deletevehicle _unit;
uisleep 2;
_veh setdamage 1;
_starttime = diag_ticktime;
waituntil {uisleep 0.25; ((getpos _veh) select 2) < 2 || diag_ticktime > _starttime+30};
_pos = getposatl _veh;
_pos set [2,0];
deletevehicle _veh;
uisleep 0.5;
if !(surfaceiswater _pos) then {
_veh = createVehicle [_veharray select 1, _pos, [], 0, "CAN_COLLIDE"];
_veh setvectorup [0,0,1];
_veh setPosatl _pos;
[objnull,"HeliCrash",false,_pos,[true,[6,12]]] call EPOCH_serverLootObject;
// Place markers and get decay, compromised and original colors
_markers = [];
_originalColors = [];
_showMarkers = if(getNumber(_cfgEpoch >> "showHeliCrashMarkers") isEqualTo 1)then{true}else{false};
_decayMarkerColor = getText(_cfgEpoch >> "heliCrashDecayMarkerColor");
_compromisedColor = getText(_cfgEpoch >> "heliCrashCompromisedColor");
if (_showMarkers) then{
_markers = ["HeliCrash",_pos] call EPOCH_server_createGlobalMarkerSet;
{
_originalColors pushBack (getMarkerColor _x);
}forEach _markers;
// Check for HeightenedPlayerVsPlayer false and remove comprimised coloring
if!(getNumber(_cfgEpoch >> "HeightenedPlayerVsPlayer") isEqualTo 1)then{
_compromisedColor = getMarkerColor (_markers select 0);
};
};
// Tick Counter +1
_counter = _counter + 1;
missionNameSpace setVariable["EPOCH_HeliCrashCounter",_counter];
// ADD POSITION TO OTHERS ARRAY
missionNameSpace setVariable["EPOCH_HeliCrashes", _others + [_pos]];
// SEND EVENT TO MONITOR
_decayTime = getNumber(_cfgEpoch >> "HeliCrashDecayTime");
_serverSettingsConfig = configFile >> "CfgEpochServer";
_timeMultiplier = ([_serverSettingsConfig, "timeMultiplier", 1] call EPOCH_fnc_returnConfigEntry);
_rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]];
_thisEvent = [_pos, [_veh], [], "EPOCH_HeliCrashCounter", diag_tickTime, (_decayTime * _timeMultiplier), _showMarkers, _markers, _originalColors, _decayMarkerColor, _compromisedColor];
missionNameSpace setVariable["EPOCH_RunningEvents",_rEvents + [_thisEvent]];
_effects = [];
{
_x params ["_distance","_effect","_sleep"];
{
if (!isnull _x) then {
deletevehicle _x;
};
} foreach _effects;
if (isnull _veh) exitwith {};
_effects = [];
_fireArray = switch _effect do {
case "FIRE_BIG": {
["BigDestructionFire","BigDestructionSmoke"]
};
case "SMOKE_MID": {
["","MediumSmoke"]
};
case "SMOKE_BIG": {
["","BigDestructionSmoke"]
};
default {[]};
};
if !(_fireArray isEqualTo []) then {
_fireArray params ["_fire","_smoke"];
if (_fire != "") then {
_eFire = "#particlesource" createVehicle (position _veh) ;
_eFire setParticleClass _fire;
_eFire attachto [_veh, [0,0,-1]];
_effects pushback _eFire;
};
if (_smoke != "") then {
_eSmoke = "#particlesource" createVehicle (position _veh);
_eSmoke setParticleClass _smoke;
_eSmoke attachto [_veh, [0,0,-1]];
_effects pushback _eSmoke;
};
};
waituntil {uisleep _sleep; !((_pos nearentities _distance) select {isplayer _x} isequalto []) || isnull _veh};
} foreach [[200,"FIRE_BIG",15],[100,"SMOKE_BIG",5],[50,"SMOKE_MID",2]];
};
};
};

View File

@ -183,9 +183,10 @@ class CfgEpoch
showHeliCrashMarkers = 1;
maxSpawnedHeliCrashes = 4;
distFromOtherHeliCrashes = 2000;
HeliCrashDecayTime = 2400;
heliCrashDecayMarkerColor = "ColorBrown"; // decay changes icon (_markers select 2)
heliCrashCompromisedColor = "ColorRed"; // compromised changes active surround (_markers select 0)
availableHeliCrashes[] = {"Land_Wreck_Heli_Attack_01_F","Land_Wreck_Heli_Attack_02_F"};
availableHeliCrashes[] = {{"O_Heli_Attack_02_F","Land_Wreck_Heli_Attack_02_F"},{"B_Heli_Attack_01_F","Land_Wreck_Heli_Attack_01_F"}};
heliCrashCustomLocs[] = {};
propsPos[] = {

View File

@ -598,6 +598,31 @@ class CfgMainTable
{ "Grenades", 2 }
};
};
class HeliCrash
{
lootMin = 10;
LootMax = 20;
tables[] = {
{ "SniperRifle", 1 },
{ "Generic", 5 },
{ "Sodas", 4 },
{ "CanFood", 4 },
{ "Rifle", 3 },
{ "Machinegun", 2 },
{ "Tools", 2 },
{ "Pistols", 3 },
{ "Scopes", 2 },
{ "Bipods", 2 },
{ "Muzzles", 2 },
{ "Medical", 2 },
{ "Explosives", 2 },
{ "HighExplosives", 1 },
{ "Backpack", 1 },
{ "Uniforms", 1 },
{ "Vests", 1 },
{ "HeadgearArmored", 2 }
};
};
class Mission_Payout1
{
lootMin = 4;