Jump to content
  • 0

mags in guns and around guns


thelonewolf1234

Question

9 answers to this question

Recommended Posts

  • 0

Edit your fn_LSgetBuildingstospawnLoot.sqf so it looks like this :

 

//special for weapons
if (_lootType == 1) exitWith {
_lootholder = createVehicle["weaponHolderSimulated", _spwnPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
_lootholder addWeaponCargoGlobal[_loot, 1];

//Function to add the right magazine for a weapon.
_ammo = [] + getArray(configFile >> "cfgWeapons" >> _loot >> "magazines");
_ammoCount = count _ammo;
if (_ammoCount > 0) then {
_lootholder addMagazineCargoGlobal[(_ammo select 0), (round(random 2))]; //max 2 magazines per weapon
};
//end custom funtion
//_lootholder setPosATL _spwnPos;
};

 

Make a backup of the file first :)

Credit

Link to comment
Share on other sites

  • 0

Ok what do you mean make your fn_LSgetBuildingstospawnLoot.sqf look like so? would I make it look like this:

//	Lootspawner spawn script
//	Author: Na_Palm (BIS forums)
//-------------------------------------------------------------------------------------
//local to Server Var. "BuildingLoot" array of [state, time], placed on buildings that can spawn loot
//												state: 0-not assigned, 1-has loot, 2-currently in use/blockaded
//												time : timestamp of last spawn
//
//local to Server Var. "Lootready" time, placed on generated lootobject, needed for removing old loot
//									time: timestamp of spawn, object is ready for use by player and loot deleter
//-------------------------------------------------------------------------------------
//special for weapons
if (_lootType == 1) exitWith {
_lootholder = createVehicle["weaponHolderSimulated", _spwnPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
_lootholder addWeaponCargoGlobal[_loot, 1];

//Function to add the right magazine for a weapon.
_ammo = [] + getArray(configFile >> "cfgWeapons" >> _loot >> "magazines");
_ammoCount = count _ammo;
if (_ammoCount > 0) then {
_lootholder addMagazineCargoGlobal[(_ammo select 0), (round(random 2))]; //max 2 magazines per weapon
};
//end custom funtion
//_lootholder setPosATL _spwnPos;
};

EDIT:
 
Ok so I have figured that all out and got the spawing to work but no mags spawn in the gun and around the gun?
 
Here is my fn_LSgetBuildingstospawnLoot:


// Lootspawner spawn script
// Author: Na_Palm (BIS forums)
//-------------------------------------------------------------------------------------
//local to Server Var. "BuildingLoot" array of [state, time], placed on buildings that can spawn loot
// state: 0-not assigned, 1-has loot, 2-currently in use/blockaded
// time : timestamp of last spawn
//
//local to Server Var. "Lootready" time, placed on generated lootobject, needed for removing old loot
// time: timestamp of spawn, object is ready for use by player and loot deleter
//-------------------------------------------------------------------------------------
private["_begintime","_BaP_list","_spInterval","_chfullfuel","_chpSpot","_genZadjust","_BaPname","_lootClass","_buildPosViable_list","_buildPosZadj_list","_lBuildVar","_posviablecount","_spwnPos","_lootspawned","_randChance","_lootholder","_selecteditem","_loot","_chfullf","_idx_sBlist","_chperSpot","_tmpPos"];

//BaP - Buildings around Player
_BaP_list = _this select 0;
_spInterval = _this select 1;
_chfullfuel = _this select 2;
_genZadjust = _this select 3;
_chpSpot = _this select 4;

_begintime = time;
{
_BaPname = "";
_lootClass = 0;
_buildPosViable_list = [];
_buildPosZadj_list = [];
_lBuildVar = (_x getVariable ["BuildingLoot", [0, 0]]);
//diag_log format["-- LOOTSPAWNER DEBUG BaP _lBuildVar: v%1v v%2v --", _lBuildVar ,_x];
if ((_lBuildVar select 0) < 2) then {
//flag immediately as in use
_x setVariable ["BuildingLoot", [2, (_lBuildVar select 1)]];
if (((_lBuildVar select 1) == 0) || ((time - (_lBuildVar select 1)) > _spInterval)) then {
//get building class
_BaPname = typeOf _x;
//here an other _x
{
//if junction found, get lists and -> exit forEach
if (_BaPname == (_x select 0)) exitWith {
_lootClass = (_x select 1);
//get viable positions Idx
_buildPosViable_list set [count _buildPosViable_list, ((Buildingpositions_list select _forEachIndex) select 1)];
if (swSpZadjust) then {
//get position adjustments
_buildPosZadj_list set [count _buildPosZadj_list, ((Buildingpositions_list select _forEachIndex) select 2)];
};
};
sleep 0.001;
}forEach Buildingstoloot_list;
//diag_log format["-- LOOTSPAWNER DEBUG BaP: v%1v%2v :: v%3v :: v%4v --", _BaPname, _lootClass, _buildPosViable_list, _buildPosZadj_list];
//get spawn position, here the former _x
_posviablecount = 0;
for "_poscount" from 0 to 100 do {
//check if position is viable
if (_poscount == ((_buildPosViable_list select 0) select _posviablecount)) then {
_posviablecount = _posviablecount +1;
//consider chance per Slot
if ((floor random 100) < _chpSpot) then {
_spwnPos = (_x buildingPos _poscount);
_tmpPos = [(_spwnPos select 0), (_spwnPos select 1), 60000];
if ((_spwnPos select 0) == 0 && (_spwnPos select 1) == 0) then {
_spwnPos = getPosATL _x;
_tmpPos = [(_spwnPos select 0), (_spwnPos select 1), 60000];
};
if (swSpZadjust) then {
_spwnPos = [_spwnPos select 0, _spwnPos select 1, (_spwnPos select 2) + ((_buildPosZadj_list select 0) select _poscount)];
};
//generally add 0.1 on z
_spwnPos = [_spwnPos select 0, _spwnPos select 1, (_spwnPos select 2) + _genZadjust];
//check if position has old loot
if ((count (nearestObjects [_spwnPos, LSusedclass_list, 0.5])) == 0) then {
sleep 0.001;
//check what type of loot to spawn
_lootspawned = false;
for "_lootType" from 1 to 5 do {
//get chance for loot every time, so all combos in spawnClassChance_list are viable
_randChance = floor(random(100));
if (((spawnClassChance_list select _lootClass) select _lootType) > _randChance) then {
_lootspawned = true;
//special for weapons
if(_lootType == 1) exitWith {
_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
_lootholder addWeaponCargoGlobal [_loot, 1];
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
//special for magazines: spawn 1-6
if(_lootType == 2) exitWith {
_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
_randChance = 1 + floor(random(5));
for "_rm" from 0 to _randChance do {
_selecteditem = (floor(random(count((lootMagazine_list select _lootClass) select 1))));
_loot = (((lootMagazine_list select _lootClass) select 1) select _selecteditem);
_lootholder addMagazineCargoGlobal [_loot, 1];
};
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
//special for item/cloth/vests
if(_lootType == 3) exitWith {
_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootItem_list select _lootClass) select 1))));
_loot = (((lootItem_list select _lootClass) select 1) select _selecteditem);
_lootholder addItemCargoGlobal [_loot, 1];
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
//special for backpacks
if(_lootType == 4) exitWith {
_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootBackpack_list select _lootClass) select 1))));
_loot = (((lootBackpack_list select _lootClass) select 1) select _selecteditem);
_lootholder addBackpackCargoGlobal [_loot, 1];
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
//special for weapons
if (_lootType == 1) exitWith {
_lootholder = createVehicle["weaponHolderSimulated", _spwnPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
_lootholder addWeaponCargoGlobal[_loot, 1];

//Function to add the right magazine for a weapon.
_ammo = [] + getArray(configFile >> "cfgWeapons" >> _loot >> "magazines");
_ammoCount = count _ammo;
if (_ammoCount > 0) then {
_lootholder addMagazineCargoGlobal[(_ammo select 0), (round(random 2))]; //max 2 magazines per weapon
};
//end custom funtion
//_lootholder setPosATL _spwnPos;
};
//special for world objects: account for Wasteland and other items
if(_lootType == 5) exitWith {
_selecteditem = (floor(random(count((lootworldObject_list select _lootClass) select 1))));
_loot = (((lootworldObject_list select _lootClass) select 1) select _selecteditem);
_lootholder = createVehicle [_loot, _tmpPos, [], 0, "CAN_COLLIDE"];
if(_loot == "Land_CanisterFuel_F") then {
_chfullf = (random 100);
if (_chfullfuel > _chfullf) then {
_lootholder setVariable["mf_item_id", "jerrycanfull", true];
} else {
_lootholder setVariable["mf_item_id", "jerrycanempty", true];
};
};
if(_loot == "Land_CanisterOil_F") then {
_lootholder setVariable["mf_item_id", "syphonhose", true];
};
if(_loot == "Land_Can_V3_F") then {
_lootholder setVariable["mf_item_id", "energydrink", true];
};
if(_loot == "Land_Basket_F") then {
_lootholder setVariable["mf_item_id", "cannedfood", true];
};
if(_loot == "Land_CanisterPlastic_F") then {
_lootholder setVariable["mf_item_id", "water", true];
};
if(_loot == "Land_Suitcase_F") then {
_lootholder setVariable["mf_item_id", "repairkit", true];
};
//if container clear its cargo
if (({_x == _loot} count exclcontainer_list) > 0) then {
clearWeaponCargoGlobal _lootholder;
clearMagazineCargoGlobal _lootholder;
clearBackpackCargoGlobal _lootholder;
clearItemCargoGlobal _lootholder;
};
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
};
//1 category loot only per place so -> exit For
//no lootpiling
if (_lootspawned) exitWith {
_lootholder setVariable ["Lootready", time];
};
};
};
};
};
//if all viable positions run through -> exit For
if (_posviablecount == (count (_buildPosViable_list select 0))) exitWith {};
};
//release building with new timestamp
_x setVariable ["BuildingLoot", [1, time]];
} else {
//release building with old timestamp
_x setVariable ["BuildingLoot", [1, (_lBuildVar select 1)]];
};
};
sleep 0.001;
}forEach _BaP_list;
//diag_log format["-- LOOTSPAWNER DEBUG BaP: %1 buildings ready, needed %2s, EXIT now --", (count _BaP_list), (time - _begintime)];

 [/­code][/spoiler]

