Jump to content
  • 0
Orc Lord

Help me edit my advanced_refiner script please?

Question

Complete Script:

http://pastebin.com/p7AH258F

Armor:

  • if refining +5 +6 +7 failed, not delete the armor
  • if refining +8 +9 +10 failed, refine -1 the armor

Weapon:

  • if refining +5 +6 +7 +8 failed, not delete the weapon
  • if refining +9 +10 failed, refine -1 the weapon

Edited by Orc Lord
Link to comment
Share on other sites

24 answers to this question

Recommended Posts

  • 0

The only thing I do not know, is whether or not you can retrieve the item attribute... I could not find a function for that.. so I left it at 0...

prt_in,281,138,5        script  Suhnbi#cash     85,{
       mes "[^ff0000Suhnbi^000000]";
       mes "I am the Armsmith";
       mes "I can refine all kinds of weapons,";
       mes "armor and equipment, so let me";
       mes "know what you want to refine.";
       next;

       setarray [email protected]$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
       set [email protected]$,"";
       for( set [email protected],1; [email protected] <= 10; set [email protected],[email protected]+1 )
       {
               if( getequipisequiped([email protected]) )
                       set [email protected]$, [email protected]$ + [email protected]$[[email protected]] + "-" + "[" + getequipname([email protected]) + "]";

               set [email protected]$, [email protected]$ + ":";
       }
       set [email protected],select([email protected]$);

       if( !getequipisequiped([email protected]) )
               close;

       if( !getequipisenableref([email protected]) )
       {
               mes "[^ff0000Suhnbi^000000]";
               mes "I don't think I can refine this item at all.";
               close;
       }
       if( !getequipisidentify([email protected]) )
       {
               mes "[^ff0000Suhnbi^000000]";
               mes "This has not been identified. So, it can't be refined...";
               close;
       }
       if( getequiprefinerycnt([email protected]) >= 10 )
       {
               mes "[^ff0000Suhnbi^000000]";
               mes "This item cannot be refined because it has already reached its maximum level...";
               close;
       }

       // Make sure you have the neccessary items and Zeny to refine your items
       // Determines chance of failure and verifies that you want to continue.
       switch( getequipweaponlv([email protected]) )
       {
               case 1: callsub S_RefineValidate,1,7620,50,[email protected]; break;
               case 2: callsub S_RefineValidate,2,7620,200,[email protected]; break;
               case 3: callsub S_RefineValidate,3,7620,5000,[email protected]; break;
               case 4: callsub S_RefineValidate,4,7620,20000,[email protected]; break;
               default: callsub S_RefineValidate,0,7619,2000,[email protected]; break;
       }

       if( getequippercentrefinery([email protected]) > rand(100) || getequippercentrefinery([email protected]) > rand(100) )
       {
               mes "[^ff0000Suhnbi^000000]";
               mes "Clink! Clank! Clunk!";
               SuccessRefItem [email protected];
               next;
               Emotion e_no1;
               mes "[^ff0000Suhnbi^000000]";
               mes "Here you are! It's done.";
               mes "It's been a while since I've made such a fine equipment. You must be happy because it has become stronger!";
               close;
       }
       else
       {

			// [Z3R0] - Added Item Check and Equipment Malfunctions

				// Armor Check & Safeguard from Deletion, -1 From Refine Count (Retain All Cards)
					if ([email protected] <= 2 && [email protected] >= 5) { // Armor Body Parts (Non Weapons)
						if (getequiprefinerycnt([email protected]) >= 7) { // Current Refine is 7 or Higher
							//FailedRefItem [email protected];

							// Do Not know if there is an attribute function to get attribute
							set [email protected][0] = getequipcardid([email protected], 0);
							set [email protected][1] = getequipcardid([email protected], 1);
							set [email protected][2] = getequipcardid([email protected], 2);
							set [email protected][3] = getequipcardid([email protected], 3);

							getitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]) - 1,0,[email protected][0],[email protected][1],[email protected][2],[email protected][3];
						}
					}

				// Weapon Check & Safeguard from Deletion, -1 From Deletion, -1 From Refine Count (Retain All Cards)
					if ([email protected] <= 4 && [email protected] >= 3) { // Weapons (Right and Left Hand)
						if (getequiprefinerycnt([email protected]) >= 8) { // Current Refine is 8 or Higher
							//FailedRefItem [email protected];

							// Do Not know if there is an attribute function to get attribute
							set [email protected][0] = getequipcardid([email protected], 0);
							set [email protected][1] = getequipcardid([email protected], 1);
							set [email protected][2] = getequipcardid([email protected], 2);
							set [email protected][3] = getequipcardid([email protected], 3);

							getitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]) - 1,0,[email protected][0],[email protected][1],[email protected][2],[email protected][3];
						}
					}					


               mes "[^ff0000Suhnbi^000000]";
               mes "Clink! Clank! Clunk!";
               //FailedRefItem [email protected];
               next;
               if (rand(5) == 1)
                       Emotion e_cash;
               else 
                       Emotion e_omg;
               mes "[^ff0000Suhnbi^000000]";
               mes "Cough!!!!";
               next;
               mes "[^ff0000Suhnbi^000000]";
               mes "Cough...Cough..";
               mes "What a shame...";
               mes "The refining process failed. I had told you earlier this might happen!";
               close;
       }

