wut751 Posted July 29, 2017 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 30 Reputation: 2 Joined: 07/17/17 Last Seen: March 9, 2023 Share 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 Link to comment Share on other sites More sharing options...
0 crazyarashi Posted July 29, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Friday at 07:27 AM Share 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 Link to comment Share on other sites More sharing options...
0 wut751 Posted July 29, 2017 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 30 Reputation: 2 Joined: 07/17/17 Last Seen: March 9, 2023 Author Share 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 Link to comment Share on other sites More sharing options...
0 sotf Posted August 5, 2017 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 Share 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 Link to comment Share on other sites More sharing options...
0 PsyOps Posted April 13, 2019 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 150 Reputation: 12 Joined: 12/03/18 Last Seen: 5 hours ago Share 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 Link to comment Share on other sites More sharing options...
0 gefind Posted March 31, 2020 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 1 Reputation: 0 Joined: 03/30/20 Last Seen: May 5, 2020 Share 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 Link to comment Share on other sites More sharing options...
0 Sallycantdance Posted January 28, 2021 Group: Members Topic Count: 225 Topics Per Day: 0.14 Content Count: 798 Reputation: 12 Joined: 12/04/20 Last Seen: 19 hours ago Share 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 Link to comment Share on other sites More sharing options...
0 lelouchxv Posted April 15, 2021 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 120 Reputation: 8 Joined: 09/16/18 Last Seen: May 5, 2023 Share 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 Link to comment Share on other sites More sharing options...
0 Sallycantdance Posted April 16, 2021 Group: Members Topic Count: 225 Topics Per Day: 0.14 Content Count: 798 Reputation: 12 Joined: 12/04/20 Last Seen: 19 hours ago Share 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 Link to comment Share on other sites More sharing options...
0 lelouchxv Posted April 16, 2021 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 120 Reputation: 8 Joined: 09/16/18 Last Seen: May 5, 2023 Share Posted April 16, 2021 @chadnessYou'll try what sir? haha im kinda confused Quote Link to comment Share on other sites More sharing options...
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
Link to comment
Share on other sites
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.