Hello, can i request to edit this refiner npc.
This NPC works fine, but when the refinement fails it goes back to the safe level of the item..
my request is how can i make this refine npc, when it fails it will reduce only 1 refine..
example [ +8 Knife refine and it fails it will become +7 only ]
here's the script
mellina,66,91,5 script Blacksmith#1 63,{
//- Price per refine / per equipment -- Refine Armor / weapon lvl 1... lvl 4 / other ?
setarray .@price[0], 100000, 100000, 100000, 100000, 100000, 100000;
//- ID material per equipment -- phracons ...
setarray .@material[0], 985, 1010, 1011, 984, 984, 985;
//- Safe limit per equipment
setarray .@safe[0], 5, 7, 7, 5, 5, 5;
//-- ID Ticket 100% -- 0 = disabled
set .@TicketID, 7608;
//-- Lucky Charm -- complete it as your content
//- ID Lucky Charm -- ID 0 or comment = disabled option
setarray .@Lcid[0], 6241, 6240;
//- + % Success rate of Lucky Charm
setarray .@Lcef[0], 50, 50;
//-
mes "[Blacksmith]";
mes "I'm the Blacksmith.";
mes "I can refine all kinds of weapons, armor and equipment, so let me";
mes "know what you want me to refine.";
next;
setarray .@position$[1], "^0000ffHead^000000","^0000ffBody^000000","^FF0000Left hand^000000","^FF0000Right hand^000000","^0000ffRobe^000000","^0000ffShoes^000000","Accessory 1","Accessory 2","^0000ffHead 2^000000","^0000ffHead 3^000000";
for( set .@i, 1; .@i <= getarraysize(.@position$); set .@i, .@i+1 ) {
if( getequipisequiped(.@i) )
set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";
set .@menu$, .@menu$+ ":"; }
set .@part, select( .@menu$ );
mes "[Blacksmith]";
if( !getequipisequiped(.@part) ) {
mes "You're not wearing";
mes "anything there that";
mes "I can refine.";
emotion 6;
close; }
//Check if the item is refinable...
if( !getequipisenableref(.@part) ) {
mes "I don't think I can";
mes "refine this item at all...";
close; }
//Check to see if the items is already +10
if( getequiprefinerycnt(.@part) >= 10 ) {
mes "I can't refine this";
mes "any more. This is as";
mes "refined as it gets!";
close; }
set .@refineitemid, getequipid(.@part); // save id of the item
set .@wp, getequipweaponlv(.@part);
mes "Select an option.";
//-- Safe : menu 0 -- one time : menu 1 -- leave : menu 2
.@mRn = select( (getequiprefinerycnt(.@part) < .@safe[.@wp]?"Refine to the safe limit, please.":""), "Refine one time.", "I've changed my mind..." ) - 1;
//-
if( .@mRn > 1 ) {
next;
mes "[Blacksmith]";
mes "You said so... So be it.";
close; }
//-- Safe limit = 0 / one refine = 1
.@rcnt = ( .@mRn ? 1 : .@safe[.@wp] - getequiprefinerycnt(.@part) );
//-
set .@refinerycnt, getequiprefinerycnt(.@part); //save refinery count
mes "To refine this I need";
mes .@rcnt+" ^FF0000"+getitemname( .@material[.@wp] )+"^000000";
mes "and a service fee of ^0000ff" +(.@price[.@wp]*.@rcnt)+ " Zeny^000000.";
mes "Do you really wish to continue?";
next;
if( select( "Yes:No" ) == 2 ) {
mes "[Blacksmith]";
mes "Yeah...";
mes "There's no need to";
mes "rush. Take your time.";
close; }
if( getequippercentrefinery(.@part) < 100 )
{
mes "[Blacksmith]";
mes "Oh no! If I continue to";
mes "refine this, there's a risk it could";
switch( .@material[.@wp] ) {
case 985:
mes "be destroyed! That means that ^FF0000this equipment^000000, and ^FF0000any cards^000000 or special properties added to this armor, ^FF0000will be gone^000000.";
break;
default:
mes "be destroyed, and you'd ^FF0000lose the weapon^000000, any ^FF0000cards in the weapon^000000,";
mes "or any added special properties.";
break; }
next;
mes "[Blacksmith]";
if( .@TicketID ) {
mes "With one ^FF0000"+getitemname( .@TicketID )+"^000000.";
mes "I can refine all item";
mes "to success 100%. And I";
mes "^FF0000NEVER LOST ANY ITEM^000000.";
}
mes "So, Do you still want to refine?";
next;
if( select("Yes:No") == 2 ) {
mes "[Blacksmith]";
mes "I completely agree...";
mes "I might be a great refiner, but sometimes even I make mistakes.";
close; }
}
if( (countitem(.@material[.@wp]) < .@rcnt) || (Zeny < .@price[.@wp]*.@rcnt) ) {
mes "[Blacksmith]";
mes "You don't seem to have";
mes "enough ^0000ffZeny^000000 or ^FF0000"+getitemname( .@material[.@wp] )+"^000000...";
mes "Go get some more. I'll be";
mes "here all day if you need me.";
close; }
//-- Menu Lucky charms
if( .@safe[.@wp] - getequiprefinerycnt(.@part) <= 0 && .@Lcid[0] ) {
.@mL$ = "Don't use Lucky charms:";
for( .@i = 0; .@i < getarraysize( .@Lcid ); .@i++ ) {
if( .@Lcid[.@i] && countitem( .@Lcid[.@i] ) ) {
.@mL$ = .@mL$ + "Use "+ getitemname( .@Lcid[.@i] ) +" ?:";
setarray .@ef[ getarraysize( .@ef ) ], .@Lcef[.@i];
setarray .@id[ getarraysize( .@id ) ], .@Lcid[.@i];
}
}
//-- Lucky charm choice (if exist)
if( getarraysize( .@ef ) > 0 ) {
.@c = select( .@mL$ ) - 1;
//-- .@c == 0 --> continue
if( .@c ) {
.@BS = .@ef[ .@c-1 ];
mes "[Blacksmith]";
mes "Using this, you would have +"+ .@BS +"% more chance of sucess.";
mes "Are you sure ?";
next;
if ( select( "Yes:No" ) -1 ) close;
delitem .@id[ .@c-1 ], 1;
}
}
}
//-- end Lucky
set Zeny, Zeny - .@price[.@wp]*.@rcnt;
delitem .@material[.@wp], .@rcnt;
if(getequipisequiped(.@part) == 0) { // hacker has removed the item (not changed, why?)
mes "[Blacksmith]";
mes "Look here... you don't have any Items on...";
close; }
if(getequiprefinerycnt(.@part) != .@refinerycnt || getequipid(.@part) != .@refineitemid) { // hacker has changed the item
mes "[Blacksmith]";
emotion e_an;
mes "Wait a second...";
mes "Do you think I'm stupid?!";
mes "You switched the item while I wasn't looking! Get out of here!";
close; }
//-- fail
if( getequippercentrefinery(.@part) + .@BS <= rand(100) ) {
if( .@TicketID && countitem(.@TicketID) > 0 ) {
set .@Drf, getequiprefinerycnt(.@part) - .@safe[.@wp];
for( .@i = 1; .@i <= .@Drf; .@i++ )
downrefitem .@part;
message strcharinfo(0),"Ticket removed from your inventory.";
delitem .@TicketID,1;
} else
failedrefitem .@part;
mes "[Blacksmith]";
emotion (!rand(5))?e_cash:e_omg;
if( !(.@lose = rand(2)) ) {
mes "OH! MY GOD!";
mes "Damn it! Not again!";
mes "I'm terribly sorry, but you know practice does make perfect.";
mes "Um, right? Heh heh...";
} else if(.@lose == 1) {
mes "Nooooooo!";
mes "It broke!";
mes "I-I'm sorry!";
} else {
mes "Crap!";
mes "It couldn't take";
mes "much more tempering!";
mes "Sorry about this..."; }
close;
}
//-- Success
mes "[Blacksmith]";
for( .@i = 0; .@i < .@rcnt; .@i++ )
successrefitem .@part;
emotion e_heh;
if( !(.@win = rand(2)) ) {
mes "[Blacksmith]";
mes "Perfect!";
mes "Heh heh!";
mes "Once again,";
mes "flawless work";
mes "from the master~";
} else if( .@win == 1 ) {
mes "[Blacksmith]";
mes "Success...!";
mes "Yet again, my amazing";
mes "talent truly dazzles";
mes "and shines today.";
} else {
mes "[Blacksmith]";
mes "Heh heh!";
mes "I'm all done.";
mes "No doubt, my work is";
mes "to your satisfaction.";
mes "Sheer, utter perfection~"; }
close;
}
Thanks in advanced..