Critica Posted June 7, 2012 Group: Members Topic Count: 82 Topics Per Day: 0.02 Content Count: 223 Reputation: 4 Joined: 02/23/12 Last Seen: March 28, 2018 Share 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 Link to comment Share on other sites More sharing options...
WhatFT Posted June 8, 2012 Group: Members Topic Count: 142 Topics Per Day: 0.03 Content Count: 511 Reputation: 7 Joined: 02/15/12 Last Seen: April 11, 2014 Share Posted June 8, 2012 post in a code box Quote Link to comment Share on other sites More sharing options...
_Dynosawr_ Posted June 8, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 69 Reputation: 10 Joined: 05/14/12 Last Seen: June 26, 2012 Share 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 Link to comment Share on other sites More sharing options...
Critica Posted June 8, 2012 Group: Members Topic Count: 82 Topics Per Day: 0.02 Content Count: 223 Reputation: 4 Joined: 02/23/12 Last Seen: March 28, 2018 Author Share Posted June 8, 2012 thankS for the help! Quote Link to comment Share on other sites More sharing options...
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 criticaLink to comment
Share on other sites
3 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.