S_RefineValidate:
       mes "[^ff0000Suhnbi^000000]";
       if (getarg(0))
               mes "A level " + getarg(0) + " weapon...";
       mes "To refine this I need one ^ff9999" + getitemname(getarg(1)) + "^000000 and a service fee of " + getarg(2) + " Zeny.";
       mes "Do you wish to continue?";
       next;
       if( select("Yes:No") == 1 )
       {
               if( getequippercentrefinery(getarg(3)) < 100 )
               {
                       mes "[^ff0000Suhnbi^000000]";
                       mes "Wow!!";
                       mes "This weapon, probably";
                       mes "looks like it's been refined...";
                       mes "many times...";
                       mes "It may break if";
                       mes "you refine it again.";
                       next;
                       mes "[^ff0000Suhnbi^000000]";
                       mes "But don't worry this is a special case so i will only take the stone if it fails.";
                       mes " ";
                       mes "I think we have a fair trade do you still want to continue?";
                       next;
                       if( select("Yes:No") == 2 )
                       {
                               mes "[^ff0000Suhnbi^000000]";
                               mes "I completely agree...";
                               mes "I might be a great refiner, but sometimes even I make mistakes.";
                               close;
                       }
               }
               if( countitem(getarg(1)) > 0 && Zeny > getarg(2) )
               {
                       delitem getarg(1), 1;
                       set Zeny, Zeny - getarg(2);
                       return;
               }
               else
               {
                       mes "[^ff0000Suhnbi^000000]";
                       mes "You don't seem to have enough Zeny or " + getitemname(getarg(1)) + "...";
                       mes "Go get some more. I'll be here all day if you need me.";
                       close;
               }
       }
       else
       {
               mes "[^ff0000Suhnbi^000000]";
               mes "Yeah... There's no need to rush.";
               mes "Take your time.";
               close;
       }
}

Link to comment
Share on other sites

  • 0

try change all the '=' into comma sigh ( , )

i dont think in eAthena script...a '=' sign can be use to assign a srting / interger into a variable ??

should be like this

set [email protected][0] , getequipcardid([email protected], 0);
set [email protected][1] , getequipcardid([email protected], 1);
set [email protected][2] , getequipcardid([email protected], 2);
set [email protected][3] , getequipcardid([email protected], 3);

Link to comment
Share on other sites

  • 0

thank you Emistry.

I tried the script and the item didn't broke and the NPC gives me +7 weapon,

is it possible to just -1 the item?

Edited by Orc Lord
Link to comment
Share on other sites

  • 0

the only problem with the script is it's not deleting the item when broken, anyone knows how to delete it? thank you.

