Hello, I think there is a mistake in % thinking... all % must be 100, you can't calculate 99% 1 to 10 or 50% 11 to 20, must be something like:
49% -> 1 to 10 coins
25% -> 11 to 20 coins
15% -> 21 to 30 coins
5% -> 31 to 50 coins
1% -> 51 to 100 coins
function script AROCG {
set .@luckyRate, rand(100);
set .@amount, rand(51, 100); // 1% chance
set .@chance$, "1%";
if (.@luckyRate >= 0 && .@luckyRate < 49) {// 49% chance
set .@amount, rand(1, 10);
set .@chance$, "50%";
} else if (.@luckyRate >= 49 && .@luckyRate < 74) { // 25% chance
set .@amount, rand(11, 20);
set .@chance$, "25%";
} else if (.@luckyRate >= 49 && .@luckyRate < 74) { // 15% chance
set .@amount, rand(21, 30);
set .@chance$, "15%";
} else if (.@luckyRate >= 49 && .@luckyRate < 74) { // 5% chance
set .@amount, rand(31, 50);
set .@chance$, "5%";
}
getitem 50007, .@amount;
announce "[" + strcharinfo(0) + "]: got [" + .@amount + "x " + getitemname(50007) + "] at " + .@chance$ + "% chance, from AsurielRO Coins Bag.", 0;
end;
}
Test before going production, I could not test, but I'm pretty sure this works 100%.