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