How to mod a coin exchange
-
KnotuAgain
- Posts: 17
- Joined: Sun Oct 05, 2014 7:29 am
How to mod a coin exchange
I would like to create a mod that would exchange 10 copper coins for 1 gold coin. However it counts one stack of coins as one. Short of having to put ten coins in one at a time, is here anything else I can do?
- cromcrom
- Posts: 549
- Joined: Tue Sep 11, 2012 7:16 am
- Location: Chateauroux in a socialist s#!$*&% formerly known as "France"
Re: How to mod a coin exchange
Hi there. I created this system for The Lost Continent. I hope it helps.
Code: Select all
--gold_coin
defineObject{
name = "gold_coin",
class = "Item",
uiName = "Gold coin",
model = "mod_assets/models/goldcoin.fbx",
gfxAtlas = "mod_assets/textures/TLC_items.tga",
gfxIndex = 8,
stackable = true,
weight = 0,
}
--copper_coin
defineObject{
name = "copper_coin",
class = "Item",
uiName = "Copper coin",
model = "mod_assets/models/coppercoin.fbx",
gfxAtlas = "mod_assets/textures/TLC_items.tga",
gfxIndex = 20,
stackable = true,
weight = 0,
description = "Use the copper coins to change ten of them into a silver coin.",
onUseItem = function(self,champion)
local stackSize = self:getStackSize()
if stackSize >= 11 then
spawn("silver_coin",party.level,party.x,party.y,party.facing)
local newStackSize = stackSize - 10
self:setStackSize(newStackSize)
end
end,
}
--silver_coin
defineObject{
name = "silver_coin",
class = "Item",
uiName = "Silver coin",
model = "mod_assets/models/silvercoin.fbx",
gfxAtlas = "mod_assets/textures/TLC_items.tga",
gfxIndex = 9,
stackable = true,
weight = 0,
description = "Use the silver coins to change ten of them into a gold coin.",
onUseItem = function(self,champion)
local stackSize = self:getStackSize()
if stackSize >= 11 then
spawn("gold_coin",party.level,party.x,party.y,party.facing)
local newStackSize = stackSize - 10
self:setStackSize(newStackSize)
end
end,
} A trip of a thousand leagues starts with a step.
-
KnotuAgain
- Posts: 17
- Joined: Sun Oct 05, 2014 7:29 am
Re: How to mod a coin exchange
Thank you, I will try it.
- cromcrom
- Posts: 549
- Joined: Tue Sep 11, 2012 7:16 am
- Location: Chateauroux in a socialist s#!$*&% formerly known as "France"
Re: How to mod a coin exchange
YW. I created copper, silver and gold coins, and "using" them piles would make some 1/10 exchange. This is what these scripts does.
A trip of a thousand leagues starts with a step.