Here is my LootSpawner:
[spoiler][code]
// Lootspawner setup and control script
// Author: Na_Palm (BIS forums)
// credit to: Ed! (404Forums) and [GoT] JoSchaap (GoT2DayZ.nl) for initial script
//-------------------------------------------------------------------------------------
if (!isServer) exitwith {};
private["_buildingname","_chfullfuel","_chperSpot","_class","_dbgloopTime","_dbgloopTimeplU","_dbgTime","_dbgTurns","_dbgTurnsplU","_endloop","_genZadjust","_hndl","_item","_nearLootdist","_pos","_posAdjustZ","_posAdjustZlist","_poscount","_posIdxlist","_posnew","_posOrg","_posViable","_randomweapontestint","_spawnradius","_spInterval","_testpos","_tmpBuild","_tmpPoslist","_tmpTstPlace","_z"];
//-------------------------------------------------------------------------------------
//Switch
swDebugLS = false; //Debug messages on/off
swSpZadjust = false; //needed for ArmA 2 and older Maps/Buildings -> true

//-------------------------------------------------------------------------------------
//Variables
//local
_spawnradius = 80; //Radius (in meter) around players to spawn loot
_spInterval = 1800; //Time (in sec.) to pass before an building spawns new loot
_chfullfuel = 100; //Chance (in %) of a spawned fuelcan to be full instead of empty
_genZadjust = -0.1; //High adjustment (in engine units) thats generally added to every spawnpoint
_tmpTstPlace = [14730, 16276, 0]; //Coord's, in [x,y,z] of a preferably flat and unocupied piece of land
_chperSpot = 95; //Chance (in %) if a spot gets loot. Will be considered before 'spawnClassChance_list'

//"spawnClassChance_list" array of [class, %weapon, %magazine, %ICV, %backpack, %object]
// class    : same classname as used in "Buildingstoloot_list"
// %weapon  : % chance to spawn a weapon on spot
// %magazine  : % chance to spawn magazines on spot
// %ICV     : % chance to spawn item/cloth/vests on spot
// %backpack  : % chance to spawn a backpack on spot
// %object  : % chance to spawn an world object on spot
//-------------- A VALUE OF '-1' RESULTS IN NO LOOT FOR THIS CLASS AND TYPE ----------------
spawnClassChance_list = [
[0, 65, 95, 75, 65, 45], // civil
[1, 65, 95, 75, 65, 45], // military
[2, 65, 95, 75, 65, 45], // industrial
[3, 65, 95, 75, 65, 45] // research
];

//"exclcontainer_list" single array of container classnames to NOT to delete if filled
exclcontainer_list = [
"Box_East_Ammo_F", "Box_East_AmmoOrd_F", "Box_East_AmmoVeh_F", "Box_East_Grenades_F", "Box_East_Support_F",
"Box_East_Wps_F", "Box_East_WpsLaunch_F", "Box_East_WpsSpecial_F",
"Box_IND_Ammo_F", "Box_IND_AmmoOrd_F", "Box_IND_AmmoVeh_F", "Box_IND_Grenades_F", "Box_IND_Support_F",
"Box_IND_Wps_F", "Box_IND_WpsLaunch_F", "Box_IND_WpsSpecial_F",
"Box_NATO_Ammo_F", "Box_NATO_AmmoOrd_F", "Box_NATO_AmmoVeh_F", "Box_NATO_Grenades_F", "Box_NATO_Support_F",
"Box_NATO_Wps_F", "Box_NATO_WpsLaunch_F", "Box_NATO_WpsSpecial_F"
];

