Aegis Support Board: Slot enchant - Aegis Support Board

Jump to content

ASB News! ASB 5.0 Beta V2 has now been released!. See here for more Info.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Slot enchant

#1 User is offline   Kasuha 

  • Average Member
  • PipPipPipPip
  • Group: Members
  • Posts: 195
  • Joined: 08-February 05

Posted 01 November 2006 - 12:30 PM

Here's my custom version of slot enchant NPC that was introduced to kRO servers a while ago. It works as described on Doddler's page but all the dialogs and equipment selection is completely made up by me. As I know Gravity's love in copy/paste operations, I bet this script is actually much shorter than the original one.

You must also add all new items to your script database and, to the itemdata/special.sc and of course to your client. I recommend to do it by just copying appropriate entries and editing the result. Note that Doddler's page also lists some additional changes in equipment's attributes (except of acquiring additional slots). New item IDs follow:

1726 Hunter_Bow_ Hunter Bow [1]
1149 Flamberge__ Flamberge [2]
1727 Ballista_ Ballista [1]
1532 Stunner__ Stunner [2]
1816 Berserk_ Berserk [1]
1172 Claymore_ Claymore [2]
1266 Infiltrator_ Infiltrator [1]
1171 Zweihander_ Zweihander [2]
1418 Gungnir__ Gungnir [2]
13016 Poison_Knife__ Poison Knife [2]
13018 Sucsamad_ Sucsamad [1]
13019 Ginnungagap_ Ginnungagap [1]
13400 Cutlas_ Cutlus [1]
1476 Crescent_Scythe_ Crescent Scythe [1]
13017 House_Auger_ Ice pick [1]
5168 Bongun_hat_ Bongun Hat [1]
5167 Munak_Turban_ Munak Hat [1]
2121 Memorize_Book_ Memory Book [1]
2359 Ninja_Suit_ Ninja Suit [1]
5157 Viking_Helm_ Orc Helm [1]
2525 Cape_Of_Ancient_Lord_ Ancient Cape [1]
5158 Holy_Bonnet_ Monk Hat [1]
5159 Golden_Gear_ Golden Gear [1]
5166 Sphinx_Helm_ Sphinx Hat [1]
2360 Robe_of_Casting_ Robe of Cast [1]
2671 Thimble_Of_Archer_ Bow Thimble [1]
5160 Magestic_Goat_ Majestic Goat [1]
5161 Sharp_Gear_ Spiky Band [1]
5162 Bone_Helm_ Bone Helm [1]
5163 Corsair_ Corsair [1]
5165 Crown_ Crown [1]
5164 Tiara_ Tiara [1]

Here are the NPC locations (taken from eAthena due to lack of better sources):

npc "lhz_in02" "Enchanter" 4_M_02 281 35 5 0 0

npc "prt_in" "Enchanter" 4_M_02 33 70 3 0 0

npc "payon" "Enchanter" 4_M_02 140 151 5 0 0

npc "morocc" "Enchanter" 4_M_02 51 41 7 0 0


