prontera,157,180,5 script test 100,{
progressbar "", rand(3,6);
if ( .used >= .used_limit ) end;
.used++;
.@rand = rand(.totalchance);
while ( ( .@rand -= .itemchance[.@i] ) >= 0 ) .@i++;
getitem .itemid[.@i], 1;
if ( .used < .used_limit ) end;
hideonnpc strnpcinfo(0);
sleep 10000; // 10 seconds to reappear
hideoffnpc strnpcinfo(0);
.used = 0;
end;
OnInit:
.used_limit = 3; // how many times used until npc is exhausted
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;
}