• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[NPC]addBuyableItemContainer

squall14

New Member
Joined
Dec 28, 2007
Messages
34
Reaction score
0
Well i was looking into the npc system code and i found a nice function addBuyableItemContainer ok so i try to set up an npc and it gives me this console error

Code:
data/npc/lib/npcsystem/modules.lua:787 attempt to index field 'npcHandler' a nil value

so i go to modules.lua to see the problem and i couldnt find anything... im not sure if im doing someh wrong so here is my npc script

Code:
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:addBuyableItemContainer({'bp sd'}, 1998, 2268, 100, 3, 'Backpack of sudden death')
npcHandler:addModule(FocusModule:new())
 
Last edited:
you need to add addBuyableItemContainer in modules.lua
I do not know where tho. i got the same problem
 
Back
Top