Boa tarde!
Criei um NPC que teleporta playres, porém aparece essa mensagem de erro no executável
Lua Script Error: [Npc interface]
data/npc/scripts/Son of Ferumbras.lua:onCreatureSay
data/npc/lib/npcsystem/modules.lua:226: attempt to call method 'sendMagicEffect' (a nil value)
stack traceback:
[C]: in function 'sendMagicEffect'
data/npc/lib/npcsystem/modules.lua:226: in function 'callback'
data/npc/lib/npcsystem/keywordhandler.lua:31: in function 'processMessage'
data/npc/lib/npcsystem/keywordhandler.lua:186: in function 'processNodeMessage'
data/npc/lib/npcsystem/keywordhandler.lua:154: in function 'processMessage'
data/npc/lib/npcsystem/npchandler.lua:427: in function 'onCreatureSay'
data/npc/scripts/Son of Ferumbras.lua:7: in function <data/npc/scripts/Son of Ferumbras.lua:7>
O Arquivo Xml deste npc está desta forma:
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
local lastSound = 0
function onThink()
if lastSound < os.time() then
lastSound = (os.time() + 5)
if math.random(100) < 25 then
Npc():say('I can help you through the walls.', TALKTYPE_SAY)
end
end
npcHandler:onThink()
end
local travelNode = keywordHandler:addKeyword({'teleport'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be teleported beyond the city walls?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x = 18427, y = 17588, z = 7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Who knows the next time?'})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Kanur. I am Ferumbras's son and friend of God Sued."})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm a wizard."})
keywordHandler:addKeyword({'wizard'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a very powerful wizard."})
keywordHandler:addKeyword({'walls'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The walls protects us from intruders."})
keywordHandler:addKeyword({'city'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This is the City of Chosen ."})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Sued is our supreme God."})
keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but I don't teleport to Carlin!"})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but I don't teleport to Thais!"})
keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but I don't teleport to Venore!"})
keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but I don't teleport to Edron!"})
keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but I don't teleport to Darashia!"})
keywordHandler:addKeyword({'darama'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I'm sorry, but I don't teleport to Darashia!"})
keywordHandler:addKeyword({'mythus'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It's a big world with wonderful adventures. "})
keywordHandler:addKeyword({'kayrus'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This is Kayrus. Where do you want to go?"})
npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|. Our God Sued bless you! Dou you need a {teleport} beyond the city walls?")
npcHandler:setMessage(MESSAGE_FAREWELL, "God Sued bless you! Come back soon!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "God Sued belss you!")
npcHandler:addModule(FocusModule:new())
Como posso resolver este erro?