//-------------------------------------------------------------------------------------
//DONT change these, will be filled in MAIN -------------------------------------------
spawnBuilding_list = [];
Buildingpositions_list = [];
LSusedclass_list = ["WeaponHolderSimulated"];
//DONT change these, will be filled in MAIN -------------------------------------------
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
//Buildings that can spawn loot go in this list
#include "LSlootBuildings.sqf"
//Loot goes in these lists
#include "LSlootLists.sqf"

//-------------------------------------------------------------------------------------
//function only runs once on beginning of mission, not really needs a compile 
//fill spawnBuilding_list with buildingnames only
getListBuildingnames = {
{
spawnBuilding_list set [count spawnBuilding_list, (_x select 0)];
//diag_log format["-- LOOTSPAWNER DEBUG add to spawnBuilding_list: %1 ", (_x select 0)];
}forEach Buildingstoloot_list;
};

//-------------------------------------------------------------------------------------
//function only runs once on beginning of mission, not really needs a compile 
//get list of all Lootspawner generatable 'Worldobjects'
getUsedclasses = {
for "_class" from 0 to ((count lootworldObject_list) - 1) do {
for "_item" from 0 to ((count ((lootworldObject_list select _class) select 1)) - 1) do {
if !((((lootworldObject_list select _class) select 1) select _item) in LSusedclass_list) then {
LSusedclass_list set [count LSusedclass_list, (((lootworldObject_list select _class) select 1) select _item)];
};
sleep 0.001;
};
sleep 0.001;
};
};

//-------------------------------------------------------------------------------------
//function only runs once on beginning of mission, not really needs a compile 
//fill Buildingpositions_list with [_buildingname, [_posIdxlist], [_posAdjustZlist]] 
getListBuildingPositionjunction = {
_tmpTstPlace = _this select 0;
_randomweapontestint = 0.01; //Sets the highintervals in which weaponpositions are tested. (Lower = slower, but more accurate. Higher = faster, but less accurate.)
_nearLootdist = 0.5;
{
_buildingname = _x;
_tmpBuild = _buildingname createVehicleLocal _tmpTstPlace;
//check if the creation was successful
if (isNil {_tmpBuild}) then {
diag_log format["--!!ERROR!! LOOTSPAWNER in Buildingstoloot_list: %1 no viable object !!ERROR!!--", _buildingname];
} else {
//get spawnpositions from building
_poscount = 0;
_posAdjustZlist = [];
_posIdxlist = [];
_tmpPoslist = [];
_endloop = false;
while {!_endloop} do {
if((((_tmpBuild buildingPos _poscount) select 0) != 0) && (((_tmpBuild buildingPos _poscount) select 1) != 0)) then {
//counter loot piling
_pos = _tmpBuild buildingPos _poscount;
_posOrg = _pos;
_posViable = false;
if (_poscount != 0) then {
{
if ((_pos distance _x) > _nearLootdist) exitWith {
_posViable = true;
};
}forEach _tmpPoslist;
} else {
_posViable = true;
};
_tmpPoslist set [count _tmpPoslist, _pos];
//get Z adjustment for position
if (_posViable) then {
_posIdxlist set [count _posIdxlist, _poscount];
_posAdjustZ = 0;
if (swSpZadjust) then {
if(_pos select 2 < 0) then {
_pos = [_pos select 0, _pos select 1, 1];
};
_z = 0;
_posnew = _pos;
_testpos = true;
while {_testpos} do 
{
if((!lineIntersects[ATLtoASL(_pos), ATLtoASL([_pos select 0, _pos select 1, (_pos select 2) - (_randomweapontestint * _z)])]) && (!terrainIntersect[(_pos), ([_pos select 0, _pos select 1, (_pos select 2) - (_randomweapontestint * _z)])]) && (_pos select 2 > 0)) then {
_posnew = [_pos select 0, _pos select 1, (_pos select 2) - (_randomweapontestint * _z)];
_z = _z + 1;
} else {
_testpos = false;
};
};
_posnew = [_posnew select 0, _posnew select 1, (_posnew select 2) + 0.05];
_posAdjustZ = (_posOrg select 2) - (_posnew select 2);
// diag_log format["-- LOOTSPAWNER DEBUG adjusted %1 times", _z];
_posAdjustZlist set [count _posAdjustZlist, _posAdjustZ];
} else {
_posAdjustZlist set [count _posAdjustZlist, _posAdjustZ];
};
};
_poscount = _poscount + 1;
} else {
_endloop = true;
};
};
//save final position Index & adjustments to list
if (_poscount != 0) then {
//diag_log format["-- LOOTSPAWNER DEBUG add to Buildingpositions_list: v%1v v%2v v%3v added", _buildingname, _posIdxlist, _posAdjustZlist];
Buildingpositions_list set [count Buildingpositions_list, [_buildingname, _posIdxlist, _posAdjustZlist]];
} else {
diag_log format["-- !!LOOTSPAWNER WARNING!! in Buildingstoloot_list: %1 has no building positions --", _buildingname];
Buildingpositions_list set [count Buildingpositions_list, [_buildingname, [0], [0]]];
};
};
deleteVehicle _tmpBuild;
}forEach spawnBuilding_list;
};