// [Z3R0] - Added Item Check and Equipment Malfunctions

 // Armor Check & Safeguard from Deletion, -1 From Refine Count (Retain All Cards)
  if ([email protected] <= 2 && [email protected] >= 5) { // Armor Body Parts (Non Weapons)
   if (getequiprefinerycnt([email protected]) >= 7) { // Current Refine is 7 or Higher
	//FailedRefItem [email protected];

	// Do Not know if there is an attribute function to get attribute
	set [email protected][0] = getequipcardid([email protected], 0);
	set [email protected][1] = getequipcardid([email protected], 1);
	set [email protected][2] = getequipcardid([email protected], 2);
	set [email protected][3] = getequipcardid([email protected], 3);

	getitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]) - 1,0,[email protected][0],[email protected][1],[email protected][2],[email protected][3];
   }
  }

 // Weapon Check & Safeguard from Deletion, -1 From Deletion, -1 From Refine Count (Retain All Cards)
  if ([email protected] <= 4 && [email protected] >= 3) { // Weapons (Right and Left Hand)
   if (getequiprefinerycnt([email protected]) >= 8) { // Current Refine is 8 or Higher
	//FailedRefItem [email protected];

	// Do Not know if there is an attribute function to get attribute
	set [email protected][0] = getequipcardid([email protected], 0);
	set [email protected][1] = getequipcardid([email protected], 1);
	set [email protected][2] = getequipcardid([email protected], 2);
	set [email protected][3] = getequipcardid([email protected], 3);

	getitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]) - 1,0,[email protected][0],[email protected][1],[email protected][2],[email protected][3];
   }
  }	

Link to comment
Share on other sites

  • 0

The problem you might have with deleting this specific item, is if they have more than 1 in their inventory that match it, you will need to use the same method I did

getitem2 getequipid(.@part),1,1,getequiprefinerycnt(.@part) - 1,0,.@card[0],.@card[1],.@card[2],.@card[3];

add the following line above it

delitem2 getequipid(.@part),1,1,getequiprefinerycnt(.@part) - 1,0,.@card[0],.@card[1],.@card[2],.@card[3];

Link to comment
Share on other sites

  • 0

the only problem with the script is it's not deleting the item when broken, anyone knows how to delete it? thank you.

I didnt changed anything in Z3R0's modification and couldnt test it..

		   	 // [Z3R0] - Added Item Check and Equipment Malfunctions

			// Armor Check & Safeguard from Deletion, -1 From Refine Count (Retain All Cards)
			if ([email protected] <= 2 && [email protected] >= 5) { // Armor Body Parts (Non Weapons)
				if (getequiprefinerycnt([email protected]) >= 7) { // Current Refine is 7 or Higher
					//FailedRefItem [email protected];

					// Do Not know if there is an attribute function to get attribute
					// [GodLesZ] Its possible.. fetch inventorylist, iterate them, compare all attributes and on match, you may access
					//			 @inventorylist_attribute
					set [email protected][0] = getequipcardid([email protected], 0);
					set [email protected][1] = getequipcardid([email protected], 1);
					set [email protected][2] = getequipcardid([email protected], 2);
					set [email protected][3] = getequipcardid([email protected], 3);

					///		<item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}
					delitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]),0,getequipcardid([email protected], 0),getequipcardid([email protected], 1),getequipcardid([email protected], 2),getequipcardid([email protected], 3);
					getitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]) - 1,0,getequipcardid([email protected], 0),getequipcardid([email protected], 1),getequipcardid([email protected], 2),getequipcardid([email protected], 3);
				}
			}

			// Weapon Check & Safeguard from Deletion, -1 From Deletion, -1 From Refine Count (Retain All Cards)
			if ([email protected] <= 4 && [email protected] >= 3) { // Weapons (Right and Left Hand)
				if (getequiprefinerycnt([email protected]) >= 8) { // Current Refine is 8 or Higher
					//FailedRefItem [email protected];

					// Do Not know if there is an attribute function to get attribute
					set [email protected][0] = getequipcardid([email protected], 0);
					set [email protected][1] = getequipcardid([email protected], 1);
					set [email protected][2] = getequipcardid([email protected], 2);
					set [email protected][3] = getequipcardid([email protected], 3);

					delitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]),0,getequipcardid([email protected], 0),getequipcardid([email protected], 1),getequipcardid([email protected], 2),getequipcardid([email protected], 3);
					getitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]) - 1,0,getequipcardid([email protected], 0),getequipcardid([email protected], 1),getequipcardid([email protected], 2),getequipcardid([email protected], 3);
				}
			}   

€dit:

delitem2 getequipid(.@part),1,1,getequiprefinerycnt(.@part) - 1,0,.@card[0],.@card[1],.@card[2],.@card[3];

