hi guys any body know how to make NPC Refiner with the equipment materials same as used, but the material must +0..
for example, i want refine +7 shadow armor, the material must shadow armor +0, if in inventory have shadow armor +1 or above , the process will close, and NPC give warning.
this is my script, the problem is that there is no check for equipment material more than +0 in inventory.
prontera,156,181,3 script Shadow Blacksmith 1_M_SMITH,{
disable_items;
mes "[Shadow Blacksmith]";
mes "I'm the Armsmith.";
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], "Head Mid", "Head Low", "Head Top", "Garment", "Armor", "Weapon", "Shield", "Shoes","Accessory","Accessory";
.@menu$ = "";
for(.@i = 1; .@i <= getarraysize(.@position$); ++.@i) {
.@pos = .@i + 10;
if(.@i >= 12)
.@pos++;
if(getequipisequiped(.@pos)) {
.@menu$ += .@position$[.@i] + "-" + "[" + getequipname(.@pos) + "]";
.@equipped = 1;
}
.@menu$ += ":";
}
if (.@equipped == 0) {
mes "[Shadow Blacksmith]";
mes "I don't think I can refine any items you have...";
close;
}
.@part = select(.@menu$) + 10;
if(!getequipisequiped(.@part)) { //custom check
mes "[Shadow Blacksmith]";
mes "You're not wearing";
mes "anything there that";
mes "I can refine.";
emotion E_FRET;
close;
}
//Check if the item is refinable...
if(!getequipisenableref(.@part)) {
mes "[Shadow Blacksmith]";
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 "[Shadow Blacksmith]";
mes "I can't refine this";
mes "any more. This is as";
mes "refined as it gets!";
close;
}
//check if item just 1
if(getequipid(.@material) <= 1) {
mes "[Shadow Blacksmith]";
mes "You dont have material i need";
mes "i need "+ getequipname(.@part) +"";
close;
}
.@refineitemid = getequipid(.@part); // save id of the item
.@refinerycnt = getequiprefinerycnt(.@part); //save refinery count
switch(getequipweaponlv(.@part)){
case 0: //Refine Armor
.@price = 2000000;
.@material = getequipid(.@part);
.@safe = 5;
break;
case 1: //Refine Level 1 Weapon
.@price = 2000000;
.@material = getequipid(.@part);
.@safe = 5;
break;
case 2: //Refine Level 2 Weapon
.@price = 2000000;
.@material = getequipid(.@part);
.@safe = 5;
break;
case 3: //Refine Level 3 Weapon
.@price = 2000000;
.@material = getequipid(.@part);
.@safe = 5;
break;
case 4: //Refine Level 4 Weapon
.@price = 2000000;
.@material = getequipid(.@part);
.@safe = 5;
break;
case 5: //Refine other stuff?
.@price = 2000000;
.@material = getequipid(.@part);
.@safe = 5;
break;
}
mes "[Shadow Blacksmith]";
mes "To refine this I need";
mes "one ^003366"+getitemname(.@material)+"^000000 and";
mes "a service fee of " + .@price + " Zeny.";
mes "Do you really wish to continue?";
next;
if(select("Yes:No") == 2){
mes "[Shadow Blacksmith]";
mes "Yeah...";
mes "There's no need to";
mes "rush. Take your time.";
close;
}
if(getequippercentrefinery(.@part) < 100) {
mes "[Shadow Blacksmith]";
mes "Oh no! If I continue to";
mes "refine this, there's a risk it could be down grade,";
switch(.@material) {
case 985:
mes "and you'd ^FF0000lose your currently upgrade^000000, but ^FF0000 it is also possible to be safe^000000.";
break;
default:
mes "and you'd ^FF0000lose your currently upgrade^000000, but ^FF0000 it is also possible to be safe^000000.";
break;
}
next;
mes "[Shadow Blacksmith]";
mes "I can't make it any clearer.";
mes "Once a shadow equipment is down grade,";
mes "there's no getting it back.";
mes "Do you still want to refine?";
next;
if(select("Yes:No") == 2){
mes "[Shadow Blacksmith]";
mes "I completely agree...";
mes "I might be a great refiner, but sometimes even I make mistakes.";
close;
}
}
if((countitem(.@material) <= 1) || (Zeny < .@price)) {
mes "[Shadow Blacksmith]";
mes "You don't seem to have";
mes "enough Zeny or "+getitemname(.@material)+"...";
mes "Go get some more. I'll be";
mes "here all day if you need me.";
close;
}
Zeny -= .@price;
delitem .@material,1;
//custom checks
if(getequipisequiped(.@part) == 0) { // hacker has removed the item (not changed, why?)
mes "[Shadow 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 "[Shadow Blacksmith]";
emotion E_FRET;
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;
}
if(getequippercentrefinery(.@part) <= rand(100)) {
//failedrefitem .@part;
mes "[Shadow Blacksmith]";
emotion (!rand(5))?ET_FRET:E_MONEY;
.@lose = rand(1,3);
if (.@lose == 1) {
specialeffect 611;
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 == 2) {
specialeffect 611;
mes "Nooooooo!";
mes "It broke!";
mes "I-I'm sorry!";
} else {
downrefitem .@part;
specialeffect 155;
mes "Crap!";
mes "It couldn't take";
mes "much more tempering!";
mes "Sorry about this...";
}
close;
}
mes "[Shadow Blacksmith]";
successrefitem .@part;
emotion E_HUK;
.@win = rand(1,3);
if (.@win == 1) {
mes "Perfect!";
mes "Heh heh!";
mes "Once again,";
mes "flawless work";
mes "from the master~";
} else if(.@win == 2) {
mes "Success...!";
mes "Yet again, my amazing";
mes "talent truly dazzles";
mes "and shines today.";
} else {
mes "Heh heh!";
mes "I'm all done.";
mes "No doubt, my work is";
mes "to your satisfaction.";
mes "Sheer, utter perfection~";
}
close;
}
Question
y00z
hi guys any body know how to make NPC Refiner with the equipment materials same as used, but the material must +0..
for example, i want refine +7 shadow armor, the material must shadow armor +0, if in inventory have shadow armor +1 or above , the process will close, and NPC give warning.
this is my script, the problem is that there is no check for equipment material more than +0 in inventory.
prontera,156,181,3 script Shadow Blacksmith 1_M_SMITH,{ disable_items; mes "[Shadow Blacksmith]"; mes "I'm the Armsmith."; 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], "Head Mid", "Head Low", "Head Top", "Garment", "Armor", "Weapon", "Shield", "Shoes","Accessory","Accessory"; .@menu$ = ""; for(.@i = 1; .@i <= getarraysize(.@position$); ++.@i) { .@pos = .@i + 10; if(.@i >= 12) .@pos++; if(getequipisequiped(.@pos)) { .@menu$ += .@position$[.@i] + "-" + "[" + getequipname(.@pos) + "]"; .@equipped = 1; } .@menu$ += ":"; } if (.@equipped == 0) { mes "[Shadow Blacksmith]"; mes "I don't think I can refine any items you have..."; close; } .@part = select(.@menu$) + 10; if(!getequipisequiped(.@part)) { //custom check mes "[Shadow Blacksmith]"; mes "You're not wearing"; mes "anything there that"; mes "I can refine."; emotion E_FRET; close; } //Check if the item is refinable... if(!getequipisenableref(.@part)) { mes "[Shadow Blacksmith]"; 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 "[Shadow Blacksmith]"; mes "I can't refine this"; mes "any more. This is as"; mes "refined as it gets!"; close; } //check if item just 1 if(getequipid(.@material) <= 1) { mes "[Shadow Blacksmith]"; mes "You dont have material i need"; mes "i need "+ getequipname(.@part) +""; close; } .@refineitemid = getequipid(.@part); // save id of the item .@refinerycnt = getequiprefinerycnt(.@part); //save refinery count switch(getequipweaponlv(.@part)){ case 0: //Refine Armor .@price = 2000000; .@material = getequipid(.@part); .@safe = 5; break; case 1: //Refine Level 1 Weapon .@price = 2000000; .@material = getequipid(.@part); .@safe = 5; break; case 2: //Refine Level 2 Weapon .@price = 2000000; .@material = getequipid(.@part); .@safe = 5; break; case 3: //Refine Level 3 Weapon .@price = 2000000; .@material = getequipid(.@part); .@safe = 5; break; case 4: //Refine Level 4 Weapon .@price = 2000000; .@material = getequipid(.@part); .@safe = 5; break; case 5: //Refine other stuff? .@price = 2000000; .@material = getequipid(.@part); .@safe = 5; break; } mes "[Shadow Blacksmith]"; mes "To refine this I need"; mes "one ^003366"+getitemname(.@material)+"^000000 and"; mes "a service fee of " + .@price + " Zeny."; mes "Do you really wish to continue?"; next; if(select("Yes:No") == 2){ mes "[Shadow Blacksmith]"; mes "Yeah..."; mes "There's no need to"; mes "rush. Take your time."; close; } if(getequippercentrefinery(.@part) < 100) { mes "[Shadow Blacksmith]"; mes "Oh no! If I continue to"; mes "refine this, there's a risk it could be down grade,"; switch(.@material) { case 985: mes "and you'd ^FF0000lose your currently upgrade^000000, but ^FF0000 it is also possible to be safe^000000."; break; default: mes "and you'd ^FF0000lose your currently upgrade^000000, but ^FF0000 it is also possible to be safe^000000."; break; } next; mes "[Shadow Blacksmith]"; mes "I can't make it any clearer."; mes "Once a shadow equipment is down grade,"; mes "there's no getting it back."; mes "Do you still want to refine?"; next; if(select("Yes:No") == 2){ mes "[Shadow Blacksmith]"; mes "I completely agree..."; mes "I might be a great refiner, but sometimes even I make mistakes."; close; } } if((countitem(.@material) <= 1) || (Zeny < .@price)) { mes "[Shadow Blacksmith]"; mes "You don't seem to have"; mes "enough Zeny or "+getitemname(.@material)+"..."; mes "Go get some more. I'll be"; mes "here all day if you need me."; close; } Zeny -= .@price; delitem .@material,1; //custom checks if(getequipisequiped(.@part) == 0) { // hacker has removed the item (not changed, why?) mes "[Shadow 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 "[Shadow Blacksmith]"; emotion E_FRET; 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; } if(getequippercentrefinery(.@part) <= rand(100)) { //failedrefitem .@part; mes "[Shadow Blacksmith]"; emotion (!rand(5))?ET_FRET:E_MONEY; .@lose = rand(1,3); if (.@lose == 1) { specialeffect 611; 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 == 2) { specialeffect 611; mes "Nooooooo!"; mes "It broke!"; mes "I-I'm sorry!"; } else { downrefitem .@part; specialeffect 155; mes "Crap!"; mes "It couldn't take"; mes "much more tempering!"; mes "Sorry about this..."; } close; } mes "[Shadow Blacksmith]"; successrefitem .@part; emotion E_HUK; .@win = rand(1,3); if (.@win == 1) { mes "Perfect!"; mes "Heh heh!"; mes "Once again,"; mes "flawless work"; mes "from the master~"; } else if(.@win == 2) { mes "Success...!"; mes "Yet again, my amazing"; mes "talent truly dazzles"; mes "and shines today."; } else { mes "Heh heh!"; mes "I'm all done."; mes "No doubt, my work is"; mes "to your satisfaction."; mes "Sheer, utter perfection~"; } close; }
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.