mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Reworked Loot Scripts + Configs
This commit is contained in:
parent
58b389a989
commit
de40c06758
@ -24,10 +24,10 @@
|
||||
BOOL
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgBaseBuilding","_class","_color","_colors","_config","_delete","_dir","_item","_lootBias","_lootLimit","_lootType","_loots","_masterConfig","_pos","_posName","_positions","_possibleCount","_possibleLoots","_randomIndex","_return","_selectedConfig","_selectedLoot"];
|
||||
private ["_cfgBaseBuilding","_class","_color","_colors","_config","_delete","_dir","_item","_lootBias","_lootLimit","_lootType","_loots","_masterConfig","_pos","_posName","_positions","_possibleCount","_possibleLoots","_randomIndex","_return","_selectedConfig","_selectedLoot","_lootObjectLimit"];
|
||||
//[[[end]]]
|
||||
params [["_building",objNull,[objNull]], ["_lootCheckBufferLimit",333], ["_lootObjectLimit",33]];
|
||||
|
||||
params [["_building",objNull,[objNull]], ["_LootBiasAdd",0]];
|
||||
_lootObjectLimit = 33;
|
||||
_selectedConfig = typeOf _building;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _building) params [["_modelName",""]];
|
||||
@ -47,17 +47,13 @@ _cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_return = false;
|
||||
if !(isClass(_config)) exitWith {_return};
|
||||
|
||||
_lootBias = getNumber(_config >> "lootBias");
|
||||
_lootBias = getNumber(_config >> "lootBias") + _LootBiasAdd;
|
||||
_lootBias = _lootBias / ((count (((position player) nearEntities 75) select {isplayer _x && alive _x})) max 1);
|
||||
_lootType = getText(_config >> "lootType");
|
||||
_loots = getArray(_config >> _lootType);
|
||||
_lootLimit = ceil random(getNumber(_config >> "limit"));
|
||||
_lootLimit = (round random(getNumber(_config >> "limit"))) max 1;
|
||||
_posName = "";
|
||||
|
||||
EPOCH_LootedBlds pushBackUnique _building;
|
||||
if (count EPOCH_LootedBlds >= _lootCheckBufferLimit) then {
|
||||
EPOCH_LootedBlds deleteAt 0;
|
||||
};
|
||||
|
||||
if ((random 100) < _lootBias) then {
|
||||
_possibleLoots = [];
|
||||
{
|
||||
@ -70,6 +66,7 @@ if ((random 100) < _lootBias) then {
|
||||
} forEach _loots;
|
||||
|
||||
if !(_possibleLoots isEqualTo []) then {
|
||||
systemchat format ["Loot Spawned - lootLimit: %1",_lootLimit];
|
||||
for "_i" from 1 to _lootLimit do
|
||||
{
|
||||
_return = true;
|
||||
|
@ -202,5 +202,3 @@ _playerNuisance = [_playerNuisanceKey,-1,_playerNuisanceMax,_playerNuisanceMin]
|
||||
// calculate max stamina
|
||||
EPOCH_playerStaminaMax = (100 * (round(_playerAliveTime/360)/10)) min 2500;
|
||||
|
||||
// process loot
|
||||
call _lootBubble;
|
||||
|
@ -1,2 +1,6 @@
|
||||
//Updates favorites bar
|
||||
call epoch_favBar_refresh;
|
||||
|
||||
// process loot
|
||||
_LootBiasAdd = _LootBiasAdd call _lootBubble;
|
||||
systemchat str _LootBiasAdd;
|
@ -16,6 +16,10 @@ _clientAliveTimer = diag_tickTime;
|
||||
// Fade Black Screen
|
||||
_fadedblack = false;
|
||||
|
||||
// Lootspawner
|
||||
_LootSpawned = false;
|
||||
_LootBiasAdd = 30;
|
||||
|
||||
// init player stat vars
|
||||
_gmVarsInit = ["CfgEpochClient", "gmVars", [["Temp",98.6],["Hunger",500],["Thirst",500],["Toxicity",0],["Stamina",10],["BloodP",100],["Alcohol",0],["Radiation",0]]] call EPOCH_fnc_returnConfigEntryV2;
|
||||
_gModeVarNames = _gmVarsInit apply {_x param [0,""]};
|
||||
@ -210,41 +214,102 @@ _lootClassesIgnore = ['Default'];
|
||||
'_cN = configName _x;if !(_cN in _lootClassesIgnore)then{_lootClasses pushBackUnique (toLower _cN)}; true' configClasses _masterConfig;
|
||||
|
||||
_lastPlayerPos = getPosATL player;
|
||||
_pushbacklootedbld = {
|
||||
private ["_lootCheckBufferLimit"];
|
||||
_lootCheckBufferLimit = 333;
|
||||
EPOCH_LootedBlds pushBackUnique _this;
|
||||
if (count EPOCH_LootedBlds >= _lootCheckBufferLimit) then {
|
||||
EPOCH_LootedBlds deleteAt 0;
|
||||
};
|
||||
};
|
||||
_lootBubble = {
|
||||
private["_jammer", "_others", "_objects", "_nearObjects", "_building", "_lootDist", "_lootLoc", "_playerPos", "_distanceTraveled"];
|
||||
private["_jammer", "_others", "_objects", "_nearObjects", "_building", "_lootDist", "_lootLoc", "_playerPos", "_distanceTraveled","_AddBias","_dir","_minlootdist","_maxlootdist"];
|
||||
_LootBiasAdd = _this;
|
||||
_playerPos = getPosATL vehicle player;
|
||||
_distanceTraveled = _lastPlayerPos distance _playerPos;
|
||||
if (_distanceTraveled > 10 && _distanceTraveled < 200) then {
|
||||
_lootDist = 30 + _distanceTraveled;
|
||||
_lootLoc = player getRelPos [_lootDist, (random [-180,0,180])];
|
||||
_objects = (_lootLoc nearObjects 30) select {
|
||||
private _selectedConfig = typeOf _x;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _x) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
_distanceTraveled = _lastPlayerPos distance2D _playerPos;
|
||||
_nearestbuilding = nearestBuilding player;
|
||||
if (player distance _nearestbuilding < (((sizeOf (typeOf _nearestbuilding))/2) min 15)) then {
|
||||
private _selectedConfig = typeOf _nearestbuilding;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _nearestbuilding) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
((toLower _selectedConfig) in _lootClasses)
|
||||
};
|
||||
// diag_log format["DEBUG: loot objects %1",_objects];
|
||||
_jammer = nearestObjects [_lootLoc, ["PlotPole_EPOCH","ProtectionZone_Invisible_F"], _buildingJammerRange];
|
||||
if (!(_objects isEqualTo[]) && (_jammer isEqualTo[])) then {
|
||||
_building = selectRandom _objects;
|
||||
if (_building getvariable ["EPOCH_Skiploot",false]) exitwith {};
|
||||
if !(_building in EPOCH_LootedBlds) then {
|
||||
_others = _building nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 15];
|
||||
if (_others isEqualTo[]) then {
|
||||
_nearObjects = nearestObjects[_building, ["WH_Loot", "Animated_Loot"], sizeOf (typeOf _building)];
|
||||
//diag_log format["DEBUG: sizeof %1 %2",sizeOf (typeOf _building), typeOf _building];
|
||||
if (_nearObjects isEqualTo[]) then {
|
||||
[_building] call EPOCH_spawnLoot;
|
||||
if ((toLower _selectedConfig) in _lootClasses) then {
|
||||
_nearestbuilding call _pushbacklootedbld;
|
||||
};
|
||||
};
|
||||
if (_distanceTraveled > 10) then {
|
||||
_lastPlayerPos = _playerPos;
|
||||
if (_distanceTraveled < 100) then {
|
||||
/*
|
||||
_minlootdist = 30;
|
||||
_maxlootdist = 80;
|
||||
_dir = 30;
|
||||
if (player == vehicle player) then {
|
||||
_LootBiasAdd = _LootBiasAdd + 1;
|
||||
_minlootdist = 15;
|
||||
_maxlootdist = 50;
|
||||
_dir = 45;
|
||||
};
|
||||
*/
|
||||
_minlootdist = 30;
|
||||
_maxlootdist = 75;
|
||||
_dir = 30;
|
||||
if (speed (vehicle player) < 30) then {
|
||||
_LootBiasAdd = (_LootBiasAdd + 0.5) min 50;
|
||||
_minlootdist = 15;
|
||||
_maxlootdist = 50;
|
||||
_dir = 45;
|
||||
};
|
||||
// _lootDist = _minlootdist + (_maxlootdist - _minlootdist)/2;
|
||||
_lootDist = (_distanceTraveled max _minlootdist) min _maxlootdist;
|
||||
systemchat format ["lootDist: %1",_lootDist];
|
||||
_lootLoc = player getRelPos [_lootDist, (random [-_dir,0,_dir])];
|
||||
if (surfaceiswater _lootLoc) then {
|
||||
_lootLoc set [2,(getPosASL vehicle player) select 2];
|
||||
};
|
||||
// _objects = (_lootLoc nearObjects 50) select {
|
||||
_objects = (nearestObjects [_lootLoc, [], 50]) select {
|
||||
!(_x in EPOCH_LootedBlds) &&
|
||||
{_x distance player > _minlootdist} &&
|
||||
{_x distance player < _maxlootdist} &&
|
||||
{
|
||||
private _selectedConfig = typeOf _x;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _x) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
};
|
||||
((toLower _selectedConfig) in _lootClasses)
|
||||
}
|
||||
};
|
||||
if (count _objects > 4) then { // remove the farthest away buildings
|
||||
_objects resize 4;
|
||||
};
|
||||
systemchat format ["possible buildings: %1",count _objects];
|
||||
// diag_log format["DEBUG: loot objects %1",_objects];
|
||||
_jammer = (_lootLoc nearObjects ["PlotPole_EPOCH", _buildingJammerRange + 50]) + (_lootLoc nearObjects ["ProtectionZone_Invisible_F", 25]);
|
||||
if (!(_objects isEqualTo[]) && (_jammer isEqualTo[])) then {
|
||||
_building = selectRandom _objects;
|
||||
if (_building getvariable ["EPOCH_Skiploot",false]) exitwith {};
|
||||
if !(_building in EPOCH_LootedBlds) then {
|
||||
_others = _building nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 15];
|
||||
if (_others isEqualTo[]) then {
|
||||
_nearObjects = nearestObjects[_building, ["WH_Loot", "Animated_Loot"], 25 min ((sizeOf (typeOf _building))/2)];
|
||||
//diag_log format["DEBUG: sizeof %1 %2",sizeOf (typeOf _building), typeOf _building];
|
||||
if (_nearObjects isEqualTo[]) then {
|
||||
_building call _pushbacklootedbld;
|
||||
_LootBiasAdd = if ([_building,_LootBiasAdd] call EPOCH_spawnLoot) then {(_LootBiasAdd - 7) max 0} else {_LootBiasAdd};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
_lastPlayerPos = _playerPos;
|
||||
_LootBiasAdd
|
||||
};
|
||||
|
||||
// init weather temperature var if not already set
|
||||
|
@ -380,7 +380,7 @@ class CfgLootTable
|
||||
{ { "SMG_02_F", "weapon" }, 9 },
|
||||
{ { "Rifle_SMG_03", "CfgLootTable" }, 9 },
|
||||
{ { "hgun_PDW2000_F", "weapon" }, 10 },
|
||||
{ { "A2_Rifles", "CfgLootTable" }, 10 }
|
||||
{ { "A2_Rifles", "CfgLootTable" }, 15 }
|
||||
};
|
||||
};
|
||||
class A2_Rifles
|
||||
|
@ -471,7 +471,7 @@ class CfgLootTable_CUP
|
||||
{ { "SMG_02_F", "weapon" }, 9 },
|
||||
{ { "Rifle_SMG_03", "CfgLootTable" }, 9 },
|
||||
{ { "hgun_PDW2000_F", "weapon" }, 10 },
|
||||
{ { "A2_Rifles", "CfgLootTable" }, 10 },
|
||||
{ { "A2_Rifles", "CfgLootTable" }, 15 },
|
||||
// CUP custom
|
||||
{ { "CUP_arifles", "CfgLootTable" }, 5 },
|
||||
{ { "CUP_shotguns", "CfgLootTable" }, 5 },
|
||||
|
@ -380,7 +380,7 @@ class CfgLootTable_MAD
|
||||
{ { "SMG_02_F", "weapon" }, 9 },
|
||||
{ { "Rifle_SMG_03", "CfgLootTable" }, 9 },
|
||||
{ { "hgun_PDW2000_F", "weapon" }, 10 },
|
||||
{ { "A2_Rifles", "CfgLootTable" }, 10 }
|
||||
{ { "A2_Rifles", "CfgLootTable" }, 15 }
|
||||
};
|
||||
};
|
||||
class A2_Rifles
|
||||
|
@ -471,7 +471,7 @@ class CfgLootTable_MADCUP
|
||||
{ { "SMG_02_F", "weapon" }, 9 },
|
||||
{ { "Rifle_SMG_03", "CfgLootTable" }, 9 },
|
||||
{ { "hgun_PDW2000_F", "weapon" }, 10 },
|
||||
{ { "A2_Rifles", "CfgLootTable" }, 10 },
|
||||
{ { "A2_Rifles", "CfgLootTable" }, 15 },
|
||||
// CUP custom
|
||||
{ { "CUP_arifles", "CfgLootTable" }, 5 },
|
||||
{ { "CUP_shotguns", "CfgLootTable" }, 5 },
|
||||
|
@ -211,13 +211,15 @@ class CfgMainTable
|
||||
lootMin = 3;
|
||||
LootMax = 6;
|
||||
tables[] = {
|
||||
{ "Rifle", 2 },
|
||||
{ "SniperRifle", 1 },
|
||||
{ "Items", 9 },
|
||||
{ "Equipment", 9 },
|
||||
{ "Pistols", 4 },
|
||||
{ "PistolAmmo", 8 },
|
||||
{ "Uniforms", 14 },
|
||||
{ "Vests", 12 },
|
||||
{ "Headgear", 12 },
|
||||
{ "Uniforms", 10 },
|
||||
{ "Vests", 10 },
|
||||
{ "Headgear", 8 },
|
||||
{ "Hand", 6 },
|
||||
{ "Generic", 6 },
|
||||
{ "GenericBed", 10 },
|
||||
@ -233,17 +235,18 @@ class CfgMainTable
|
||||
{ "Equipment", 8 },
|
||||
{ "Pistols", 4 },
|
||||
{ "PistolAmmo", 5 },
|
||||
{ "Rifle", 1 },
|
||||
{ "Rifle", 4 },
|
||||
{ "SniperRifle", 2 },
|
||||
{ "MachinegunAmmo", 6 },
|
||||
{ "RifleAmmo", 6 },
|
||||
{ "Grenades", 5 },
|
||||
{ "Uniforms", 7 },
|
||||
{ "Uniforms", 6 },
|
||||
{ "Vests", 6 },
|
||||
{ "Headgear", 6 },
|
||||
{ "Hand", 9 },
|
||||
{ "Generic", 11 },
|
||||
{ "GenericBed", 6 },
|
||||
{ "Backpack", 7 },
|
||||
{ "Backpack", 8 },
|
||||
{ "HighExplosives", 5 }
|
||||
};
|
||||
};
|
||||
@ -307,11 +310,12 @@ class CfgMainTable
|
||||
{ "Uniforms", 4 },
|
||||
{ "Vests", 5 },
|
||||
{ "Headgear", 5 },
|
||||
{ "Rifle", 1 },
|
||||
{ "Rifle", 3 },
|
||||
{ "Hand", 4 },
|
||||
{ "Explosives", 11 },
|
||||
{ "Explosives", 8 },
|
||||
{ "Generic", 10 },
|
||||
{ "Food", 7 }
|
||||
{ "Food", 6 },
|
||||
{ "Backpack", 2 }
|
||||
};
|
||||
};
|
||||
class Fridge_EPOCH : Default
|
||||
@ -337,7 +341,7 @@ class CfgMainTable
|
||||
lootMin = 2;
|
||||
LootMax = 4;
|
||||
tables[] = {
|
||||
{ "Pistols", 12 },
|
||||
{ "Pistols", 10 },
|
||||
{ "Scopes", 10 },
|
||||
{ "Muzzles", 10 },
|
||||
{ "Machinegun", 10 },
|
||||
@ -351,16 +355,18 @@ class CfgMainTable
|
||||
lootMin = 3;
|
||||
LootMax = 6;
|
||||
tables[] = {
|
||||
{ "Rifle", 3 },
|
||||
{ "SniperRifle", 2 },
|
||||
{ "Items", 5 },
|
||||
{ "Equipment", 8},
|
||||
{ "Pistols", 3 },
|
||||
{ "Equipment", 7},
|
||||
{ "Pistols", 4 },
|
||||
{ "PistolAmmo", 5 },
|
||||
{ "Scopes", 5 },
|
||||
{ "Muzzles", 5 },
|
||||
{ "Uniforms", 6 },
|
||||
{ "Vests", 6 },
|
||||
{ "Headgear", 8 },
|
||||
{ "Food", 9 },
|
||||
{ "Scopes", 3 },
|
||||
{ "Muzzles", 3 },
|
||||
{ "Uniforms", 5 },
|
||||
{ "Vests", 5 },
|
||||
{ "Headgear", 6 },
|
||||
{ "Food", 7 },
|
||||
{ "RifleAmmo", 7 },
|
||||
{ "MachinegunAmmo", 3 },
|
||||
{ "SniperRifleAmmo", 2 },
|
||||
@ -380,19 +386,19 @@ class CfgMainTable
|
||||
{ "Equipment", 6 },
|
||||
{ "Pistols", 5 },
|
||||
{ "PistolAmmo", 6 },
|
||||
{ "Scopes", 5 },
|
||||
{ "Muzzles", 5 },
|
||||
{ "Scopes", 4 },
|
||||
{ "Muzzles", 3 },
|
||||
{ "Uniforms", 5 },
|
||||
{ "Vests", 5 },
|
||||
{ "Headgear", 5 },
|
||||
{ "Food", 8 },
|
||||
{ "Rifle", 2 },
|
||||
{ "Headgear", 3 },
|
||||
{ "Food", 6 },
|
||||
{ "Rifle", 3 },
|
||||
{ "RifleAmmo", 4 },
|
||||
{ "Machinegun", 1 },
|
||||
{ "MachinegunAmmo", 4 },
|
||||
{ "SniperRifle", 1 },
|
||||
{ "SniperRifleAmmo", 3 },
|
||||
{ "Hand", 6 },
|
||||
{ "Hand", 4 },
|
||||
{ "Generic", 7 },
|
||||
{ "GenericBed", 9 },
|
||||
{ "Backpack", 6 },
|
||||
@ -404,6 +410,8 @@ class CfgMainTable
|
||||
lootMin = 3;
|
||||
LootMax = 6;
|
||||
tables[] = {
|
||||
{ "Rifle", 3 },
|
||||
{ "SniperRifle", 1 },
|
||||
{ "Items", 6 },
|
||||
{ "Equipment", 6 },
|
||||
{ "Pistols", 5 },
|
||||
@ -412,11 +420,11 @@ class CfgMainTable
|
||||
{ "Muzzles", 5 },
|
||||
{ "Uniforms", 7 },
|
||||
{ "Vests", 5 },
|
||||
{ "Headgear", 13 },
|
||||
{ "Food", 11 },
|
||||
{ "Headgear", 6 },
|
||||
{ "Food", 8 },
|
||||
{ "RifleAmmo", 8 },
|
||||
{ "MachinegunAmmo", 6 },
|
||||
{ "Hand", 8 },
|
||||
{ "Hand", 6 },
|
||||
{ "Generic", 10 }
|
||||
};
|
||||
};
|
||||
@ -444,8 +452,8 @@ class CfgMainTable
|
||||
{ "PistolAmmo", 10 },
|
||||
{ "Scopes", 6 },
|
||||
{ "Muzzles", 6 },
|
||||
{ "Vests", 6 },
|
||||
{ "Headgear", 8 },
|
||||
{ "Vests", 4 },
|
||||
{ "Headgear", 6 },
|
||||
{ "Food", 8 },
|
||||
{ "RifleAmmo", 7 },
|
||||
{ "SniperRifleAmmo", 6 },
|
||||
@ -465,8 +473,8 @@ class CfgMainTable
|
||||
{ "PistolAmmo", 10 },
|
||||
{ "Scopes", 6 },
|
||||
{ "Muzzles", 6 },
|
||||
{ "Vests", 6 },
|
||||
{ "Headgear", 8 },
|
||||
{ "Vests", 4 },
|
||||
{ "Headgear", 6 },
|
||||
{ "Food", 8 },
|
||||
{ "RifleAmmo", 7 },
|
||||
{ "SniperRifleAmmo", 6 },
|
||||
@ -480,18 +488,20 @@ class CfgMainTable
|
||||
lootMin = 2;
|
||||
LootMax = 6;
|
||||
tables[] = {
|
||||
{ "Rifle", 3 },
|
||||
{ "SniperRifle", 2 },
|
||||
{ "Items", 7 },
|
||||
{ "Equipment", 7 },
|
||||
{ "Pistols", 5 },
|
||||
{ "PistolAmmo", 9 },
|
||||
{ "Scopes", 6 },
|
||||
{ "Muzzles", 6 },
|
||||
{ "Vests", 6 },
|
||||
{ "Headgear", 6 },
|
||||
{ "Scopes", 5 },
|
||||
{ "Muzzles", 5 },
|
||||
{ "Vests", 4 },
|
||||
{ "Headgear", 4 },
|
||||
{ "RifleAmmo", 7 },
|
||||
{ "SniperRifleAmmo", 3 },
|
||||
{ "MachinegunAmmo", 4 },
|
||||
{ "Hand", 9 },
|
||||
{ "Hand", 7 },
|
||||
{ "Generic", 10 },
|
||||
{ "Tools", 15 }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user