• 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=100cc

mocoba

New Member
Joined
Aug 23, 2008
Messages
332
Reaction score
0
Iam Sorry Guys But I need Help
i want make
gold nugget=100cc
I will be Thanks If anyone Help me
Thanks
 
in Items.xml

replace:
Code:
<item id="2157" article="a" name="gold nugget" plural="gold nuggets">
		<attribute key="weight" value="10" />
	</item>

with:
Code:
<item id="2157" article="a" name="gold nugget" plural="gold nuggets">
	<attribute key="weight" value="10" />
        <attribute key="worth" value="1000000" />
</item>
 
edit the "Changegold.lua" to this:

PHP:
--Configurations
local ITEM_NUGGET = 2157 -- Nugget ID
--End of Configs

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then --Gold Coin to Platinum Coin
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)
		doSendAnimatedText(fromPosition, "Platinum", TEXTCOLOR_LIGHTBLUE)
	elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then --Platinum Coin to Crystal Coin
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, 1)
		doSendAnimatedText(fromPosition, "Crystal!", TEXTCOLOR_TEAL)
	elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then --Platinum Coin to Gold Coin
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_GOLD_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "Gold", TEXTCOLOR_YELLOW)
	elseif item.itemid == ITEM_CRYSTAL_COIN and item.type < ITEMCOUNT_MAX then --Crystal Coin to Platinum Coin
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "Platinum", TEXTCOLOR_LIGHTBLUE)
	elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then --Crystal Coin to Nugget
		doChangeTypeItem(item.uid, item.type - item.type)
        doPlayerAddItem(cid, ITEM_NUGGET,1)
        doSendAnimatedText(fromPosition, "Nugget", TEXTCOLOR_YELLOW)
	  else
		return FALSE
	end
	return TRUE
end

Then, make a new Lua file called "changenugget.lua" inside "actions/scripts/other"

PHP:
--Configurations
local ITEM_NUGGET = 2157 -- Nugget ID
--End of Configs

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == ITEM_NUGGET then --Nugget to Crystal Coin
	doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "Crystal", TEXTCOLOR_TEAL)
	  else
		return FALSE
	end
	return TRUE
end

and now go to actions/actions.xml then add this
PHP:
<action itemid="2157" script="other/changenugget.lua"/>


rep+++
 
I used that script too. But when you want to buy items from NPC with nuggets it will not accept it.. lol ;9 i changed in source it failed XD
 
in action .xml serch for <!-- Change gold -->
and replace lines under it by those

PHP:
	<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

PHP:
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

rep++
 
Yes, you can also just test it.
Could you help me? I have a banker npc how can i add so he accepts gold nuggets to?
This is my bank npc

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Banker" script="data/npc/scripts/bank.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="132" head="97" body="21" legs="76" feet="19" addons="3" corpse="2212"/>
    <parameters>
        <parameter key="message_greet" value="Welcome |PLAYERNAME|. What can I do for you? {Deposit}, {withdraw}, check {balance} or {transfer}? I can also {change} gold for you." />
    </parameters>
</npc>
 
Last edited:
Back
Top