Jump to content
  • 0

How to add loot chance with this?


Reaper5150

Question

I'm trying to figure out how to have this randomly search for more then just one item like in static buildings and wreaks I list listed. Here is what I have so far, but it only gives one random item per search.

disableSerialization;
private["_canSearch","_loot"];

_canSearch = count nearestObjects [_playerPos, ["LADAWreck","hiluxWreck","datsun01Wreck","datsun02Wreck","SKODAWreck","UAZWreck","UralWreck","Land_Shed_W02","Land_Shed_M03"], 4] > 0;

_loot=["ItemSodaPepsi",
"ItemBandage",
"FishCookedTrout",
"FoodBeefCooked",
"ItemSodaMdew",
"Attachment_Kobra",
"ItemBriefcase100oz",
"ItemGoldBar",
"ItemKiloHemp",
"ItemRuby",
"PartGeneric",
"PartWheel",
"PartGlass",
"PartEngine",
"ItemAntibiotic",
"ItemFuelBarrel",
"ItemFuelcan",
"ItemHotwireKit",
"Skin_CZ_Soldier_Sniper_EP1_DZ"] call BIS_fnc_selectRandom;


if (_canSearch) then {
        sleep 2;
        systemChat ("Searching...");
        sleep 2; 
        systemChat ("Searching...");
        player playActionNow "PutDown";
        player addMagazine _loot;
        titleText [format["Sweet, I found something!!!"] , "PLAIN DOWN", 1];
        
};

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
private["_canSearch","_loot"];

_canSearch = count nearestObjects [player, ["LADAWreck","hiluxWreck","datsun01Wreck","datsun02Wreck","SKODAWreck","UAZWreck","UralWreck","Land_Shed_W02","Land_Shed_M03"], 4] > 0;

_loot=["ItemSodaPepsi",
"ItemBandage",
"FishCookedTrout",
"FoodBeefCooked",
"ItemSodaMdew",
"Attachment_Kobra",
"ItemBriefcase100oz",
"ItemGoldBar",
"ItemKiloHemp",
"ItemRuby",
"PartGeneric",
"PartWheel",
"PartGlass",
"PartEngine",
"ItemAntibiotic",
"ItemFuelBarrel",
"ItemFuelcan",
"ItemHotwireKit",
"Skin_CZ_Soldier_Sniper_EP1_DZ"] call BIS_fnc_selectRandom;


if (_canSearch) then {
    sleep 2;
    systemChat ("Searching...");
    sleep 2; 
    systemChat ("Searching...");
	if (20 > random 100) then {  // 20% chance 
        player playActionNow "PutDown";
        player addMagazine _loot;
        titleText ["Sweet, I found something!!!", "PLAIN DOWN", 1];    
	}else{
	    titleText ["Nothing...", "PLAIN DOWN", 1]; 
	};
};

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...