//-------------------------------------------------------------------------------------
// MAIN
//-------------------------------------------------------------------------------------
diag_log format["-- LOOTSPAWNER initialise ------------------------"];
if ((count Buildingstoloot_list) == 0) then {
diag_log format["--!!ERROR!! LOOTSPAWNER Buildingstoloot_list in lootBuildings.sqf MUST have one entry at least !!ERROR!!--"];
diag_log format["-- LOOTSPAWNER disabled --"];
} else {
_dbgTime = time;
_hndl = [] spawn getListBuildingnames;
waitUntil{scriptDone _hndl};
diag_log format["-- LOOTSPAWNER spawnBuilding_list ready, d: %1s", (time - _dbgTime)];
_dbgTime = time;
_hndl = [_tmpTstPlace] spawn getListBuildingPositionjunction;
waitUntil{scriptDone _hndl};
diag_log format["-- LOOTSPAWNER Buildingpositions_list ready, d: %1s", (time - _dbgTime)];
_dbgTime = time;
_hndl = [] spawn getUsedclasses;
waitUntil{scriptDone _hndl};
diag_log format["-- LOOTSPAWNER LSusedclass_list ready, d: %1s", (time - _dbgTime)];
//run loot deleter continously
null = _spInterval spawn LSdeleter;
diag_log format["-- LOOTSPAWNER LSDer started..."];
if (swDebugLS) then {
dbgTime = time;
dbgTurns = 0;
dbgTurnsplU = 0;
dbgloopTime = 0;
dbgloopTimeplU = 0;
};
diag_log format["-- LOOTSPAWNER ready and waiting for players -----"];
//go into mainloop till mission ends
while {true} do {
_playersalive = false;
{
if (swDebugLS) then {
dbgTimeplU = time;
};
//is Player online and alive?
if ((isPlayer _x) && (alive _x)) then {
_playersalive = true;
//jogging has 4.16..., sprinting has 5.5... so if player velocity is < 6 spawn loot
//works for players in vehicles too
if (((velocity _x) distance [0,0,0]) < 6) then {
//if ((vehicle _x isKindOf "Land") || (vehicle _x isKindOf "Ship")) then {
_posPlayer = getPos _x;
//get list of viable buildings around player
_BaP_list = nearestObjects [_posPlayer, spawnBuilding_list, _spawnradius];
if ((count _BaP_list) > 0) then {
//give to spawn function
_hndl = [_BaP_list, _spInterval, _chfullfuel, _genZadjust, _chperSpot] spawn fn_getBuildingstospawnLoot;
waitUntil{scriptDone _hndl};
};
};
};
sleep 0.001;
if (swDebugLS) then {
dbgloopTimeplU = dbgloopTimeplU + (time - dbgTimeplU);
dbgTurnsplU = dbgTurnsplU + 1;
};
}forEach playableUnits;
if (swDebugLS) then {
dbgloopTime = dbgloopTime + dbgloopTimeplU;
dbgloopTimeplU = 0;
dbgTurns = dbgTurns + 1;
//every 30 sec. give stats out
if ((time - dbgTime) > 30) then {
if (dbgTurnsplU > 0) then {
diag_log format["-- DEBUG LOOTSPAWNER MAIN turns (spawned): %1(%2), duration: %3sec, average: %4sec.",dbgTurns ,dbgTurnsplU , dbgloopTime, (dbgloopTime / dbgTurnsplU)];
} else {
diag_log format["-- DEBUG LOOTSPAWNER MAIN waiting for players"];
};
dbgTime = time;
dbgTurns = 0;
dbgTurnsplU = 0;
dbgloopTime = 0;
};
};
//if no players online wait a bit
if (!_playersalive) then {
sleep 2;
};
};
};

[/­code][/spoiler]

Here is my LSDeleter:
[spoiler][code]
// Lootspawner deleter script to remove old loot
// Author: Na_Palm (BIS forums)
//-------------------------------------------------------------------------------------
private["_objlT","_countdel","_timedel","_objempty","_playersnear","_objisContainer","_objVar","_obj","_objlocked","_objclass"];

_objlT = _this;
while {true} do {
_countdel = 0;
//_timedel = time;
{
{
_objempty = false;
_playersnear = false;
_objisContainer = false;
//try to get local server Var "Lootready"
_objVar = (_x getVariable "Lootready");
//if "Lootready" NOT present then its not spawned by LS or in creation
if (!isNil "_objVar") then {
//check if lifetime is expired
if ((time - _objVar) > _objlT) then {
//if object has the var. "objectLocked", it belongs now to a player and therefor bad idea to delete it
_objlocked = (_x getVariable "objectLocked");
if(isNil "_objlocked") then {
//case-insensitive
_objclass = typeOf _x;
if (({_x == _objclass} count exclcontainer_list) > 0) then {
_objisContainer = true;
if ((count ((getWeaponCargo _x) select 0)) == 0) then {
if ((count ((getMagazineCargo _x) select 0)) == 0) then {
if ((count ((getItemCargo _x) select 0)) == 0) then {
if ((count ((getBackpackCargo _x) select 0)) == 0) then {
_objempty = true;
};
};
};
};
};
_obj = _x;
//check if any alive player is near
{
if ((isPlayer _x) && (alive _x)) then {
if (((getPosATL _x) distance (getPosATL _obj)) < 500)  then {
_playersnear = true;
};
};
sleep 0.001;
}forEach playableUnits;
//if (_objempty AND !_playersnear) OR (!_objisContainer AND !_playersnear) then delete
if (((_objempty) && (!_playersnear)) || ((!_objisContainer) && (!_playersnear))) then {
//diag_log format["-- DEBUG LOOTSPAWNER Delete item: %1:%2:%3 %4vLT%5v%6v for %7 v%8v%9%10v%11v --", _objisContainer, _objempty, _playersnear, _objVar, (time - _objVar), _objlT, (typeOf _x), ((getWeaponCargo _x) select 0), ((getMagazineCargo _x) select 0), ((getItemCargo _x) select 0), ((getBackpackCargo _x) select 0)];
deleteVehicle _x;
_countdel = _countdel + 1;
};
};
};
};
_objVar = Nil;
_objlocked = Nil;
sleep 0.001;
}forEach allMissionObjects _x;
sleep 0.001;
}forEach LSusedclass_list;
if (_countdel > 0) then {
diag_log format["-- LOOTSPAWNER deleted %1 objects --", _countdel];
};
sleep 60;
};
  // Lootspawner spawn script
// Author: Na_Palm (BIS forums)
//-------------------------------------------------------------------------------------
//local to Server Var. "BuildingLoot" array of [state, time], placed on buildings that can spawn loot
// state: 0-not assigned, 1-has loot, 2-currently in use/blockaded
// time : timestamp of last spawn
//
//local to Server Var. "Lootready" time, placed on generated lootobject, needed for removing old loot
// time: timestamp of spawn, object is ready for use by player and loot deleter
//-------------------------------------------------------------------------------------
private["_begintime","_BaP_list","_spInterval","_chfullfuel","_chpSpot","_genZadjust","_BaPname","_lootClass","_buildPosViable_list","_buildPosZadj_list","_lBuildVar","_posviablecount","_spwnPos","_lootspawned","_randChance","_lootholder","_selecteditem","_loot","_chfullf","_idx_sBlist","_chperSpot","_tmpPos"];

//BaP - Buildings around Player
_BaP_list = _this select 0;
_spInterval = _this select 1;
_chfullfuel = _this select 2;
_genZadjust = _this select 3;
_chpSpot = _this select 4;

