• 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!

Solved transform weapons

Nerevr back

Member
Joined
Nov 7, 2014
Messages
269
Reaction score
7
i need make all knight weapons in one weapons like when player click on weapon change to other weapon .
 
Code:
local ITEM_IDS = {
[7850] = 7839,
[7838] = 7839,
[7839] = 7840,
[7840] = 7838,
[7838] = 7850,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(not ITEM_IDS[item.itemid]) then
return false
end

doTransformItem(item.uid, ITEM_IDS[item.itemid])
doDecayItem(item.uid)
return true
end
 
Code:
local ITEM_IDS = {
[7850] = 7839,
[7838] = 7839,
[7839] = 7840,
[7840] = 7838,
[7838] = 7850,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(not ITEM_IDS[item.itemid]) then
return false
end

doTransformItem(item.uid, ITEM_IDS[item.itemid])
doDecayItem(item.uid)
return true
end
its work thx but i need some edite when player change it say weapon name like if i changed fire sword t fire axe say You transformed fire sword to fire axe.
 
its work thx but i need some edite when player change it say weapon name like if i changed fire sword t fire axe say You transformed fire sword to fire axe.
Not tested, but give this a try

Code:
-- not tested
local ITEM_IDS = {
    [7850] = 7850,
    [7838] = 7839,
    [7839] = 7840,
    [7840] = 7838,
    [7838] = 7850,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(not ITEM_IDS[item.itemid]) then
        return false
    end
   
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You changed "..getItemInfo(item.itemid).name.." to "..getItemInfo(ITEM_IDS[item.itemid]).name..".")
    doTransformItem(item.uid, ITEM_IDS[item.itemid])
    doDecayItem(item.uid)
    return true
end
 
i add some diseffects and exhaustion and eited it :D
Code:
local disteffect = 35
local effect = 66
local ITEM_IDS = {
    [7838] = 7839,
    [7839] = 7840,
    [7840] = 7838,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(not ITEM_IDS[item.itemid]) then
        return false
    end 
    if (exhaustion.check(cid, 17024)) then
        doPlayerSendCancel(cid, "You will be able to use this GEM again in  "..tostring(exhaustion.get(cid, 17024)).." seconds.")
        return true
    end
    local position = getCreaturePosition(cid)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            for i = 1, 30 do
doSendDistanceShoot({x = position.x + math.random(-12 ,12), y = position.y + math.random(-12 ,12), z = position.z}, position, disteffect)
end
    doPlayerSendTextMessage(cid, 22, "You changed "..getItemInfo(item.itemid).name.." to "..getItemInfo(ITEM_IDS[item.itemid]).name..".")
    exhaustion.set(cid, 17024, 5)
    doTransformItem(item.uid, ITEM_IDS[item.itemid])
    doDecayItem(item.uid)
    doSendMagicEffect(getCreaturePosition(cid), 29)
    return true
end
 

Similar threads

Back
Top