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

Problem with gold changing TFS 1.2

Gamesert13

New Member
Joined
Sep 18, 2019
Messages
15
Reaction score
0
Hey i have problem with gold,platinum changing i can't change gold to platinum and platinum to crystal. On server i have gold converter but is don't work to ;/. I need for this someone script for change gold on this?
 
Code:
local config = {
    [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN},
    [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local coin = config[target.itemid]

    if not coin then
        return false
    end

    local charges = item:getCharges()
    if coin.changeTo and target.type == 100 then
        target:remove()
        player:addItem(coin.changeTo, 1)
        item:transform(item:getId(), charges -1)
    elseif coin.changeBack then
        target:transform(target.itemid, target.type - 1)
        player:addItem(coin.changeBack, 100)
        item:transform(item:getId(), charges -1)
    else
        return false
    end

    if charges == 0 then
        item:remove()
    end

    return true
end
Merged :
But i better want use on click on stac platinum coin for exchange to crystal coin. I don't want use conventer
 
Then remove the Goldconverter one and add this
data\actions\scripts\other create changegold.lua and add this inside
Lua:
local config = {
    [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN},
    [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local coin = config[item:getId()]
    if coin.changeTo and item.type == 100 then
        item:remove()
        player:addItem(coin.changeTo, 1)
    elseif coin.changeBack then
        item:remove(1)
        player:addItem(coin.changeBack, 100)
    else
        return false
    end
    return true
end
and in data\actions\actions.xml add this
XML:
    <action itemid="2148" script="other/changegold.lua" />
    <action itemid="2152" script="other/changegold.lua" />
    <action itemid="2160" script="other/changegold.lua" />
 
Any errors in console? your gold/platinum/crystal ids are 2148-2152-2160?
You added the script in the right path?
 
Last edited:
Code:
local config = {
    [2148] = {changeTo = 2152},
    [2152] = {changeBack = 2148, changeTo = 2160},
    [2160] = {changeBack = 2152}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local CONFIG = config[item.itemid]
    
    if not CONFIG then return false end
    
    if CONFIG.changeTo and item.type == 100 then
        item:remove()
        player:addItem(CONFIG.changeTo, 1)
    elseif CONFIG.changeBack then
        item:remove(1)
        player:addItem(CONFIG.changeBack, 100)
    end
    return false
end
 
0 error on console yes im check this and im make this what u say. Now i change
script="other/changegold.lua" />
to
script="changegold.lua" />
past this lua to script and it's work
 
Yeah because you added your script in data\actions\scripts instead of data\actions\scripts\other that's what I thought "wrong path".
 
Back
Top