Yudax Posted April 27, 2013 Share Posted April 27, 2013 I have an item: 25620,3D_Glasses_Box,Box of Minion,2,0,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ },{},{} Is there a possible way that when a player double click's this item, it gives a random item with these sets and its percentage?; 20103 - 60% 20104 - 10% 20105 - 10% 20106- 10% 20106 - 5% 20107 - 5% so like its; getitem 20103,1; getitem 20104,1;.... Quote Link to comment Share on other sites More sharing options...
2 Jarek Posted April 27, 2013 Share Posted April 27, 2013 {if(rand(100)>60) getitem 20103,1; if(rand(100)>10) getitem 20104,1; ... } Quote Link to comment Share on other sites More sharing options...
0 skymia Posted May 30, 2017 Share Posted May 30, 2017 How to put percentage to this script? {getitem callfunc("F_Rand",7078,7079,7080,7081,7082,7083,7084,7085,7086,7087),1;}{}{} Quote Link to comment Share on other sites More sharing options...
0 amanikoko Posted July 1, 2021 Share Posted July 1, 2021 Sir Capuche, please guide where to add bc_all for certain item opened? Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 27, 2013 Share Posted April 27, 2013 function script box____ { setarray [email protected], 20103, 60, 20104, 10, 20105, 10, 20106, 10, 20106, 5, 20107, 5; set [email protected], getarraysize( [email protected] ); for( set [email protected], 1; [email protected] < [email protected]; [email protected] += 2 ) { [email protected][[email protected]] = [email protected] + [email protected][[email protected]]; [email protected] += [email protected][[email protected]]; } [email protected] = rand( [email protected] +1 ); for( set [email protected], 1; [email protected] < [email protected]; [email protected] += 2 ) if( [email protected][[email protected]] > [email protected] ) break; getitem [email protected][ [email protected] ], 1; end; } EDIT : Fix a mistake. 25620,3D_Glasses_Box,Box of Minion,2,0,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "box____"; },{},{} 2 Quote Link to comment Share on other sites More sharing options...
Yudax Posted April 27, 2013 Author Share Posted April 27, 2013 Thank you sir, If I like to add another Item, do I have to edit one of these? [email protected] = getarraysize( [email protected] ); for( set [email protected], 1; [email protected] < [email protected]; [email protected] += 2 ) [email protected][[email protected]] += [email protected][[email protected]]; [email protected] = rand( [email protected][ [email protected] -1 ] +1 ); for( set [email protected], 1; [email protected] < [email protected]; [email protected] += 2 ) if( [email protected][[email protected]] > [email protected] ) break; getitem [email protected][ [email protected] ], 1; return; function script box____ { setarray [email protected], 20103, 60, 20104, 10, 20105, 10, 20106, 10, 20106, 5, 20107, 5; [email protected] = getarraysize( [email protected] ); for( set [email protected], 1; [email protected] < [email protected]; [email protected] += 2 ) [email protected][[email protected]] += [email protected][[email protected]]; [email protected] = rand( [email protected][ [email protected] -1 ] +1 ); for( set [email protected], 1; [email protected] < [email protected]; [email protected] += 2 ) if( [email protected][[email protected]] > [email protected] ) break; getitem [email protected][ [email protected] ], 1; return; } 25620,3D_Glasses_Box,Box of Minion,2,0,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "box____"; },{},{} I made it work like the old one, but I was wondering whether this has the same effect just like you did? 63,20103,70 63,20296,10 63,20703,10 63,20705,10 63,20706,10 63,20707,10 63,20294,10 63,20113,10 63,20114,10 63,20115,10 63,20116,10 63,20702,10 Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 27, 2013 Share Posted April 27, 2013 I made it work like the old one, but I was wondering whether this has the same effect just like you did? The effect is the same : you get an item randomly. Thank you sir, If I like to add another Item, do I have to edit one of these? No, just add in this setarray [email protected], 20103, 60, 20104, 10, 20105, 10, 20106, 10, 20106, 5, 20107, 5; <item ID>, <rate> The total can be above 100 Btw I made a mistake in the previous function. I edited the previous post, please take the new function. Quote Link to comment Share on other sites More sharing options...
Yudax Posted April 27, 2013 Author Share Posted April 27, 2013 I made it work like the old one, but I was wondering whether this has the same effect just like you did? The effect is the same : you get an item randomly. >Thank you sir, If I like to add another Item, do I have to edit one of these? No, just add in this setarray [email protected], 20103, 60, 20104, 10, 20105, 10, 20106, 10, 20106, 5, 20107, 5; <item ID>, <rate> The total can be above 100 Btw I made a mistake in the previous function. I edited the previous post, please take the new function. Okay thanks, I can make it like this right? You said Its okay that the total can be above 100. setarray [email protected], 20103, 60, 20104, 10, 20105, 10, 20106, 10, 20106, 5, 20107, 5; 20107, 80; 20107, 60; Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 27, 2013 Share Posted April 27, 2013 setarray .@reward, 20103, 60, 20104, 10, 20105, 10, 20106, 10, 20106, 5, 20107, 5; 20107, 805; 20107, 60; in red must be , the rest is right. Quote Link to comment Share on other sites More sharing options...
Yudax Posted April 28, 2013 Author Share Posted April 28, 2013 setarray .@reward, 20103, 60, 20104, 10, 20105, 10, 20106, 10, 20106, 5, 20107, 5; 20107, 805; 20107, 60; in red must be , the rest is right. thank you sir! Quote Link to comment Share on other sites More sharing options...
I have an item:
25620,3D_Glasses_Box,Box of Minion,2,0,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ },{},{}Is there a possible way that when a player double click's this item, it gives a random item with these sets and its percentage?;
20103 - 60%
20104 - 10%
20105 - 10%
20106- 10%
20106 - 5%
20107 - 5%
so like its;
Link to comment
Share on other sites