Sultan 68 Report post Posted June 21, 2016 (edited) Special Gem Combiner A lot of friends were asking me to release what I had in my server, which is a normal gem combiner like any other server "but" it takes only level 1. Few servers used to let players keep level 2+ gems in bank before combining. With this Special Gem Combiner, it will only take level 1 and combine it with ease. First, add this to any of your NPCscript (Add rest of gems by yourself) function FastCombinerNpc() Talk(1,'Hello! I am the Fast Gem Combiner. How can I help you?') Text(1,'Level 4 Gem Combining!', JumpPage, 2) Talk(2,'Special Gem Combiner: Here is list of Level 4 Gems!' ) Text(2,'Refining Gem',FastCombiner,885,4) -- Gem item id, level to combine Text(2,'Gem of Rage',FastCombiner,863,4) -- Gem item id, level to combine Text(2,'Eye of Black Dragon',FastCombiner,864,4) -- Gem item id, level to combine end Second, add this in your NPCsdk.lua (between lines: 2300~2500?) elseif item.func == FastCombiner then return FastCombiner(character,item.p1,item.p2) Finally, add this in your functions.lua function FastCombiner(cha,itemid,lvl) local CombineLvl = {} CombineLvl[4] = {pieces=8,fee=100000} CombineLvl[5] = {pieces=16,fee=500000} CombineLvl[6] = {pieces=32,fee=1000000} --! Check if Bag is locked if(KitbagLock(cha, 0) ~= LUA_TRUE)then HelpInfo(cha,0,'Your bag is locked!') return end --! Check has money required for gem level local m = HasMoney(cha,CombineLvl[lvl].fee) if(m == 0)then HelpInfo(cha,0,'You must have '..CombineLvl[lvl].fee..'G to combine!') return end --! Scan whole inventory and store gem slots location local bag,gemSlot,gemLv,array = GetKbCap(cha),0,0,{} for i = 0,bag-1 do gemSlot = GetChaItem(cha,2,i) if(GetItemID(gemSlot) == itemid)then gemLv = GetItemAttr(gemSlot,ITEMATTR_VAL_BaoshiLV) if(gemLv == 1)then table.insert(array,i) end end end --! Check if player has correct number of gems (Lv1) if(table.getn(array) < CombineLvl[lvl].pieces)then HelpInfo(cha,0,'You must have x'..CombineLvl[lvl].pieces..' of Lv1 '..GetItemName(itemid)..' to combine!') return end --! Remove gems local rem = 0 for k,j in pairs(array) do if(rem < CombineLvl[lvl].pieces)then RemoveChaItem(cha,0,1,2,j,2,1) rem = rem + 1 else break end end --! Give a message, take the money & the gem combined BickerNotice(cha,GetItemName(itemid)..' was successfully combined to level '..lvl..'!') TakeMoney(cha,0,CombineLvl[lvl].fee) GiveItem(cha,0,itemid,1,100+lvl) end Edited November 18, 2016 by Sultan Fixed issues with the script 5 Quote Share this post Link to post Share on other sites
Sultan 68 Report post Posted June 21, 2016 Someone do quick testing for it if you're planning to use, I have lost my original one I used in my server before (currently I'm using another way to combine gems: Vouchers). I'm sure this should work 100%, but someone test to ensure only. Quote Share this post Link to post Share on other sites
HILO 0 Report post Posted November 18, 2016 Used similar one, It does not remove lv4 gems, but If you have x9 lv1 gems they will be removed and you get x1 lv4 It works with x8 lv1 gems, but if u have x9 it'll take them all. or for example if you have x16 gems and wanna make x2 lv4 gems, it will take x9 for the 1st lv4 gem, and all you have left is x7 lv1 gems + x1 lv4 gem. That is the issue I figured out so far. Quote Share this post Link to post Share on other sites
Shako 97 Report post Posted November 18, 2016 4 hours ago, HILO said: Used similar one, It does not remove lv4 gems, but If you have x9 lv1 gems they will be removed and you get x1 lv4 It works with x8 lv1 gems, but if u have x9 it'll take them all. or for example if you have x16 gems and wanna make x2 lv4 gems, it will take x9 for the 1st lv4 gem, and all you have left is x7 lv1 gems + x1 lv4 gem. That is the issue I figured out so far. Is this referring to the script provided by Sultan or another one? Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
HILO 0 Report post Posted November 18, 2016 Quote Is this referring to the script provided by Sultan or another one? This one, you can test it. Quote Share this post Link to post Share on other sites
Sultan 68 Report post Posted November 18, 2016 Thanks a lot for pointing it out I think this should be the issue: --! Remove gems local rem = 0 for k,j in pairs(array) do if(rem < CombineLvl[lvl].pieces)then -- change "<=" to "<"; RemoveChaItem(cha,0,1,2,j,2,1) rem = rem + 1 else break end end Quote Share this post Link to post Share on other sites
Sultan 68 Report post Posted November 18, 2016 @Totoka has released a better version with nice concept, check it out Thanks a lot for your help! Quote Share this post Link to post Share on other sites
Vasil 71 Report post Posted November 18, 2016 Hello @HILO, i've done fixing this bug by storing the amount of gems required in each level in a variables and modified @Sultan scripts , and then it worked perfectly. Quote Share this post Link to post Share on other sites
Totoka 152 Report post Posted November 18, 2016 8 minutes ago, Sultan said: @Totoka has released a better version with nice concept, check it out Well, It is just different, another option, not better =) Quote Discord: andresc Share this post Link to post Share on other sites