node 10 Posted August 16, 2014 Hello, Trying to make a script that would make it to where you run around and you randomly find a IL(islandlifeitem) item. This is what I have tried so far. if (100 > random 100 then ['Donut',2] call INV_AddInventoryItem if (!isServer) exitWith {}; if (100 > random 100 then { if (random 2 = 1) then {['Donut',2] call INV_AddInventoryItem} else {exitWith {}}; }; Any ideas how I would do this? Share this post Link to post Share on other sites
geqqo 11 Posted August 16, 2014 if (100 > random 100[color=RED][b])[/b][/color] then [color=RED][b]{[/b][/color]['Donut',2] call INV_AddInventoryItem[color=RED][b]}[/b][/color] Also, the 100 > effectively means 100% chance, so it's not really random in the given code (but of course works for testing if the code works at all). Share this post Link to post Share on other sites
node 10 Posted August 19, 2014 is there any way to make it to where it adds a item to your inventory randomly. Or did i do this script wrong/another way to do this script. _player = _this select 0; if (!isServer) exitWith {}; if ((100 > random 100 then { if (floor random 100 = 0) then //Item goes here else {exitWith {}}; }; Share this post Link to post Share on other sites
Viba 1 Posted August 19, 2014 Well, your condition returns always true. Randomly upon joining or just randomly when playing? if (!isDedicated) then { _number = random 100; if (_number > 85) then { player addWeapon "DMR"; player addMagazine... and so on }; }; Share this post Link to post Share on other sites
node 10 Posted August 19, 2014 would I still include _player = _this select 0; Share this post Link to post Share on other sites
Viba 1 Posted August 20, 2014 Depends how you launch the script. If it runs on the client you can just use player. Share this post Link to post Share on other sites
node 10 Posted September 4, 2014 Viba I want it to whenever I am playing such as walking around. Share this post Link to post Share on other sites
Viba 1 Posted September 4, 2014 if (!isDedicated) then { while {true} do { waitUntil {sleep 5; (alive player) && (isNull (finddisplay 49))}; // || any other things needed to take into account, respawn dialog and so on? _number = random 100; if (_number > 85) then { player addWeapon "DMR"; //player addMagazine... and so on }; //If you loop at fullspeed you'd get DMR's all the time, just modify the random chance and the sleep time so it's balanced. sleep 60; }; }; Share this post Link to post Share on other sites
node 10 Posted September 5, 2014 if (!isDedicated) then { while {true} do { waitUntil {sleep 1; (alive player) && (isNull (finddisplay 49))}; _number = random 100; if (_number > 100) then { player addWeapon "DMR"; player addMagazine "20Rnd_762x51_DMR"; }; sleep 60; }; }; this is what im doing and it is not working Share this post Link to post Share on other sites
Viba 1 Posted September 5, 2014 random 100 and check if the number is over 100? Logical error, you have to lower the number you are checking for. Share this post Link to post Share on other sites
node 10 Posted September 5, 2014 doesnt seem to be working i put the script into my mission and try it but it is not working Share this post Link to post Share on other sites
Viba 1 Posted September 5, 2014 Just try copying my version directly. Share this post Link to post Share on other sites
node 10 Posted September 8, 2014 if its not necessary but then you don't have to but if you can add me on skype @ dylanhood999 so u can help me some more Share this post Link to post Share on other sites