- script Piercing Expert -1,{ mes .@npc_name$ = "[Piercing Expert]"; mes "I have been researching ways to use ^0000FF"+getitemname(.item_cost)+"^000000 to put a socket on some headgear"; next; switch(select("Headgear List:Piercing:Guide")) { case 1: callsub OnMenuGen; close; case 2: break; case 3: .@rate$ = ((.rate_setting == 1) ? "but only at "+.success_rate[0]+"%" : "on different"); mes .@npc_name$; mes "It was successful, "+.@rate$+" success rate.If you are willing to risk it,+" " just bring me an ^0000FF"+getitemname(.itemc_cost)+"^000000 and the headgear."; next; mes .@npc_name$; mes "You can use "+getitemname(.protection)+", it will prevent you lossing item if failed."; next; mes .@npc_name$; mes "You can use "+getitemname(.inc_chance[0])+", it will increase your success chance by "+.inc_chance[1]+"%."; close; } callsub OnMenuGen; next; mes .@npc_name$; mes "If I fail your "+getitemname(.headgear_list[.@s])+" will be destroyed."+ "Do you still want to have it pierced ?"; next; if (select("Yes:No") == 2) { mes .@npc_name$; mes "All right, "+callfunc("F_Bye"); close; } if (countitem(.protection)) { mes .@npc_name$; mes "Do you want to use "+getitemname(.protection)+" ?, it will prevent you lossing item."; next; .@p = select("No:Yes") -1; } if (countitem(.inc_chance[0])) { mes .@npc_name$; mes "Do you want to use "+getitemname(.inc_chance[0])+" ?, it increase your success chance by "+.inc_chance[1]+"%."; next; .@c = select("No:Yes") -1; } .@rate = ((.rate_setting == 1) ? .success_rate[0] : .success_rate[.@s]); .@rate$ = ((.rate_setting == 1) ? .success_rate[0]+"%" : .success_rate[.@s]+"%"); if (.@c) { delitem .inc_chance[0], 1; .@rate += .inc_chance[2]; } if (rand(99) > .@rate) { if (!.@p) delitem .headgear_list[.@s], 1; mes .@npc_name$; mes "Oh, my... I failed."; mes "I todl you it was only "+.@rate$+" chance."; mes "There's always next time!"; close; } if (.@p) delitem .protection, 1; delitem .headgear_list[.@s], 1; getitem .headgear_list2[.@s], 1; mes .@npc_name$; mes "Wow, It was success"; close;OnMenuGen: .@menu$ = ""; for (.@i = 0; .@i < getarraysize(.headgear_list); .@i++) { .@menu$ += getitemname(.headgear_list[.@i])+":"; } mes .@npc_name$; mes "Select a headgear to see different before and after piercing "+((.rate_setting == 2) ? "and Rate" : "")+"."; next; .@s = select(.@menu$) -1; explode(.@item_diff$, .diff_change$[.@s], "|"); mes .@npc_name$; mes getitemname(.headgear_list[.@s])+" Change:"; if (.rate_setting == 2) { mes "Rate: "+.success_rate[.@s]; } mes "Before: "+.@item_diff$[0]; mes "After: "+.@item_diff$[1]; mes "But at least it will now have a socket"; return;OnInit: // rate_setting: // 1 = Chance will only use the first value of .success_rate. // 2 = All headgear will have different chance, set the chance on .success_rate array. .rate_setting = 1; .item_cost = 6396; // item that will be used as piercing price .protection = 501; // item that will be used as portection that will prevent lossing headgear if failed setarray .inc_chance, 502, 10; // , setarray .headgear_list, 2286, 18599; // Headgear list that can be pierced setarray .headgear_list2, 18507, 18603; // Headgear list exchange of the pierced headgear setarray .success_rate, 20, 20; setarray .diff_change$, "Have no slot|Have a slot", "All Stats +2, Have no slot|All Stats +1, Have a slot"; // Do not touch it from here, insanity check; if (getarraysize(.headgear_list) != getarraysize(.headgear_list2)) { logmes "Piercing Expert: Error! Different array size on Headgear List."; disablenpc "Piercing Expert;"; end; } if (.rate_setting < 1 || .rate_setting > 2) .rate_setting = 1; if (.rate_setting == 2) { if (getarraysize(.headgear_list) != getarraysize(.success_rate)) { logmes "Piercing Expert: Error! Different size on headgear list ["+getarraysize(.headgear_list)+"] and success rate ["+getarraysize(.succes_rate)+"]"; disablenpc "Piercing Expert"; } } end;}