
Code Block
Tags:
New Feature, Command
Creator:
UrLocalBFDIfan_2763
Code:
let roll = Math.random();
if (roll < 0.05) {
// 5% chance for Legendary
api.giveItem(playerId, 'Moonstone', 1);
} else if (roll < 0.20) {
// 15% chance for Rare (0.20 - 0.05)
api.giveItem(playerId, 'Gold Ore', 5);
} else {
// 80% chance for Common
api.giveItem(playerId, 'Dirt', 10);
}Instructions:
-Chance of the Special Reward(s)
-Special Reward(s)
-Chance of the Normal Reward(s)
-Normal Reward(s)
Optional: You can add how many rewards to it and also change the chance.
Ex: 0.05 = 5%
0.7 = 70%
1 = 100%