• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

8.60 Combine Item Issue

Jordan_August

New Member
Joined
Jul 24, 2012
Messages
122
Reaction score
4
Okay. Well, i am currently having an issue that i don't know why it exists. im using a script that i use an item on a piece of equipment to make 1 upgraded armor. For example: 3 crown armors in a backpack make a golden armor. Now for some reason this script only works with certain eq ids... and i just wanna know why. why crown armor and golden armor work but 3 pirates hats don't combine. i have no idea what allows the crown armor to work and a pirate hat cant turn into a crown helmet. this is an issue with most eq pieces. Thanks in advance for any help regarding this situation.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local upgmaterial = 2488
local upgresult = 7891
    if itemEx.itemid == upgmaterial then
    if getPlayerItemCount(cid, upgmaterial) == 3 then
        doTransformItem(itemEx.uid, upgresult)
        doPlayerRemoveItem(cid, upgmaterial, 2)
        doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
        doSendAnimatedText(getPlayerPosition(cid), "Upgrade!", 210)
    elseif getPlayerItemCount(cid, upgmaterial) < 3 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must have 3 of the same item to upgrade it to the next item!")
        end
        end
return true
end
 
I will explain the full script and then show you how to add more items to it
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local upgmaterial = 2488 -- Material ID to upgrade to Result ID
local upgresult = 7891 -- Result ID from upgrading
if itemEx.itemid == upgmaterial then -- If the item you are using this on is the material then..
if getPlayerItemCount(cid, upgmaterial) == 3 then -- If player has 3 of the material then..
doTransformItem(itemEx.uid, upgresult) -- Transform the item into the upgrade result
doPlayerRemoveItem(cid, upgmaterial, 2) -- Removes 2 material item from backpack (Transforms 1 Removes 2 = 3)
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT) -- Sends magic effect (Block hit)
doSendAnimatedText(getPlayerPosition(cid), "Upgrade!", 210) -- Sends animated text of "Upgrade!" (Yellow)
elseif getPlayerItemCount(cid, upgmaterial) < 3 then -- If player does not have at least 3 of upgrade material then..
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must have 3 of the same item to upgrade it to the next item!") -- Sends cancel
end
end -- Ends Upgrading
return true
end -- Ends Function
Now, to add more items is pretty simple.
You take this and copy and paste it 2 lines after the "end -- Ends Upgrading"
Code:
local upgmaterial = 2488 -- Material ID to upgrade to Result ID
local upgresult = 7891 -- Result ID from upgrading
if itemEx.itemid == upgmaterial then -- If the item you are using this on is the material then..
if getPlayerItemCount(cid, upgmaterial) == 3 then -- If player has 3 of the material then..
doTransformItem(itemEx.uid, upgresult) -- Transform the item into the upgrade result
doPlayerRemoveItem(cid, upgmaterial, 2) -- Removes 2 material item from backpack (Transforms 1 Removes 2 = 3)
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT) -- Sends magic effect (Block hit)
doSendAnimatedText(getPlayerPosition(cid), "Upgrade!", 210) -- Sends animated text of "Upgrade!" (Yellow)
elseif getPlayerItemCount(cid, upgmaterial) < 3 then -- If player does not have at least 3 of upgrade material then..
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must have 3 of the same item to upgrade it to the next item!") -- Sends cancel
end
end -- Ends Upgrading
This should be the result.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local upgmaterial = 2488 -- Material ID to upgrade to Result ID
local upgresult = 7891 -- Result ID from upgrading
if itemEx.itemid == upgmaterial then -- If the item you are using this on is the material then..
if getPlayerItemCount(cid, upgmaterial) == 3 then -- If player has 3 of the material then..
doTransformItem(itemEx.uid, upgresult) -- Transform the item into the upgrade result
doPlayerRemoveItem(cid, upgmaterial, 2) -- Removes 2 material item from backpack (Transforms 1 Removes 2 = 3)
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT) -- Sends magic effect (Block hit)
doSendAnimatedText(getPlayerPosition(cid), "Upgrade!", 210) -- Sends animated text of "Upgrade!" (Yellow)
elseif getPlayerItemCount(cid, upgmaterial) < 3 then -- If player does not have at least 3 of upgrade material then..
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must have 3 of the same item to upgrade it to the next item!") -- Sends cancel
end
end -- Ends Upgrading
--START UPGRADE 2
local upgmaterial = 2488 -- Material ID to upgrade to Result ID
local upgresult = 7891 -- Result ID from upgrading
if itemEx.itemid == upgmaterial then -- If the item you are using this on is the material then..
if getPlayerItemCount(cid, upgmaterial) == 3 then -- If player has 3 of the material then..
doTransformItem(itemEx.uid, upgresult) -- Transform the item into the upgrade result
doPlayerRemoveItem(cid, upgmaterial, 2) -- Removes 2 material item from backpack (Transforms 1 Removes 2 = 3)
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT) -- Sends magic effect (Block hit)
doSendAnimatedText(getPlayerPosition(cid), "Upgrade!", 210) -- Sends animated text of "Upgrade!" (Yellow)
elseif getPlayerItemCount(cid, upgmaterial) < 3 then -- If player does not have at least 3 of upgrade material then..
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must have 3 of the same item to upgrade it to the next item!") -- Sends cancel
end
end -- Ends Upgrading
return true
end -- Ends Function

Look for anything that contains the locals from upgrade 1 in the upgrade 2 section:
Code:
local upgmaterial = 2488 -- Material ID to upgrade to Result ID
local upgresult = 7891 -- Result ID from upgrading
if itemEx.itemid == upgmaterial then -- If the item you are using this on is the material then..
if getPlayerItemCount(cid, upgmaterial) == 3 then -- If player has 3 of the material then..
doTransformItem(itemEx.uid, upgresult) -- Transform the item into the upgrade result
doPlayerRemoveItem(cid, upgmaterial, 2) -- Removes 2 material item from backpack (Transforms 1 Removes 2 = 3)
elseif getPlayerItemCount(cid, upgmaterial) < 3 then -- If player does not have at least 3 of upgrade material then..

Now change the local names first,
Code:
local upgmaterial2 = 2488 -- Material ID to upgrade to Result ID
local upgresult2 = 7891 -- Result ID from upgrading

Now that the local names for upgrade section 2 are changed, go back to these:
Code:
if itemEx.itemid == upgmaterial then -- If the item you are using this on is the material then..
if getPlayerItemCount(cid, upgmaterial) == 3 then -- If player has 3 of the material then..
doTransformItem(itemEx.uid, upgresult) -- Transform the item into the upgrade result
doPlayerRemoveItem(cid, upgmaterial, 2) -- Removes 2 material item from backpack (Transforms 1 Removes 2 = 3)
elseif getPlayerItemCount(cid, upgmaterial) < 3 then -- If player does not have at least 3 of upgrade material then..

Change every "upgmaterial" and "upgresult" to "upgmaterial2" and "upgresult2" or whatever you decide to change the local names to. Repeat this process as many times needed for any amount of set upgrades you need. Good luck!
 
Thanks for the tutorial... on what i already knew.. that's not my issue. my issue is that if i set the pirate hat id as the upgrade item. or magma armor pieces or dragon scale mail items. they do not combine. It literally just wont do it and THAT is what i don't understand why.
 
Back
Top