• 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!

Lua Npc Buying *2 double items

Joined
Aug 15, 2014
Messages
143
Reaction score
24
So when I buyed 1x they sold me 2x. When I buyed 2x sold me 4x and 3x sold me 6x....



I use in scripts/Aldee.lua

--Buyable
shopModule:addBuyableItem({'short sword'},2406,30,'short sword')
shopModule:addBuyableItem({'hand axe'},2380,8,'hand axe')


I tried to use:
shopModule:addBuyableItem({'short sword'},2406,30,'short sword')
shopModule:addBuyableItem({'hand axe'},2380,8,'hand axe')


I guess is something in modules or npchandler.

When I talk buy 1 short sword, is working fine the npc sell me right 1x
Buy when I use trade options he sold me double items.

I guess is something aprox this:
Lua:
if SHOPMODULE_MODE ~= SHOPMODULE_MODE_TALK then
            if itemSubType == nil then
                itemSubType = 0
            end

            local shopItem = self:getShopItem(itemid, itemSubType)
            if shopItem == nil then
                self.npcHandler.shopItems[#self.npcHandler.shopItems + 1] = {id = itemid, buy = -1, sell = cost, subType = itemSubType, name = realName or ItemType(itemid):getName()}
            else
                shopItem.sell = cost
            end
        end


Can someone help me?
Thanks
Post automatically merged:

Solved:

Function in xml and lua repeting

Removed:

<parameter key="module_shop" value="1"/>
<parameter key="shop_buyable" value="" />
<parameter key="shop_sellable" value="" />
 

Attachments

Last edited:
Back
Top