_begintime = time;
{
_BaPname = "";
_lootClass = 0;
_buildPosViable_list = [];
_buildPosZadj_list = [];
_lBuildVar = (_x getVariable ["BuildingLoot", [0, 0]]);
//diag_log format["-- LOOTSPAWNER DEBUG BaP _lBuildVar: v%1v v%2v --", _lBuildVar ,_x];
if ((_lBuildVar select 0) < 2) then {
//flag immediately as in use
_x setVariable ["BuildingLoot", [2, (_lBuildVar select 1)]];
if (((_lBuildVar select 1) == 0) || ((time - (_lBuildVar select 1)) > _spInterval)) then {
//get building class
_BaPname = typeOf _x;
//here an other _x
{
//if junction found, get lists and -> exit forEach
if (_BaPname == (_x select 0)) exitWith {
_lootClass = (_x select 1);
//get viable positions Idx
_buildPosViable_list set [count _buildPosViable_list, ((Buildingpositions_list select _forEachIndex) select 1)];
if (swSpZadjust) then {
//get position adjustments
_buildPosZadj_list set [count _buildPosZadj_list, ((Buildingpositions_list select _forEachIndex) select 2)];
};
};
sleep 0.001;
}forEach Buildingstoloot_list;
//diag_log format["-- LOOTSPAWNER DEBUG BaP: v%1v%2v :: v%3v :: v%4v --", _BaPname, _lootClass, _buildPosViable_list, _buildPosZadj_list];
//get spawn position, here the former _x
_posviablecount = 0;
for "_poscount" from 0 to 100 do {
//check if position is viable
if (_poscount == ((_buildPosViable_list select 0) select _posviablecount)) then {
_posviablecount = _posviablecount +1;
//consider chance per Slot
if ((floor random 100) < _chpSpot) then {
_spwnPos = (_x buildingPos _poscount);
_tmpPos = [(_spwnPos select 0), (_spwnPos select 1), 60000];
if ((_spwnPos select 0) == 0 && (_spwnPos select 1) == 0) then {
_spwnPos = getPosATL _x;
_tmpPos = [(_spwnPos select 0), (_spwnPos select 1), 60000];
};
if (swSpZadjust) then {
_spwnPos = [_spwnPos select 0, _spwnPos select 1, (_spwnPos select 2) + ((_buildPosZadj_list select 0) select _poscount)];
};
//generally add 0.1 on z
_spwnPos = [_spwnPos select 0, _spwnPos select 1, (_spwnPos select 2) + _genZadjust];
//check if position has old loot
if ((count (nearestObjects [_spwnPos, LSusedclass_list, 0.5])) == 0) then {
sleep 0.001;
//check what type of loot to spawn
_lootspawned = false;
for "_lootType" from 1 to 5 do {
//get chance for loot every time, so all combos in spawnClassChance_list are viable
_randChance = floor(random(100));
if (((spawnClassChance_list select _lootClass) select _lootType) > _randChance) then {
_lootspawned = true;
//special for weapons
if(_lootType == 1) exitWith {
_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
_lootholder addWeaponCargoGlobal [_loot, 1];
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
//special for magazines: spawn 1-6
if(_lootType == 2) exitWith {
_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
_randChance = 1 + floor(random(5));
for "_rm" from 0 to _randChance do {
_selecteditem = (floor(random(count((lootMagazine_list select _lootClass) select 1))));
_loot = (((lootMagazine_list select _lootClass) select 1) select _selecteditem);
_lootholder addMagazineCargoGlobal [_loot, 1];
};
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
//special for item/cloth/vests
if(_lootType == 3) exitWith {
_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootItem_list select _lootClass) select 1))));
_loot = (((lootItem_list select _lootClass) select 1) select _selecteditem);
_lootholder addItemCargoGlobal [_loot, 1];
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
//special for backpacks
if(_lootType == 4) exitWith {
_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootBackpack_list select _lootClass) select 1))));
_loot = (((lootBackpack_list select _lootClass) select 1) select _selecteditem);
_lootholder addBackpackCargoGlobal [_loot, 1];
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
//special for weapons
if (_lootType == 1) exitWith {
_lootholder = createVehicle["weaponHolderSimulated", _spwnPos, [], 0, "CAN_COLLIDE"];
_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
_lootholder addWeaponCargoGlobal[_loot, 1];

//Function to add the right magazine for a weapon.
_ammo = [] + getArray(configFile >> "cfgWeapons" >> _loot >> "magazines");
_ammoCount = count _ammo;
if (_ammoCount > 0) then {
_lootholder addMagazineCargoGlobal[(_ammo select 0), (round(random 2))]; //max 2 magazines per weapon
};
//end custom funtion
//_lootholder setPosATL _spwnPos;
};
//special for world objects: account for Wasteland and other items
if(_lootType == 5) exitWith {
_selecteditem = (floor(random(count((lootworldObject_list select _lootClass) select 1))));
_loot = (((lootworldObject_list select _lootClass) select 1) select _selecteditem);
_lootholder = createVehicle [_loot, _tmpPos, [], 0, "CAN_COLLIDE"];
if(_loot == "Land_CanisterFuel_F") then {
_chfullf = (random 100);
if (_chfullfuel > _chfullf) then {
_lootholder setVariable["mf_item_id", "jerrycanfull", true];
} else {
_lootholder setVariable["mf_item_id", "jerrycanempty", true];
};
};
if(_loot == "Land_CanisterOil_F") then {
_lootholder setVariable["mf_item_id", "syphonhose", true];
};
if(_loot == "Land_Can_V3_F") then {
_lootholder setVariable["mf_item_id", "energydrink", true];
};
if(_loot == "Land_Basket_F") then {
_lootholder setVariable["mf_item_id", "cannedfood", true];
};
if(_loot == "Land_CanisterPlastic_F") then {
_lootholder setVariable["mf_item_id", "water", true];
};
if(_loot == "Land_Suitcase_F") then {
_lootholder setVariable["mf_item_id", "repairkit", true];
};
//if container clear its cargo
if (({_x == _loot} count exclcontainer_list) > 0) then {
clearWeaponCargoGlobal _lootholder;
clearMagazineCargoGlobal _lootholder;
clearBackpackCargoGlobal _lootholder;
clearItemCargoGlobal _lootholder;
};
_lootholder setdir (random 360);
_lootholder setPosATL _spwnPos;
};
};
//1 category loot only per place so -> exit For
//no lootpiling
if (_lootspawned) exitWith {
_lootholder setVariable ["Lootready", time];
};
};
};
};
};
//if all viable positions run through -> exit For
if (_posviablecount == (count (_buildPosViable_list select 0))) exitWith {};
};
//release building with new timestamp
_x setVariable ["BuildingLoot", [1, time]];
} else {
//release building with old timestamp
_x setVariable ["BuildingLoot", [1, (_lBuildVar select 1)]];
};
};
sleep 0.001;
}forEach _BaP_list;
//diag_log format["-- LOOTSPAWNER DEBUG BaP: %1 buildings ready, needed %2s, EXIT now --", (count _BaP_list), (time - _begintime)];

 [/­code][/spoiler]

