[FREE] [Standalone] Random generator

This script will allow you to generate a random element for the reward from the specified array

Exports:

  • exports['rury_random']:getRandomReward(RandomArray) - Returns the name of the element
  • exports['rury_random']:getRandomRewardWithCounts(RandomArray2) - Returns the name and quantity
Array Examples
local RandomArray = {
    chance = { -- The higher the number, the higher the chance of a drop
        basic = 100,
        low = 80,
        med = 35,
        high = 15,
        prem = 4
    },
    rewards = {
        basic = {'fish_eel', 'fish'},
        low = {'fish_bream'},
        med = {'fish_silvercarp'},
        high = {'fish_pikeperch'},
        prem = {'fish_rainbowtrout'}
    }
}
local RandomArray2 = {
    chance = { -- The higher the number, the higher the chance of a drop
        basic = 300,
        low = 150,
        med = 20,
        high = 5,
        prem = 2,
        god = 1
    },
    rewards = {
        basic = {
            {'scrapmetal', {[math.random(1,2)] = 100, [math.random(3,6)] = 3}},
        },
        low = {
            {'scrapmetal', {[math.random(3,5)] = 100, [math.random(6,9)] = 3}},
        },
        med = {
            {'treasuremap', {[1] = 1}},
            {'jewelrybox', {[1] = 1}},
        },
        high = {
            {'markedbills', {[1] = 1}},
        },
        prem = {
            {'deluxetreasuremap', {[1] = 1}},
        },
        god = {
            {'vanpogo', {[1] = 1}},
        }
    }
}

Download: Github

My paid scripts:

1 Like