Dori Posted January 19, 2015 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 332 Reputation: 15 Joined: 12/11/11 Last Seen: August 8, 2017 Share Posted January 19, 2015 I found this script on another topic made by Capuche. I want to be able to add an amount to the items received from the box. So for example: Apple x2 Orange x1 Red Potion x3 Here is the script: function script rewardchest { setarray .@reward, 20103, 60, 20104, 10, 20105, 10, 20106, 10, 20106, 5, 20107, 5; .@size = getarraysize( .@reward ); for( set .@i, 1; .@i < .@size; .@i += 2 ) .@percent[.@i] += .@reward[.@i]; .@r = rand( .@percent[ .@size -1 ] +1 ); for( set .@i, 1; .@i < .@size; .@i += 2 ) if( .@percent[.@i] > .@r ) break; getitem .@reward[ .@i-1 ], 1; return; } Thanks in advance for any help! Quote Link to comment Share on other sites More sharing options...
Dori Posted January 20, 2015 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 332 Reputation: 15 Joined: 12/11/11 Last Seen: August 8, 2017 Author Share Posted January 20, 2015 (edited) I tried it out, but I keep getting the first item on the list. I don't get any of the other items.Here is what I have: function script rewardchest { setarray .@reward, 501,1, 60, 502,2, 40, 503,1, 40, 504,4, 30, 505,1, 20, 506,2, 10; .@size = getarraysize( .@reward ); for( set .@i, 2; .@i < .@size; .@i += 3 ) .@percent[.@i] += .@reward[.@i]; .@r = rand( .@percent[ .@size -1 ] +1 ); for( set .@i, 2; .@i < .@size; .@i += 3 ) if( .@percent[.@i] > .@r ) break; getitem .@reward[ .@i-2 ], .@reward[ .@i-1 ]; return; } EDIT: Nevermind, I found a better way of doing this using the item_package.txt Thanks anyways Capuche! Edited January 20, 2015 by Phenex Quote Link to comment Share on other sites More sharing options...
Capuche Posted January 19, 2015 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted January 19, 2015 function script rewardchest { setarray .@reward, 20103,1, 60, 20104,1, 10, 20105,1, 10, 20106,1, 10, 20106,1, 5, 20107,1, 5; .@size = getarraysize( .@reward ); for( set .@i, 2; .@i < .@size; .@i += 3 ) .@percent[.@i] += .@reward[.@i]; .@r = rand( .@percent[ .@size -1 ] +1 ); for( set .@i, 2; .@i < .@size; .@i += 3 ) if( .@percent[.@i] > .@r ) break; getitem .@reward[ .@i-2 ], .@reward[ .@i-1 ]; return; } 1 Quote Link to comment Share on other sites More sharing options...
Cydh Posted January 20, 2015 Group: Developer Topic Count: 153 Topics Per Day: 0.03 Content Count: 2285 Reputation: 748 Joined: 06/16/12 Last Seen: February 21 Share Posted January 20, 2015 EDIT: Nevermind, I found a better way of doing this using the item_package.txt Thanks anyways Capuche!meh I just want to say it, try use item package Quote Link to comment Share on other sites More sharing options...
Question
Dori
I found this script on another topic made by Capuche. I want to be able to add an amount to the items received from the box.
So for example: Apple x2
Orange x1
Red Potion x3
Here is the script:
Link 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.