Hello community!
I need your help with something...
But first, I want to explain how it is expected to work.
Expected Result: After killing x monster, add a chance to obtain randomly from 1 to 3 different items (not duplicating), of random x (from 1 to the max specified amount in the array) amounts. Everything is practically randomized.
Right now, it is throwing duplicate items and the random amount is not in line with the corresponding item.
//============================================================
//= Dropped Random Items by Monsters
//============================================================
- script Dropped -1,{
OnInit:
.rand_amt = 3; // Amount of random items
setarray .item_id[1], 501, 645, 533; // Possible items to receive (ID, amount)
setarray .item_qty[1], 25, 5, 30;
monster "jupe_ele",0,0,"--ja--",1004,1,"Dropped::OnDropping";
end;
OnDropping:
getmapxy(@map$, @x, @y, BL_PC);
do{
.@loc = rand(1, getarraysize(.item_id) - 1);
.@pos = rand(1, getarraysize(.item_qty) - 1);
debugmes ("count: "+.@i);
makeitem .item_id[.@loc], .item_qty[.@pos],@map$, @x, @y;
.@count++;
debugmes("Count: "+.@count);
}while(.@count < rand(0,.rand_amt));
monster "jupe_ele",0,0,"--ja--",1004,1,"Dropped::OnDropping";
end;
}
Hopefully you guys can help me!
Thanks in advance.