diff --git a/Server_Install_Pack/@epochhive/epochconfig.hpp b/Server_Install_Pack/@epochhive/epochconfig.hpp index fd460bea..19ed1b1e 100644 --- a/Server_Install_Pack/@epochhive/epochconfig.hpp +++ b/Server_Install_Pack/@epochhive/epochconfig.hpp @@ -19,6 +19,7 @@ forceRestartTime = 14400; // 4 hour restarts { 900, "ChangeWeather", 1 , 1, -1, {} ,{"VR"}}, { 1200, "ContainerSpawner", 0 , 1, -1, {} ,{"VR"}}, { 1440, "GardenManager", 0 , 1, -1, {} ,{"VR"}}, + { 600, "MoneyDrop", 0 , 1 , -1, {} ,{"VR"}}, //No comma on last Entry { 300, "PlantSpawner", 0 , 1 , -1, {} ,{"VR"}} //No comma on last Entry }; diff --git a/Sources/epoch_config/Configs/CfgMarkerSets.hpp b/Sources/epoch_config/Configs/CfgMarkerSets.hpp index c10f7f82..5b4be020 100644 --- a/Sources/epoch_config/Configs/CfgMarkerSets.hpp +++ b/Sources/epoch_config/Configs/CfgMarkerSets.hpp @@ -202,4 +202,11 @@ class CfgMarkerSets {"","ICON","EpochShipwreck","ColorOrange",1,{0.5,0.5}} }; }; + class MoneyDrop { + markerArray[] = { + {"","ICON","EpochCash","ColorGreen",1,{0.9,0.9}}, + {"","ICON","","ColorBlack",1,{0.8,0.8}}, + {"","ICON","","ColorGreen",0.2,{0.8,0.8}}, + }; + }; }; diff --git a/Sources/epoch_server/compile/epoch_trading/EPOCH_server_takeCrypto.sqf b/Sources/epoch_server/compile/epoch_trading/EPOCH_server_takeCrypto.sqf index b711305a..3bffdcf9 100644 --- a/Sources/epoch_server/compile/epoch_trading/EPOCH_server_takeCrypto.sqf +++ b/Sources/epoch_server/compile/epoch_trading/EPOCH_server_takeCrypto.sqf @@ -25,6 +25,9 @@ _getCrypto = _object getVariable["Crypto", 0]; if (_getCrypto > 0) then { // remove crypto from object _object setVariable["Crypto", nil, true]; + if (_object getvariable ["RemoveOnTake",false]) then { + deletevehicle _object; + }; // send data back to player [_player,_getCrypto] call EPOCH_server_effectCrypto; // debug and logging. diff --git a/Sources/epoch_server_settings/EpochEvents/MoneyDrop.sqf b/Sources/epoch_server_settings/EpochEvents/MoneyDrop.sqf new file mode 100644 index 00000000..5024fa6f --- /dev/null +++ b/Sources/epoch_server_settings/EpochEvents/MoneyDrop.sqf @@ -0,0 +1,103 @@ +/* + Earthquake and Mineral Deposit Event + by He-Man - EpochMod.com + + Improvements and or bugfixes and other contributions are welcome via the github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/MoneyDrop.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_cfgEpoch", "_debug", "_limit", "_counter", "_others", "_distFromOthers", "_position", "_goodPos", "_playersNearEpicenter", "_chance", "_values","_spawncount" ,"_scatter" ,"_packs" ,"_packPos" , "_item", "_debugMkr", "_markers", "_originalColors", "_showMarkers", "_decayMarkerColor", "_compromisedColor", "_spawned", "_decayTime", "_serverSettingsConfig", "_timeMultiplier", "_rEvents", "_thisEvent"]; +//[[[end]]] +_cfgEpoch = configFile >> "CfgEpoch" >> worldname; +_debug = if(getNumber(_cfgEpoch >> "debugMoneyDrop") isEqualTo 1)then{true}else{false}; +_limit = getNumber(_cfgEpoch >> "maxMoneyDrops"); +_counter = missionNameSpace getVariable["EPOCH_MoneyDropCounter",0]; +_others = missionNameSpace getVariable["EPOCH_MoneyDrops", [[0,0,0]] ]; +_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherMoneyDrops"); + +//STOP THE SCRIPT AND EXIT IF THE COUNTER IS TOO HIGH. +if (_counter >= _limit) exitWith { + if (_debug) then {diag_log "DEBUG: suppressed MONEYDROP 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 + _chance = 0.2 + (linearConversion [1, 100, (count allPlayers), 0, 0.5, true]); + if ((random 1) < _chance) then { + + _values = getArray(_cfgEpoch >> "MoneyDropValues"); + _values params ["_PacksArr","_ValueArr"]; + _PacksArr params ["_packsmin","_packsmax"]; + _ValueArr params ["_minvalue","_maxvalue"]; + + _spawncount = round (_packsmin + random (_packsmax-_packsmin)); + + // Spawn Scattered Money + _scatter = 10; + _packs = []; + for "_i" from 0 to (_spawncount - 1) step 1 do { + _value = round (_minvalue + random (_maxvalue-_minvalue)); + _item = createVehicle["Land_Money_F", _position, [], _scatter, "NONE"]; + _item setVariable ["Crypto",_value,true]; + _item setVariable ["RemoveOnTake",true]; + _packs pushBack _item; + if(_debug)then{ + _packPos = getPosATL _item; + _debugMkr = createMarker [str(_packPos), _packPos]; + _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 >> "showMoneyMarkers") isEqualTo 1)then{true}else{false}; + _decayMarkerColor = getText(_cfgEpoch >> "MoneyDropDecayMarkerColor"); + _compromisedColor = getText(_cfgEpoch >> "MoneyDropCompromisedColor"); + if (_showMarkers) then{ + _markers = ["MoneyDrop",_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_MoneyDropCounter",_counter]; + + // ADD POSITION TO OTHERS ARRAY + missionNameSpace setVariable["EPOCH_MoneyDrops", _others + [_position]]; + + // SEND EVENT TO MONITOR + _decayTime = getNumber(_cfgEpoch >> "MoneyDropDecayTime"); + _serverSettingsConfig = configFile >> "CfgEpochServer"; + _timeMultiplier = ([_serverSettingsConfig, "timeMultiplier", 1] call EPOCH_fnc_returnConfigEntry); + _rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]]; + _thisEvent = [_position, _packs, [], "MoneyDropCounter", 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",[]]]; + }; + }; +}; diff --git a/Sources/epoch_server_settings/config.cpp b/Sources/epoch_server_settings/config.cpp index 6c966529..0cffb63f 100644 --- a/Sources/epoch_server_settings/config.cpp +++ b/Sources/epoch_server_settings/config.cpp @@ -106,7 +106,7 @@ class CfgEpoch shipwreckCompromisedColor = "ColorRed"; // compromised changes active surround (_markers select 0) shipwreckCustomWrecks[] = {"Land_UWreck_FishingBoat_F", "Land_UWreck_Heli_Attack_02_F", "Land_UWreck_MV22_F"}; shipwreckCustomLocs[] = {}; - + // Plant Spawner debugPlantSpawner = 0; showPlantMarkers = 1; @@ -136,7 +136,17 @@ class CfgEpoch earthquakeDecayMarkerColor = "ColorBrown"; earthquakeCompromisedColor = "ColorRed"; availableMinerals[] = {"MineralDepositCopper_EPOCH", "MineralDepositGold_EPOCH", "MineralDepositSilver_EPOCH"}; - + + // MoneyDrop + debugMoneyDrop = 0; + showMoneyMarkers = 1; + maxMoneyDrops = 3; + distFromOtherMoneyDrops = 1500; + MoneyDropDecayTime = 2400; + MoneyDropDecayMarkerColor = "ColorBrown"; + MoneyDropCompromisedColor = "ColorRed"; + MoneyDropValues[] = {{3,6},{50,120}}; // {{min money lumps, max money lumps},{min crypto per lump, max crypto per lump}} + // Container Spawner debugContainerSpawner = 0; showContainerMarkers = 1; diff --git a/changelog.md b/changelog.md index 7ef41732..cad77981 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ All changes for [Arma 3](https://arma3.com/) [Epoch Mod](https://epochmod.com) a ## [1.1.0.0] - Unreleased ### Added - Plant Spawner: vehicle object for sunflower. @Helion4 +- MoneyDrop Event: Random Money lump with Mapmarker (like Plants) @He-Man - Examples for Vehicle upgrades for Server Admins into CfgVehicleUpgrades.hpp @He-Man - Make Lighter refillable at Fuel-Sources (Gasstations / Vehicles) @He-Man - Make Trader more configurable in epochconfig.hpp @He-Man