Bad idea to delete refine -1 :)

Edited by GodLesZ
Link to comment
Share on other sites

  • 0

Why not just use the failedirefitem function for deleting the item equipped, then using getitem2 to bring it back? Personally i made my own refiner with custom rates which can be changed, and i used this method in there and it worked fine.

+Edit: Tested and it works fine, let me know if you get any errors!

prt_in,281,138,5		script  Suhnbi#cash	 85,{
	mes "[^ff0000Suhnbi^000000]";
	mes "I am the Armsmith";
	mes "I can refine all kinds of weapons,";
	mes "armor and equipment, so let me";
	mes "know what you want to refine.";
	next;

	setarray [email protected]$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
	set [email protected]$,"";
	for( set [email protected],1; [email protected] <= 10; set [email protected],[email protected]+1 )
	{
			if( getequipisequiped([email protected]) )
					set [email protected]$, [email protected]$ + [email protected]$[[email protected]] + "-" + "[" + getequipname([email protected]) + "]";

			set [email protected]$, [email protected]$ + ":";
	}
	set [email protected],select([email protected]$);

	if( !getequipisequiped([email protected]) )
			close;

	if( !getequipisenableref([email protected]) )
	{
			mes "[^ff0000Suhnbi^000000]";
			mes "I don't think I can refine this item at all.";
			close;
	}
	if( !getequipisidentify([email protected]) )
	{
			mes "[^ff0000Suhnbi^000000]";
			mes "This has not been identified. So, it can't be refined...";
			close;
	}
	if( getequiprefinerycnt([email protected]) >= 10 )
	{
			mes "[^ff0000Suhnbi^000000]";
			mes "This item cannot be refined because it has already reached its maximum level...";
			close;
	}

	// Make sure you have the neccessary items and Zeny to refine your items
	// Determines chance of failure and verifies that you want to continue.
	switch( getequipweaponlv([email protected]) )
	{
			case 1: callsub S_RefineValidate,1,7620,50,[email protected]; break;
			case 2: callsub S_RefineValidate,2,7620,200,[email protected]; break;
			case 3: callsub S_RefineValidate,3,7620,5000,[email protected]; break;
			case 4: callsub S_RefineValidate,4,7620,20000,[email protected]; break;
			default: callsub S_RefineValidate,0,7619,2000,[email protected]; break;
	}

	if( getequippercentrefinery([email protected]) > rand(100) || getequippercentrefinery([email protected]) > rand(100) )
	{
			mes "[^ff0000Suhnbi^000000]";
			mes "Clink! Clank! Clunk!";
			SuccessRefItem [email protected];
			next;
			Emotion e_no1;
			mes "[^ff0000Suhnbi^000000]";
			mes "Here you are! It's done.";
			mes "It's been a while since I've made such a fine equipment. You must be happy because it has become stronger!";
			close;
	}
	else
	{

// [Z3R0] - Added Item Check and Equipment Malfunctions

// Armor Check & Safeguard from Deletion, -1 From Refine Count (Retain All Cards)
if ([email protected] <= 2 && [email protected] >= 5) { // Armor Body Parts (Non Weapons)
if (getequiprefinerycnt([email protected]) >= 7) { // Current Refine is 7 or Higher
//FailedRefItem [email protected];

// Do Not know if there is an attribute function to get attribute
set [email protected][0], getequipcardid([email protected], 0);
set [email protected][1], getequipcardid([email protected], 1);
set [email protected][2], getequipcardid([email protected], 2);
set [email protected][3], getequipcardid([email protected], 3);
getitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]) - 1,0,[email protected][0],[email protected][1],[email protected][2],[email protected][3];
failedrefitem [email protected];
}
}

