• 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 Spell vendor NPC

soler91

New Member
Joined
Feb 16, 2016
Messages
5
Reaction score
0
Hello, i'm using OTX don't really know which one and i'm having problem with a spell vendor npc

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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

function creatureSayCallback(cid, type, msg)
     if not npcHandler:isFocused(cid) then
         return false
     end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
   
   
local node1 = keywordHandler:addKeyword({'great light'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn great light for 500 gp?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'great light',level = 1,vocation = 4,price = 500 })
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', price = 170, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'light'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light for free?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light', price = 0, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'find person'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn find person for 80 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'find person', price = 80, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})

local node1 = keywordHandler:addKeyword({'antidote'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn antidote for 150 gold coins?'})
node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'antidote', price = 150, level = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true})


     return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

The error is
Code:
[28/2/2016 23:19:45] [Error - NpcScript Interface]
[28/2/2016 23:19:45] data/npc/scripts/Carlin/Trisha.lua:onCreatureSay
[28/2/2016 23:19:45] Description:
[28/2/2016 23:19:45] data/npc/lib/npcsystem/modules.lua:112: attempt to call field 'vocation' (a number value)
[28/2/2016 23:19:45] stack traceback:
[28/2/2016 23:19:45]     data/npc/lib/npcsystem/modules.lua:112: in function 'callback'
[28/2/2016 23:19:45]     data/npc/lib/npcsystem/keywordhandler.lua:42: in function 'processMessage'
[28/2/2016 23:19:46]     data/npc/lib/npcsystem/keywordhandler.lua:177: in function 'processNodeMessage'
[28/2/2016 23:19:46]     data/npc/lib/npcsystem/keywordhandler.lua:129: in function 'processMessage'
[28/2/2016 23:19:46]     data/npc/lib/npcsystem/npchandler.lua:360: in function 'onCreatureSay'
[28/2/2016 23:19:46]     data/npc/scripts/Carlin/Trisha.lua:8: in function <data/npc/scripts/Carlin/Trisha.lua:8>

I have tried removing the vocation field, changing the orders and looking at other scripts doesnt help too much because this is 7.6 and the ones i've seen are using the trade window

Here's my lib folder http://www.mediafire.com/download/ybwg57sa3od9lac/lib.zip
 
Back
Top