prontera,157,180,5 script test item_reward#3 2_VENDING_MACHINE1,{
if ( !countitem(.itemuse) ) {
mes "A "+ getitemname(.itemuse) +" is needed to use this machine";
close;
}
delitem .itemuse, 1;
.@r = rand(.totalchance);
for ( .@i = 0; ( .@r -= .itemchance[.@i] ) >= 0; ++.@i );
getitem .itemid[.@i], 1;
end;
OnInit:
.itemuse = 7539; // poring coin
setarray .itemid, 501,502,503,504,505,506,507,508,509;
setarray .itemchance, 10,10,10,10,3,10,10,10,10;
for ( .@i = 0; .itemid[.@i]; ++.@i )
.totalchance += .itemchance[.@i];
end;
}
btw this script is call "lotti girl" https://rathena.org/board/search/?&q=lotti&search_and_or=and&sortby=relevancy
a lot of results return from it