Here's the NPC code (common to all enchanters):
OnClick:
 var itemname = ""
 var itemid = 0
 var newitemid = 0
 var chance = 0
 var phracon_cnt = 0
 var oridecon_cnt = 0
 var steel_cnt = 0
 var elunium_cnt = 0
 var price = 0
 var hasslots = 0
 var back
 var menu1
 var menu2
 var menu3
 var menu4
 dialog "[Enchanter]"
 dialog "I am the master of smiths and I can add slots to some weapons or armors if you bring them to me and pay the price."
 dialog "What would you like to do?"
 wait
 while (itemid == 0)
  back = "Back"
  menu1 = "Weapon"
  menu2 = "Armor"
  menu3 = "Nothing"
  choose menu menu1 menu2 menu3
  case 1
   while (itemid == 0)
	menu1 = "Weapon C Rank"
	menu2 = "Weapon B Rank"
	menu3 = "Weapon A Rank"
	menu4 = "Weapon S Rank"
	choose menu menu1 menu2 menu3 menu4 back
	case 1
	 chance = 2
	 phracon_cnt = 10
	 oridecon_cnt = 0
	 steel_cnt = 0
	 elunium_cnt = 0
	 price = 200000
	 hasslots = 1
	 choose menu "Trident" "Rope" "Violin" back
	 case 1
	  itemname = "Trident"
	  itemid = Trident
	  newitemid = Trident_
	  break
	 case 2
	  itemname = "Rope"
	  itemid = Rope
	  newitemid = Rope_
	  break
	 case 3
	  itemname = "Violin"
	  itemid = Violin
	  newitemid = Violin_
	  break
	 case 4
	  break
	 endchoose
	 break
	case 2
	 chance = 4
	 phracon_cnt = 0
	 oridecon_cnt = 2
	 steel_cnt = 5
	 elunium_cnt = 0
	 price = 300000
	 hasslots = 1
	 choose menu "Chain" "Gladius" "Gakkung Bow" "Pike" "Haedonggum" "Lute" "Wire Whip" "Waghnakh" "Arbalest" back
	 case 1
	  itemname = "Chain"
	  itemid = Chain
	  newitemid = Chain_
	  break
	 case 2
	  itemname = "Gladius"
	  itemid = Gladius
	  newitemid = Gladius_
	  break
	 case 3
	  itemname = "Gakkung Bow"
	  itemid = Kakkung
	  newitemid = Kakkung_
	  break
	 case 4
	  itemname = "Pike"
	  itemid = Pike
	  newitemid = Pike_
	  break
	 case 5
	  itemname = "Haedonggum"
	  itemid = Haedonggum
	  newitemid = Hae_Dong_Gum_
	  break
	 case 6
	  itemname = "Lute"
	  itemid = Lute
	  newitemid = Lute_
	  break
	 case 7
	  itemname = "Wire Whip"
	  itemid = Wire
	  newitemid = Wire_
	  break
	 case 8
	  itemname = "Waghnakh"
	  itemid = Waghnakh
	  newitemid = Waghnakh_
	  break
	 case 9
	  itemname = "Arbalest"
	  itemid = Arbalest
	  newitemid = Arbalest_
	  break
	 case 10
	  break
	 endchoose
	 break
	case 3
	 chance = 8
	 phracon_cnt = 0
	 oridecon_cnt = 2
	 steel_cnt = 10
	 elunium_cnt = 0
	 price = 500000
	 hasslots = 0
	 choose menu "Hunter Bow" "(Int) Survivor's Rod" "Flamberge" "Ballista" "Stunner" "Berserk" "Claymore" "Infiltrator" "Zweihander" back
	 case 1
	  itemname = "Hunter Bow"
	  itemid = Hunter_Bow
	  newitemid = Hunter_Bow_
	  break
	 case 2
	  itemname = "(Int) Survivor's Rod"
	  itemid = Wand_of_Survival__
	  newitemid = Wand_of_Survival___
	  break
	 case 3
	  itemname = "Flamberge"
	  itemid = Flamberge
	  newitemid = Flamberge__
	  break
	 case 4
	  itemname = "Ballista"
	  itemid = Ballista
	  newitemid = Ballista_
	  break
	 case 5
	  itemname = "Stunner"
	  itemid = Stunner
	  newitemid = Stunner__
	  break
	 case 6
	  itemname = "Berserk"
	  itemid = Berserk
	  newitemid = Berserk_
	  break
	 case 7
	  itemname = "Claymore"
	  itemid = Claymore
	  newitemid = Claymore_
	  break
	 case 8
	  itemname = "Infiltrator"
	  itemid = Infiltrator
	  newitemid = Infiltrator_
	  price = 700000
	  break
	 case 9
	  itemname = "Zweihander"
	  itemid = Zweihander
	  newitemid = Zweihander_
	  price = 800000
	  break
	 case 10
	  break
	 endchoose
	 break
	case 4
	 chance = 16
	 phracon_cnt = 0
	 oridecon_cnt = 5
	 steel_cnt = 10
	 elunium_cnt = 0
	 price = 1000000
	 hasslots = 0
	 choose menu "Gungnir" "Poison Knife" "Sucsamad" "Ginnungagap" "Cutlus" "Crescent Scythe" "Ice Pick" "(Dex) Survivor's Rod" back
	 case 1
	  itemname = "Gungnir"
	  itemid = Gungnir
	  newitemid = Gungnir__
	  break
	 case 2
	  itemname = "Poison Knife"
	  itemid = Poison_Knife
	  newitemid = Poison_Knife__
	  break
	 case 3
	  itemname = "Sucsamad"
	  itemid = Sucsamad
	  newitemid = Sucsamad_
	  break
	 case 4
	  itemname = "Ginnungagap"
	  itemid = Ginnungagap
	  newitemid = Ginnungagap_
	  break
	 case 5
	  itemname = "Cutlus"
	  itemid = Cutlas
	  newitemid = Cutlas_
	  break
	 case 6
	  itemname = "Crescent Scythe"
	  itemid = Crescent_Scythe
	  newitemid = Crescent_Scythe_
	  break
	 case 7
	  itemname = "Ice Pick"
	  itemid = House_Auger
	  newitemid = House_Auger_
	  price = 2000000
	  break
	 case 8
	  itemname = "(Dex) Survivor's Rod"
	  itemid = Wand_of_Survival
	  newitemid = Wand_of_Survival_
	  price = 2000000
	  break
	 case 9
	  break
	 endchoose
	 break
	case 5
	 exitwhile
	endchoose
   endwhile
   break
  case 2
   while (itemid == 0)
	menu1 = "Armor C Rank"
	menu2 = "Armor B Rank"
	menu3 = "Armor A Rank"
	menu4 = "Armor S Rank"
	choose menu menu1 menu2 menu3 menu4 back
	case 1
	 chance = 2
	 phracon_cnt = 0
	 oridecon_cnt = 0
	 steel_cnt = 3
	 elunium_cnt = 0
	 price = 200000
	 hasslots = 0
	 choose menu "Mantle" "Coat" "Circlet" "Biretta" back
	 case 1
	  itemname = "Mantle"
	  itemid = Mantle
	  newitemid = Mantle_
	  break
	 case 2
	  itemname = "Coat"
	  itemid = Coat
	  newitemid = Coat_
	  break
	 case 3
	  itemname = "Circlet"
	  itemid = Circlet
	  newitemid = Circlet_
	  break
	 case 4
	  itemname = "Biretta"
	  itemid = Biretta
	  newitemid = Biretta_
	  break
	 case 5
	  break
	 endchoose
	 break
	case 2
	 chance = 4
	 phracon_cnt = 0
	 oridecon_cnt = 0
	 steel_cnt = 5
	 elunium_cnt = 0
	 price = 300000
	 hasslots = 0
	 choose menu "Mirror Shield" "Chain Mail" "Shield" "Bongun Hat" "Saint's Robe" "Silk Robe" "Boots" "Shoes" "Muffler" "Guard" "Buckler" back
	 case 1
	  itemname = "Mirror Shield"
	  itemid = Mirror_Shield
	  newitemid = Mirror_Shield_
	  price = 250000
	  break
	 case 2
	  itemname = "Chain Mail"
	  itemid = Chain_Mail
	  newitemid = Chain_Mail_
	  price = 250000
	  break
	 case 3
	  itemname = "Shield"
	  itemid = Shield
	  newitemid = Shield_
	  price = 250000
	  break
	 case 4
	  itemname = "Bongun Hat"
	  itemid = Bongun_hat
	  newitemid = Bongun_hat_
	  price = 250000
	  break
	 case 5
	  itemname = "Saint's Robe"
	  itemid = Saint_Robe
	  newitemid = Saint_Robe_
	  break
	 case 6
	  itemname = "Silk Robe"
	  itemid = Silk_Robe
	  newitemid = Silk_Robe_
	  break
	 case 7
	  itemname = "Boots"
	  itemid = Boots
	  newitemid = Boots_
	  break
	 case 8
	  itemname = "Shoes"
	  itemid = Shoes
	  newitemid = Shoes_
	  break
	 case 9
	  itemname = "Muffler"
	  itemid = Muffler
	  newitemid = Muffler_
	  break
	 case 10
	  itemname = "Guard"
	  itemid = Guard
	  newitemid = Guard_
	  break
	 case 11
	  itemname = "Buckler"
	  itemid = Buckler
	  newitemid = Buckler_
	  break
	 case 12
	  break
	 endchoose
	 break
	case 3
	 chance = 8
	 phracon_cnt = 0
	 oridecon_cnt = 0
	 steel_cnt = 0
	 elunium_cnt = 1
	 price = 400000
	 hasslots = 0
	 choose menu "Munak Hat" "Gemmed Sallet" "Bucket Hat" "Memory Book" "Tights" "Legion Plate Armor" "Full Plate" "Thief Clothes" "Greaves" "Coif" "Manteau" "Helm" "Ninja Suit" "Orc Helm" "Ancient Cape" "Monk Hat" "Golden Gear" "Brooch" back
	 case 1
	  itemname = "Munak Hat"
	  itemid = Munak_Turban
	  newitemid = Munak_Turban_
	  price = 300000
	  break
	 case 2
	  itemname = "Gemmed Sallet"
	  itemid = Gemmed_Sallet
	  newitemid = Gemmed_Sallet_
	  break
	 case 3
	  itemname = "Bucket Hat"
	  itemid = Soldier's_Felt_Hat
	  newitemid = Soldier's_Felt_Hat_
	  break
	 case 4
	  itemname = "Memory Book"
	  itemid = Memorize_Book
	  newitemid = Memorize_Book_
	  break
	 case 5
	  itemname = "Tights"
	  itemid = Tights
	  newitemid = Tights_
	  break
	 case 6
	  itemname = "Legion Plate Armor"
	  itemid = Full_Plate_Armor
	  newitemid = Full_Plate_Armor_
	  break
	 case 7
	  itemname = "Full Plate"
	  itemid = Plate_Armor
	  newitemid = Plate_Armor_
	  break
	 case 8
	  itemname = "Thief Clothes"
	  itemid = Thief_Clothes
	  newitemid = Thief_Clothes_
	  break
	 case 9
	  itemname = "Greaves"
	  itemid = Greaves
	  newitemid = Greaves_
	  break
	 case 10
	  itemname = "Coif"
	  itemid = Nun_Hat
	  newitemid = Nun_Hat_
	  break
	 case 11
	  itemname = "Manteau"
	  itemid = Manteau
	  newitemid = Manteau_
	  break
	 case 12
	  itemname = "Helm"
	  itemid = Helm
	  newitemid = Helm_
	  break
	 case 13
	  itemname = "Ninja Suit"
	  itemid = Ninja_Suit
	  newitemid = Ninja_Suit_
	  break
	 case 14
	  itemname = "Orc Helm"
	  itemid = Viking_Helm
	  newitemid = Viking_Helm_
	  break
	 case 15
	  itemname = "Ancient Cape"
	  itemid = Cape_Of_Ancient_Lord
	  newitemid = Cape_Of_Ancient_Lord_
	  break
	 case 16
	  itemname = "Monk Hat"
	  itemid = Holy_Bonnet
	  newitemid = Holy_Bonnet_
	  break
	 case 17
	  itemname = "Golden Gear"
	  itemid = Golden_Gear
	  newitemid = Golden_Gear_
	  break
	 case 18
	  itemname = "Brooch"
	  itemid = Brooch
	  newitemid = Brooch_
	  break
	 case 19
	  break
	 endchoose
	 break
	case 4
	 chance = 16
	 phracon_cnt = 0
	 oridecon_cnt = 0
	 steel_cnt = 0
	 elunium_cnt = 2
	 price = 2000000
	 hasslots = 0
	 choose menu "Sphinx Hat" "Robe of Cast" "Earring" "Ring" "Bow Thimble" "Majestic Goat" "Spiky Band" "Bone Helm" "Corsair" "Crown" "Tiara" back
	 case 1
	  itemname = "Sphinx Hat"
	  itemid = Sphinx_Helm
	  newitemid = Sphinx_Helm_
	  price = 1000000
	  break
	 case 2
	  itemname = "Robe of Cast"
	  itemid = Robe_of_Casting
	  newitemid = Robe_of_Casting_
	  price = 1000000
	  break
	 case 3
	  itemname = "Earring"
	  itemid = Earring
	  newitemid = Earring_
	  price = 1000000
	  break
	 case 4
	  itemname = "Ring"
	  itemid = Ring
	  newitemid = Ring_
	  price = 1000000
	  break
	 case 5
	  itemname = "Bow Thimble"
	  itemid = Thimble_Of_Archer
	  newitemid = Thimble_Of_Archer_
	  price = 1000000
	  break
	 case 6
	  itemname = "Majestic Goat"
	  itemid = Magestic_Goat
	  newitemid = Magestic_Goat_
	  break
	 case 7
	  itemname = "Spiky Band"
	  itemid = Sharp_Gear
	  newitemid = Sharp_Gear_
	  break
	 case 8
	  itemname = "Bone Helm"
	  itemid = Bone_Helm
	  newitemid = Bone_Helm_
	  break
	 case 9
	  itemname = "Corsair"
	  itemid = Corsair
	  newitemid = Corsair_
	  break
	 case 10
	  itemname = "Crown"
	  itemid = Crown
	  newitemid = Crown_
	  break
	 case 11
	  itemname = "Tiara"
	  itemid = Tiara
	  newitemid = Tiara_
	  break
	 case 12
	  break
	 endchoose
	 break
	case 5
	 exitwhile
	endchoose
   endwhile
   break
  case 3
   exitwhile
  endchoose
 endwhile
 if itemid == 0
  dialog "[Enchanter]"
  dialog "Be your way, then."
  close
  return
 endif
 if v[itemid] < 1
  dialog "[Enchanter]"
  dialog "You don't seem to have any " + itemname + " with you."
  close
  return
 endif
 dialog "[Enchanter]"
 dialog "To enchant your " + itemname + " with additional slots, I need:"
 if phracon_cnt > 0
  dialog "^0000ff" + phracon_cnt + " Phracon^000000"
 endif
 if oridecon_cnt > 0
  dialog "^0000ff" + oridecon_cnt + " Oridecon^000000"
 endif
 if steel_cnt > 0
  dialog "^0000ff" + steel_cnt + " Steel^000000"
 endif
 if elunium_cnt > 0
  dialog "^0000ff" + elunium_cnt + " Elunium^000000"
 endif
 dialog "and ^0000ff" + price + " zeny^000000."
 wait
 dialog "[Enchanter]"
 dialog "Please note that your " + itemname + " will ^ff0000lose any refines^000000 that it may have on it now."
 if hasslots > 0
  dialog "Also if you have ^ff0000any cards^000000 compounded to it, they ^ff0000will be lost^000000."
 endif
 wait
 dialog "[Enchanter]"
 dialog "Last but not least, there is only a chance that I'll succeed. If I fail, you'll lose the equipment forever."
 dialog "Do you wish to try to imbue your " + itemname + "with additional slots?"
 wait
 var menu1
 var menu2
 menu1 = "Sure, let's do it"
 menu2 = "Wait a minute..."
 choose menu menu1 menu2
 case 1
  if v[VAR_MONEY] < price
   dialog "[Enchanter]"
   dialog "You don't have the money I need for it."
   close
   return
  endif
  if v[itemid] < 1
   dialog "[Enchanter]"
   dialog "And where did you put that " + itemname + "? Did you forget it in your other pants?"
   close
   return
  endif
  if v[Phracon] < phracon_cnt
   dialog "[Enchanter]"
   dialog "You don't have enough Phracon with you."
   close
   return
  endif
  if v[Oridecon] < oridecon_cnt
   dialog "[Enchanter]"
   dialog "You don't have enough Oridecon with you."
   close
   return
  endif
  if v[Steel] < steel_cnt
   dialog "[Enchanter]"
   dialog "You don't have enough Steel with you."
   close
   return
  endif
  if v[Elunium] < elunium_cnt
   dialog "[Enchanter]"
   dialog "You don't have enough Elunium with you."
   close
   return
  endif
  if phracon_cnt > 0
   dropitem Phracon phracon_cnt
  endif
  if oridecon_cnt > 0
   dropitem Oridecon oridecon_cnt
  endif
  if steel_cnt > 0
   dropitem Steel steel_cnt
  endif
  if elunium_cnt > 0
   dropitem Elunium elunium_cnt
  endif
  dropgold price
  dropitem itemid 1
  if 2 == (rand 1 chance)
   getitem newitemid 1
   ShowEffect EF_REFINEOK ""
   dialog "[Enchanter]"
   dialog "Oh, we got lucky!"
   dialog "Here, enjoy your new slotted " + itemname + "!"
   close
  else
   ShowEffect EF_REFINEFAIL ""
   dialog "[Enchanter]"
   dialog "Uh-oh, bad luck."
   dialog "I'm sorry for that but I've told you that I may fail."
   dialog "Wish we have better luck next time."
   close
  endif
  break
 case 2
  dialog "[Enchanter]"
  dialog "Be your way, then."
  close
  break
 endchoose
 return


