

DrGruning
Members-
Posts
7 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
DrGruning's Achievements
-
Great service, pretty diligent, i would reccomend this service to anyone! Was eager to help me through the whole process, skills is top notch!
-
I'll try and see if it's limited to my import folders being way too big or something related to memory hungry scripts, but i'm on a dedicated server which makes it weird, since resources shouldn't be problem
-
mm this is pretty weird to be honest.. and i've tried replacing item_db with a fresh one...
-
Everything works except from @reloaditemdb, no error shown in the console, it just freeze and map server hung with no crash error...
-
Enchant Script not working with random option, getitem3 issue?
DrGruning replied to DrGruning's question in Scripting Support
Thanks a lot for your input @sader1992. Aftter trying your fixes at first it didn't work but somehow after replacing .@eq_loc to .@equip_loc it worked! -
Enchant Script not working with random option, getitem3 issue?
DrGruning posted a question in Scripting Support
prt_in,86,73,5 script Bermund 654,{ function get_rune_id; function get_rune_equip; function get_rune_zeny; function get_rune_success_rate; disable_items; mes "You want to fuse the MvP Core with your equipments?"; mes "NOTE:"; mes "Please by all means just have equipped the item you will enchant and once at time,that is to avoid any item lost or bug, you are already warned"; mes "Enchanting an equipment will erase Item Options"; .@color = select( "Shoes","Armor","Shield","Accesories","Headgear" ); next; mes "I can transmute it depending on your budget and wiht it chances increases"; .@rank = select( "Normal Services","Premiun Services","VIP Services" ); .@enchant_slot = 4; .@equip_loc = get_rune_equip( .@color ); .@rune_id = get_rune_id( .@color,.@rank ); .@zeny_cost = get_rune_zeny( .@rank ); .@success_rate = get_rune_success_rate( .@rank ); .@item_id = getequipid( .@equip_loc ); next; mes "Equipment: "+getitemname( .@item_id ); mes "Rune: "+getitemname( .@rune_id ); mes "Zeny: "+F_InsertComma( .@zeny_cost ); mes "Success Rate: "+.@success_rate+"%"; mes " "; if ( Zeny >= .@zeny_cost ) if ( select( "Continue","Cancel" ) == 1 ) { if ( getitemslots( .@item_id ) >= .@enchant_slot ) { mes "This item slot cant be enchanted."; } else { Zeny -= .@zeny_cost; if ( rand(100) < .@success_rate ) { for ( .@card = 0; .@card < 4; .@card++ ) .@slot[.@card] = getequipcardid( .@equip_loc,.@card ); setarray .@OptID[0],0; setarray .@OptID[1],0; setarray .@OptID[2],0; setarray .@OptID[3],0; setarray .@OptID[4],0; setarray .@OptVal[0],0; setarray .@OptVal[1],0; setarray .@OptVal[2],0; setarray .@OptVal[3],0; setarray .@OptVal[4],0; setarray .@OptParam[0],0; setarray .@OptParam[1],0; setarray .@OptParam[2],0; setarray .@OptParam[3],0; setarray .@OptParam[4],0; for (.@j = 0; .@j < 5; .@j++) { setarray .@OptID[.@j],getequiprandomoption(.@eq_loc,.@j,ROA_ID); setarray .@OptVal[.@j],getequiprandomoption(.@eq_loc,.@j,ROA_VALUE); setarray .@OptParam[.@j],getequiprandomoption(.@eq_loc,.@j,ROA_PARAM); } .@refine = getequiprefinerycnt( .@equip_loc ); .@slot[.@enchant_slot-1] = .@rune_id; mes "Enchant Success"; specialeffect2 EF_REFINEOK; delitem .@rune_id,1; delitem3 .@item_id,1,1,.@refine,0,.@slot[0],.@slot[1],.@slot[2],.@slot[3],.@OptID,.@OptVal,.@OptParam; getitem3 .@item_id,1,1,.@refine,0,.@slot[0],.@slot[1],.@slot[2],.@slot[3],.@OptID,.@OptVal,.@OptParam; } else { mes "Enchant Failed."; specialeffect2 EF_REFINEFAIL; delitem .@rune_id,1; } } } close; function get_rune_id { .@color = getarg(0,0); .@rank = getarg(1,0); switch( .@color ) { case 1: // Blue switch( .@rank ) { case 1: setarray .@rune_list,15495,15539,15482; break; case 2: setarray .@rune_list,15495,15539,15482; break; case 3: setarray .@rune_list,15495,15539,15482; break; default: break; } break; case 2: // Green switch( .@rank ) { case 1: setarray .@rune_list,15485,15501,15493,15500,15542,15501; break; case 2: setarray .@rune_list,15485,15501,15493,15500,15542,15501; break; case 3: setarray .@rune_list,15485,15501,15493,15500,15542,15501; break; default: break; } break; case 3: // Yellow switch( .@rank ) { case 1: setarray .@rune_list,15496,15502,15497; break; case 2: setarray .@rune_list,15496,15502,15497; break; case 3: setarray .@rune_list,15496,15502,15497; break; default: break; } break; case 4: // Red switch( .@rank ) { case 1: setarray .@rune_list,15494,15487,15489; break; case 2: setarray .@rune_list,15494,15487,15489; break; case 3: setarray .@rune_list,15494,15487,15489; break; default: break; } break; case 5: // Red switch( .@rank ) { case 1: setarray .@rune_list,15541,15544; break; case 2: setarray .@rune_list,15541,15544; break; case 3: setarray .@rune_list,15541,15544; break; default: break; } break; default: break; } .@rune_list_size = getarraysize( .@rune_list ); if ( .@rune_list_size ) { while ( .@i < .@rune_list_size ) { .@menu$ = .@menu$ + ( ( countitem( .@rune_list[.@i] ) )? "^0055FF":"^777777" ) + getitemname( .@rune_list[.@i] ) + "^000000" + ":"; .@i++; } .@i = select( .@menu$ ) - 1; if ( !countitem( .@rune_list[.@i] ) ) { mes "You don't have the required rune."; close; } } return .@rune_list[.@i]; } function get_rune_equip { .@color = getarg(0,0); switch ( .@color ) { case 1: // Blue setarray .@equip_loc_list,EQI_SHOES; setarray .@equip_loc_name$,"SHOES"; break; case 2: // Green setarray .@equip_loc_list,EQI_ARMOR; setarray .@equip_loc_name$,"ARMOR"; break; case 3: // Yellow setarray .@equip_loc_list,EQI_HAND_L; setarray .@equip_loc_name$,"SHIELD"; break; case 4: // Red setarray .@equip_loc_list,EQI_ACC_L,EQI_ACC_R; setarray .@equip_loc_name$,"ACCESSORY LEFT","ACCESSORY RIGHT"; break; case 5: // Red setarray .@equip_loc_list,EQI_HEAD_LOW ; setarray .@equip_loc_name$,"LOWER HEADGEAR"; break; default: break; } .@equip_loc_list_size = getarraysize( .@equip_loc_list ); if ( .@equip_loc_list_size ) { while ( .@i < .@equip_loc_list_size ) { .@equip_id = getequipid( .@equip_loc_list[.@i] ); .@menu$ = .@menu$ + ( ( .@equip_id <= 0 )?"^777777":"^0055FF" ) +.@equip_loc_name$[.@i] + " (" + getitemname( .@equip_id ) + ")^000000" + ":"; .@i++; } .@i = select( .@menu$ ) - 1; if ( getequipid( .@equip_loc_list[.@i] ) <= 0 ) { mes "You didnt equipped any equipment on this slot."; close; } } return .@equip_loc_list[.@i]; } function get_rune_zeny { .@rank = getarg(0,0); switch( .@rank ) { case 1: return 1000000; // Rare - 1,000,000 Zeny case 2: return 10000000; // Epic - 10,000,000 Zeny case 3: return 25000000; // Legend - 80,000,000 Zeny default: return 0; } } function get_rune_success_rate { .@rank = getarg(0,0); switch( .@rank ) { case 1: return 10; // Rare - 90% success case 2: return 15; // Epic - 50% success case 3: return 20; // Legend - 20% success default: return 0; } } } I have this custom enchant system right, but when i tried to adapt it to random option support it always delete the random options, and shows the following error at console: -
Thanks for your input, but i don't think that's how its supposed to work, random option should stay permanently if so, enlight me otherwise.
-
//===== rAthena Script ======================================= //= Random Option NPC dealer //===== By: ================================================== //= Keitenai //===== Current Version: ===================================== //= 1.0 //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= Deals with a player to apply random item option //= for the price of zeny/cashpoint //============================================================ vip_lounge,70,147,3 script Magnus 500,{ goto NPC; end; OnInit: //============================== // CURRENCY SETTING // 1 = Zeny // 0 = Cashpoints //============================== set .Currency,1; // Currency to buy random option //============================== // RANDOM OPTION SETTING //============================== set .OverWrite,1; // Allows overwriting the already existing option enchantment ( 0 to disable ) set .MaxOpt,64; // Maximum item option a player can enchant ( reference: https://github.com/rathena/rathena/blob/master/db/const.txt#L1645-L1836 ) set .MinOpt,1; // Minimum item option a player can enchant set .MinValue,1; // Minimum option effect value set .MaxValue,10; // Maximum option effect value set .MaxIndex,3; // Maximum option slots ( default is 0 to 4 ) // Random option that will not be applied setarray .ignore[0], end; NPC: disable_items; mes "[ Magnus ]"; mes "Good day sir"; mes "My name is magnus and i can unlock your Weapon inner abilities"; mes "abilities are chosen at ^FF0000random^000000"; next; mes "[ Magnus ]"; mes "I can make your weapon"; mes "become more powerful"; if(.Currency){ mes "For a prize of ^0000FF1x Weapon V Core^000000,"; } else { mes "For a prize of ^0000FF"+.Price+" Cashpoints^000000,"; } mes "I will apply a ^FF0000RANDOM^000000"; mes "option enchantment on your"; mes "equipment. (^_^)"; next; if(select("^0000FFEnchant my equip!^000000:Nevermind i changed my mind...")==2) goto OnCancel; mes "[ Magnus ]"; mes "Wonderful!"; mes "i'll start right away"; mes "Don't move a muscle while"; mes "i'm enchanting your equipment!"; close2; setarray .@eq[1], EQI_HAND_R; for(set .@i,1; .@i<getarraysize(.@eq); set .@i,.@i+1){ if(getequipisequiped(.@eq[.@i])){ set .@menu$,.@menu$+F_getpositionname(.@eq[.@i])+" ~ [ " + getequipname(.@eq[.@i]) + " ]"; set .@equipped,1; } set .@menu$,.@menu$+":"; } set .@part,.@eq[select(.@menu$)]; set .@val,rand(.MinValue,.MaxValue); OnLoop: set .@opt,rand(.MinOpt,.MaxOpt); for(set .@f,1; .@f<getarraysize(.ignore); set .@f,.@f+1){ if(.@opt==.ignore[.@f]){ goto IgnoreCheck; end; } } goto OnApplyOpts; end; IgnoreCheck: set .@opt,rand(.MinOpt,.MaxOpt); for(set .@f,1; .@f<getarraysize(.ignore); set .@f,.@f+1) if(.@opt==.ignore[.@f]){ goto OnLoop; end; } OnApplyOpts: set .@indx,rand(.MaxIndex); if(!.OverWrite){ if(getequiprandomoption(.@part,4,ROA_ID,getcharid(0))) set .@x4,4; if(getequiprandomoption(.@part,3,ROA_ID,getcharid(0))) set .@x3,3; if(getequiprandomoption(.@part,2,ROA_ID,getcharid(0))) set .@x2,2; if(getequiprandomoption(.@part,1,ROA_ID,getcharid(0))) set .@x1,1; if(getequiprandomoption(.@part,0,ROA_ID,getcharid(0))) set .@x0,0; if(.@indx == 0 && .@x0) if(.@indx==.MaxIndex) goto OnMax; else set .@indx,1; if(.@indx == 1 && .@x1) if(.@indx==.MaxIndex) goto OnMax; else set .@indx,2; if(.@indx == 2 && .@x2) if(.@indx==.MaxIndex) goto OnMax; else set .@indx,3; if(.@indx == 3 && .@x3) if(.@indx==.MaxIndex) goto OnMax; else set .@indx,4; if(.@indx == 4 && .@x4) if(.@indx==.MaxIndex) goto OnMax; } if(.@indx == 4 && (!getequiprandomoption(.@part,3,ROA_ID,getcharid(0)))) set .@indx,3; if(.@indx == 3 && (!getequiprandomoption(.@part,2,ROA_ID,getcharid(0)))) set .@indx,2; if(.@indx == 2 && (!getequiprandomoption(.@part,1,ROA_ID,getcharid(0)))) set .@indx,1; if(.@indx == 1 && (!getequiprandomoption(.@part,0,ROA_ID,getcharid(0)))) set .@indx,0; if(.Currency){ if( countitem(20986) < 1 ) goto PriceFail; else delitem 20986,1; } else { if(#CASHPOINTS < .Price) goto PriceFail; else set #CASHPOINTS,#CASHPOINTS-.Price; } // Success!! setrandomoption(.@part,.@indx,.@opt,.@val,.@indx,getcharid(0)); end; OnMax: mes "[ Magnus ]"; mes "Wow! your equip already"; mes "Maxed out its option"; mes "enchant slots!"; mes "Sorry but I can't add"; mes "any more enchantment with"; mes "your equipment."; close; OnFailure: specialeffect2 EF_PHARMACY_FAIL; mes "[ Magnus ]"," "; mes "I'm really sorry..."," "; mes "^FF0000The process have failed..."; mes "Your item has been destroyed.^000000"; delequip .@part; close; PriceFail: mes "[ Magnus ]"; mes "What's this?"; mes "Are you kidding me?"; mes "Sorry but I don't work"; mes "for free!"; mes "You can come back if you"; mes "Have enough to pay for"; mes "my service."; close; OnCancel: mes "[ Magnus ]"; mes "Suit yourself."; mes "Let me know if you"; mes "ever changed you mind"; close; } Although random option is applied and the bonus works, when i relog, the last random option applied dissapear, i tried simpliers script and it worked, this somehow not