events overhaul

Streamline all events to Events Monitor within Server Monitor fsm.
Cycles and removes events as they decay or are looted.
This commit is contained in:
DESKTOP-UH65DCE\MusTanG 2017-11-12 17:39:03 -06:00
parent de1e15374b
commit 8fb45fc35c
10 changed files with 1077 additions and 585 deletions

View File

@ -13,29 +13,39 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_looting/EPOCH_server_spawnBoatLoot.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_worldSize","_shipwrecks","_total","_count","_distFromOthers","_tooClose","_spawnedLoot","_wreck","_item","_markers"];
private ["_cfgEpoch","_debug","_showBoatMarkers","_decayMarkerColor","_compromisedColor","_worldSize","_shipwrecks","_total","_count","_distFromOthers","_tooClose","_spawnedLoot","_wreck","_item","_markers","_position","_debugMkr","_heightenedPVP"];
//[[[end]]]
_cfgEpoch = configFile >> "CfgEpoch" >> worldname;
_debug = if(getNumber(_cfgEpoch >> "debugShipwreckLoot") isEqualTo 1)then{true}else{false};
_showBoatMarkers = if(getNumber(_cfgEpoch >> "showBoatLootMarkers") isEqualTo 1)then{true}else{false};
_decayMarkerColor = getText(_cfgEpoch >> "shipwreckDecayMarkerColor");
_compromisedColor = getText(_cfgEpoch >> "shipwreckCompromisedColor");
_heightenedPVP = if(getNumber(_cfgEpoch >> "HeightenedPlayerVsPlayer") isEqualTo 1)then{true}else{false};
_markers = [];
_originalColors = [];
if (getNumber(_cfgEpoch >> "shipwreckLootEnabled") isEqualTo 1) then {
_worldSize = worldSize/2;
_shipwrecks = nearestTerrainObjects [ [_worldSize, _worldSize], ["SHIPWRECK"], _worldSize];
_total = getNumber(_cfgEpoch >> "maxSpawnedShipwrecks");
if(_shipwrecks isEqualTo [])exitWith{diag_log "EPOCHDebug: no shipwrecks found"};
if(_total isEqualTo 0)exitWith{diag_log "EPOCHDebug: no shipwrecks allowed"};
if(_shipwrecks isEqualTo [])exitWith{if(_debug)then{diag_log "EPOCHDebug: no shipwrecks found"}};
if(_total isEqualTo 0)exitWith{if(_debug)then{diag_log "EPOCHDebug: no shipwrecks allowed"}};
_count = count(_shipwrecks);
if(_count < _total)then{diag_log "EPOCHDebug: not enough shipwrecks to fill your needs on this map, trying all available locations!"};
if(_count < _total)then{if(_debug)then{diag_log "EPOCHDebug: not enough shipwrecks to fill your needs on this map, trying all available locations!"}};
_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherShipwrecks");
_spawnedLoot = [];
for "_i" from 1 to _total do {
if(_shipwrecks isEqualTo [])exitWith{diag_log "EPOCHDebug: no more shipwrecks found"};
if(_shipwrecks isEqualTo [])exitWith{if(_debug)then{diag_log "EPOCHDebug: no more shipwrecks found"}};
_tooClose = false;
_wreck = selectRandom _shipwrecks;
if(isNil "_wreck")exitWith{};
{
if(!(_spawnedLoot isEqualTo []) && ((_wreck distance _x) < _distFromOthers))exitWith{
diag_log "EPOCHDebug: Shipwreck too close to another shipwreck";
if(_debug)then{diag_log "EPOCHDebug: Shipwreck too close to another shipwreck"};
_tooClose = true;
_i = (_i - 1);
};
@ -46,12 +56,32 @@ if (getNumber(_cfgEpoch >> "shipwreckLootEnabled") isEqualTo 1) then {
_position = [_wreck,1,20,3,1,20,0] call BIS_fnc_findSafePos;
_item = createVehicle["container_epoch",_position, [], 0, "NONE"];
_spawnedLoot pushback _wreck;
if(_debug)then{
_debugMkr = createMarker [str(_position),_position];
_debugMkr setMarkerShape "ICON";
_debugMkr setMarkerType "mil_dot";
_debugMkr setMarkerColor "ColorRed";
};
_item setMass 220;
if (EPOCH_SHOW_BOATLOOT) then {
_item setVariable["EPOCH_Loot",false,true];
if (_showBoatMarkers) then {
_markers = ["Shipwreck",_wreck] call EPOCH_server_createGlobalMarkerSet;
{
_originalColors pushBack (getMarkerColor _x);
}forEach _markers;
};
// Check for HeightenedPlayerVsPlayer false and remove comprimised coloring
if((_showBoatMarkers) && !(_heightenedPVP))then{
_compromisedColor = getMarkerColor (_markers select 0);
};
_rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]];
_shipwreckEvent = [_position, [_item], [], "shipwreckCounter", diag_tickTime, 99999, _showBoatMarkers, _markers, _originalColors, _decayMarkerColor, _compromisedColor];
missionNameSpace setVariable["EPOCH_RunningEvents",_rEvents + [_shipwreckEvent]];
};
};
};
if(_debug)then{
diag_log format["EPOCHDebug: Safely spawned %1 loot container(s) at these shipwreck locations:%2",count _spawnedLoot , _spawnedLoot];
};
};

View File

@ -0,0 +1,55 @@
/*
EPOCH_server_isNearChecks
Author: DirtySanchez
Description:
Checks the position provided against distances configured for Traders, Jammers and Players.
_position - position on map
_traderCheck - BOOL - check _position distance near ProtectionZone_Invisible_F
_jammerCheck - BOOL - check _position distance near PlotPole_EPOCH
_playerCheck - BOOL - check _position distance near other Players
_others - ARRAY - positions to check with _distFromOthers
_distFromOthers - NUMBER - How far away from _others array in meters
*/
params [ ["_position",[]], ["_traderCheck",true], ["_jammerCheck",true], ["_playerCheck",true], ["_others",[[0,0,0]]], ["_distFromOthers",2000] ];
_distFromTraders = getNumber(_cfgEpoch >> "spawnDistanceFromTraders");
_distFromJammers = getNumber(_cfgEpoch >> "spawnDistanceFromJammers");
_distFromPlayers = getNumber(_cfgEpoch >> "spawnDistanceFromPlayers");
_return = true;
//CHECK FOR PROTECTED AREA WITIN CONFIG RANGE
if(_traderCheck)then{
_restricted = nearestObjects [_position, ["ProtectionZone_Invisible_F"], _distFromTraders];
if(count _restricted > 0) then {
_return = false;
};
};
//CHECK FOR JAMMERS IN THE AREA WITHIN CONFIG RANGE
if(_jammerCheck)then{
_jammers = nearestObjects[_position, ["PlotPole_EPOCH"], _distFromJammers];
if(count _jammers > 0) then {
_return = false;
};
};
//CHECK TO SEE IF PLAYERS WITHIN CONFIG RANGE
if(_playerCheck)then{
_playersNearby = _position nearEntities[["Epoch_Male_F", "Epoch_Female_F"], _distFromPlayers];
if(count _playersNearby > 0) then {
_return = false;
};
};
//CHECK FOR OTHERS
if!(_others isEqualTo [[0,0,0]])then{
{
if!(_x distance _position > _distFromOthers)then{
_return = false;
};
}forEach _others;
};
_return

