Critica Posted June 7, 2012 Posted June 7, 2012 (edited) -%tab%script%tab%INSERTNPCNAMEHERE%tab%-1,{ end; OnNPCKillEvent: switch(rand(10)){ case 1: getitem xx, amount; end; default: end; } end; } how can make this script do 2 random chance? like for the first few items chances are 10% then the 2nd list items have 5% chance..? Edited June 7, 2012 by critica Quote
_Dynosawr_ Posted June 8, 2012 Posted June 8, 2012 (edited) X = Item ID Y = Item amount - <TAB> script <TAB> <NPCNAME> <TAB> -1,{ end; OnNPCKillEvent: setarray .@a[1],rand(1,100),rand(1,100); // Add as many more randoms of 1 and 100 as you want. if(.@a[1]<=10){ // Less than or equal to 10 would mean 10% chance getitem X,Y; end;} if(.@a[2]<=5){ // Less than or equal to 5 would mean 5% chance getitem X,Y; end;} } Also, I used an array so that if the number is less than 5, it won't give both items. Here's one in which you can get both items: - <TAB> script <TAB> <NPCNAME> <TAB> -1,{ end; OnNPCKillEvent: setarray .@a,rand(1,100); // Add as many more randoms of 1 and 100 as you want. if(.@a<=10){ // Less than or equal to 10 would mean 10% chance getitem X,Y; end;} if(.@a<=5){ // Less than or equal to 5 would mean 5% chance getitem X,Y; end;} } Edited June 8, 2012 by Joey Quote
Question
Critica
-%tab%script%tab%INSERTNPCNAMEHERE%tab%-1,{
end;
OnNPCKillEvent:
switch(rand(10)){
case 1:
getitem xx, amount;
end;
default:
end;
}
end;
}
how can make this script do 2 random chance?
like for the first few items chances are 10%
then the 2nd list items have 5% chance..?
Edited by critica3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.