Advertisement
serfma

Untitled

May 24th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1.                 //Math and shit for randomly selecting the rarity
  2.                 local r = math.random(1, 100)
  3.                 local rarity
  4.                 for i=1,#sws.rarity do
  5.                     //If the rarity has no chance assigned, skip that raity.
  6.                     if not sws.rarity[i].chance then continue end
  7.                     //Checks the random number to the raritys chance.
  8.                     if r >= 1 and r <= sws.rarity[i].chance then
  9.                         //If it passes, set the rarity and break the loop.
  10.                         rarity = i
  11.                         break
  12.                     end
  13.                 end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement