I am trying to make the "sell" value in this code change based on the rank. Currently the code works to sell items at higher prices based on the rank, but the trade window doesn't update to reflect the new value.
I thought maybe this would do the trick
This gives me "attempt to perform arithmetic on field 'sell' a nil value"
Mostly working code below-
I thought maybe this would do the trick
Code:
local rank = .75
local function getTable(player)
local itemsList = {
{name="axe ring", id=2208, buy=100, sell=(500*rank)},
Mostly working code below-
Code:
local rank_neutral = .75
local function getTable(player)
local itemsList = {
{name="ring", id=2208, buy=100, sell=500},
{name="necklace", id=2209, buy=100, sell=500},
{name="trinket", id=2188, buy=1000, sell=600}
}
return itemsList
end
local function setNewTradeTable(table)
local items, item = {}
for i = 1, #table do
item = table[i]
sellPrice = (item.sell * rank_neutral)
items[item.id] = {itemId = item.id, buyPrice = item.buy, sellPrice, subType = item.subType, realName = item.name}
print (sellPrice)
end
return items
end