Jump to content
  • 0

I have script NPC Refine 100% +1 to max with item event item.


Question

Posted (edited)

Hello! Is me LongLong /ok

I have write (and copy) a script NPC Refine 100% +1 to +10 with item Ticket and .

Here is this:

prt_in,58,55,5 script Blacksmith 63,{

OnUsed:
set .EquipCheck,1; // Check Equips is refineable or not. [ 0 = Disable / 1 = Enable ]
set .@TicketID,503; // Ticket ID
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";
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)) {
mes "[blacksmith]";
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 "[blacksmith]";
mes "I don't think I can";
mes "refine this item at all...";
close;
}
//Check if the item is identified... (Don't know why this is in here... but kept it anyway)
if(!getequipisidentify(.@part)) {
mes "[blacksmith]";
mes "You can't refine this";
mes "if you haven't appraised";
mes "it first. Make sure your";
mes "stuff is identified before";
mes "I can refine it.";
close;
}
//Check to see if the items is already +10
if(getequiprefinerycnt(.@part) >= 10) {
mes "[blacksmith]";
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 .@refinerycnt, getequiprefinerycnt(.@part); //save refinery count
switch(getequipweaponlv(.@part)){
case 0:  //Refine Armor
set .@price,2000;
set .@material,985;
set .@safe,4;
break;
case 1:  //Refine Level 1 Weapon
set .@price,50;
set .@material,1010;
set .@safe,7;
break;
case 2:  //Refine Level 2 Weapon
set .@price,200;
set .@material,1011;
set .@safe,6;
break;
case 3:  //Refine Level 3 Weapon
set .@price,5000;
set .@material,984;
set .@safe,5;
break;
case 4:  //Refine Level 4 Weapon
set .@price,20000;
set .@material,984;
set .@safe,4;
break;
case 5:  //Refine other stuff?
set .@price,2000;
set .@material,985;
set .@safe,4;
break;
}
if(.@features != 1) {
mes "[blacksmith]";
mes "To refine this I need";
mes "one ^FF0000"+getitemname(.@material)+"^000000, one ^0000ff"+getitemname(.@TicketID)+"^000000";
mes "and a service fee of ^0000ff" + .@price + " 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) {
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]";
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) < 1) || (countitem(.@TicketID) < 1) || (Zeny < .@price)) {
mes "[blacksmith]";
mes "You don't seem to have";
mes "enough ^0000ffZeny^000000, ^FF0000"+getitemname(.@material)+"^000000 or ^0000ff"+getitemname(.@TicketID)+"^000000...";
mes "Go get some more. I'll be";
mes "here all day if you need me.";
close;}
else {
mes "[blacksmith]";
successrefitem .@part;
set Zeny,Zeny-.@price;
delitem .@material,1;
if(getequippercentrefinery(.@part) < 100) {
delitem .@TicketID,1;
message strcharinfo(0),"The Equipments has been refined, Ticket will also be removed from your inventory.";}
Emotion e_heh;
set .@win,rand(1,3);
if (.@win == 1) {
mes "[blacksmith]";
mes "Perfect!";
mes "Heh heh!";
mes "Once again,";
mes "flawless work";
mes "from the master~";
} else if(.@win == 2) {
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;}
	}
	}	 

But i want equip refine have rate Success. if refine fail but u have Ticket item become to safe.

Eg: U have Weapon Lv 4 +4 => Refine if Success ok. => Got Weapon Lv 4 +5

Now u have Weapon Lv 4 +7 => Refine fail and u have Ticket => Got Weapon Lv 4 +4.

And if have multi Ticket with difference Special effects. Safe +7, safe +10, Safe +4, safe +0.

And what about "lucky charm" have 4 lucky charm: + 10%, +15%, +20%, +25%.

With Lucky Charm Success rate be come = rate refine_db + lucky charm = Success to refine equip.

Thank for read my topic. My ideas may be hard but i think we can do it. Thank again.

Blacksmith v1.0.txt

Edited by AnnieRuru
use [codebox] if the script > 10 lines

3 answers to this question

Recommended Posts

Posted

Here for you

prt_in,58,55,5    script    Blacksmithnhgfds    63,{

//- Price per refine / per equipment -- Refine Armor / weapon lvl 1... lvl 4 / other ?
   setarray .@price[0],    2000,    50,        200,    5000,    20000,    2000;
//- ID material per equipment -- phracons ...
   setarray .@material[0],    985,    1010,    1011,    984,    984,    985;
//- Safe limit per equipment
   setarray .@safe[0],        4,        7,        6,        5,        4,        4;
   //-- 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], 0,        0;
   //- + % Success rate of Lucky Charm
   setarray .@Lcef[0], 10,        15;
//-

   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 if the item is identified... (Don't know why this is in here... but kept it anyway)
   if( !getequipisidentify(.@part) ) {
       mes "You can't refine this";
       mes "if you haven't appraised";
       mes "it first. Make sure your";
       mes "stuff is identified before";
       mes "I can refine it.";
       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;
}

Contents :

But i want equip refine have rate Success. if refine fail but u have Ticket item become to safe.

Eg: U have Weapon Lv 4 +4 => Refine if Success ok. => Got Weapon Lv 4 +5

Now u have Weapon Lv 4 +7 => Refine fail and u have Ticket => Got Weapon Lv 4 +4.

Configuration ticket

   //-- ID Ticket 100% -- 0 = disabled
   set .@TicketID, 7608;

And what about "lucky charm" have 4 lucky charm: + 10%, +15%, +20%, +25%.

With Lucky Charm Success rate be come = rate refine_db + lucky charm = Success to refine equip.

Configuration Lucky Charms :

   //-- Lucky Charm -- complete it as your content
   //- ID Lucky Charm -- ID 0 or comment = disabled option
   setarray .@Lcid[0], 0,        0;
   //- + % Success rate of Lucky Charm
   setarray .@Lcef[0], 10,        15;

It works with rathena only. Maybe it's not full optimized... if you have comment post it.

  • Upvote 1

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...