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

[Request] Gold Ingot

Trader

New Member
Joined
Aug 12, 2009
Messages
219
Reaction score
2
Hello OTLand,
Can anyone help me with a script for currency

Works like this:
100 Crystal Coins = 1 Gold Nugget
100 Gold Nuggets = 1 Gold Ingot

I only need the 100 gold nuggets = 1 gold ingot script, I already got the crystal coin -> gold nugget script.
Thank you!
 
It is the same way, but I do not recommend making such big coin because it will be buggy, when you have 100 gold ingot and buy something by npc or command it will take a strange amount of money or say that you dont have enough money ;/
 
It is the same way, but I do not recommend making such big coin because it will be buggy, when you have 100 gold ingot and buy something by npc or command it will take a strange amount of money or say that you dont have enough money ;/
what.....??he can go make its value in item.otb

change your change gold script with this
Lua:
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 = 2157, effect = TEXTCOLOR_TEAL
	},
	[2157] = {
		from = ITEM_CRYSTAL_COIN, to = 9971, effect = TEXTCOLOR_TEAL
	},
	[9971] = {
		from = 2157 , effect = TEXTCOLOR_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
then go to action.xml--> search for changegold and add thos line if not found
Code:
 <action itemid="2157" event="script" value="other/changegold.lua"/>
	 [B][I][COLOR="red"]<action itemid="9971" event="script" value="other/changegold.lua"/>[/COLOR][/I][/B]
now in item.otb you have to define the gold ignot value : so go to item.otb and search for 9971 and paste this under
Code:
<attribute key="worth" value="100000000" />
 
All you have to do is this:

Go into data/global.lua
Near the bottom you will see this

Code:
ITEM_GOLD_COIN = 2148
ITEM_PLATINUM_COIN = 2152
ITEM_CRYSTAL_COIN = 2160

Now after the crystal coin add this

Code:
ITEM_GOLD_NUGGET = 2157
ITEM_GOLD_INGOT = 9971

Now in data/actions/action.xml
find this:

Code:
	<!-- 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"/>

and add this

Code:
	<action itemid="2157" script="other/changegold.lua"/> <!-- Gold Nugget -->
	<action itemid="9971" script="other/changegold.lua"/> <!-- 1 Gold Ingot -->

Now in data/actions/scripts/other/changegold.lua
you will see this:

Code:
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, effect = TEXTCOLOR_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

Change it to this:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE)
	elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, 1)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_TEAL)
	elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, ITEM_GOLD_NUGGET, 1)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_GREEN)
	elseif item.itemid == ITEM_GOLD_NUGGET and item.type == ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, ITEM_GOLD_INGOT, 1)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_GREEN)

	elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_GOLD_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_YELLOW)
	elseif item.itemid == ITEM_CRYSTAL_COIN then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE)
	elseif item.itemid == ITEM_GOLD_NUGGET then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_GREEN)
	elseif item.itemid == ITEM_GOLD_INGOT then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_GOLD_NUGGET, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_GREEN)
	else
		return FALSE
	end
	return TRUE
end

That is it should work great.
 
Back
Top