... stupid board, previews correctly and cuts the post then :hello:

This post has been edited by Kasuha: 01 November 2006 - 12:33 PM

0

#2 User is offline   Kasuha 

  • Average Member
  • PipPipPipPip
  • Group: Members
  • Posts: 195
  • Joined: 08-February 05

Posted 06 November 2006 - 06:24 PM

Oh yeah, why do I bother trying to contribute ... I bet nobody even tried the code ;) else I would expect somebody will notice that I swapped parameters of ShowEffect command.
Well, I'll leave it as is, DIY.
0

#3 User is offline   .chronoz. 

  • The Wanderer
  • PipPipPipPip
  • Group: Members
  • Posts: 234
  • Joined: 21-October 04

Posted 06 November 2006 - 07:20 PM

Ill give it a try, looks promising
0

#4 User is offline   980542 

  • Average Member
  • PipPipPipPip
  • Group: Members
  • Posts: 106
  • Joined: 21-December 05

Posted 07 November 2006 - 01:45 AM

Kasuha, I like your scripts a lot. ;)

I havent time to check this yet, but dont feel your work isnt appreciated.
0

#5 User is offline   KillerCore1984 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 74
  • Joined: 12-October 04

Posted 21 August 2007 - 07:15 PM

could you please explain how this
if 2 == (rand 1 chance)
works.? i would like to check the chances and maybe change them.
Thanks in advance.

Greetings KillerCore
0

#6 User is offline   Scriptor 

  • Average Member
  • PipPipPipPip
  • Group: ASB Staff
  • Posts: 243
  • Joined: 05-May 05
  • Gender:Male

Posted 23 August 2007 - 09:31 AM

bump
0

#7 User is offline   .chronoz. 

  • The Wanderer
  • PipPipPipPip
  • Group: Members
  • Posts: 234
  • Joined: 21-October 04

Posted 23 August 2007 - 09:49 AM

View PostScriptor, on Aug 23 2007, 09:31 AM, said:

bump


Thanks for your release, looks like a job well done :thankyou:
0

#8 User is offline   Kasuha 

  • Average Member
  • PipPipPipPip
  • Group: Members
  • Posts: 195
  • Joined: 08-February 05

Posted 05 September 2007 - 09:52 AM

View PostKillerCore1984, on Aug 22 2007, 03:15 AM, said:

could you please explain how this
if 2 == (rand 1 chance)
works.? i would like to check the chances and maybe change them.
Thanks in advance.

Greetings KillerCore

The 'rand' function generates a random number between its two arguments.
So, the 'chance' variable contains a value depending on the item class (i.e. 2, 4, 8, or 16) and the 'rand 1 chance' generates a random number from 1 to the value currently in the 'chance' variable. The 'if' statement condition is true if the randomly generated value is 2, which has a chance of 50%, 25%, 12.5%, or 6.25% depending if the 'chance' variable contains 2, 4, 8, or 16 respectively.

You can change the probability by changing the 'chance' variable value.

This post has been edited by Kasuha: 05 September 2007 - 09:54 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users