With this system you will be able to transform 100 crystal coins to a new coin without making new actions, only adding variables at lib, also you can use it to buy with it as a normal coin
Example:
___________________
---->
___________________
---->
___________________
1. lib/000-constant.lua:
After:
Add:
2. data/actions/scripts/other/changegold.lua
Reeplace your script with this
3. actions/actions.xml:
4. Items/items.xml
Add this tag to the coin
That's it eace:
Example:
___________________
___________________
___________________
1. lib/000-constant.lua:
After:
Lua:
ITEM_CRYSTAL_COIN = 2160
Add:
Lua:
ITEM_SUPER_COIN = ID-OF-YOUR-NEW-COIN
2. data/actions/scripts/other/changegold.lua
Reeplace your 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 = ITEM_SUPER_COIN, effect = TEXTCOLOR_TEAL
},
[ITEM_SUPER_COIN] = {
from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_WHITE
}
}
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
3. actions/actions.xml:
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="XXXX" event="script" value="other/changegold.lua"/>
4. Items/items.xml
Add this tag to the coin
Lua:
<attribute key="worth" value="1000000" />
That's it eace:
Last edited: