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;
_item setMass 220;
if (EPOCH_SHOW_BOATLOOT) then {
_markers = ["Shipwreck",_wreck] call EPOCH_server_createGlobalMarkerSet;
if(_debug)then{
_debugMkr = createMarker [str(_position),_position];
_debugMkr setMarkerShape "ICON";
_debugMkr setMarkerType "mil_dot";
_debugMkr setMarkerColor "ColorRed";
};
_item setMass 220;
_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]];
};
};
diag_log format["EPOCHDebug: Safely spawned %1 loot container(s) at these shipwreck locations:%2",count _spawnedLoot , _spawnedLoot];
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 {};

File diff suppressed because it is too large Load Diff

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");
{
_item = createVehicle[_x, _ferrisPosition, [], 80, "NONE"];
sleep 1;
} forEach["Carnival_Tent", "Land_Slide_F", "Carnival_Tent", "Land_Carousel_01_F", "Carnival_Tent", "Carnival_Tent"];
//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"};
};
if (EPOCH_showShippingContainers) then{
_markers = ["Carnival",_ferrisPosition] call EPOCH_server_createGlobalMarkerSet;
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, _position, [], 80, "NONE"];
_objs pushBack _item;
sleep 1;
} forEach (getArray(_cfgEpoch >> "carnivalSpawnedObjects"));
// 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

@ -1,14 +1,40 @@
/*
Earthquake and Mineral Deposit Event
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]]]
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
_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];
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;
};
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;
_goodPos = [_position, true, true, true, _others, _distFromOthers] call EPOCH_server_isNearChecks;
//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"};
};
//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(_goodPos)then{
_i = 100;
}else{
_position = [];
};
};
// 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;
};
// TICK COUNTER + 1 SPAWNED PLANT PATCH.
EPOCH_plantCounter = EPOCH_plantCounter + 1;
// 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";
};
};
_originalColors pushBack (getMarkerColor _x);
}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;
};
// Check for HeightenedPlayerVsPlayer false and remove comprimised coloring
if!(getNumber(_cfgEpoch >> "HeightenedPlayerVsPlayer") isEqualTo 1)then{
_compromisedColor = getMarkerColor (_markers select 0);
};
sleep 30;
};
// TICK COUNTER + 1
_counter = _counter + 1;
missionNameSpace setVariable["EPOCH_plantCounter",_counter];
// 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]]]
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
if ((count _position) == 2) then{
_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");
// spawn Satellite
_satellites = ["Land_Wreck_Satellite_EPOCH"];
_satellite = createVehicle[(selectRandom _satellites), _position, [], 0.0, "CAN_COLLIDE"];
//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"};
};
// 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];
};
// set rads
_satellite setVariable ["EPOCH_Rads", [30,50], true]; //30 rads within 50 meters
if (EPOCH_showSatellites) then{
_markers = ["Satellite",_position] call EPOCH_server_createGlobalMarkerSet;
// 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{
// select a Satellite type to spawn
_satellites = getArray(_cfgEpoch >> "availableSatellites");
_satellite = createVehicle[(selectRandom _satellites), _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 >> "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 = "";