wut751 Posted July 29, 2017 Posted July 29, 2017 Hi All I just made random box from exist box in the game so I want some script to announce when player open the box and get item inside from random box. below is my random box detail 12152,Special_Box,Special Present,2,0,,100,,,,,0xFFFFFFFF,7,2,,,,,,{ getrandgroupitem(IG_Special_Box),1; },{},{} sorry for my bad english thank you in advance Quote
0 crazyarashi Posted July 29, 2017 Posted July 29, 2017 (edited) 12152,Special_Box,Special Present,2,0,,100,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "specialbox"; },{},{} // box item id function script specialbox { setarray .i[0],12345,12346; // Itemlist in box set .chance, rand(100); // First item in list (12345) x 1 (1% Chance) if (.chance == 1){ getitem .i[0],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[0])+"] from the Special Box.",0; end; } // First item in list (12346) x 100 (5~10% Chance) if (.chance <= 10 && .chance > 5){ getitem .i[1],100; end; } } Edited July 29, 2017 by crazyarashi 2 Quote
0 wut751 Posted July 29, 2017 Author Posted July 29, 2017 1 hour ago, crazyarashi said: 12152,Special_Box,Special Present,2,0,,100,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "specialbox"; },{},{} // box item id function script specialbox { setarray .i[0],12345,12346; // Itemlist in box set .chance, rand(100); // First item in list (12345) x 1 (1% Chance) if (.chance == 1){ getitem .i[0],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[0])+"] from the Special Box.",0; end; } // First item in list (12346) x 100 (5~10% Chance) if (.chance <= 10 && .chance > 5){ getitem .i[1],100; end; } } Thank you crazy, and I have question if in list is A,B,C,D,E,F,G,H and I want rate A,B = 1% C,D,E = 10% and F,G,H 50%. how I can set the rate Quote
0 sotf Posted August 5, 2017 Posted August 5, 2017 On 7/29/2017 at 7:19 PM, wut751 said: Thank you crazy, and I have question if in list is A,B,C,D,E,F,G,H and I want rate A,B = 1% C,D,E = 10% and F,G,H 50%. how I can set the rate Try: function script specialbox { setarray .i1[0],909,910; // Common Items set .i1rand,rand(0,1); // Randomize Common Items; just change max amount if you add items setarray .i2[0],911,912; // Rare Items set .i2rand,rand(0,1); // Randomize Rare Items; just change max amount if you add items setarray .i3[0],2199,1599; // Super Rare Items set .i3rand,rand(0,1); //Randomize Super Rare Items; just change max amount if you add items set .chance, rand(100); // Super Rare Item 1% if (.chance == 1){ getitem .i[.i3rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[.i3rand])+"] from the Special Box.",0; end; } // Rare Item 10% else if (.chance <= 2 && .chance >= 11){ getitem .i[.i2rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[.i2rand])+"] from the Special Box.",0; end; } // Common Items else { getitem .i1[.i1rand],1; end; } } Just add items in .i1, .i2 and .i3 arrays and make sure to change the variables that randomizes the items to the max number of item you included -1. (-1 since arrays start with 0). Quote
0 PsyOps Posted April 13, 2019 Posted April 13, 2019 (edited) On 8/5/2017 at 1:04 PM, sotf said: Try: function script specialbox { setarray .i1[0],909,910; // Common Items set .i1rand,rand(0,1); // Randomize Common Items; just change max amount if you add items setarray .i2[0],911,912; // Rare Items set .i2rand,rand(0,1); // Randomize Rare Items; just change max amount if you add items setarray .i3[0],2199,1599; // Super Rare Items set .i3rand,rand(0,1); //Randomize Super Rare Items; just change max amount if you add items set .chance, rand(100); // Super Rare Item 1% if (.chance == 1){ getitem .i[.i3rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[.i3rand])+"] from the Special Box.",0; end; } // Rare Item 10% else if (.chance <= 2 && .chance >= 11){ getitem .i[.i2rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[.i2rand])+"] from the Special Box.",0; end; } // Common Items else { getitem .i1[.i1rand],1; end; } } Just add items in .i1, .i2 and .i3 arrays and make sure to change the variables that randomizes the items to the max number of item you included -1. (-1 since arrays start with 0). I need to ask if this is working on the latest rathena? - Solved it works. I need to ask why it said " Player won a [null] from the Special Box. " Edited April 13, 2019 by Dev G Inc Additional Quote
0 gefind Posted March 31, 2020 Posted March 31, 2020 On 7/29/2017 at 5:16 PM, crazyarashi said: function script specialbox { setarray .i[0],12345,12346; // Itemlist in box set .chance, rand(100); // First item in list (12345) x 1 (1% Chance) if (.chance == 1){ getitem .i[0],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[0])+"] from the Special Box.",0; end; } // First item in list (12346) x 100 (5~10% Chance) if (.chance <= 10 && .chance > 5){ getitem .i[1],100; end; } } Where i need to put this script? on new txt or just copy under the box item id? Quote
0 Sallycantdance Posted January 28, 2021 Posted January 28, 2021 On 7/29/2017 at 6:16 PM, crazyarashi said: 12152,Special_Box,Special Present,2,0,,100,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "specialbox"; },{},{} // box item id function script specialbox { setarray .i[0],12345,12346; // Itemlist in box set .chance, rand(100); // First item in list (12345) x 1 (1% Chance) if (.chance == 1){ getitem .i[0],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[0])+"] from the Special Box.",0; end; } // First item in list (12346) x 100 (5~10% Chance) if (.chance <= 10 && .chance > 5){ getitem .i[1],100; end; } } what if i got this error how to fix it sir? Quote
0 lelouchxv Posted April 15, 2021 Posted April 15, 2021 On 8/4/2017 at 9:04 PM, sotf said: Try: function script specialbox { setarray .i1[0],909,910; // Common Items set .i1rand,rand(0,1); // Randomize Common Items; just change max amount if you add items setarray .i2[0],911,912; // Rare Items set .i2rand,rand(0,1); // Randomize Rare Items; just change max amount if you add items setarray .i3[0],2199,1599; // Super Rare Items set .i3rand,rand(0,1); //Randomize Super Rare Items; just change max amount if you add items set .chance, rand(100); // Super Rare Item 1% if (.chance == 1){ getitem .i[.i3rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[.i3rand])+"] from the Special Box.",0; end; } // Rare Item 10% else if (.chance <= 2 && .chance >= 11){ getitem .i[.i2rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(.i[.i2rand])+"] from the Special Box.",0; end; } // Common Items else { getitem .i1[.i1rand],1; end; } } Just add items in .i1, .i2 and .i3 arrays and make sure to change the variables that randomizes the items to the max number of item you included -1. (-1 since arrays start with 0). @sotf how to add Custom points in rewards? Ex. Cashpoints Pvp points Hourly Points 1 Quote
0 Sallycantdance Posted April 16, 2021 Posted April 16, 2021 7 hours ago, lelouchxv said: @sotf how to add Custom points in rewards? Ex. Cashpoints Pvp points Hourly Points i will try it later thanks Quote
0 lelouchxv Posted April 16, 2021 Posted April 16, 2021 @chadnessYou'll try what sir? haha im kinda confused Quote
Question
wut751
Hi All
I just made random box from exist box in the game so I want some script to announce when player open the box and get item inside from random box.
below is my random box detail
12152,Special_Box,Special Present,2,0,,100,,,,,0xFFFFFFFF,7,2,,,,,,{ getrandgroupitem(IG_Special_Box),1; },{},{}
sorry for my bad english
thank you in advance
9 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.