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

[Bug] Enchanting

Lifer420

Advanced OT User
Joined
Jul 27, 2009
Messages
1,490
Reaction score
196
Im in a situation where I can use a hand because I just found out this bug in my OT.

When you enchant an item, when the charges run out (war hammer, for example) it decaysTo the regular war hammer, but after 1 hit with the regular war hammer, it disappears that too.. Also, I tried changing the amount of charges it gives when you enchant it to 100, in items.xml - but it still comes out to 1000? I cant seem to find where the enchanting script is located either. How can I fix it from decaying the actual weapon, and find the actual script? I searched, but never found it.
 
Im in a situation where I can use a hand because I just found out this bug in my OT.

When you enchant an item, when the charges run out (war hammer, for example) it decaysTo the regular war hammer, but after 1 hit with the regular war hammer, it disappears that too.. Also, I tried changing the amount of charges it gives when you enchant it to 100, in items.xml - but it still comes out to 1000? I cant seem to find where the enchanting script is located either. How can I fix it from decaying the actual weapon, and find the actual script? I searched, but never found it.
You can find enchanting script at actions folder (actions\scripts\other\enchanting) and about charges you can edit it in enchant script for example
Code:
if(not isInArray({2544, 8905}, itemEx.itemid)) then
subtype = 1000 ---CHARGES
and about decoy hammer you can will find something like this at regular war hammer
Code:
    <attribute key="decayTo" value="00000" /> -- just remove this line
 
Here's my script, seems diff from the one you're talking about. Can you possibly edit it and just paste it back for me and explain what you change so I understand? :S Please and thanks!

Code:
local config = {
    hardcoreManaSpent = getConfigValue("addManaSpentInPvPZone"),
    manaCost = 300,
    soulCost = 20,
}

local spheres = {
    [7759] = {3, 7},
    [7760] = {1, 5},
    [7761] = {2, 6},
    [7762] = {4, 8}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isInArray({33268, 33269}, toPosition.x) and toPosition.y == 31830 and toPosition.z == 10 and getPlayerStorageValue(cid, 65100) > 0 then
        if not isInArray(spheres[item.itemid], getPlayerVocation(cid)) then
            return false
        elseif isInArray({7915, 7916}, itemEx.itemid) == TRUE then
            doCreatureSay(cid, 'Turn off the machine first.', TALKTYPE_ORANGE_1)
            return true
        else
            setPlayerStorageValue(cid, 65102, math.max(1, getPlayerStorageValue(cid, 65102) + 1))
            doSendMagicEffect(toPosition, CONST_ME_PURPLEENERGY)
            doChangeTypeItem(item.uid, item.type - 1)
            return true
        end
    end

    if(item.itemid == 2147 and itemEx.itemid == 2342) then
        doTransformItem(itemEx.uid, 2343)
        doDecayItem(itemEx.uid)
        doRemoveItem(item.uid, 1)

        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        return true
    end

    if(item.itemid == 7760 and isInArray({9934, 10022}, itemEx.itemid)) then
        doTransformItem(itemEx.uid, 9933)
        doRemoveItem(item.uid, 1)

        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        return true
    end

    if(isInArray(enchantableGems, item.itemid)) then
        local subtype = item.type
        if(subtype == 0) then
            subtype = 1
        end

        local mana = config.manaCost * subtype
        if(getPlayerMana(cid) < mana) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
            return true
        end

        local soul = config.soulCost * subtype
        if(getPlayerSoul(cid) < soul) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHSOUL)
            return true
        end

        local a = table.find(enchantableGems, item.itemid)
        if(a == nil or not isInArray(enchantingAltars[a], itemEx.itemid)) then
            return false
        end

        doPlayerAddMana(cid, -mana)
        doPlayerAddSoul(cid, -soul)

        doTransformItem(item.uid, enchantedGems[a])
        if(not getPlayerFlagValue(cid, PlayerFlag_NotGainMana) and (not getTileInfo(getThingPosition(cid)).hardcore or config.hardcoreManaSpent)) then
            doPlayerAddSpentMana(cid, mana)
        end

        doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
        return true
    end

    if(isInArray(enchantedGems, item.itemid)) then
        if(not isInArray(enchantableItems, itemEx.itemid)) then
            doSendMagicEffect(fromPosition, CONST_ME_POFF)
            return false
        end

        local b = table.find(enchantedGems, item.itemid)
        if(b == nil) then
            return false
        end

        local subtype = itemEx.type
        if(not isInArray({2544, 8905}, itemEx.itemid)) then
            subtype = 1000
        end

        doTransformItem(itemEx.uid, enchantedItems[itemEx.itemid][b], subtype)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYDAMAGE)
        doDecayItem(itemEx.uid)

        doRemoveItem(item.uid, 1)
        return true
    end

    return false
end
 
I got it down to 100 charges from the "Subtype = 1000" just switched to 100

