Elpulpo
Member
- Joined
- Mar 18, 2016
- Messages
- 52
- Reaction score
- 8
I need to transform this TFS 1.x function to OTHire (7.72).
It looks for the amount of money in a position and returns a variable with the amount of money.
Can anyone help me?
Code:
local function getMoneyAmount(position)
local moneyAmount = 0
for _, item in ipairs(Tile(position):getItems()) do
local itemId = item:getId()
if itemId == ITEM_GOLD_COIN then
moneyAmount = moneyAmount + item.type
elseif itemId == ITEM_PLATINUM_COIN then
moneyAmount = moneyAmount + item.type * 100
elseif itemId == ITEM_CRYSTAL_COIN then
moneyAmount = moneyAmount + item.type * 10000
end
end
return moneyAmount
end
Can anyone help me?