Here is my LootSpawner:
[spoiler][code]
// Lootspawner setup and control script
// Author: Na_Palm (BIS forums)
// credit to: Ed! (404Forums) and [GoT] JoSchaap (GoT2DayZ.nl) for initial script
//-------------------------------------------------------------------------------------
if (!isServer) exitwith {};
private["_buildingname","_chfullfuel","_chperSpot","_class","_dbgloopTime","_dbgloopTimeplU","_dbgTime","_dbgTurns","_dbgTurnsplU","_endloop","_genZadjust","_hndl","_item","_nearLootdist","_pos","_posAdjustZ","_posAdjustZlist","_poscount","_posIdxlist","_posnew","_posOrg","_posViable","_randomweapontestint","_spawnradius","_spInterval","_testpos","_tmpBuild","_tmpPoslist","_tmpTstPlace","_z"];
//-------------------------------------------------------------------------------------
//Switch
swDebugLS = false; //Debug messages on/off
swSpZadjust = false; //needed for ArmA 2 and older Maps/Buildings -> true

//-------------------------------------------------------------------------------------
//Variables
//local
_spawnradius = 80; //Radius (in meter) around players to spawn loot
_spInterval = 1800; //Time (in sec.) to pass before an building spawns new loot
_chfullfuel = 100; //Chance (in %) of a spawned fuelcan to be full instead of empty
_genZadjust = -0.1; //High adjustment (in engine units) thats generally added to every spawnpoint
_tmpTstPlace = [14730, 16276, 0]; //Coord's, in [x,y,z] of a preferably flat and unocupied piece of land
_chperSpot = 95; //Chance (in %) if a spot gets loot. Will be considered before 'spawnClassChance_list'

//"spawnClassChance_list" array of [class, %weapon, %magazine, %ICV, %backpack, %object]
// class    : same classname as used in "Buildingstoloot_list"
// %weapon  : % chance to spawn a weapon on spot
// %magazine  : % chance to spawn magazines on spot
// %ICV     : % chance to spawn item/cloth/vests on spot
// %backpack  : % chance to spawn a backpack on spot
// %object  : % chance to spawn an world object on spot
//-------------- A VALUE OF '-1' RESULTS IN NO LOOT FOR THIS CLASS AND TYPE ----------------
spawnClassChance_list = [
[0, 65, 95, 75, 65, 45], // civil
[1, 65, 95, 75, 65, 45], // military
[2, 65, 95, 75, 65, 45], // industrial
[3, 65, 95, 75, 65, 45] // research
];

//"exclcontainer_list" single array of container classnames to NOT to delete if filled
exclcontainer_list = [
"Box_East_Ammo_F", "Box_East_AmmoOrd_F", "Box_East_AmmoVeh_F", "Box_East_Grenades_F", "Box_East_Support_F",
"Box_East_Wps_F", "Box_East_WpsLaunch_F", "Box_East_WpsSpecial_F",
"Box_IND_Ammo_F", "Box_IND_AmmoOrd_F", "Box_IND_AmmoVeh_F", "Box_IND_Grenades_F", "Box_IND_Support_F",
"Box_IND_Wps_F", "Box_IND_WpsLaunch_F", "Box_IND_WpsSpecial_F",
"Box_NATO_Ammo_F", "Box_NATO_AmmoOrd_F", "Box_NATO_AmmoVeh_F", "Box_NATO_Grenades_F", "Box_NATO_Support_F",
"Box_NATO_Wps_F", "Box_NATO_WpsLaunch_F", "Box_NATO_WpsSpecial_F"
];

//-------------------------------------------------------------------------------------
//DONT change these, will be filled in MAIN -------------------------------------------
spawnBuilding_list = [];
Buildingpositions_list = [];
LSusedclass_list = ["WeaponHolderSimulated"];
//DONT change these, will be filled in MAIN -------------------------------------------
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
//Buildings that can spawn loot go in this list
#include "LSlootBuildings.sqf"
//Loot goes in these lists
#include "LSlootLists.sqf"

//-------------------------------------------------------------------------------------
//function only runs once on beginning of mission, not really needs a compile 
//fill spawnBuilding_list with buildingnames only
getListBuildingnames = {
{
spawnBuilding_list set [count spawnBuilding_list, (_x select 0)];
//diag_log format["-- LOOTSPAWNER DEBUG add to spawnBuilding_list: %1 ", (_x select 0)];
}forEach Buildingstoloot_list;
};

//-------------------------------------------------------------------------------------
//function only runs once on beginning of mission, not really needs a compile 
//get list of all Lootspawner generatable 'Worldobjects'
getUsedclasses = {
for "_class" from 0 to ((count lootworldObject_list) - 1) do {
for "_item" from 0 to ((count ((lootworldObject_list select _class) select 1)) - 1) do {
if !((((lootworldObject_list select _class) select 1) select _item) in LSusedclass_list) then {
LSusedclass_list set [count LSusedclass_list, (((lootworldObject_list select _class) select 1) select _item)];
};
sleep 0.001;
};
sleep 0.001;
};
};

//-------------------------------------------------------------------------------------
//function only runs once on beginning of mission, not really needs a compile 
//fill Buildingpositions_list with [_buildingname, [_posIdxlist], [_posAdjustZlist]] 
getListBuildingPositionjunction = {
_tmpTstPlace = _this select 0;
_randomweapontestint = 0.01; //Sets the highintervals in which weaponpositions are tested. (Lower = slower, but more accurate. Higher = faster, but less accurate.)
_nearLootdist = 0.5;
{
_buildingname = _x;
_tmpBuild = _buildingname createVehicleLocal _tmpTstPlace;
//check if the creation was successful
if (isNil {_tmpBuild}) then {
diag_log format["--!!ERROR!! LOOTSPAWNER in Buildingstoloot_list: %1 no viable object !!ERROR!!--", _buildingname];
} else {
//get spawnpositions from building
_poscount = 0;
_posAdjustZlist = [];
_posIdxlist = [];
_tmpPoslist = [];
_endloop = false;
while {!_endloop} do {
if((((_tmpBuild buildingPos _poscount) select 0) != 0) && (((_tmpBuild buildingPos _poscount) select 1) != 0)) then {
//counter loot piling
_pos = _tmpBuild buildingPos _poscount;
_posOrg = _pos;
_posViable = false;
if (_poscount != 0) then {
{
if ((_pos distance _x) > _nearLootdist) exitWith {
_posViable = true;
};
}forEach _tmpPoslist;
} else {
_posViable = true;
};
_tmpPoslist set [count _tmpPoslist, _pos];
//get Z adjustment for position
if (_posViable) then {
_posIdxlist set [count _posIdxlist, _poscount];
_posAdjustZ = 0;
if (swSpZadjust) then {
if(_pos select 2 < 0) then {
_pos = [_pos select 0, _pos select 1, 1];
};
_z = 0;
_posnew = _pos;
_testpos = true;
while {_testpos} do 
{
if((!lineIntersects[ATLtoASL(_pos), ATLtoASL([_pos select 0, _pos select 1, (_pos select 2) - (_randomweapontestint * _z)])]) && (!terrainIntersect[(_pos), ([_pos select 0, _pos select 1, (_pos select 2) - (_randomweapontestint * _z)])]) && (_pos select 2 > 0)) then {
_posnew = [_pos select 0, _pos select 1, (_pos select 2) - (_randomweapontestint * _z)];
_z = _z + 1;
} else {
_testpos = false;
};
};
_posnew = [_posnew select 0, _posnew select 1, (_posnew select 2) + 0.05];
_posAdjustZ = (_posOrg select 2) - (_posnew select 2);
// diag_log format["-- LOOTSPAWNER DEBUG adjusted %1 times", _z];
_posAdjustZlist set [count _posAdjustZlist, _posAdjustZ];
} else {
_posAdjustZlist set [count _posAdjustZlist, _posAdjustZ];
};
};
_poscount = _poscount + 1;
} else {
_endloop = true;
};
};
//save final position Index & adjustments to list
if (_poscount != 0) then {
//diag_log format["-- LOOTSPAWNER DEBUG add to Buildingpositions_list: v%1v v%2v v%3v added", _buildingname, _posIdxlist, _posAdjustZlist];
Buildingpositions_list set [count Buildingpositions_list, [_buildingname, _posIdxlist, _posAdjustZlist]];
} else {
diag_log format["-- !!LOOTSPAWNER WARNING!! in Buildingstoloot_list: %1 has no building positions --", _buildingname];
Buildingpositions_list set [count Buildingpositions_list, [_buildingname, [0], [0]]];
};
};
deleteVehicle _tmpBuild;
}forEach spawnBuilding_list;
};

