Hello, I'm trying to create a custom egg, but I'm having problems ...
1st - I can not put numbers that are not integers. Ex: 0.1, 5.2, 4.3 etc ...
2nd - Would like you to always win an item, regardless of the percentage. Eg: when opening the egg, the message "dispbottom" would never appear. There was no prize in this egg. ";", Since there will always be an item, the player will never open the egg and will not win anything.
3th - Announce upon receiving an item with a low percentage eg chance of getting an item = 0.1;%, when someone received this item, was announced for every server.
function script Surp {
setarray @id[0], 501,502,503; /* Id of the awards that can be obtained. */
setarray @qn[0], 10, 1,1; /* Quantity wins.*/
setarray @pt[0], 1,0.5,0.1; /*Percentage of chance to get the item. (1 = 1% - 10 = 10% - 100 = 100%) */
for(set @i,0; @i < getarraysize(@id);set @i,@i+1){
if(@pt[@i] >= rand(100)){
getitem @id[@i],@qn[@i];
dispbottom "Congrats you were awarded with "+@qn[@i]+" "+getitemname(@id[@i]);
end;
}
}
dispbottom "There was no prize in this egg..";
end;
}
NOTE: I know you can do this for the package, but I find it easier for the function and it gets much faster.
Share this post
Link to post
Share on other sites