Edit : I just seen you said to look at REGULAR war hammer for decay to, sec ill try.
2nd edit : The regular war hammer doesn't have a "decayTo" only the elemental ones do, and it's decaying to 2391 (regular war hammer)
 
Here's my script, seems diff from the one you're talking about. Can you possibly edit it and just paste it back for me and explain what you change so I understand? :S Please and thanks!

Code:
local config = {
    hardcoreManaSpent = getConfigValue("addManaSpentInPvPZone"),
    manaCost = 300,
    soulCost = 20,
}

local spheres = {
    [7759] = {3, 7},
    [7760] = {1, 5},
    [7761] = {2, 6},
    [7762] = {4, 8}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isInArray({33268, 33269}, toPosition.x) and toPosition.y == 31830 and toPosition.z == 10 and getPlayerStorageValue(cid, 65100) > 0 then
        if not isInArray(spheres[item.itemid], getPlayerVocation(cid)) then
            return false
        elseif isInArray({7915, 7916}, itemEx.itemid) == TRUE then
            doCreatureSay(cid, 'Turn off the machine first.', TALKTYPE_ORANGE_1)
            return true
        else
            setPlayerStorageValue(cid, 65102, math.max(1, getPlayerStorageValue(cid, 65102) + 1))
            doSendMagicEffect(toPosition, CONST_ME_PURPLEENERGY)
            doChangeTypeItem(item.uid, item.type - 1)
            return true
        end
    end

    if(item.itemid == 2147 and itemEx.itemid == 2342) then
        doTransformItem(itemEx.uid, 2343)
        doDecayItem(itemEx.uid)
        doRemoveItem(item.uid, 1)

        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        return true
    end

    if(item.itemid == 7760 and isInArray({9934, 10022}, itemEx.itemid)) then
        doTransformItem(itemEx.uid, 9933)
        doRemoveItem(item.uid, 1)

        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        return true
    end

    if(isInArray(enchantableGems, item.itemid)) then
        local subtype = item.type
        if(subtype == 0) then
            subtype = 1
        end

        local mana = config.manaCost * subtype
        if(getPlayerMana(cid) < mana) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
            return true
        end

        local soul = config.soulCost * subtype
        if(getPlayerSoul(cid) < soul) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHSOUL)
            return true
        end

        local a = table.find(enchantableGems, item.itemid)
        if(a == nil or not isInArray(enchantingAltars[a], itemEx.itemid)) then
            return false
        end

        doPlayerAddMana(cid, -mana)
        doPlayerAddSoul(cid, -soul)

        doTransformItem(item.uid, enchantedGems[a])
        if(not getPlayerFlagValue(cid, PlayerFlag_NotGainMana) and (not getTileInfo(getThingPosition(cid)).hardcore or config.hardcoreManaSpent)) then
            doPlayerAddSpentMana(cid, mana)
        end

        doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
        return true
    end

    if(isInArray(enchantedGems, item.itemid)) then
        if(not isInArray(enchantableItems, itemEx.itemid)) then
            doSendMagicEffect(fromPosition, CONST_ME_POFF)
            return false
        end

        local b = table.find(enchantedGems, item.itemid)
        if(b == nil) then
            return false
        end

        local subtype = itemEx.type
        if(not isInArray({2544, 8905}, itemEx.itemid)) then
            subtype = 1000
        end

        doTransformItem(itemEx.uid, enchantedItems[itemEx.itemid][b], subtype)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYDAMAGE)
        doDecayItem(itemEx.uid)

        doRemoveItem(item.uid, 1)
        return true
    end

    return false
end
Actually its same script o_O
if(not isInArray({2544, 8905}, itemEx.itemid)) then
subtype = 1000
this line for changing how many charges do you need to add to this ITEM >8905< and if you need to understand how is it working just summon this item in-game to check it.
 
Actually its same script o_O
if(not isInArray({2544, 8905}, itemEx.itemid)) then
subtype = 1000
this line for changing how many charges do you need to add to this ITEM >8905< and if you need to understand how is it working just summon this item in-game to check it.

8905 is rainbow shield, that's a timer set for a whole different script, so the charges from "Subtype" are set to all the other enchanted weapons it seems. But that doesn't solve the weapon decaying problem :/
 
8905 is rainbow shield, that's a timer set for a whole different script, so the charges from "Subtype" are set to all the other enchanted weapons it seems. But that doesn't solve the weapon decaying problem :/
i gave you this id for example lol i didn't check this id and about decoying weapons you will find it like i said just search about it.
 
i gave you this id for example lol i didn't check this id and about decoying weapons you will find it like i said just search about it.

I did, I went to war hammer and the others and like I said - The ONLY decayTo is for the items to go back to their respective items. (icy war hammer decayTo regular war hammer and so on) and if I remove that, the item itself just disappears after the charges are up, without returning to the regular war hammer first.
 
Back
Top