Jump to content
  • 0

Help me edit my advanced_refiner script please?


Question

24 answers to this question

Recommended Posts

  • 0
Posted

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 .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
       set .@menu$,"";
       for( set .@i,1; .@i <= 10; set .@i,.@i+1 )
       {
               if( getequipisequiped(.@i) )
                       set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";

               set .@menu$, .@menu$ + ":";
       }
       set .@part,select(.@menu$);

       if( !getequipisequiped(.@part) )
               close;

       if( !getequipisenableref(.@part) )
       {
               mes "[^ff0000Suhnbi^000000]";
               mes "I don't think I can refine this item at all.";
               close;
       }
       if( !getequipisidentify(.@part) )
       {
               mes "[^ff0000Suhnbi^000000]";
               mes "This has not been identified. So, it can't be refined...";
               close;
       }
       if( getequiprefinerycnt(.@part) >= 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(.@part) )
       {
               case 1: callsub S_RefineValidate,1,7620,50,.@part; break;
               case 2: callsub S_RefineValidate,2,7620,200,.@part; break;
               case 3: callsub S_RefineValidate,3,7620,5000,.@part; break;
               case 4: callsub S_RefineValidate,4,7620,20000,.@part; break;
               default: callsub S_RefineValidate,0,7619,2000,.@part; break;
       }

       if( getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100) )
       {
               mes "[^ff0000Suhnbi^000000]";
               mes "Clink! Clank! Clunk!";
               SuccessRefItem .@part;
               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 (.@part <= 2 && .@part >= 5) { // Armor Body Parts (Non Weapons)
						if (getequiprefinerycnt(.@part) >= 7) { // Current Refine is 7 or Higher
							//FailedRefItem .@part;

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

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

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

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

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


               mes "[^ff0000Suhnbi^000000]";
               mes "Clink! Clank! Clunk!";
               //FailedRefItem .@part;
               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;
       }
}

  • 0
Posted

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 .@card[0] , getequipcardid(.@part, 0);
set .@card[1] , getequipcardid(.@part, 1);
set .@card[2] , getequipcardid(.@part, 2);
set .@card[3] , getequipcardid(.@part, 3);

  • 0
Posted (edited)

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
  • 0
Posted

Sorry, that was my bad, I didn't include the delitem or delitem2 lolz...

Also, sorry, I'm working on a php project, got languages blended together :S

  • 0
Posted

Moving this post to Scripting Support

Reasons:

  • Script was already established Prior to Requesting Help
  • No one has requested support lately :)

  • 0
Posted

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 (.@part <= 2 && .@part >= 5) { // Armor Body Parts (Non Weapons)
   if (getequiprefinerycnt(.@part) >= 7) { // Current Refine is 7 or Higher
	//FailedRefItem .@part;

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

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

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

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

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

  • 0
Posted

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];

  • 0
Posted (edited)

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 (.@part <= 2 && .@part >= 5) { // Armor Body Parts (Non Weapons)
				if (getequiprefinerycnt(.@part) >= 7) { // Current Refine is 7 or Higher
					//FailedRefItem .@part;

					// 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 .@card[0] = getequipcardid(.@part, 0);
					set .@card[1] = getequipcardid(.@part, 1);
					set .@card[2] = getequipcardid(.@part, 2);
					set .@card[3] = getequipcardid(.@part, 3);

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

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

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

					delitem2 getequipid(.@part),1,1,getequiprefinerycnt(.@part),0,getequipcardid(.@part, 0),getequipcardid(.@part, 1),getequipcardid(.@part, 2),getequipcardid(.@part, 3);
					getitem2 getequipid(.@part),1,1,getequiprefinerycnt(.@part) - 1,0,getequipcardid(.@part, 0),getequipcardid(.@part, 1),getequipcardid(.@part, 2),getequipcardid(.@part, 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
  • 0
Posted (edited)

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 .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
	set .@menu$,"";
	for( set .@i,1; .@i <= 10; set .@i,.@i+1 )
	{
			if( getequipisequiped(.@i) )
					set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";

			set .@menu$, .@menu$ + ":";
	}
	set .@part,select(.@menu$);

	if( !getequipisequiped(.@part) )
			close;

	if( !getequipisenableref(.@part) )
	{
			mes "[^ff0000Suhnbi^000000]";
			mes "I don't think I can refine this item at all.";
			close;
	}
	if( !getequipisidentify(.@part) )
	{
			mes "[^ff0000Suhnbi^000000]";
			mes "This has not been identified. So, it can't be refined...";
			close;
	}
	if( getequiprefinerycnt(.@part) >= 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(.@part) )
	{
			case 1: callsub S_RefineValidate,1,7620,50,.@part; break;
			case 2: callsub S_RefineValidate,2,7620,200,.@part; break;
			case 3: callsub S_RefineValidate,3,7620,5000,.@part; break;
			case 4: callsub S_RefineValidate,4,7620,20000,.@part; break;
			default: callsub S_RefineValidate,0,7619,2000,.@part; break;
	}

	if( getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100) )
	{
			mes "[^ff0000Suhnbi^000000]";
			mes "Clink! Clank! Clunk!";
			SuccessRefItem .@part;
			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 (.@part <= 2 && .@part >= 5) { // Armor Body Parts (Non Weapons)
if (getequiprefinerycnt(.@part) >= 7) { // Current Refine is 7 or Higher
//FailedRefItem .@part;

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

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

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


			mes "[^ff0000Suhnbi^000000]";
			mes "Clink! Clank! Clunk!";
			//FailedRefItem .@part;
			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
  • 0
Posted

if (getequiprefinerycnt(.@part) >= 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!"

  • 0
Posted (edited)

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
  • 0
Posted

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.

  • 0
Posted

Alright i think i found it, change this line:

if (.@part <= 2 && .@part >= 5) { // Armor Body Parts (Non Weapons)

to

if (.@part <= 2 || .@part >= 5) { // Armor Body Parts (Non Weapons)

  • 0
Posted

ah yes, sorry about that, I ended up going a different route in the middle of the script, and forgot to change that to an OR ( || ) and not AND ( && ) Nice find

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...