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

New money tfs 0.4

you also need to edit data/scripts/other/changegold.lua :)
here is example
Lua:
local newmoney = NEW_MONEY_ID <-- change here
local coins = {
[12416] = {to = 2148},
[2148] = {to = 2152, from = 12416},
[2152] = {to = 2160, from = 2148},
[2160] = {from = 2152, to = NEW_MONEY_ID},
[NEW_MONEY_ID] = {from = 2160},
}
 
What im doing wrong? I've added a new currency, i can transform 100 crystal coin into a ruby coin, but i cant transform 1 ruby coin into 100 crystal coin back:

Lua:
local coins = {
    [ITEM_GOLD_COIN] = {
        to = ITEM_PLATINUM_COIN, effect = COLOR_YELLOW
    }, 
    [ITEM_PLATINUM_COIN] = {
        from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = COLOR_LIGHTBLUE
    }, 
    [ITEM_CRYSTAL_COIN] = {
        from = ITEM_PLATINUM_COIN, to = ITEM_RUBY_COIN, effect = COLOR_TEAL
    },
    [ITEM_RUBY_COIN] = {
        from = ITEM_CRYSTAL_COIN, effect = COLOR_RED
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
        return false
    end

    local coin = coins[item.itemid]
    if(not coin) then
        return false
    end

    if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
        doChangeTypeItem(item.uid, item.type - item.type)
        doPlayerAddItem(cid, coin.to, 1)
        doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
    elseif(coin.from ~= nil) then
        doChangeTypeItem(item.uid, item.type - 1)
        doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
        doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
    end

    return true
end
 
@potinho

try this:
Lua:
local coins = {
    [ITEM_GOLD_COIN] = {
        to = ITEM_PLATINUM_COIN, effect = COLOR_YELLOW
    },
    [ITEM_PLATINUM_COIN] = {
        from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = COLOR_LIGHTBLUE
    },
    [ITEM_CRYSTAL_COIN] = {
        from = ITEM_PLATINUM_COIN, to = ITEM_RUBY_COIN, effect = COLOR_TEAL
    },
    [ITEM_RUBY_COIN] = {
        to = ITEM_CRYSTAL_COIN, effect = COLOR_RED
    }
}
 
@potinho

try this:
Lua:
local coins = {
    [ITEM_GOLD_COIN] = {
        to = ITEM_PLATINUM_COIN, effect = COLOR_YELLOW
    },
    [ITEM_PLATINUM_COIN] = {
        from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = COLOR_LIGHTBLUE
    },
    [ITEM_CRYSTAL_COIN] = {
        from = ITEM_PLATINUM_COIN, to = ITEM_RUBY_COIN, effect = COLOR_TEAL
    },
    [ITEM_RUBY_COIN] = {
        to = ITEM_CRYSTAL_COIN, effect = COLOR_RED
    }
}
Not worked :/, originally is this way, i just tried to reproduce same logic:

Lua:
local coins = {
    [ITEM_GOLD_COIN] = {
        to = ITEM_PLATINUM_COIN, effect = COLOR_YELLOW
    },
    [ITEM_PLATINUM_COIN] = {
        from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = COLOR_LIGHTBLUE
    },
    [ITEM_CRYSTAL_COIN] = {
        from = ITEM_PLATINUM_COIN, effect = COLOR_TEAL
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
        return false
    end

    local coin = coins[item.itemid]
    if(not coin) then
        return false
    end

    if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
        doChangeTypeItem(item.uid, item.type - item.type)
        doPlayerAddItem(cid, coin.to, 1)
        doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
    elseif(coin.from ~= nil) then
        doChangeTypeItem(item.uid, item.type - 1)
        doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
        doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
    end

    return true
end
 
I have a script on my server that allows me to convert Crystal Coins to Ruby Coins. In addition, you can transform them into any other item you like, with a colorful visual effect ($$), whenever you want. If interested, I can share the script with you.

If you want, I can send you the script as soon as I get home. It is quite simple and works perfectly.
 
I have a script on my server that allows me to convert Crystal Coins to Ruby Coins. In addition, you can transform them into any other item you like, with a colorful visual effect ($$), whenever you want. If interested, I can share the script with you.

If you want, I can send you the script as soon as I get home. It is quite simple and works perfectly.
If you can, please ^^
 
I have two servers, one using TFS 1.5 and the other using TFS 0.4.
TFS 0.4
Lua:
function onUse(cid, item, frompos, item2, topos)
       if item.itemid == 2160 and item.type == 100 then
           doRemoveItem(item.uid,item.type)
           doPlayerAddItem(cid,11510,1)
                doSendAnimatedText(getPlayerPosition(cid), "$$$$", TEXTCOLOR_RED)
           doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You turned 1 Ruby Coin into 100 Crystal Coins")
       elseif item.itemid == 2160 and item.type < 100 then
           doRemoveItem(item.uid,1)
                doSendAnimatedText(getPlayerPosition(cid), "$$", 23)
           doPlayerAddItem(cid,2152,100)
           doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have turned 1 Crystal Coin into 100 Platium Coins")
       end
   end

TFS 1.5 NEKIRO
Lua:
function onUse(cid, item, frompos, item2, topos)
    if item.itemid == 2160 and item.type == 100 then
        doRemoveItem(item.uid, item.type)
        doPlayerAddItem(cid, 38915, 1)
        doSendAnimatedText("$$$$", getPlayerPosition(cid), 180)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You turned 100 Crystal Coins into 1 Ruby Coin")
    elseif item.itemid == 2160 and item.type < 100 then
        doRemoveItem(item.uid, 1)
        doSendAnimatedText("$$", getPlayerPosition(cid), 172)
        doPlayerAddItem(cid, 2152, 100)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have turned 1 Crystal Coin into 100 Platium Coins")
    end
end
Both are quite similar, except for the difference in the use of "doSendAnimatedText", which is working correctly. See the GIF below:
If you can, please ^^
don't know if this should work for you... :D
 
Last edited:
What for? Why use another script for something as simple.
Keep the things simple and organized.
@potinho Did you even defined value for that const ITEM_RUBY_COIN?
data/lib/000-constant.lua
Lua:
ITEM_GOLD_COIN = 2148
ITEM_PLATINUM_COIN = 2152
ITEM_CRYSTAL_COIN = 2160
ITEM_RUBY_COIN = 2157

Edit:
Seems like you already found that out ;)
But for others it was about:
XML:
    <!-- Change gold -->
    <action itemid="2148" event="script" value="other/changegold.lua"/>
    <action itemid="2152" event="script" value="other/changegold.lua"/>
    <action itemid="2160" event="script" value="other/changegold.lua"/>
    <action itemid="2148" event="script" value="other/changegold.lua"/>
 
What for? Why use another script for something as simple.
Keep the things simple and organized.
@potinho Did you even defined value for that const ITEM_RUBY_COIN?
data/lib/000-constant.lua
Lua:
ITEM_GOLD_COIN = 2148
ITEM_PLATINUM_COIN = 2152
ITEM_CRYSTAL_COIN = 2160
ITEM_RUBY_COIN = 2157

Edit:
Seems like you already found that out ;)
But for others it was about:
XML:
    <!-- Change gold -->
    <action itemid="2148" event="script" value="other/changegold.lua"/>
    <action itemid="2152" event="script" value="other/changegold.lua"/>
    <action itemid="2160" event="script" value="other/changegold.lua"/>
    <action itemid="2148" event="script" value="other/changegold.lua"/>
If I use what you suggested, is it possible for the NPC or some NPCs to allow purchasing directly using Ruby Coins, without having to turn them into Crystal Coins first? On my server, every time I need to convert to Crystal Coins to buy something, it becomes a nuisance.
 
Back
Top