Jump to content

REQUEST | Random Item Selection


Scenic

Recommended Posts

So, let me explain what I want to achieve...

 

Basically I want to make it so that if you scroll and click on something it will give you an option like:

player addaction[("<t color=""#c70000"">" + ("Shake Object") +"</t>")

Then, when it is activated it plays a sound (or not), A Message displays saying "You Shook "Object" and got "Item"!

and selects a random item from a list of potential loots and adds it to the activators inventory.

So for example....

 

Player Zero Walks Up To A Hanging Doctor, Shakes The Object.

Sound Plays, Message Displays and gives zero a dmr mag....

 

So... I think it needs a percentage chance system...

 

ANYONE WILLING TO HELP ME, WILL BE GIVEN THE COMPLETED SCRIPT

And the Idea I have for an awesome event used for that script.

Link to comment
Share on other sites

  • 2 years later...

and........................... 3 years later:

randomobjets.sqf

Spoiler

private ["_position","_nearobj","_random"];

_position = getPosATL player;
_nearobj = count nearestObjects [_position, ["PUT OBJET OR UNIT ID TO ACTIVATE THE OPTION"], 4] > 0;
_random = round(random(33));
_posibleitems = ["ItemSodaOrangeSherbet","HandGrenade_west","ItemSodaEmpty","ItemTrashRazor","ItemTrashToiletpaper","TrashJackDaniels","TrashTinCan","ItemOilBarrel","ItemFuelBarrel","ItemBriefcase50oz","ItemAluminumBar10oz","FoodSteakRaw","ItemWaterbottle","ItemAntibiotic","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemCanvas","MortarBucket","ItemLightBulb","PartWheel","ItemTent","ItemTentOld","Skin_FR_OHara_DZ","ItemGenerator","ItemComboLock","ItemMixOil","ItemKiloHemp","ItemSandbag","30Rnd_556x45_StanagSD","100Rnd_762x54_PK","20Rnd_762x51_DMR","PartGlass","ItemRuby"] call BIS_fnc_selectRandom;

 

if !(_nearobj) exitWith {
    cutText [format["PUT NEGATIVE TEXT IN HERE."], "PLAIN DOWN"];
};

            

if (_nearobj) then
    {
    player playActionNow "Medic";
    sleep 3;
    player addMagazine _posibleitems;
    sleep 3;
    cutText ["YOU FIND.....", "PLAIN DOWN"];
};

drop it into MPmissions\your instance\custom\

bottom of fn_selfactions

Spoiler

/////////////randomobjets//
private["_playerPos","_nearobj"];

_playerPos = getPosATL player;
_neartrade = count nearestObjects [_playerPos, ["PUT SAME OBJET IN randomobjets.sqf"], 4] > 0;
 
if (_nearobj) then {
        if (s_player_obj < 0) then {
            s_player_obj = player addaction[("<t color=""#00C732"">" + ("FIND ITEMS") +"</t>"),"custom\randomobjets.sqf"];
        };
    } else {
        player removeAction s_player_obj;
        s_player_obj = -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...