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

[Actions] Gold Converter?

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,837
Solutions
18
Reaction score
614
Location
Poland
Anyone got working script for Gold Converter item?
If yes - can you share it? :(

I mean this item - Gold Converter

Thanks in advance,
F.
 
Last edited:
Rules for the Support board
5. Incomplete Problem Description:
- Post as much useful information as possible. If the problem is about something on your server, post the server version and client version. Also always post the errors you get and the scripts with the problems.

first, this should be in requests since you're asking for a script (i moved it for you)
second, post your server version (the tag 1.x is correct but there are differences between 1.0, 1.1, 1.2, and 1.3)
third, what do you mean by a "gold converter item"? describe what it does so we can help you
 
Rules for the Support board


first, this should be in requests since you're asking for a script (i moved it for you)
second, post your server version (the tag 1.x is correct but there are differences between 1.0, 1.1, 1.2, and 1.3)
third, what do you mean by a "gold converter item"? describe what it does so we can help you

he wants this my lady Gold Converter
 
Try using this if it works, there are no effects or messages, just add it on your own.

XML
Code:
<action itemid="26378" script="goldconverter.lua" />
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[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

I didn't make this code.
 
Try using this if it works, there are no effects or messages, just add it on your own.

XML
Code:
<action itemid="26378" script="goldconverter.lua" />
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[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

I didn't make this code.

Worked, thanks
 
Back
Top