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

Gold nugget

GOD Wille

Excellent OT User
Joined
Jan 11, 2010
Messages
2,826
Solutions
2
Reaction score
815
Location
Sweden
How to fix so i can change gold ingots to gold nuggets?

Edit ma script plz?
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, to = ITEM_GOLD_INGOTS, effect = TEXTCOLOR_LIGHTBLUE
},
[ITEM_GOLD_INGOTS] = {
from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_YELLOW
}
}
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, "Mmm, cash!", coins[coin.to].effect)
elseif(coin.from ~= nil) then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "Mmm, cash!", coins[coin.from].effect)
end
return true
end
 
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, to = ITEM_GOLD_INGOTS, effect = TEXTCOLOR_LIGHTBLUE
},
[ITEM_GOLD_INGOTS] = {
from = ITEM_CRYSTAL_COIN, to = ITEM_GOLD_NUGGETS, effect = TEXTCOLOR_YELLOW
},
[ITEM_GOLD_NUGGETS] = {
from = ITEM_GOLD_NUGGETS, effect = TEXTCOLOR_YELLOW
}
}
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, "Mmm, cash!", coins[coin.to].effect)
elseif(coin.from ~= nil) then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "Mmm, cash!", coins[coin.from].effect)
end
return true
end

cant u read the script and make it ur self?
 
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, to = ITEM_GOLD_INGOT, effect = TEXTCOLOR_LIGHTBLUE
},
[ITEM_GOLD_INGOT] = {
from = ITEM_CRYSTAL_COIN, to = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_YELLOW
},
[ITEM_GOLD_NUGGET] = {
from = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_YELLOW
}
}
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, "Mmm, cash!", coins[coin.to].effect)
elseif(coin.from ~= nil) then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "Mmm, cash!", coins[coin.from].effect)
end
return true
end
 
I am not sure, but I think that you need to do a change in the sources for make a gold nugget to work as a coin? Like using it to buy items in shops.
 
Na not realy, i just added this:
Code:
<attribute key="worth" value="xxxxxxx"/></item>
in items.xml after the item and then you can sell and by with it, and here is my script for gold nugget:


items.xml
Lua:
<item id="2157" article="a" name="gold nugget" plural="gold nuggets">
<attribute key="weight" value="10"/>
<attribute key="worth" value="1000000"/>
</item>
that makes 1 gold nugget worht like 100cc

actions part:


actions.xml

PHP:
	<!-- Change gold -->
	<action itemid="2148" script="other/changegold.lua"/>
	<action itemid="2152" script="other/changegold.lua"/>
	<action itemid="2160" script="other/changegold.lua"/>
    <action itemid="2157" script="other/changegold.lua"/>

other/changegold.lua
Lua:
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 = TEXTCOLOR_YELLOW
	}
}

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 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) then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
	end
	return true
end

Regards,
Djivar
 
Please tell me how to put it in constant.lua, just to add or?

Edit: should it work to exchange all other coins ingame if i have the new script but dont putted the 4rth item (gold nugget) in actions.xml and dont have edited the lib? cuz it wont work then
 
Last edited:
just put the id of the golden nugget instead lol

in action .xml serch for <!-- Change gold -->
and replace lines under it by those

Code:
		<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="9971" event="script" value="other/changegold.lua"/>
		<action itemid="2157" event="script" value="other/changegold.lua"/>

exchange your changegold.lua by 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 = 9971, effect = TEXTCOLOR_TEAL
	},
	[9971] = {
		from = ITEM_CRYSTAL_COIN, to = 2157, effect = TEXTCOLOR_TEAL
	},
	[2157] = {
		from = 9971 , 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



and add that line in items as djivar said
 
Last edited:
Okay i want to make 3 Extra money things it goes from gold nuggets to gold ingots then from gold ingots to christmas token then from christmas tokens to scarab coins
 

Similar threads

Back
Top