//-------------------------------------------------------------------------------------
// MAIN
//-------------------------------------------------------------------------------------
diag_log format["-- LOOTSPAWNER initialise ------------------------"];
if ((count Buildingstoloot_list) == 0) then {
diag_log format["--!!ERROR!! LOOTSPAWNER Buildingstoloot_list in lootBuildings.sqf MUST have one entry at least !!ERROR!!--"];
diag_log format["-- LOOTSPAWNER disabled --"];
} else {
_dbgTime = time;
_hndl = [] spawn getListBuildingnames;
waitUntil{scriptDone _hndl};
diag_log format["-- LOOTSPAWNER spawnBuilding_list ready, d: %1s", (time - _dbgTime)];
_dbgTime = time;
_hndl = [_tmpTstPlace] spawn getListBuildingPositionjunction;
waitUntil{scriptDone _hndl};
diag_log format["-- LOOTSPAWNER Buildingpositions_list ready, d: %1s", (time - _dbgTime)];
_dbgTime = time;
_hndl = [] spawn getUsedclasses;
waitUntil{scriptDone _hndl};
diag_log format["-- LOOTSPAWNER LSusedclass_list ready, d: %1s", (time - _dbgTime)];
//run loot deleter continously
null = _spInterval spawn LSdeleter;
diag_log format["-- LOOTSPAWNER LSDer started..."];
if (swDebugLS) then {
dbgTime = time;
dbgTurns = 0;
dbgTurnsplU = 0;
dbgloopTime = 0;
dbgloopTimeplU = 0;
};
diag_log format["-- LOOTSPAWNER ready and waiting for players -----"];
//go into mainloop till mission ends
while {true} do {
_playersalive = false;
{
if (swDebugLS) then {
dbgTimeplU = time;
};
//is Player online and alive?
if ((isPlayer _x) && (alive _x)) then {
_playersalive = true;
//jogging has 4.16..., sprinting has 5.5... so if player velocity is < 6 spawn loot
//works for players in vehicles too
if (((velocity _x) distance [0,0,0]) < 6) then {
//if ((vehicle _x isKindOf "Land") || (vehicle _x isKindOf "Ship")) then {
_posPlayer = getPos _x;
//get list of viable buildings around player
_BaP_list = nearestObjects [_posPlayer, spawnBuilding_list, _spawnradius];
if ((count _BaP_list) > 0) then {
//give to spawn function
_hndl = [_BaP_list, _spInterval, _chfullfuel, _genZadjust, _chperSpot] spawn fn_getBuildingstospawnLoot;
waitUntil{scriptDone _hndl};
};
};
};
sleep 0.001;
if (swDebugLS) then {
dbgloopTimeplU = dbgloopTimeplU + (time - dbgTimeplU);
dbgTurnsplU = dbgTurnsplU + 1;
};
}forEach playableUnits;
if (swDebugLS) then {
dbgloopTime = dbgloopTime + dbgloopTimeplU;
dbgloopTimeplU = 0;
dbgTurns = dbgTurns + 1;
//every 30 sec. give stats out
if ((time - dbgTime) > 30) then {
if (dbgTurnsplU > 0) then {
diag_log format["-- DEBUG LOOTSPAWNER MAIN turns (spawned): %1(%2), duration: %3sec, average: %4sec.",dbgTurns ,dbgTurnsplU , dbgloopTime, (dbgloopTime / dbgTurnsplU)];
} else {
diag_log format["-- DEBUG LOOTSPAWNER MAIN waiting for players"];
};
dbgTime = time;
dbgTurns = 0;
dbgTurnsplU = 0;
dbgloopTime = 0;
};
};
//if no players online wait a bit
if (!_playersalive) then {
sleep 2;
};
};
};

[/­code][/spoiler]

Here is my LSDeleter:
[spoiler][code]
// Lootspawner deleter script to remove old loot
// Author: Na_Palm (BIS forums)
//-------------------------------------------------------------------------------------
private["_objlT","_countdel","_timedel","_objempty","_playersnear","_objisContainer","_objVar","_obj","_objlocked","_objclass"];

_objlT = _this;
while {true} do {
_countdel = 0;
//_timedel = time;
{
{
_objempty = false;
_playersnear = false;
_objisContainer = false;
//try to get local server Var "Lootready"
_objVar = (_x getVariable "Lootready");
//if "Lootready" NOT present then its not spawned by LS or in creation
if (!isNil "_objVar") then {
//check if lifetime is expired
if ((time - _objVar) > _objlT) then {
//if object has the var. "objectLocked", it belongs now to a player and therefor bad idea to delete it
_objlocked = (_x getVariable "objectLocked");
if(isNil "_objlocked") then {
//case-insensitive
_objclass = typeOf _x;
if (({_x == _objclass} count exclcontainer_list) > 0) then {
_objisContainer = true;
if ((count ((getWeaponCargo _x) select 0)) == 0) then {
if ((count ((getMagazineCargo _x) select 0)) == 0) then {
if ((count ((getItemCargo _x) select 0)) == 0) then {
if ((count ((getBackpackCargo _x) select 0)) == 0) then {
_objempty = true;
};
};
};
};
};
_obj = _x;
//check if any alive player is near
{
if ((isPlayer _x) && (alive _x)) then {
if (((getPosATL _x) distance (getPosATL _obj)) < 500)  then {
_playersnear = true;
};
};
sleep 0.001;
}forEach playableUnits;
//if (_objempty AND !_playersnear) OR (!_objisContainer AND !_playersnear) then delete
if (((_objempty) && (!_playersnear)) || ((!_objisContainer) && (!_playersnear))) then {
//diag_log format["-- DEBUG LOOTSPAWNER Delete item: %1:%2:%3 %4vLT%5v%6v for %7 v%8v%9%10v%11v --", _objisContainer, _objempty, _playersnear, _objVar, (time - _objVar), _objlT, (typeOf _x), ((getWeaponCargo _x) select 0), ((getMagazineCargo _x) select 0), ((getItemCargo _x) select 0), ((getBackpackCargo _x) select 0)];
deleteVehicle _x;
_countdel = _countdel + 1;
};
};
};
};
_objVar = Nil;
_objlocked = Nil;
sleep 0.001;
}forEach allMissionObjects _x;
sleep 0.001;
}forEach LSusedclass_list;
if (_countdel > 0) then {
diag_log format["-- LOOTSPAWNER deleted %1 objects --", _countdel];
};
sleep 60;
};

