Dori Posted January 19, 2015 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
Dori Posted January 20, 2015 Author 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
Capuche Posted January 19, 2015 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
Cydh Posted January 20, 2015 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
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:
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.