Try this.
Script.
function script Boxes {
setarray @i1[0],501; // Common
setarray @i2[0],502; // Rare
setarray @i3[0],503; // Super Rare
set @i1rand,rand( getarraysize(@i1) );
set @i2rand,rand( getarraysize(@i2) );
set @i3rand,rand( getarraysize(@i3) );
.chance = rand(100);
// Super Rare
if (.chance == 1){
getitem @i3[@i3rand],1;
announce "["+strcharinfo(0)+"] got ["+getitemname(@i3[@i3rand])+"] 'Super Rare'.",0;
}
// Rare
else if (.chance <= 10 && .chance >= 5){
getitem @i2[@i2rand],1;
announce "["+strcharinfo(0)+"] obtained ["+getitemname(@i2[@i2rand])+"] 'Rare'.",0;
}
// Common
else {
getitem @i1[@i1rand],1;
announce "["+strcharinfo(0)+"] obtained ["+getitemname(@i2[@i2rand])+"] 'Common'.",0;
end; }
}
item_db (example).
501,Red_Potion,Red Potion,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "Boxes"; },{},{}