Link to comment
Share on other sites

  • 0

Here is my LSLootBuildings:

//    Lootspawner junction list for buildings to classes
//    Author: Na_Palm (BIS forums)
//-------------------------------------------------------------------------------------
//"Buildingstoloot_list" array of [buildingname, class]
//                                buildingname:     building class name (in editor debug console use "typeof BIS_fnc_camera_target"
//                                                to monitor and then copy/paste or any other method you know...)
//                                class:             0-civil, 1-military, ... (add more as you wish)
//
//!!!EVERY building must have only ONE entry here AND been in ONE class!!!
//-------------------------------------------------------------------------------------
Buildingstoloot_list = [
["Land_CarService_F", 2],
["Land_Cargo_HQ_V1_F", 1],
["Land_Cargo_HQ_V2_F", 1],
["Land_Cargo_HQ_V3_F", 1],
["Land_Cargo_House_V1_F", 1],
["Land_Cargo_House_V2_F", 1],
["Land_Cargo_House_V3_F", 1],
["Land_Cargo_Patrol_V1_F", 1],
["Land_Cargo_Patrol_V2_F", 1],
["Land_Cargo_Patrol_V3_F", 1],
["Land_Cargo_Tower_V2_F", 1],
["Land_Cargo_Tower_V3_F", 1],
["Land_Chapel_Small_V1_F", 0],
["Land_Chapel_Small_V2_F", 0],
["Land_Chapel_V1_F", 0],
["Land_Chapel_V2_F", 0],
["Land_Crane_F", 2],
["Land_Factory_Main_F", 2],
["Land_Hangar_F", 1],
["Land_Hospital_main_F", 3],
["Land_Hospital_side1_F", 3],
["Land_Hospital_side2_F", 3],
["Land_LightHouse_F", 2],
["Land_Lighthouse_small_F", 2],
["Land_Metal_Shed_F", 2],
["Land_Pier_F", 2],
["Land_Pier_small_F", 2],
["Land_Radar_F", 3],
["Land_Research_HQ_F", 3],
["Land_Research_house_V1_F", 3],
["Land_Slum_House01_F", 0],
["Land_Slum_House02_F", 0],
["Land_Slum_House03_F", 0],
["Land_Unfinished_Building_01_F", 2],
["Land_Unfinished_Building_02_F", 2],
["Land_WIP_F", 2],
["Land_cargo_house_slum_F", 0],
["Land_d_Addon_02_V1_F", 0],
["Land_d_House_Big_01_V1_F", 0],
["Land_d_House_Big_02_V1_F", 0],
["Land_d_House_Small_01_V1_F", 0],
["Land_d_House_Small_02_V1_F", 0],
["Land_d_Shop_01_V1_F", 0],
["Land_d_Shop_02_V1_F", 0],
["Land_d_Stone_HouseBig_V1_F", 0],
["Land_d_Stone_HouseSmall_V1_F", 0],
["Land_d_Stone_Shed_V1_F", 2],
["Land_d_Windmill01_F", 2],
["Land_dp_bigTank_F", 2],
["Land_dp_mainFactory_F", 2],
["Land_i_Addon_02_V1_F", 0],
["Land_i_Addon_03_V1_F", 0],
["Land_i_Addon_03mid_V1_F", 0],
["Land_i_Addon_04_V1_F", 0],
["Land_i_Garage_V1_F", 0],
["Land_i_Garage_V1_dam_F", 0],
["Land_i_Garage_V2_F", 0],
["Land_i_Garage_V2_dam_F", 0],
["Land_i_House_Big_01_V1_F", 0],
["Land_i_House_Big_01_V2_F", 0],
["Land_i_House_Big_01_V3_F", 0],
["Land_i_House_Big_02_V1_F", 0],
["Land_i_House_Big_02_V2_F", 0],
["Land_i_House_Big_02_V3_F", 0],
["Land_i_House_Small_01_V1_F", 0],
["Land_i_House_Small_01_V2_F", 0],
["Land_i_House_Small_01_V3_F", 0],
["Land_i_House_Small_02_V1_F", 0],
["Land_i_House_Small_02_V2_F", 0],
["Land_i_House_Small_02_V3_F", 0],
["Land_i_House_Small_03_V1_F", 0],
["Land_i_Shed_Ind_F", 2],
["Land_i_Shop_01_V1_F", 0],
["Land_i_Shop_01_V2_F", 0],
["Land_i_Shop_01_V3_F", 0],
["Land_i_Shop_02_V1_F", 0],
["Land_i_Shop_02_V2_F", 0],
["Land_i_Shop_02_V3_F", 0],
["Land_i_Stone_HouseBig_V1_F", 0],
["Land_i_Stone_HouseBig_V2_F", 0],
["Land_i_Stone_HouseBig_V3_F", 0],
["Land_i_Stone_HouseSmall_V1_F", 0],
["Land_i_Stone_HouseSmall_V2_F", 0],
["Land_i_Stone_HouseSmall_V3_F", 0],
["Land_i_Stone_Shed_V1_F", 2],
["Land_i_Stone_Shed_V2_F", 2],
["Land_i_Stone_Shed_V3_F", 2],
["Land_i_Windmill01_F", 2],
["Land_nav_pier_m_F", 2],
["Land_spp_Tower_F", 0],
["Land_u_Addon_01_V1_F", 0],
["Land_u_Addon_02_V1_F", 0],
["Land_u_Barracks_V2_F", 1],
["Land_u_House_Big_01_V1_F", 0],
["Land_u_House_Big_02_V1_F", 0],
["Land_u_House_Small_01_V1_F", 0],
["Land_u_House_Small_02_V1_F", 0],
["Land_u_Shed_Ind_F", 2],
["Land_u_Shop_01_V1_F", 0],
["Land_u_Shop_02_V1_F", 0]
]; 
 

[/­code][/spoiler]

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...