Achmed Posted August 24, 2014 Report Share Posted August 24, 2014 Im thinking of using gems as high value item you can trade in your briefcases for as a way of taking up less space and something to work towards looking at the gem code it looks as if there is the same chance for them all to spawn rather then some more rare then others if (_isMine) then { if((random 10) <= 4) then { _gems = ["ItemTopaz","ItemObsidian","ItemSapphire","ItemAmethyst","ItemEmerald","ItemCitrine","ItemRuby"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; }; Would the code below work to make it so each gem has a different spawn chance? if (_isMine) then { if((random 20) <= 7) then { _gems = ["ItemTopaz"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; {else} if((random 20) <= 6) then { _gems = ["ItemObsidian"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; {else} if((random 20) <= 5) then { _gems = ["ItemSapphire"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; {else} if((random 20) <= 4) then { _gems = ["ItemAmethyst"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; {else} if((random 20) <= 3) then { _gems = ["ItemEmerald"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; {else} if((random 20) <= 2) then { _gems = ["ItemCitrine"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; {else} if((random 20) <= 1) then { _gems = ["ItemRuby"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; }; Link to comment Share on other sites More sharing options...
0 Achmed Posted August 25, 2014 Author Report Share Posted August 25, 2014 bump Link to comment Share on other sites More sharing options...
0 Darihon Posted August 25, 2014 Report Share Posted August 25, 2014 Try this: _randomMineCount = floor(random 21); //0-20 if (_isMine) then { if (_randomMineCount <= 7) then { _gems = ["ItemTopaz"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; if (_randomMineCount <= 6) then { _gems = ["ItemObsidian"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; if (_randomMineCount <= 5) then { _gems = ["ItemSapphire"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; if (_randomMineCount <= 4) then { _gems = ["ItemAmethyst"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; if (_randomMineCount <= 3) then { _gems = ["ItemEmerald"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; if (_randomMineCount <= 2) then { _gems = ["ItemCitrine"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; if (_randomMineCount <= 1) then { _gems = ["ItemRuby"]; _gem = _gems select (floor(random (count _gems))); _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; }; This is untested. You can also do it with "Switch do" . Link to comment Share on other sites More sharing options...
0 Achmed Posted October 5, 2014 Author Report Share Posted October 5, 2014 tried that and a few other ways but nothing i do can get it to work :( it should be such a simple thing as well Link to comment Share on other sites More sharing options...
0 deadeye Posted October 5, 2014 Report Share Posted October 5, 2014 Try something like this: if (_isMine) then { _rnd = random 100; if (_rnd < 40) then {_gem = "ItemTopaz";}; //13.6% if (_rnd < 26.4) then {_gem = "ItemObsidian";}; //9.2% if (_rnd < 17.2) then {_gem = "ItemSapphire";}; //6.4% if (_rnd < 10.8) then {_gem = "ItemAmethyst";}; //4.4% if (_rnd < 6.4) then {_gem = "ItemEmerald";}; //3.2% if (_rnd < 3.2) then {_gem = "ItemCitrine";}; //2% if (_rnd < 1.2) then {_gem = "ItemRuby";}; //1.2% _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; Link to comment Share on other sites More sharing options...
0 A Pollo Posted October 10, 2014 Report Share Posted October 10, 2014 Try something like this: if (_isMine) then { _rnd = random 100; if (_rnd < 40) then {_gem = "ItemTopaz";}; //13.6% if (_rnd < 26.4) then {_gem = "ItemObsidian";}; //9.2% if (_rnd < 17.2) then {_gem = "ItemSapphire";}; //6.4% if (_rnd < 10.8) then {_gem = "ItemAmethyst";}; //4.4% if (_rnd < 6.4) then {_gem = "ItemEmerald";}; //3.2% if (_rnd < 3.2) then {_gem = "ItemCitrine";}; //2% if (_rnd < 1.2) then {_gem = "ItemRuby";}; //1.2% _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]]; }; I tried using this but when i do no gems spawn at all. I must be doing something wrong. Does this work on your server? I figured it out. I had to add "_gem" to the list of private variables at the top. Link to comment Share on other sites More sharing options...
Question
Achmed
Im thinking of using gems as high value item you can trade in your briefcases for as a way of taking up less space and something to work towards
looking at the gem code it looks as if there is the same chance for them all to spawn rather then some more rare then others
Would the code below work to make it so each gem has a different spawn chance?
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now