Jump to content

-to-

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

-to-'s Achievements

Poring

Poring (1/15)

0

Reputation

  1. I needed a quick change to make something like this work.... It might help you: You just need to replace the function void itemdb_add_randomopt(struct item *it) in itemdb.cpp and recompile. It makes 1random option 100%, 2nd 80%, 3rd 60% and so on... void itemdb_add_randomopt(struct item *it) { struct item_data *id; struct s_random_opt_group *randomopt_group; int i; if (!it || !it->nameid || (id = itemdb_exists(it->nameid)) == NULL) { return; } for (i = 0; i < MAX_ITEM_RDM_OPT; i++) { if (id->randomopt_groupid[i] && ((randomopt_group = itemdb_randomopt_group_exists(id->randomopt_groupid[i])) != NULL)) { int rndOpt = rnd() % (MAX_ITEM_RDM_OPT); if (i > 0) { if ((i > 3 && rndOpt < 4) || (i > 2 && rndOpt < 3) || (i > 1 && rndOpt < 2)) break; if (rndOpt < 1) break; } int rnd_value = rnd() % (randomopt_group->total_weight); int total = 0; int j; for (j = 0; j < randomopt_group->total; j++) { total += randomopt_group->entries[j].weight; if (rnd_value < total) { it->option[i].id = randomopt_group->entries[j].option.id; if (randomopt_group->entries[j].max_value > 0 && randomopt_group->entries[j].max_value != randomopt_group->entries[j].option.value) { int max = randomopt_group->entries[j].max_value; int min = randomopt_group->entries[j].option.value; it->option[i].value = rnd() % (max - min + 1) + min; } else { it->option[i].value = randomopt_group->entries[j].option.value; } it->option[i].param = randomopt_group->entries[j].option.param; break; } } } } } In item_randomopt_equips.txt you cannot duplicate any RandomOption_GroupId in the same item. You can use something like this: 1202,RDMOPT_Weapon_Tier1_Slot1,RDMOPT_Weapon_Tier1_Slot2,RDMOPT_Weapon_Tier1_Slot3,RDMOPT_Weapon_Tier1_Slot4,RDMOPT_Weapon_TierSpecial_Slot5 If you want a item to have less than 5 options, you just need to remove the option from this file.
  2. I've added a loop to save the gear`s random options in variables for([email protected]=0;[email protected]<(MAX_ITEM_RDM_OPT);[email protected]++){ [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_ID); [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_VALUE); [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_PARAM); } And changed getitem2 to getitem3 to create the stored random options values. Here it is: //===== rAthena Script ======================================= //= Enchant NPC //===== By: ================================================== //= Sehrentos //===== Current Version: ===================================== //= 1.2 //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= Enchant player's equipment. Support multiple enchants. //===== Additional Comments: ================================= //= 1.0 Initial script. //= 1.1 Remove enchant option. //= 1.2 Added .max_enchant option. //============================================================ // shop/cashshop/itemshop/pointshop - shop enc_atk -1,501:300; - shop enc_def -1,501:300; - shop enc_stats -1,501:300; prontera,159,177,6 script Enchant#prt1 4_M_MERCAT1,{ disable_items; switch(select("Attack:Defence:Stats:Remove")) { case 1: @shop_name$ = "enc_atk"; break; case 2: @shop_name$ = "enc_def"; break; case 3: @shop_name$ = "enc_stats"; break; case 4: callsub S_Remove; break; default: end; } callshop @shop_name$, 1; npcshopattach @shop_name$; end; OnInit: // Settings: shop names, currencies, items, prices .max_enchant = 2; // Max amount of enchants 0-4 setarray .shop_name$[0], "enc_atk", "enc_def", "enc_stats"; setarray .shop_currency$[0],"Zeny", "Zeny", "Zeny"; setarray .enc_atk_id[0], 4760, 4761, 4806, 4815, 4814, 4813, 4812, 4826, 4827, 4828, 4829, 4830, 4831, 4819, 4766, 4767,4764,4765, 4807, 4842, 4818, 4817, 4816, 4843, 4844, 4811, 4810, 4809, 4808, 4820, 4821, 4822, 4823, 4824, 4825, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841; setarray .enc_atk_price[0],10000,20000,30000,10000,20000,30000,40000,50000,60000,70000,80000,90000,100000,10000,20000,30000,5000,7000,10000,20000,10000,20000,30000,40000,50000,10000,20000,30000,40000,50000,60000,70000,80000,90000,100000,10000,20000,30000,40000,50000,60000,70000,80000,90000,100000; setarray .enc_def_id[0], 4805, 4850, 4851, 4852,4762, 4763,4786,4787,4788,4789, 4790,4791,4792,4793, 4794,4795,4796,4797,4798,4799,4800,4801, 4802; setarray .enc_def_price[0],10000,20000,40000,60000,5000,12000,2000,4000,6000,8000,10000,3000,5000,9000,12000,1000,2000,3000,4000,5000,2500,5000,10000; setarray .enc_stats_id[0], 4700,4710,4720,4730,4740,4750, 4701,4711,4721,4731,4741,4751, 4702,4712,4722,4732,4742,4752, 4703,4713,4723,4733,4743,4753, 4704,4714,4724,4734,4744,4754, 4705,4715,4725,4735,4745,4755, 4706,4716,4726,4736,4746,4756, 4707,4717,4727,4737,4747,4757, 4708,4718,4728,4738,4748,4758, 4709, 4719, 4729, 4739, 4749, 4759; setarray .enc_stats_price[0],1500,1500,1500,1500,1500,1500, 2500,2500,2500,2500,2500,2500, 3500,3500,3500,3500,3500,3500, 4500,4500,4500,4500,4500,4500, 5500,5500,5500,5500,5500,5500, 6500,6500,6500,6500,6500,6500, 7500,7500,7500,7500,7500,7500, 8500,8500,8500,8500,8500,8500, 9500,9500,9500,9500,9500,9500, 10500,10500,10500,10500,10500,10500; // Load shop items for([email protected] = 0; [email protected] < getarraysize(.shop_name$); [email protected]++) { [email protected]$ = .shop_name$[[email protected]]; deletearray [email protected][0],getarraysize([email protected]); deletearray [email protected][0],getarraysize([email protected]); copyarray [email protected][0], getd("."[email protected]$+"_id[0]"), getarraysize(getd("."[email protected]$+"_id")); copyarray [email protected][0], getd("."[email protected]$+"_price[0]"), getarraysize(getd("."[email protected]$+"_price")); npcshopdelitem [email protected]$,501;// Remove apple for([email protected] = 0; [email protected] < getarraysize([email protected]); [email protected]++) { npcshopadditem [email protected]$, [email protected][[email protected]], [email protected][[email protected]]; } } end; OnSellItem: end; OnBuyItem: [email protected]_count = getarraysize(@bought_nameid); if([email protected]_count < 1) end; // Get shop data by @shop_name$ [email protected]_index = inarray(.shop_name$[0], @shop_name$); if([email protected]_index == -1 || getarraysize(.shop_name$) < 1) { message strcharinfo(0), "Shop was not found!"; debugmes "Incorrect shop array detected in '"[email protected]_name$+"'! FIXME!"; end; } copyarray [email protected]_id[0], getd("."[email protected]_name$+"_id"), getarraysize(getd("."[email protected]_name$+"_id")); copyarray [email protected]_price[0], getd("."[email protected]_name$+"_price"), getarraysize(getd("."[email protected]_name$+"_price")); for([email protected] = 0; [email protected] < [email protected]_count; [email protected]++) { [email protected] = inarray([email protected]_id[0], @bought_nameid[[email protected]]); if([email protected] == -1) { message strcharinfo(0), "Price was not found!"; debugmes "Incorrect price array detected in '"[email protected]_name$+"'! FIXME!"; end; } setarray [email protected]_cost[getarraysize([email protected]_cost)],[email protected]_price[[email protected]]*@bought_quantity[[email protected]]; for ([email protected] = 0; [email protected] < @bought_quantity[[email protected]]; [email protected]++) { setarray [email protected][getarraysize([email protected])],@bought_nameid[[email protected]]; } } // Count total cost for([email protected] = 0; [email protected] < [email protected]_count; [email protected]++) { [email protected]_cost = [email protected]_cost + [email protected]_cost[[email protected]]; } // Currency check if(.shop_currency$[[email protected]_index] == "Zeny" && Zeny < [email protected]_cost) { message strcharinfo(0), "("[email protected]_cost+") Not enough "+.shop_currency$[[email protected]_index]+"!"; end; } // Other currency checks... // Select equipment (EQI) mes "[ " + strnpcinfo(1) + " ]"; mes "Please select which equipment you want me to enchant."; [email protected] = callsub(S_SelectPosition); // Check if position has equipment if(!getequipisequiped([email protected])) { clear; mes "[ " + strnpcinfo(1) + " ]"; mes "You don't have anything equipped there!"; close; } [email protected]_id = getequipid([email protected]); //Equipped item id [email protected] = getequiprefinerycnt([email protected]); //Equipped refine value [email protected] = getitemslots([email protected]_id); setarray [email protected][0], getequipcardid([email protected],0), getequipcardid([email protected],1), getequipcardid([email protected],2), getequipcardid([email protected],3); [email protected]_count = getarraysize([email protected]); [email protected]_count = getarraysize([email protected]); for([email protected]=0;[email protected]<(MAX_ITEM_RDM_OPT);[email protected]++){ [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_ID); [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_VALUE); [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_PARAM); } /*if([email protected]_count > .max_enchant) { clear; mes "[ " + strnpcinfo(1) + " ]"; mes "This item has been crafted or produced and cannot be enchanted."; close; }*/ // Check for enabled refinement /*if(!getequipisenableref([email protected])) { clear; mes "[ " + strnpcinfo(1) + " ]"; mes "I don't think I can enchant this item at all."; mes "Sorry..."; close; }*/ // Add all card slots for([email protected] = 0; [email protected] < [email protected]; [email protected]++) { setarray [email protected][getarraysize([email protected])], ([email protected][[email protected]] > 0 ? [email protected][[email protected]] : -1); } // Add previous enchants for([email protected] = [email protected]; [email protected] < [email protected]_count; [email protected]++) { if([email protected][[email protected]] > 0) { setarray [email protected][getarraysize([email protected])], [email protected][[email protected]]; } } // Add new enchants for([email protected] = 0; [email protected] < [email protected]_count; [email protected]++) { setarray [email protected][getarraysize([email protected])], [email protected][[email protected]]; } // Check for produced/crafted items 254,255 if([email protected][0] == CARD0_FORGE || [email protected][0] == CARD0_CREATE) { clear; mes "[ " + strnpcinfo(1) + " ]"; mes "This item has been crafted or produced and cannot be enchanted."; close; } // Has card sockets 4 - slots if([email protected]_count > (.max_enchant - [email protected])) { clear; mes "[ " + strnpcinfo(1) + " ]"; mes "This equipment can hold "+(.max_enchant - [email protected])+" enchant."; close; } // Has free sockets if(([email protected] + [email protected]_count) > .max_enchant || getarraysize([email protected]) > .max_enchant) { clear; mes "[ " + strnpcinfo(1) + " ]"; mes "This item does not have enough free sockets to enchant."; close; } // Confirm the setup clear; mes "[ " + strnpcinfo(1) + " ]^6E6E6E Setup^000000"; for([email protected] = 0; [email protected] < [email protected]_count; [email protected]++) { mes "Enchant: "+ getitemname([email protected][[email protected]]); } mes "Equipment: "+ getitemname(getequipid([email protected])); mes "Cost: "[email protected]_cost+" "+.shop_currency$[[email protected]_index]+"."; if (select("Create enchant:Cancel") != 1) { clear; mes "[ " + strnpcinfo(1) + " ]"; mes "Farewell."; close; } // Create selected enchant clear; mes "[ " + strnpcinfo(1) + " ]^6E6E6E Done^000000"; mes "Here is your enchanted equipment!"; delequip([email protected]); specialeffect2 154; if(.shop_currency$[[email protected]_index] == "Zeny") { Zeny = Zeny - [email protected]_cost; } //getitem2 [email protected]_id, 1, 1, [email protected], 0, getitem3 [email protected]_id, 1, 1, [email protected], 0, ([email protected][0] > 0 ? [email protected][0] : 0), ([email protected][1] > 0 ? [email protected][1] : 0), ([email protected][2] > 0 ? [email protected][2] : 0), ([email protected][3] > 0 ? [email protected][3] : 0),[email protected],[email protected],@randOptParam; close; S_Remove: // Select equipment (EQI) mes "[ " + strnpcinfo(1) + " ]"; mes "Please select which equipment you want me to work on."; [email protected] = callsub(S_SelectPosition); // Check if position has equipment if(!getequipisequiped([email protected])) { clear; mes "[ " + strnpcinfo(1) + " ]"; mes "You don't have anything equipped there!"; close; } [email protected]_id = getequipid([email protected]); //Equipped item id [email protected] = getequiprefinerycnt([email protected]); //Equipped refine value [email protected] = getitemslots([email protected]_id); setarray [email protected][0], getequipcardid([email protected],0), getequipcardid([email protected],1), getequipcardid([email protected],2), getequipcardid([email protected],3); [email protected]_count = getarraysize([email protected]); [email protected]_count = getarraysize([email protected]); for([email protected]=0;[email protected]<(MAX_ITEM_RDM_OPT);[email protected]++){ [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_ID); [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_VALUE); [email protected][[email protected]] = getequiprandomoption([email protected],[email protected],ROA_PARAM); } // Create selected item clear; mes "[ " + strnpcinfo(1) + " ]^6E6E6E Done^000000"; mes "Here is your equipment back!"; delequip([email protected]); specialeffect2 169; //getitem2 [email protected]_id, 1, 1, [email protected], 0,0,0,0,0; getitem3 [email protected]_id, 1, 1, [email protected], 0,0,0,0,0,[email protected],[email protected],@randOptParam; for([email protected]=0; [email protected]<[email protected]; [email protected]++) { if([email protected][[email protected]] > 0) getitem [email protected][[email protected]], 1; } close; S_SelectPosition: setarray [email protected][1], EQI_HEAD_TOP, EQI_HEAD_MID, EQI_HEAD_LOW, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R; setarray [email protected]$[1], "Top", "Mid", "Low", "Armor", "Left Hand", "Right Hand", "Garment", "Shoes", "Accessory L", "Accessory R"; setarray [email protected][1], 1, 1, 1, 1, 1, 1, 1, 1, 1, 1; // 1=allow, 0=deny for([email protected]=1; [email protected]<getarraysize([email protected]); [email protected]++) { if([email protected][[email protected]] && getequipisequiped([email protected][[email protected]])) { [email protected]$ = [email protected]$ + [email protected]$[[email protected]] + "-[" + getequipname([email protected][[email protected]]) + "]"; } [email protected]$ = [email protected]$ + ":"; } [email protected] = [email protected][select([email protected]$)]; return [email protected]; }
  3. ITEMID,ITEMNAME,ITEMNAME,4,20,,0,,0,,0,0xFFFFFFFF,7,2,8192,,0,0,0,{},{setlook LOOK_BODY2,1;},{setlook LOOK_BODY2,0;} In case you still need this. 8192 = Costume Garment On unequipped it changes back to normal bodystyle. You just need to change the jobs that will be able to use the item.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.