Fixed crash spawner & supply drop loot positioning

This commit is contained in:
Uro1
2014-07-10 19:13:18 +01:00
parent 08f28045f4
commit 5507513336
2 changed files with 126 additions and 120 deletions

View File

@@ -1,4 +1,4 @@
private ["_guaranteedLoot","_randomizedLoot","_spawnChance","_spawnMarker","_spawnRadius","_spawnFire","_fadeFire","_crashModel","_lootTable","_crashName","_spawnRoll","_position","_crash","_config","_hasAdjustment","_newHeight","_adjustedPos","_num","_itemTypes","_index","_weights","_cntWeights","_nearby","_itemType","_needsrelocated","_istoomany"]; private ["_guaranteedLoot","_randomizedLoot","_spawnChance","_spawnMarker","_spawnRadius","_spawnFire","_fadeFire","_crashModel","_lootTable","_crashName","_spawnRoll","_position","_crash","_config","_hasAdjustment","_newHeight","_adjustedPos","_num","_itemTypes","_index","_weights","_cntWeights","_nearby","_itemType","_needsrelocated","_istoomany","_pos","_lootPos"];
_guaranteedLoot = 3; _guaranteedLoot = 3;
_randomizedLoot = 4; _randomizedLoot = 4;
@@ -8,7 +8,8 @@ _spawnMarker = 'center';
_spawnRadius = HeliCrashArea; _spawnRadius = HeliCrashArea;
_spawnFire = true; _spawnFire = true;
_fadeFire = false; _fadeFire = false;
_minLootRadius = 4;
_maxLootRadius = 4;
_spawnRoll = random 1; _spawnRoll = random 1;
if (_spawnRoll <= _spawnChance) then { if (_spawnRoll <= _spawnChance) then {
@@ -19,7 +20,7 @@ if (_spawnRoll <= _spawnChance) then {
} else { } else {
_lootTable = "HeliCrash"; _lootTable = "HeliCrash";
}; };
_maxLootRadius = _maxLootRadius - _minLootRadius;
_crashName = getText (configFile >> "CfgVehicles" >> _crashModel >> "displayName"); _crashName = getText (configFile >> "CfgVehicles" >> _crashModel >> "displayName");
// Loop for a new location without any vehicles // Loop for a new location without any vehicles
@@ -56,7 +57,7 @@ if (_spawnRoll <= _spawnChance) then {
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crash]; PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crash];
_crash setVariable ["ObjectID","1",true]; _crash setVariable ["ObjectID","1",true];
_pos = getPos _crash;
// Disable simulation server side // Disable simulation server side
_crash enableSimulation false; _crash enableSimulation false;
@@ -85,13 +86,15 @@ if (_spawnRoll <= _spawnChance) then {
for "_x" from 1 to _num do { for "_x" from 1 to _num do {
//create loot //create loot
_maxLootRadius = (random _maxLootRadius) + _minLootRadius;
_lootPos = [_pos, _maxLootRadius, random 360] call BIS_fnc_relPos;
_index1 = floor(random _cntWeights); _index1 = floor(random _cntWeights);
_index2 = _weights select _index1; _index2 = _weights select _index1;
_itemType = _itemTypes select _index2; _itemType = _itemTypes select _index2;
[_itemType select 0, _itemType select 1, _position, 5] call spawn_loot; [_itemType select 0, _itemType select 1, _lootPos, 5] call spawn_loot;
}; };
// ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items. // ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items.
_nearby = _position nearObjects ["ReammoBox", sizeOf(_crashModel)]; _nearby = _pos nearObjects ["ReammoBox", sizeOf(_crashModel)];
{ {
_x setVariable ["permaLoot",true]; _x setVariable ["permaLoot",true];
} count _nearBy; } count _nearBy;

View File

@@ -1,11 +1,12 @@
private ["_guaranteedLoot","_randomizedLoot","_spawnChance","_spawnMarker","_spawnRadius","_crashModel","_lootTable","_spawnRoll","_position","_crash","_config","_num","_itemTypes","_index","_weights","_cntWeights","_nearby","_itemType","_needsrelocated","_istoomany"]; private ["_guaranteedLoot","_randomizedLoot","_spawnChance","_spawnMarker","_spawnRadius","_crashModel","_lootTable","_spawnRoll","_position","_crash","_config","_num","_itemTypes","_index","_weights","_cntWeights","_nearby","_itemType","_needsrelocated","_istoomany","_pos","_lootPos"];
_guaranteedLoot = 4; _guaranteedLoot = 4;
_randomizedLoot = 8; _randomizedLoot = 8;
_spawnChance = 0.50; _spawnChance = 0.50;
_spawnMarker = 'center'; _spawnMarker = 'center';
_spawnRadius = (HeliCrashArea/2); _spawnRadius = (HeliCrashArea/2);
_minLootRadius = 4;
_maxLootRadius = 4;
_spawnRoll = random 1; _spawnRoll = random 1;
if (_spawnRoll <= _spawnChance) then { if (_spawnRoll <= _spawnChance) then {
@@ -34,7 +35,7 @@ if (_spawnRoll <= _spawnChance) then {
//PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crash]; //PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crash];
//_crash setVariable ["ObjectID","1",true]; //_crash setVariable ["ObjectID","1",true];
_pos = getPos _crash;
// Disable simulation server side // Disable simulation server side
_crash enableSimulation false; _crash enableSimulation false;
@@ -51,10 +52,12 @@ if (_spawnRoll <= _spawnChance) then {
for "_x" from 1 to _num do { for "_x" from 1 to _num do {
//create loot //create loot
_maxLootRadius = (random _maxLootRadius) + _minLootRadius;
_lootPos = [_pos, _maxLootRadius, random 360] call BIS_fnc_relPos;
_index1 = floor(random _cntWeights); _index1 = floor(random _cntWeights);
_index2 = _weights select _index1; _index2 = _weights select _index1;
_itemType = _itemTypes select _index2; _itemType = _itemTypes select _index2;
[_itemType select 0, _itemType select 1, _position, 5] call spawn_loot; [_itemType select 0, _itemType select 1, _lootPos, 5] call spawn_loot;
}; };
// ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items. // ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items.