View File

@ -125,6 +125,7 @@ class CfgServerFunctions
class server_removeMarker {};
class server_createGlobalMarkerSet {};
class server_deleteGlobalMarkerSet {};
class server_isNearChecks {};
};
class epoch_missions {
class Server_createObject {};

View File

@ -1,4 +1,4 @@
/*%FSM<COMPILE "F:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Server Monitor">*/
/*%FSM<COMPILE "C:\Program Files (x86)\Steam\steamapps\common\Arma 3 Tools\FSMEditor\scriptedFSM.cfg, Server Monitor">*/
/*%FSM<HEAD>*/
/*
item0[] = {"Init",0,250,600.000000,-575.000000,700.000000,-525.000000,0.000000,"Init"};
@ -12,7 +12,22 @@ item7[] = {"Events_Manager",4,218,599.992371,-192.435822,699.992371,-142.435822,
item8[] = {"Save_Vehicles",4,218,450.000000,-300.000000,550.000000,-250.000000,4.000000,"Save" \n "Vehicles"};
item9[] = {"Cleanup_Handler",4,218,750.000000,-450.000000,850.000000,-400.000000,8.000000,"Cleanup" \n "Handler"};
item10[] = {"Server_FPS",4,218,746.045227,-248.683014,846.045227,-198.683014,0.000000,"Server FPS"};
item11[] = {"Forced_Restart",4,4314,684.856567,-214.145233,784.856567,-164.145233,0.000000,"Forced" \n "Restart"};
item11[] = {"Forced_Restart",4,218,684.856567,-214.145233,784.856567,-164.145233,0.000000,"Forced" \n "Restart"};
item12[] = {"Events_Monitor",4,4314,516.730896,-213.251221,616.730896,-163.251221,0.000000,"Events" \n "Monitor"};
item13[] = {"_",-1,250,532.894043,-183.108612,548.753357,-175.178955,0.000000,""};
version=1;
class LayoutItems
{
class Item13
{
class ItemInfo
{
FontFace="Arial";
FontHeight=10;
lStyle=1;
};
};
};
link0[] = {0,1};
link1[] = {1,2};
link2[] = {2,3};
@ -24,17 +39,19 @@ link7[] = {2,8};
link8[] = {2,9};
link9[] = {2,10};
link10[] = {2,11};
link11[] = {3,2};
link12[] = {4,2};
link13[] = {5,2};
link14[] = {6,2};
link15[] = {7,2};
link16[] = {8,2};
link17[] = {9,2};
link18[] = {10,2};
link19[] = {11,2};
globals[] = {0.000000,0,0,0,0,640,480,1,5,6316128,1,275.180084,1161.319580,208.497711,-659.879456,898,884,1};
window[] = {2,-1,-1,-1,-1,864,104,1396,104,3,916};
link11[] = {2,12};
link12[] = {3,2};
link13[] = {4,2};
link14[] = {5,2};
link15[] = {6,2};
link16[] = {7,2};
link17[] = {8,2};
link18[] = {9,2};
link19[] = {10,2};
link20[] = {11,2};
link21[] = {12,2};
globals[] = {0.000000,0,0,0,0,640,480,1,6,6316128,1,275.180084,1161.319580,208.497711,-659.879456,896,844,1};
window[] = {2,-1,-1,-32000,-32000,984,224,1516,224,3,918};
*//*%FSM</HEAD>*/
class FSM
{
@ -45,6 +62,7 @@ class FSM
class Init
{
name = "Init";
itemno = 0;
init = /*%FSM<STATEINIT""">*/"diag_log ""Loaded Server FSM"";" \n
"" \n
"_cfgSecConf = (configFile >> ""CfgSecConf"");" \n
@ -54,6 +72,7 @@ class FSM
"_serverSettingsConfig = configFile >> ""CfgEpochServer"";" \n
"_ahInitAuthCfg = [_serverSettingsConfig, ""antihack_ahInitAuthCfg"", [0,180]] call EPOCH_fnc_returnConfigEntry;" \n
"_events = [_serverSettingsConfig, ""events"", []] call EPOCH_fnc_returnConfigEntry;" \n
"_events2Check = [];" \n
"" \n
"_initAhInitBanOrLog = _ahInitAuthCfg select 0;" \n
"_initTimeLimit = _ahInitAuthCfg select 1;" \n
@ -93,6 +112,7 @@ class FSM
"" \n
"_pvehTime = diag_tickTime;" \n
"_forcedrestartTimer = diag_tickTime;" \n
"_pvemTime = diag_tickTime;" \n
"" \n
"_instanceID = call EPOCH_fn_InstanceID;" \n
"" \n
@ -170,6 +190,7 @@ class FSM
/*%FSM<LINK "_">*/
class _
{
itemno = 1;
priority = 0.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
@ -184,6 +205,7 @@ class FSM
class Process
{
name = "Process";
itemno = 2;
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
@ -191,6 +213,7 @@ class FSM
/*%FSM<LINK "CMD_queue">*/
class CMD_queue
{
itemno = 4;
priority = 10.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
@ -208,9 +231,26 @@ class FSM
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Cleanup_Handler">*/
class Cleanup_Handler
{
itemno = 9;
priority = 8.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastObjectCleanup) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastObjectCleanup = diag_tickTime;" \n
"" \n
"// TODO need better way allMissionObjects is not performant" \n
"if (_cleanupItems isEqualTo []) then {" \n
" _cleanupItems = allMissionObjects ""groundWeaponHolder"" + entities ""WeaponHolderSimulated"";" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Cleanup">*/
class Cleanup
{
itemno = 6;
priority = 8.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
@ -225,24 +265,10 @@ class FSM
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Cleanup_Handler">*/
class Cleanup_Handler
{
priority = 8.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastObjectCleanup) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastObjectCleanup = diag_tickTime;" \n
"" \n
"// TODO need better way allMissionObjects is not performant" \n
"if (_cleanupItems isEqualTo []) then {" \n
" _cleanupItems = allMissionObjects ""groundWeaponHolder"" + entities ""WeaponHolderSimulated"";" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Save_Vehicles">*/
class Save_Vehicles
{
itemno = 8;
priority = 4.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
@ -271,6 +297,7 @@ class FSM
/*%FSM<LINK "Save_Players">*/
class Save_Players
{
itemno = 5;
priority = 3.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
@ -287,6 +314,7 @@ class FSM
/*%FSM<LINK "Vehicle_and_Player">*/
class Vehicle_and_Player
{
itemno = 3;
priority = 1.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
@ -326,9 +354,156 @@ class FSM
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Server_FPS">*/
class Server_FPS
{
itemno = 10;
priority = 0.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _serverFpsTime) > 30) && _serverFPSCheckFine"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_serverFpsTime = diag_tickTime;" \n
"" \n
"if (_oldFPS isEqualTo EPOCH_diag_fps) then {" \n
" _currentFPS = round(diag_fps);" \n
" if !(_oldFPS isEqualTo _currentFPS) then {" \n
" missionNamespace setVariable [""EPOCH_diag_fps"",_currentFPS,true];" \n
" _oldFPS = _currentFPS;" \n
" };" \n
"} else {" \n
" missionNamespace setVariable [""EPOCH_diag_fps"", compileFinal """",true];" \n
" _serverFPSCheckFine = false;" \n
"};" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Forced_Restart">*/
class Forced_Restart
{
itemno = 11;
priority = 0.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _forcedrestartTimer) > 20)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"// restart script" \n
"_forcedrestartTimer = diag_tickTime;" \n
"if (_scriptBasedRestart) then {" \n
" if (diag_tickTime >= _forceRestartTimeWarning) then {" \n
" if (!_serverLocked) then {" \n
" diag_log ""server shutdown: locked"";" \n
" _serverLocked = true;" \n
" [""lock""] call EPOCH_serverCommand;" \n
" } else {" \n
" if (allPlayers isEqualTo []) then {" \n
" [""shutdown""] call EPOCH_serverCommand;" \n
" diag_log ""server shutdown: now"";" \n
" };" \n
" };" \n
" _restartIn = round((_forceRestartTime-diag_tickTime)/60);" \n
" if (_prevRestartIn != _restartIn) then {" \n
" _prevRestartIn = _restartIn;" \n
" if (_restartIn > 1) then {" \n
" [""message"", format[""Server restart in %1 minutes"",_restartIn]] call EPOCH_serverCommand;" \n
" } else {" \n
" [""message"", format[""Server restart in %1 minute"",1]] call EPOCH_serverCommand;" \n
" };" \n
" };" \n
" };" \n
" // kick all remaining players before shutdown to force player save" \n
" if (diag_tickTime >= _forceRestartTime) then {" \n
" if (_serverRestarting) then {" \n
" [""shutdown""] call EPOCH_serverCommand;" \n
" diag_log ""server shutdown: now"";" \n
" } else {" \n
" {" \n
" [""kick"", _x , ""Server Restarting""] call EPOCH_serverCommand;" \n
" } forEach allPlayers;" \n
" _serverRestarting = true;" \n
" };" \n
" };" \n
"};" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Events_Monitor">*/
class Events_Monitor
{
itemno = 12;
priority = 0.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _pvemTime) > 5)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"// Epoch Events Monitor" \n
"_pvemTime = diag_tickTime;" \n
"_events2Check append (missionNamespace getVariable [""EPOCH_RunningEvents"", []]);" \n
"missionNamespace setVariable [""EPOCH_RunningEvents"", nil];" \n
"_newEventsArray = [];" \n
"{" \n
" _x params [""_position"", ""_objs"", ""_extraObjs"", ""_countName"", ""_timeStamp"", ""_decayTime"", ""_showMarkers"", ""_markers"", ""_originalColors"", ""_decayColor"", ""_interactedColor""];" \n
" _formatted = format[""EPOCH_%1"",_countName];" \n
" _current = missionNameSpace getVariable[_formatted,0];" \n
" // check objects" \n
" _objsLeft = [];" \n
" _nearPlayers = (count (_position nearEntities[[""Epoch_Male_F"", ""Epoch_Female_F""], 500]) > 0);" \n
" {" \n
" _isOpenLid = (_x animationPhase 'open_lid' > 0.5); " \n
" _isEPOCH_looted = (_x getVariable [""EPOCH_Loot"",false]);" \n
" _isOpenDoor = (_x animationPhase 'Door_1_rot' > 0.5);" \n
" if(!isNull _x)then{" \n
" _objsLeft pushBack _x;" \n
" };" \n
" if(!(_nearPlayers) && !(_objsLeft isEqualTo []))then{" \n
" if(((_x iskindof 'container_epoch') && {_isOpenLid || _isEPOCH_looted}) || ((_x iskindof 'Cargo_Container') && {_isOpenDoor || _isEPOCH_looted}) || (damage _x isEqualTo 1))then{" \n
" _objsLeft = _objsLeft - [_x];" \n
" };" \n
" };" \n
" }forEach _objs;" \n
" // check event" \n
" if (!(_nearPlayers) && {_objsLeft isEqualTo [] || (diag_tickTime - _timeStamp) > _decayTime}) then {" \n
" // event ends" \n
" missionNameSpace setVariable[_formatted,(_current - 1)];" \n
" if (_showMarkers) then{" \n
" [_markers] call EPOCH_server_deleteGlobalMarkerSet;" \n
" };" \n
" {deleteVehicle _x} forEach _objs;" \n
" {deleteVehicle _x} forEach _extraObjs;" \n
" }else{" \n
" // event continues" \n
" _newEventsArray pushBack _x;" \n
" // check for compromised objs or area" \n
" if (_showMarkers) then{" \n
" if((count(_objsLeft) != count(_objs)) || (count (_position nearEntities[[""Epoch_Male_F"", ""Epoch_Female_F""], 150]) > 0)) then {" \n
" if !((getMarkerColor (_markers select 0)) isEqualTo _interactedColor) then {" \n
" (_markers select 0) setMarkerColor _interactedColor;" \n
" };" \n
" }else{" \n
" if ((getMarkerColor (_markers select 0)) isEqualTo _interactedColor) then {" \n
" if !((diag_tickTime - _timeStamp) > (_decayTime/2)) then {" \n
" (_markers select 0) setMarkerColor (_originalColors select 0);" \n
" }else{" \n
" (_markers select 0) setMarkerColor _decayColor;" \n
" };" \n
" };" \n
" };" \n
" // check for decay and change to configured preset decay color" \n
" if ((diag_tickTime - _timeStamp) > (_decayTime/2)) then {" \n
" if !((getMarkerColor (_markers select 2)) isEqualTo _decayColor) then {" \n
" {" \n
" _x setMarkerColor _decayColor;" \n
" }forEach _markers;" \n
" };" \n
" };" \n
" };" \n
" };" \n
"} forEach _events2Check;" \n
"// remove expired events" \n
"_events2Check = _newEventsArray;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Events_Manager">*/
class Events_Manager
{
itemno = 7;
priority = 0.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
@ -401,75 +576,6 @@ class FSM
"_events = _newEvents;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Server_FPS">*/
class Server_FPS
{
priority = 0.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _serverFpsTime) > 30) && _serverFPSCheckFine"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_serverFpsTime = diag_tickTime;" \n
"" \n
"if (_oldFPS isEqualTo EPOCH_diag_fps) then {" \n
" _currentFPS = round(diag_fps);" \n
" if !(_oldFPS isEqualTo _currentFPS) then {" \n
" missionNamespace setVariable [""EPOCH_diag_fps"",_currentFPS,true];" \n
" _oldFPS = _currentFPS;" \n
" };" \n
"} else {" \n
" missionNamespace setVariable [""EPOCH_diag_fps"", compileFinal """",true];" \n
" _serverFPSCheckFine = false;" \n
"};" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Forced_Restart">*/
class Forced_Restart
{
priority = 0.000000;
to="Process";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _forcedrestartTimer) > 20)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"// restart script" \n
"_forcedrestartTimer = diag_tickTime;" \n
"if (_scriptBasedRestart) then {" \n
" if (diag_tickTime >= _forceRestartTimeWarning) then {" \n
" if (!_serverLocked) then {" \n
" diag_log ""server shutdown: locked"";" \n
" _serverLocked = true;" \n
" [""lock""] call EPOCH_serverCommand;" \n
" } else {" \n
" if (allPlayers isEqualTo []) then {" \n
" [""shutdown""] call EPOCH_serverCommand;" \n
" diag_log ""server shutdown: now"";" \n
" };" \n
" };" \n
" _restartIn = round((_forceRestartTime-diag_tickTime)/60);" \n
" if (_prevRestartIn != _restartIn) then {" \n
" _prevRestartIn = _restartIn;" \n
" if (_restartIn > 1) then {" \n
" [""message"", format[""Server restart in %1 minutes"",_restartIn]] call EPOCH_serverCommand;" \n
" } else {" \n
" [""message"", format[""Server restart in %1 minute"",1]] call EPOCH_serverCommand;" \n
" };" \n
" };" \n
" };" \n
" // kick all remaining players before shutdown to force player save" \n
" if (diag_tickTime >= _forceRestartTime) then {" \n
" if (_serverRestarting) then {" \n
" [""shutdown""] call EPOCH_serverCommand;" \n
" diag_log ""server shutdown: now"";" \n
" } else {" \n
" {" \n
" [""kick"", _x , ""Server Restarting""] call EPOCH_serverCommand;" \n
" } forEach allPlayers;" \n
" _serverRestarting = true;" \n
" };" \n
" };" \n
"};" \n
""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/

View File

@ -6,18 +6,89 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/CarnivalSpawner.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_ferrisPosition","_item","_markers"];
private ["_cfgEpoch", "_debug", "_showMarkers", "_limit", "_counter", "_decayTime", "_distFromOthers", "_others", "_position", "_goodPos", "_objs","_item", "_lootPos", "_lootPos", "_loot", "_debugMkr", "_markers", "_originalColors", "_decayMarkerColor", "_compromisedColor", "_rEvents", "_thisEvent"];
//[[[end]]]
_ferrisPosition = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 4000, 0] call BIS_fnc_findSafePos;
if ((count _ferrisPosition) == 2) then{
_item = createVehicle["ferrisWheel_EPOCH", _ferrisPosition, [], 0.0, "CAN_COLLIDE"];
_cfgEpoch = configFile >> "CfgEpoch" >> worldname;
_debug = if(getNumber(_cfgEpoch >> "debugCarnivalSpawner") isEqualTo 1)then{true}else{false};
_limit = getNumber(_cfgEpoch >> "maxCarnivalSpawns");
_counter = missionNameSpace getVariable["EPOCH_carnivalCounter",0];
_others = missionNameSpace getVariable["EPOCH_carnivals", [[0,0,0]] ];
_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherCarnivals");
//STOP THE SCRIPT AND EXIT IF THE COUNTER IS TOO HIGH.
if (_counter >= _limit) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed carnival spawn over limit"};
};
for "_i" from 0 to 100 step 1 do {
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
_goodPos = true;
_goodPos = [_position, true, true, true, _others, _distFromOthers] call EPOCH_server_isNearChecks;
if(_goodPos)then{
_i = 100;
}else{
_position = [];
};
};
_objs = [];
if ((count _position) == 2) then{
// CREATE THE CARNIVAL AREA AND LOOT
_item = createVehicle["ferrisWheel_EPOCH", _position, [], 0.0, "CAN_COLLIDE"];
_objs pushBack _item;
_lootPos = [_position,1,20,3,1,20,0] call BIS_fnc_findSafePos;
_loot = createVehicle["container_epoch", _lootPos, [], 0.0, "CAN_COLLIDE"];
_loot setMass 220;
_loot setVariable["EPOCH_Loot",false,true];
if(_debug)then{
_debugMkr = createMarker [str(_lootPos),_lootPos];
_debugMkr setMarkerShape "ICON";
_debugMkr setMarkerType "mil_dot";
_debugMkr setMarkerColor "ColorRed";
};
{
_item = createVehicle[_x, _ferrisPosition, [], 80, "NONE"];
_item = createVehicle[_x, _position, [], 80, "NONE"];
_objs pushBack _item;
sleep 1;
} forEach["Carnival_Tent", "Land_Slide_F", "Carnival_Tent", "Land_Carousel_01_F", "Carnival_Tent", "Carnival_Tent"];
} forEach (getArray(_cfgEpoch >> "carnivalSpawnedObjects"));
if (EPOCH_showShippingContainers) then{
_markers = ["Carnival",_ferrisPosition] call EPOCH_server_createGlobalMarkerSet;
// SET UP THE MARKER.
_markers = [];
_originalColors = [];
_showMarkers = if(getNumber(_cfgEpoch >> "showCarnivalMarkers") isEqualTo 1)then{true}else{false};
_decayMarkerColor = getText(_cfgEpoch >> "carnivalDecayMarkerColor");
_compromisedColor = getText(_cfgEpoch >> "carnivalCompromisedColor");
if (_showMarkers) then{
_markers = ["Carnival",_position] 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 SPAWNED PLANT PATCH.
_counter = _counter + 1;
missionNameSpace setVariable["EPOCH_carnivalCounter",_counter];
// ADD POSITION TO OTHERS ARRAY
missionNameSpace setVariable["EPOCH_carnivals", _others + [_position]];
// SEND EVENT TO MONITOR
_decayTime = getNumber(_cfgEpoch >> "carnivalDecayTime");
_serverSettingsConfig = configFile >> "CfgEpochServer";
_timeMultiplier = ([_serverSettingsConfig, "timeMultiplier", 1] call EPOCH_fnc_returnConfigEntry);
_rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]];
_thisEvent = [_lootPos, [_loot], _objs,"carnivalCounter", diag_tickTime, (_decayTime * _timeMultiplier), _showMarkers, _markers, _originalColors, _decayMarkerColor, _compromisedColor];
missionNameSpace setVariable["EPOCH_RunningEvents",_rEvents + [_thisEvent]];
if (_debug) then {
diag_log format["EPOCHDebug: carnivalSpawner-%1", missionNameSpace getVariable["EPOCH_RunningEvents",[]]];
};
};

View File

@ -6,12 +6,78 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/ContainterSpawner.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_cargoPosition","_item","_markers"];
private ["_position","_item","_markers"];
//[[[end]]]
_cargoPosition = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 4000, 1] call BIS_fnc_findSafePos;
if ((count _cargoPosition) == 2) then{
_item = createVehicle["Cargo_Container", _cargoPosition, [], 0.0, "CAN_COLLIDE"];
if (EPOCH_showShippingContainers) then{
_markers = ["Container",_cargoPosition] call EPOCH_server_createGlobalMarkerSet;
_cfgEpoch = configFile >> "CfgEpoch" >> worldname;
_debug = if(getNumber(_cfgEpoch >> "debugContainerSpawner") isEqualTo 1)then{true}else{false};
_limit = getNumber(_cfgEpoch >> "maxContainerSpawns");
_counter = missionNameSpace getVariable["EPOCH_containerCounter",0];
_others = missionNameSpace getVariable["EPOCH_containers", [[0,0,0]] ];
_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherContainers");
//STOP THE SCRIPT AND EXIT IF THE COUNTER IS TOO HIGH.
if (_counter >= _limit) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed CONTAINER spawn over limit"};
};
// FIND A POSITION
for "_i" from 0 to 100 step 1 do {
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 4000, 1] call BIS_fnc_findSafePos;
_goodPos = true;
_goodPos = [_position, true, true, true, _others, _distFromOthers] call EPOCH_server_isNearChecks;
if(_goodPos)then{
_i = 100;
}else{
_position = [];
};
};
if ((count _position) == 2) then{
// CREATE THE CARGO CONTAINER
_item = createVehicle["Cargo_Container", _position, [], 0.0, "CAN_COLLIDE"];
if(_debug)then{
_debugMkr = createMarker [str(_position), _position];
_debugMkr setMarkerShape "ICON";
_debugMkr setMarkerType "mil_dot";
_debugMkr setMarkerColor "ColorRed";
};
// SET UP THE MARKER.
_markers = [];
_originalColors = [];
_showMarkers = if(getNumber(_cfgEpoch >> "showContainerMarkers") isEqualTo 1)then{true}else{false};
_decayMarkerColor = getText(_cfgEpoch >> "containerDecayMarkerColor");
_compromisedColor = getText(_cfgEpoch >> "containerCompromisedColor");
if (_showMarkers) then{
_markers = ["Container",_position] 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_containerCounter",_counter];
// ADD POSITION TO OTHERS ARRAY
missionNameSpace setVariable["EPOCH_containers", _others + [_position]];
// SEND EVENT TO MONITOR
_decayTime = getNumber(_cfgEpoch >> "containerDecayTime");
_serverSettingsConfig = configFile >> "CfgEpochServer";
_timeMultiplier = ([_serverSettingsConfig, "timeMultiplier", 1] call EPOCH_fnc_returnConfigEntry);
_rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]];
_thisEvent = [_position, [_item], [], "containerCounter", diag_tickTime, (_decayTime * _timeMultiplier), _showMarkers, _markers, _originalColors, _decayMarkerColor, _compromisedColor];
missionNameSpace setVariable["EPOCH_RunningEvents",_rEvents + [_thisEvent]];
if (_debug) then {
diag_log format["EPOCHDebug: containerSpawner-%1", missionNameSpace getVariable["EPOCH_RunningEvents",[]]];
};
};
// END SCRIPT.

View File

@ -2,13 +2,39 @@
Earthquake and Mineral Deposit Event
by Aaron Clark - EpochMod.com
Events Overhaul by DirtySanchez
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/Earthquake.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_chance","_item","_markers","_minerals","_playersNearEpicenter","_position"];
private ["_cfgEpoch", "_debug", "_limit", "_counter", "_others", "_distFromOthers", "_position", "_goodPos", "_playersNearEpicenter", "_chance", "_minerals", "_item", "_debugMkr", "_markers", "_originalColors", "_showMarkers", "_decayMarkerColor", "_compromisedColor", "_spawned", "_decayTime", "_rEvents", "_thisEvent"];
//[[[end]]]
_cfgEpoch = configFile >> "CfgEpoch" >> worldname;
_debug = if(getNumber(_cfgEpoch >> "debugEarthquakeSpawner") isEqualTo 1)then{true}else{false};
_limit = getNumber(_cfgEpoch >> "maxEarthquakeSpawns");
_counter = missionNameSpace getVariable["EPOCH_earthquakeCounter",0];
_others = missionNameSpace getVariable["EPOCH_earthquakes", [[0,0,0]] ];
_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherEarthquakes");
//STOP THE SCRIPT AND EXIT IF THE COUNTER IS TOO HIGH.
if (_counter >= _limit) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed EARTHQUAKE spawn over limit"};
};
for "_i" from 0 to 100 step 1 do {
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 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{
_playersNearEpicenter = _position nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 1000];
// decrease chance with more players
@ -21,10 +47,49 @@ if ((count _position) == 2) then{
};
// Mineral veins
_minerals = ["MineralDepositCopper_EPOCH", "MineralDepositGold_EPOCH", "MineralDepositSilver_EPOCH"];
_minerals = getArray(_cfgEpoch >> "availableMinerals");
_item = createVehicle[(selectRandom _minerals), _position, [], 0.0, "CAN_COLLIDE"];
if (EPOCH_showEarthQuakes) then{
if(_debug)then{
_debugMkr = createMarker [str(_position), _position];
_debugMkr setMarkerShape "ICON";
_debugMkr setMarkerType "mil_dot";
_debugMkr setMarkerColor "ColorRed";
};
// Place markers and get decay, compromised and original colors
_markers = [];
_originalColors = [];
_showMarkers = if(getNumber(_cfgEpoch >> "showEarthquakeMarkers") isEqualTo 1)then{true}else{false};
_decayMarkerColor = getText(_cfgEpoch >> "earthquakeDecayMarkerColor");
_compromisedColor = getText(_cfgEpoch >> "earthquakeCompromisedColor");
if (_showMarkers) then{
_markers = ["EarthQuake",_position] 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_earthquakeCounter",_counter];
// ADD POSITION TO OTHERS ARRAY
missionNameSpace setVariable["EPOCH_earthquakes", _others + [_position]];
// SEND EVENT TO MONITOR
_decayTime = getNumber(_cfgEpoch >> "earthquakeDecayTime");
_serverSettingsConfig = configFile >> "CfgEpochServer";
_timeMultiplier = ([_serverSettingsConfig, "timeMultiplier", 1] call EPOCH_fnc_returnConfigEntry);
_rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]];
_thisEvent = [_position, [_item], [], "earthquakeCounter", diag_tickTime, (_decayTime * _timeMultiplier), _showMarkers, _markers, _originalColors, _decayMarkerColor, _compromisedColor];
missionNameSpace setVariable["EPOCH_RunningEvents",_rEvents + [_thisEvent]];
if (_debug) then {
diag_log format["EPOCHDebug: earthquakeSpawner-%1", missionNameSpace getVariable["EPOCH_RunningEvents",[]]];
};
};
};

View File

@ -3,6 +3,8 @@
Redbeard Actual
Aaron Clark - EpochMod.com
Events Overhaul by DirtySanchez
Description:
Improved Plant Spawner - Plant Patch Spawner
Event spawns a random number of plants based on plant type.
@ -15,64 +17,49 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/PlantSpawner.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_debug","_decayTime","_jammers","_markers","_nearbyLocations","_plant","_plantCount","_plants","_playersNearby","_position","_restricted","_scatter","_selectedLocation","_showPlantMarkers","_timeStamp"];
private ["_cfgEpoch", "_debug", "_limit", "_counter", "_distFromOthers", "_others", "_nearbyLocations", "_position", "_selectedLocation", "_goodPos", "_plantsArray", "_plant", "_plantCount", "_scatter", "_plants", "_plantPos", "_debugMkr", "_markers", "_originalColors", "_showMarkers", "_decayMarkerColor", "_compromisedColor", "_decayTime", "_rEvents","_thisEvent"];
//[[[end]]]
// SET THIS TO TRUE TO GET MESSAGES IN LOG.
_debug = true;
_showPlantMarkers = true;
// select a plant type to spawn
_plant = selectRandom ["Goldenseal_EPOCH", "Goldenseal_EPOCH", "Goldenseal_EPOCH", "Poppy_EPOCH", "Pumpkin_EPOCH"];
// START PLANT PATCH SPAWN LIMIT CODE IF EPOCH_plantCounter HAS NOT BEEN INITIATED.
// THIS MAKES SURE IT ONLY DOES THIS BIT THE FIRST TIME THE EVENT RUNS.
if (isNil "EPOCH_plantCounter") then {
//SET COUNTER TO ZERO.
EPOCH_plantCounter = 0;
//SET LIMIT TO FIVE.
EPOCH_plantLimit = 5;
};
_cfgEpoch = configFile >> "CfgEpoch" >> worldname;
_debug = if(getNumber(_cfgEpoch >> "debugPlantSpawner") isEqualTo 1)then{true}else{false};
_limit = getNumber(_cfgEpoch >> "maxPlantSpawns");
_counter = missionNameSpace getVariable["EPOCH_plantCounter",0];
_others = missionNameSpace getVariable["EPOCH_plants", [[0,0,0]] ];
_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherPlants");
//STOP THE SCRIPT AND EXIT IF THE COUNTER IS TOO HIGH.
if (EPOCH_plantCounter >= EPOCH_plantLimit) exitWith {
if (_counter >= _limit) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed plant spawn over limit"};
};
// FIND A POSITION FOR PLANT PATCH prefer Hills and Vineyards
_nearbyLocations = nearestLocations [epoch_centerMarkerPosition,["VegetationVineyard","Hill"],EPOCH_dynamicVehicleArea];
for "_i" from 0 to 100 step 1 do {
if (_nearbyLocations isEqualTo []) then {
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 4000, 0] call BIS_fnc_findSafePos;
} else {
_selectedLocation = locationPosition (selectRandom _nearbyLocations);
_position = [_selectedLocation, 0, 1000, 10, 0, 4000, 0] call BIS_fnc_findSafePos;
};
_goodPos = true;
//CHECK FOR PROTECTED AREA WITIN 2000 METERS.
_restricted = nearestObjects [_position, ["ProtectionZone_Invisible_F"], 2000];
if(count _restricted > 0) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed PLANT PATCH spawn TRADER too close"};
_goodPos = [_position, true, true, true, _others, _distFromOthers] call EPOCH_server_isNearChecks;
if(_goodPos)then{
_i = 100;
}else{
_position = [];
};
//CHECK FOR JAMMERS IN THE AREA WITHIN 1000 METERS.
_jammers = nearestObjects[_position, ["PlotPole_EPOCH"], 1000];
if(count _jammers > 0) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed PLANT PATCH spawn jammer too close"};
};
//CHECK TO SEE IF PLAYERS WITHIN 900 METERS.
_playersNearby = _position nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 900];
if(count _playersNearby > 0) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed PLANT PATCH spawn PLAYER too close"};
};
// IF WE MADE IT THIS FAR, WE CAN SPAWN SOME SHIT.
if ((count _position) == 2) then{
// select a plant type to spawn
_plantsArray = getArray(_cfgEpoch >> "availablePlants");
_plant = selectRandom _plantsArray;
// vary plant count and scatter by plant type
_plantCount = 1;
_plantCount = (floor(random(2)));
_scatter = 10;
_decayTime = 1200;
switch _plant do {
case "Goldenseal_EPOCH": {
_plantCount = (floor(random(4)))+3;
@ -90,52 +77,51 @@ if ((count _position) == 2) then{
_plants = [];
// CREATE THE PATCH OF PLANTS.
for "_i" from 1 to _plantCount step 1 do {
for "_i" from 0 to (_plantCount - 1) step 1 do {
_plants pushBack createVehicle[_plant, _position, [], _scatter, "NONE"];
if(_debug)then{
_plantPos = getPosATL (_plants select _i);
_debugMkr = createMarker [str(_plantPos), _plantPos];
_debugMkr setMarkerShape "ICON";
_debugMkr setMarkerType "mil_dot";
_debugMkr setMarkerColor "ColorRed";
};
};
_timeStamp = diag_tickTime;
// SET UP THE MARKER.
if (_showPlantMarkers) then{
_markers = [];
_originalColors = [];
_showMarkers = if(getNumber(_cfgEpoch >> "showPlantMarkers") isEqualTo 1)then{true}else{false};
_decayMarkerColor = getText(_cfgEpoch >> "plantDecayMarkerColor");
_compromisedColor = getText(_cfgEpoch >> "plantCompromisedColor");
if (_showMarkers) then{
_markers = ["PlantSpawn",_position] 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 SPAWNED PLANT PATCH.
EPOCH_plantCounter = EPOCH_plantCounter + 1;
// TICK COUNTER + 1
_counter = _counter + 1;
missionNameSpace setVariable["EPOCH_plantCounter",_counter];
// wait loop to handle plant patch
while {true} do {
private _plantsLeft = _plants select {!isNull _x};
// Wait for all plants to be picked or to decay
if (_plantsLeft isEqualTo [] || (diag_tickTime - _timeStamp) > _decayTime) exitWith {
// TICK THE COUNTER DOWN SO A NEW PLANT PATCH WILL SPAWN TO TAKE ITS PLACE.
EPOCH_plantCounter = EPOCH_plantCounter - 1;
// DELETE THAT MARKER.
if (_showPlantMarkers) then{
[_markers] call EPOCH_server_deleteGlobalMarkerSet;
};
// remove any left over "dead" plants (only if decayTime is reached)
{deleteVehicle _x} forEach _plantsLeft;
};
// set marker to brown to show 50% decay but not if already marked as picked (red).
{
if !(getMarkerColor _x in ["ColorRed","ColorBrown"]) then {
if ((diag_tickTime - _timeStamp) > (_decayTime/2)) then {
_x setMarkerColor "ColorBrown";
};
};
}forEach _markers;
// WAIT FOR A PLAYER TO Pick one plant then set marker to red
if (count _plantsLeft != _plantCount) then {
if (_showPlantMarkers) then{
{
if (getMarkerColor _x != "ColorRed") then {
_x setMarkerColor "ColorRed";
};
}forEach _markers;
};
};
sleep 30;
// ADD POSITION TO OTHERS ARRAY
missionNameSpace setVariable["EPOCH_plants", _others + [_position]];
// SEND EVENT TO MONITOR
_decayTime = getNumber(_cfgEpoch >> "plantDecayTime");
_serverSettingsConfig = configFile >> "CfgEpochServer";
_timeMultiplier = ([_serverSettingsConfig, "timeMultiplier", 1] call EPOCH_fnc_returnConfigEntry);
_rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]];
_thisEvent = [_position, _plants, [], "plantCounter", diag_tickTime, (_decayTime * _timeMultiplier), _showMarkers, _markers, _originalColors, _decayMarkerColor, _compromisedColor];
missionNameSpace setVariable["EPOCH_RunningEvents",_rEvents + [_thisEvent]];
if (_debug) then {
diag_log format["EPOCHDebug: plantSpawner-EPOCH_PlantSpawns:%1", missionNameSpace getVariable["EPOCH_RunningEvents",[]]];
};
};
// END SCRIPT.

View File

@ -8,23 +8,77 @@
//[[[cog import generate_private_arrays ]]]
private ["_satellite","_markers","_playersNearEpicenter","_position","_satellites"];
//[[[end]]]
_cfgEpoch = configFile >> "CfgEpoch" >> worldname;
_debug = if(getNumber(_cfgEpoch >> "debugSatelliteSpawner") isEqualTo 1)then{true}else{false};
_limit = getNumber(_cfgEpoch >> "maxSatelliteSpawns");
_counter = missionNameSpace getVariable["EPOCH_satelliteCounter",0];
_others = missionNameSpace getVariable["EPOCH_satellites", [[0,0,0]] ];
_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherSatellites");
//STOP THE SCRIPT AND EXIT IF THE COUNTER IS TOO HIGH.
if (_counter >= _limit) exitWith {
if (_debug) then {diag_log "DEBUG: suppressed SATELLITE spawn over limit"};
};
// FIND A POSITION
for "_i" from 0 to 100 step 1 do {
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
_goodPos = true;
_goodPos = [_position, true, true, true, _others, _distFromOthers] call EPOCH_server_isNearChecks;
if(_goodPos)then{
_i = 100;
}else{
_position = [];
};
};
if ((count _position) == 2) then{
// spawn Satellite
_satellites = ["Land_Wreck_Satellite_EPOCH"];
// select a Satellite type to spawn
_satellites = getArray(_cfgEpoch >> "availableSatellites");
_satellite = createVehicle[(selectRandom _satellites), _position, [], 0.0, "CAN_COLLIDE"];
// send shockwave + effects to each player in zone at time of crash
_playersNearEpicenter = _position nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 1000];
if !(_playersNearEpicenter isEqualTo[]) then{
[_satellite, -1, 0.8, false] remoteExec ['BIS_fnc_sandstorm',_playersNearEpicenter];
if(_debug)then{
_debugMkr = createMarker [str(_position), _position];
_debugMkr setMarkerShape "ICON";
_debugMkr setMarkerType "mil_dot";
_debugMkr setMarkerColor "ColorRed";
};
// set rads
_satellite setVariable ["EPOCH_Rads", [30,50], true]; //30 rads within 50 meters
if (EPOCH_showSatellites) then{
// SET UP THE MARKER.
_markers = [];
_originalColors = [];
_showMarkers = if(getNumber(_cfgEpoch >> "showSatelliteMarkers") isEqualTo 1)then{true}else{false};
_decayMarkerColor = getText(_cfgEpoch >> "satelliteDecayMarkerColor");
_compromisedColor = getText(_cfgEpoch >> "satelliteCompromisedColor");
if (_showMarkers) then{
_markers = ["Satellite",_position] 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_satelliteCounter",_counter];
// ADD POSITION TO OTHERS ARRAY
missionNameSpace setVariable["EPOCH_satellites", _others + [_position]];
// SEND EVENT TO MONITOR
_decayTime = getNumber(_cfgEpoch >> "satelliteDecayTime");
_serverSettingsConfig = configFile >> "CfgEpochServer";
_timeMultiplier = ([_serverSettingsConfig, "timeMultiplier", 1] call EPOCH_fnc_returnConfigEntry);
_rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]];
_thisEvent = [_position, [_satellite], [], "satelliteCounter", diag_tickTime, (_decayTime * _timeMultiplier), _showMarkers, _markers, _originalColors, _decayMarkerColor, _compromisedColor];
missionNameSpace setVariable["EPOCH_RunningEvents",_rEvents + [_thisEvent]];
if (_debug) then {
diag_log format["EPOCHDebug: satelliteSpawner-%1", missionNameSpace getVariable["EPOCH_RunningEvents",[]]];
};
};
// END SCRIPT.

View File

@ -52,7 +52,6 @@ class CfgEpoch
class Default
{
worldSize = 12000;
plantLimit = 10;
vehicleSpawnTypes[] = {
{"FlatAreaCity",1},
{"FlatAreaCitySmall",1},
@ -79,11 +78,6 @@ class CfgEpoch
traderHomes[] = {"House", "Building"};
traderUniforms[] = {"U_OG_leader", "U_C_Poloshirt_stripped", "U_C_Poloshirt_blue", "U_C_Poloshirt_burgundy", "U_C_Poloshirt_tricolour", "U_C_Poloshirt_salmon", "U_C_Poloshirt_redwhite", "U_C_Poor_1", "U_C_WorkerCoveralls", "U_C_Journalist", "U_C_Scientist", "U_OrestesBody"};
// Shipwrecks
shipwreckLootEnabled = 1;
maxSpawnedShipwrecks = 12;
distFromOtherShipwrecks = 750;
// Debug Box
telePos[] = {};
lightPos[] = {
@ -93,6 +87,70 @@ class CfgEpoch
debugBoxClass = "Debug_static_F";
cloneClasses[] = {"clone_empty_static_F", "clone_male_static_F", "clone_female_static_F"};
// Settings for Events, Missions, etc
spawnDistanceFromPlayers = 500;
spawnDistanceFromJammers = 1000;
spawnDistanceFromTraders = 2000;
HeightenedPlayerVsPlayer = 1; // 0 = OFF
// Shipwrecks Loot Box Spawner
shipwreckLootEnabled = 1; // 0 = OFF
debugShipwreckLoot = 0; // 1 = ON
showBoatLootMarkers = 1;
maxSpawnedShipwrecks = 12;
distFromOtherShipwrecks = 750;
shipwreckDecayMarkerColor = "ColorBrown"; // decay changes icon (_markers select 2)
shipwreckCompromisedColor = "ColorRed"; // compromised changes active surround (_markers select 0)
// Plant Spawner
debugPlantSpawner = 0;
showPlantMarkers = 1;
maxPlantSpawns = 5;
distFromOtherPlants = 2500;
plantDecayTime = 1200; //Half this time results in decayMarkerColor marker
plantDecayMarkerColor = "ColorBrown";
plantCompromisedColor = "ColorRed";
availablePlants[] = {"Goldenseal_EPOCH", "Goldenseal_EPOCH", "Goldenseal_EPOCH", "Poppy_EPOCH", "Pumpkin_EPOCH"};
// Carnival and Loot Box Spawner
debugCarnivalSpawner = 0;
showCarnivalMarkers = 1;
maxCarnivalSpawns = 2;
distFromOtherCarnivals = 5000;
carnivalDecayTime = 3600;
carnivalDecayMarkerColor = "ColorBrown";
carnivalCompromisedColor = "ColorRed";
carnivalSpawnedObjects[] = {"Carnival_Tent", "Land_Slide_F", "Carnival_Tent", "Land_Carousel_01_F", "Carnival_Tent", "Carnival_Tent"};
// EarthQuake and Mineral Deposit Spawner
debugEarthquakeSpawner = 0;
showEarthquakeMarkers = 1;
maxEarthquakeSpawns = 3;
distFromOtherEarthquakes = 1500;
earthquakeDecayTime = 2400;
earthquakeDecayMarkerColor = "ColorBrown";
earthquakeCompromisedColor = "ColorRed";
availableMinerals[] = {"MineralDepositCopper_EPOCH", "MineralDepositGold_EPOCH", "MineralDepositSilver_EPOCH"};
// Container Spawner
debugContainerSpawner = 0;
showContainerMarkers = 1;
maxContainerSpawns = 5;
distFromOtherContainers = 3500;
containerDecayTime = 1200;
containerDecayMarkerColor = "ColorBrown";
containerCompromisedColor = "ColorRed";
// Satellite Crash Spawner
debugSatelliteSpawner = 0;
showSatelliteMarkers = 1;
maxSatelliteSpawns = 5;
distFromOtherSatellites = 2500;
satelliteDecayTime = 2700;
satelliteDecayMarkerColor = "ColorBrown";
satelliteCompromisedColor = "ColorRed";
availableSatellites[] = {"Land_Wreck_Satellite_EPOCH"};
propsPos[] = {};
staticNpcPos[] = {};
forcedVehicleSpawnTable = "";