Jump to content
  • 0
Sign in to follow this  
Reaper5150

How to add loot chance with this?

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];
        
};

Share this post


Link to post
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]; 
	};
};

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...