@buraquera
sorry for the very very late reply, just been doing other things than this. so I tried the script but only gives the Junk.
please see the code i made.
function script Get_MysteryBox {
// If the summ != 100, Junk item is activated and has the difference in chance (45% in this example)
set .@junk, 19578; // Apple
setarray .@items,19543,19525,31171,19620,19527,19733,20057;
setarray .@chance[1],1,10,25,40,55,70,95; // The difference from the previous number is the chance. So Item 5979 has a (10-6 = 4%chance)
set .@rand,rand(1,100);
for (.@i =1; .@i <= getarraysize(.@chance); .@i++){
if (.@rand <= .@chance[.@i]){
getitem .@items[.@i-1];
if ((.@chance[.@i]- .@chance[.@i-1])) <6)
announce "A rare item has been created",bc_all;
end;
}
}
getitem .@junk,1; //Get apple
end;
}