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

Change Gold ~Golden Nugget~ Help!

Zaggyzigzig

plx itens menz
Joined
Aug 25, 2014
Messages
386
Reaction score
50
Location
Canada Ontario
Been playing with my scripts for a while, Been working on this for over 2 hours now so I am going to ask for help!

Heres my gold platinum and crystal scripts, been trying to build a working one to change change 100 crystal coins into 1 golden nugget, Would be be awesome If someone knows how to do this!

Gold:
Code:
function onUse(cid, item, frompos, item2, topos)
   if item.itemid == 2148 and item.type == 100 then
   doRemoveItem(item.uid,item.type)
   doPlayerAddItem(cid,2152,1)
   doPlayerSendTextMessage(cid,22,"You have changed 100 gp to 1 platnium coin")
   elseif item.itemid == 2148 and item.type < 100 then
   doPlayerSendTextMessage(cid,22,"You have to have 100 gp's to change for platinum coin")
   end
  end

Platinum:
Code:
function onUse(cid, item, frompos, item2, topos)
   if item.itemid == 2152 and item.type == 100 then
   doRemoveItem(item.uid,item.type)
   doPlayerAddItem(cid,2160,1)
   doPlayerSendTextMessage(cid,22,"You have changed 100 platinum to 1 crystal coin")
   elseif item.itemid == 2152 and item.type < 100 then
   doRemoveItem(item.uid,1)
   doPlayerAddItem(cid,2148,100)
   doPlayerSendTextMessage(cid,22,"You have changed 1 platinum to 100 gold coins")
   end
  end

Crystal:
Code:
function onUse(cid, item, frompos, item2, topos)
   if doRemoveItem(item.uid,1) then
   doPlayerSendTextMessage(cid,22,"You have changed 1 crystal coin to 100 platinum coins")
   doPlayerAddItem(cid,2152,100)
   end
  end


Really Can't seem to get it to work! Any Ideas? All of these scripts work fine, Just not the one I am trying to make.. Heres mine..

Golden Nugget:
Code:
function onUse(cid, item, frompos, item2, topos)
   if item.itemid == 2160 and item.type == 100 then
   doRemoveItem(item.uid,item.type)
   doPlayerAddItem(cid,2152,1)
   doPlayerSendTextMessage(cid,22,"You have changed 100 crystal coins to 1 golden nugget")
   elseif item.itemid == 2160 and item.type < 100 then
   doPlayerSendTextMessage(cid,22,"You have to have 100 crystl coins to change for 1 golden nugget")
   end
  end

-- Moderator edit: Use code tags when posting scripts.
 
Last edited by a moderator:
just follow this if you want it as a normal currency because if you only make it change to a gold ingot it still won't be accepted as currency while buying
http://otland.net/threads/request-gold-ingot.97550/

Though if you want to have it as a "donate coin" to buy special stuff or something like that you need another script it all depends on what you want to do with your gold ingot
 
Code:
<action itemid="2148;2152;2160;2157" event="script" value="other/changegold.lua"/>


Code:
local ITEM_GOLD_NUGGET = 2157

local coins = {
    [ITEM_GOLD_COIN] = {
        to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
    },
    [ITEM_PLATINUM_COIN] = {
        from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
    },
    [ITEM_CRYSTAL_COIN] = {
        from = ITEM_PLATINUM_COIN, to = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_TEAL
    },
    [ITEM_GOLD_NUGGET] = {
        from = ITEM_CRYSTAL_COIN, effect = 205
    }
}

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
 
Code:
local ITEM_GOLD_NUGGET = 2157

local coins = {
    [ITEM_GOLD_COIN] = {
        to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
    },
    [ITEM_PLATINUM_COIN] = {
        from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
    },
    [ITEM_CRYSTAL_COIN] = {
        from = ITEM_PLATINUM_COIN, to = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_TEAL
    },
    [ITEM_GOLD_NUGGET] = {
        from = ITEM_CRYSTAL_COIN, effect = 205
    }
}

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
What version is this for?
 

Similar threads

Back
Top