// Weapon Check & Safeguard from Deletion, -1 From Deletion, -1 From Refine Count (Retain All Cards)
if ([email protected] <= 4 && [email protected] >= 3) { // Weapons (Right and Left Hand)
if (getequiprefinerycnt([email protected]) >= 8) { // Current Refine is 8 or Higher
//FailedRefItem [email protected];

// Do Not know if there is an attribute function to get attribute
set [email protected][0], getequipcardid([email protected], 0);
set [email protected][1], getequipcardid([email protected], 1);
set [email protected][2], getequipcardid([email protected], 2);
set [email protected][3], getequipcardid([email protected], 3);
getitem2 getequipid([email protected]),1,1,getequiprefinerycnt([email protected]) - 1,0,[email protected][0],[email protected][1],[email protected][2],[email protected][3];
failedrefitem [email protected];
}
}


			mes "[^ff0000Suhnbi^000000]";
			mes "Clink! Clank! Clunk!";
			//FailedRefItem [email protected];
			next;
			if (rand(5) == 1)
					Emotion e_cash;
			else
					Emotion e_omg;
			mes "[^ff0000Suhnbi^000000]";
			mes "Cough!!!!";
			next;
			mes "[^ff0000Suhnbi^000000]";
			mes "Cough...Cough..";
			mes "What a shame...";
			mes "The refining process failed. I had told you earlier this might happen!";
			close;
	}

S_RefineValidate:
	mes "[^ff0000Suhnbi^000000]";
	if (getarg(0))
			mes "A level " + getarg(0) + " weapon...";
	mes "To refine this I need one ^ff9999" + getitemname(getarg(1)) + "^000000 and a service fee of " + getarg(2) + " Zeny.";
	mes "Do you wish to continue?";
	next;
	if( select("Yes:No") == 1 )
	{
			if( getequippercentrefinery(getarg(3)) < 100 )
			{
					mes "[^ff0000Suhnbi^000000]";
					mes "Wow!!";
					mes "This weapon, probably";
					mes "looks like it's been refined...";
					mes "many times...";
					mes "It may break if";
					mes "you refine it again.";
					next;
					mes "[^ff0000Suhnbi^000000]";
					mes "But don't worry this is a special case so i will only take the stone if it fails.";
					mes " ";
					mes "I think we have a fair trade do you still want to continue?";
					next;
					if( select("Yes:No") == 2 )
					{
							mes "[^ff0000Suhnbi^000000]";
							mes "I completely agree...";
							mes "I might be a great refiner, but sometimes even I make mistakes.";
							close;
					}
			}
			if( countitem(getarg(1)) > 0 && Zeny > getarg(2) )
			{
					delitem getarg(1), 1;
					set Zeny, Zeny - getarg(2);
					return;
			}
			else
			{
					mes "[^ff0000Suhnbi^000000]";
					mes "You don't seem to have enough Zeny or " + getitemname(getarg(1)) + "...";
					mes "Go get some more. I'll be here all day if you need me.";
					close;
			}
	}
	else
	{
			mes "[^ff0000Suhnbi^000000]";
			mes "Yeah... There's no need to rush.";
			mes "Take your time.";
			close;
	}
}

Edited by Truly
  • Upvote 1
Link to comment
Share on other sites

  • 0

When refining a weapon it's okay but this is not working on armor:

if refining +5 +6 +7 failed, not delete the armor
if refining +8 +9 +10 failed, refine -1 the armor

Link to comment
Share on other sites

  • 0

if (getequiprefinerycnt([email protected]) >= 7) { // Current Refine is 7 or Higher

This line will check for the armor being at least 7, or higher, and if so it will continue. Else, it will not destroy the item. Have you tested the latest script that i just posted, and if it doesn't work, explain in detail what is not working o:

"I click on refine cotton shirts, and when it is refining 6 to 7, it fails and removes!"

or

"When i refine from 8 to 9, if i fail, it doesn't delete the armor!"

Link to comment
Share on other sites

  • 0

When i refine +8 armor and fail i want the armor to remove 1 refine

example:

+8 coat refining to +9

if fail, my +8 coat will be +7 coat

+9 coat refining to +10

if fail, my +9 coat will be +8 coat

Edited by Orc Lord
Link to comment
Share on other sites

  • 0

When i refine +8 armor and fail i want the armor to remove 1 refine

example:

+8 coat refining to +9

if fail, my +8 coat will be +7 coat

+9 coat refining to +10

if fail, my +9 coat will be +8 coat

So when you test this in game,

does it not remove the refine? or

does it just delete the item completely? or

does it do something else?

These questions will pinpoint where the error in the script is. The getitem2 is set to return the item exactly like the weapons do, so i dont think that is the problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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