Jump to content
  • 0

Help with LSspawner edit?


dank

Question

I am using the LSspawner and want to change it so that if there is 1 loot on the position it will just continue on and not stack loot at all.

 

I have had no luck at all, any tips?

I have toyed around with this function i found in fn_LSgetBuildingstospawnLoot.sqf:


//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(8));
                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 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];
        };
    };
};
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...