• 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 Buy items From Npc (tibia 8.60-Tfs 0.4)

Gaber Zen

Well-Known Member
Joined
Apr 22, 2023
Messages
224
Reaction score
51
Location
Egypt
Hello Guy`s
When buy items from shop, have Erro?
but i can buy skin amulet, other items not, why?
Tfs 0.4
Tibia Clinet 8.60
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'star amulet'}, 2131, 4000000, 'star amulet')
shopModule:addBuyableItem({'ruby necklace'}, 2133, 2000000, 'ruby necklace')
shopModule:addBuyableItem({'emerald bangle'}, 2127, 3500000,'emerald bangle')
shopModule:addBuyableItem({'stone skin amulet'}, 2197, 10000, 5,'stone skin amulet')

npcHandler:addModule(FocusModule:new())
 

Attachments

try..

NPC XML.
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Deruno" script="default.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="132" head="20" body="39" legs="45" feet="7" addons="0"/>
    <parameters>
        <parameter key="module_shop" value="1"/>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. Are you interested in something?"/>
        <parameter key="shop_buyable" value="star amulet,2131,4000000;ruby necklace,2133,2000000;emerald bangle,2127,3500000;stone skin amulet,2197,10000,5"/>
        
    </parameters>
</npc>

default.lua
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid)         end
function onCreatureSay(cid, type, msg)      npcHandler:onCreatureSay(cid, type, msg)    end
function onThink()                          npcHandler:onThink()                        end

npcHandler:addModule(FocusModule:new())
 
Back
Top