Tupac Posted February 10, 2019 Posted February 10, 2019 (edited) function script visualbox { .@item = F_Rand(17041,17037,17043,17039,17038,17042,13999,12922,13996,7715,12103,674,28370,6239,6238,7712,7711,18849,2980,6235,6231,6439,6438,16771,12623,6380,6423,12208,12902,); getitem .@item, 1; announce "["+strcharinfo(0)+"] Ganhou: ["+getitemname( .@item )+"("+.@item+")] da caixa visual.",0; return; } Change chance items Ids 1% = 6438,6239,6439 Edited February 10, 2019 by spawnn Quote
0 utofaery Posted February 12, 2019 Posted February 12, 2019 (edited) On 2/12/2019 at 6:45 AM, spawnn said: Not work, no gain items. This method is easier comparing to recompiling lolz. comparing to editing database .txt all around and this method is fully changable to event script's need easily..(on the fly changes) Sorry for the broken previous script but this script tested working in current rathena version. Put this part inside your npc files. function script F_RBox { // change Item ID here setarray @i1[0],607,608; // Common Items setarray @i2[0],512,513; // Rare Items setarray @i3[0],514,515; // Super Rare Items set @i1rand,rand( getarraysize(@i1) ); // Randomize Common Items; just change max amount if you add items set @i2rand,rand( getarraysize(@i2) ); // Randomize Rare Items; just change max amount if you add items set @i3rand,rand( getarraysize(@i3) ); //Randomize Super Rare Items; just change max amount if you add items .chance = rand(100); // Super Rare Item 1% if (.chance == 1) { getitem @i[@i3rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(@i3[@i3rand])+"] from the Super Rare Box.",0; end; } // Rare Item 10% else if (.chance <= 11 && .chance >= 1){ getitem @i[@i2rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(@i2[@i2rand])+"] from the Rare Item Box.",0; end; } // Common Items else { getitem @i1[@i1rand],1; end; } } Note : above script is to be inside any .txt which are loaded in your npc folder https://www.google.com/search?q=rathena+adding+npc+script&oq=rathena+adding+npc+script&aqs=chrome..69i57j69i60l3.4790j0j1&sourceid=chrome&ie=UTF-8 Put this line in you Item Script. callfunc("F_RBox"); https://github.com/rathena/rathena/wiki/Adding-a-Script example: 617,Old_Violet_Box,Old Purple Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ callfunc ( "F_RBox" ) ; },{},{} https://github.com/rathena/rathena/wiki/Custom-Items Edited February 12, 2019 by utofaery 1 Quote
0 Balfear Posted February 10, 2019 Posted February 10, 2019 (edited) 2 hours ago, spawnn said: function script visualbox { .@item = F_Rand(17041,17037,17043,17039,17038,17042,13999,12922,13996,7715,12103,674,28370,6239,6238,7712,7711,18849,2980,6235,6231,6439,6438,16771,12623,6380,6423,12208,12902,); getitem .@item, 1; announce "["+strcharinfo(0)+"] Ganhou: ["+getitemname( .@item )+"("+.@item+")] da caixa visual.",0; return; } Change chance items Ids 1% = 6438,6239,6439 Why you don`t want use item_group "getgroupitem(IG_MyItemGroup);" with announce? Edited February 10, 2019 by Balfear Quote
0 utofaery Posted February 10, 2019 Posted February 10, 2019 I did answer your question in another topic by giving you suggestion already, This is the two line in the script to change item id and item chances if you need further help post here. setarray .itemId , 502, 678, 607 ,608 ,2101 ,1505 ,609;// Item List setarray .iRates, 15, 16, 17, 18, 19, 20, 21; // seperated item rates or chances to get which item is higher than other item in the array Quote
0 Tupac Posted February 11, 2019 Author Posted February 11, 2019 On 2/10/2019 at 7:03 PM, utofaery said: I did answer your question in another topic by giving you suggestion already, This is the two line in the script to change item id and item chances if you need further help post here. setarray .itemId , 502, 678, 607 ,608 ,2101 ,1505 ,609;// Item List setarray .iRates, 15, 16, 17, 18, 19, 20, 21; // seperated item rates or chances to get which item is higher than other item in the array Not work, no gain items. Quote
0 Tupac Posted February 11, 2019 Author Posted February 11, 2019 On 2/10/2019 at 4:17 PM, Balfear said: Why you don`t want use item_group "getgroupitem(IG_MyItemGroup);" with announce? exemple plz Quote
0 Balfear Posted February 12, 2019 Posted February 12, 2019 (edited) 10 hours ago, spawnn said: exemple plz db/import/item_package.txt GroupID, ItemID, Rate{, Amount, Random, isAnnounced, Duration, GUID, isBound, isNamed} add // MyBox IG_MyBox,501,1,1,1,1,0,0 IG_MyBox,502,1,1,1,1,0,0 src/map/itemdb.hpp add to the end of this group "e_random_item_group" enum e_random_item_group { ......... .......... ........... IG_MyBox, }; script_constants.hpp add after /* item groups */ /* item groups */ ....... ......... ........... export_constant(IG_MyBox); getgroupitem <group_id>{,<identify>{,<char_id>}}; Add this to your box script: getgroupitem IG_MyBox; Edited February 12, 2019 by Balfear 1 Quote
0 Tupac Posted February 12, 2019 Author Posted February 12, 2019 21 minutes ago, utofaery said: This method is easier comparing to recompiling lolz. comparing to editing database .txt all around and this method is fully changable to event script's need easily..(on the fly changes) Sorry for the broken previous script but this script tested working in current rathena version. Put this part inside your npc files. function script F_RBox { // change Item ID here setarray @i1[0],607,608; // Common Items setarray @i2[0],512,513; // Rare Items setarray @i3[0],514,515; // Super Rare Items set @i1rand,rand( getarraysize(@i1) ); // Randomize Common Items; just change max amount if you add items set @i2rand,rand( getarraysize(@i2) ); // Randomize Rare Items; just change max amount if you add items set @i3rand,rand( getarraysize(@i3) ); //Randomize Super Rare Items; just change max amount if you add items .chance = rand(100); // Super Rare Item 1% if (.chance == 1) { getitem @i[@i3rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(@i3[@i3rand])+"] from the Super Rare Box.",0; end; } // Rare Item 10% else if (.chance <= 11 && .chance >= 1){ getitem @i[@i2rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(@i2[@i2rand])+"] from the Rare Item Box.",0; end; } // Common Items else { getitem @i1[@i1rand],1; end; } } Note : above script is to be inside any .txt which are loaded in your npc folder https://www.google.com/search?q=rathena+adding+npc+script&oq=rathena+adding+npc+script&aqs=chrome..69i57j69i60l3.4790j0j1&sourceid=chrome&ie=UTF-8 Put this line in you Item Script. callfunc("F_RBox"); https://github.com/rathena/rathena/wiki/Adding-a-Script example: 617,Old_Violet_Box,Old Purple Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ callfunc ( "F_RBox" ) ; },{},{} https://github.com/rathena/rathena/wiki/Custom-Items Error to gain super rare and rare. [Error]: buildin_getitem: Nonexistant item 0 requested. [Debug]: Source (NPC): FAKE_NPC (invisible/not on a map) Quote
0 Tupac Posted February 12, 2019 Author Posted February 12, 2019 Solved: getitem @i[@i3rand],1; for getitem @i3[@i3rand],1; and getitem @i[@i2rand],1; for getitem @i2[@i2rand],1; Thx! @utofaery Quote
0 utofaery Posted February 13, 2019 Posted February 13, 2019 16 hours ago, spawnn said: Thx! @utofaery Don't just thank me... Thank everyone been around lol... I leech from everyone too... Quote
0 Haganezuka Posted July 14, 2019 Posted July 14, 2019 @utofaery what if i wanted to have a specific amount of items, how can i do that? On 2/13/2019 at 2:00 AM, utofaery said: function script F_RBox { // change Item ID here setarray @i1[0],607,608; // Common Items setarray @i2[0],512,513; // Rare Items setarray @i3[0],514,515; // Super Rare Items set @i1rand,rand( getarraysize(@i1) ); // Randomize Common Items; just change max amount if you add items set @i2rand,rand( getarraysize(@i2) ); // Randomize Rare Items; just change max amount if you add items set @i3rand,rand( getarraysize(@i3) ); //Randomize Super Rare Items; just change max amount if you add items .chance = rand(100); // Super Rare Item 1% if (.chance == 1) { getitem @i[@i3rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(@i3[@i3rand])+"] from the Super Rare Box.",0; end; } // Rare Item 10% else if (.chance <= 11 && .chance >= 1){ getitem @i[@i2rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(@i2[@i2rand])+"] from the Rare Item Box.",0; end; } // Common Items else { getitem @i1[@i1rand],1; end; } } Quote
0 lelouchxv Posted April 17, 2021 Posted April 17, 2021 On 2/12/2019 at 2:00 PM, utofaery said: This method is easier comparing to recompiling lolz. comparing to editing database .txt all around and this method is fully changable to event script's need easily..(on the fly changes) Sorry for the broken previous script but this script tested working in current rathena version. Put this part inside your npc files. function script F_RBox { // change Item ID here setarray @i1[0],607,608; // Common Items setarray @i2[0],512,513; // Rare Items setarray @i3[0],514,515; // Super Rare Items set @i1rand,rand( getarraysize(@i1) ); // Randomize Common Items; just change max amount if you add items set @i2rand,rand( getarraysize(@i2) ); // Randomize Rare Items; just change max amount if you add items set @i3rand,rand( getarraysize(@i3) ); //Randomize Super Rare Items; just change max amount if you add items .chance = rand(100); // Super Rare Item 1% if (.chance == 1) { getitem @i[@i3rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(@i3[@i3rand])+"] from the Super Rare Box.",0; end; } // Rare Item 10% else if (.chance <= 11 && .chance >= 1){ getitem @i[@i2rand],1; announce "["+strcharinfo(0)+"] won a ["+getitemname(@i2[@i2rand])+"] from the Rare Item Box.",0; end; } // Common Items else { getitem @i1[@i1rand],1; end; } } Note : above script is to be inside any .txt which are loaded in your npc folder https://www.google.com/search?q=rathena+adding+npc+script&oq=rathena+adding+npc+script&aqs=chrome..69i57j69i60l3.4790j0j1&sourceid=chrome&ie=UTF-8 Put this line in you Item Script. callfunc("F_RBox"); https://github.com/rathena/rathena/wiki/Adding-a-Script example: 617,Old_Violet_Box,Old Purple Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ callfunc ( "F_RBox" ) ; },{},{} https://github.com/rathena/rathena/wiki/Custom-Items @utofaery Hi! how can i add custom points? Ex. Pvp Points Hourly Points Cash Points Quote
Question
Tupac
Change chance items
Ids
1% = 6438,6239,6439
11 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.