thanhlan94
Dragonot.zapto.org Owner
- Joined
- Jun 11, 2011
- Messages
- 192
- Reaction score
- 14
Hello when I start my ot that i made a few years back it used to work but now it says this and I cannot make any npcs at all
Ive tried looking at the fourms but I could not find anything
Ive tried to make new npcs but it also did not work
Can anyone help me fix this errors, Thank you!
Example of npc:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Reborn Statue" script="data/npc/scripts/reborn.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look typeex="8780"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you want to {reborn}?!"/>
<parameter key="message_farewell" value="Farewell!"/>
</parameters>
</npc>
Example of the script:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local spellReborn = {
[1] = 'Reborn1',
[5] = 'Reborn5',
[10] = 'Reborn10',
[25] = 'Reborn25',
[50] = 'Reborn50',
[100] = 'Reborn100',
[250] = 'Reborn250',
[500] = 'Reborn500'
}
local level = 999999
local maxReborns = 10000
function onCreatureAppear(cid) npcHandler
nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler
nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler
nCreatureSay(cid, type, msg) end
function onThink() npcHandler
nThink() end
function greetCallback(cid)
Topic[cid] = nil
return true
end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif Topic[cid] then
if msgcontains(msg, 'yes') then
if getRebornsDone(cid) < maxReborns then
doAddReborns(cid) -- adds 1 reborn
doPlayerAddItem(cid, 9020,5)
for k, v in pairs(spellReborn) do
if getRebornsDone(cid) == k then
doPlayerLearnInstantSpell(cid, v)
doSendMagicEffect(getThingPosition(cid), CONST_ME_FIREWORK_RED)
break
end
end
local g = getPlayerGUID(cid)
npcHandler:releaseFocus(cid)
doRemoveCreature(cid)
db.executeQuery('UPDATE players SET level=100,experience=15219400 WHERE id=' .. g)
else
npcHandler:say('You reached maximum amount of reborns.', cid)
end
else
npcHandler:say('Maybe next time.', cid)
end
Topic[cid] = nil
else
if msgcontains(msg, 'reborn') then
if getPlayerLevel(cid) >= level then
npcHandler:say('Are you sure that you want to make reborn?',cid)
Topic[cid] = 1
else
npcHandler:say('You don\'t have enough level. ['..level..']',cid)
Topic[cid] = nil
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
The errors are down here:
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/addons.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/addons.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/addons.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/default.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/runes.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/runes.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/runes.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/addons.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/addons.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/addons.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/default.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/furniture.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:27] data/npc/scripts/furniture.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:27] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/furniture.lua
[19/02/2016 20:40:27] [Error - Npc interface]
[19/02/2016 20:40:27] data/npc/scripts/furniture.lua
[19/02/2016 20:40:27] Description:
[19/02/2016 20:40:27] data/npc/scripts/furniture.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:27] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/furniture.lua
Ive tried looking at the fourms but I could not find anything
Ive tried to make new npcs but it also did not work
Can anyone help me fix this errors, Thank you!
Example of npc:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Reborn Statue" script="data/npc/scripts/reborn.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look typeex="8780"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you want to {reborn}?!"/>
<parameter key="message_farewell" value="Farewell!"/>
</parameters>
</npc>
Example of the script:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local spellReborn = {
[1] = 'Reborn1',
[5] = 'Reborn5',
[10] = 'Reborn10',
[25] = 'Reborn25',
[50] = 'Reborn50',
[100] = 'Reborn100',
[250] = 'Reborn250',
[500] = 'Reborn500'
}
local level = 999999
local maxReborns = 10000
function onCreatureAppear(cid) npcHandler
function onCreatureDisappear(cid) npcHandler
function onCreatureSay(cid, type, msg) npcHandler
function onThink() npcHandler
function greetCallback(cid)
Topic[cid] = nil
return true
end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif Topic[cid] then
if msgcontains(msg, 'yes') then
if getRebornsDone(cid) < maxReborns then
doAddReborns(cid) -- adds 1 reborn
doPlayerAddItem(cid, 9020,5)
for k, v in pairs(spellReborn) do
if getRebornsDone(cid) == k then
doPlayerLearnInstantSpell(cid, v)
doSendMagicEffect(getThingPosition(cid), CONST_ME_FIREWORK_RED)
break
end
end
local g = getPlayerGUID(cid)
npcHandler:releaseFocus(cid)
doRemoveCreature(cid)
db.executeQuery('UPDATE players SET level=100,experience=15219400 WHERE id=' .. g)
else
npcHandler:say('You reached maximum amount of reborns.', cid)
end
else
npcHandler:say('Maybe next time.', cid)
end
Topic[cid] = nil
else
if msgcontains(msg, 'reborn') then
if getPlayerLevel(cid) >= level then
npcHandler:say('Are you sure that you want to make reborn?',cid)
Topic[cid] = 1
else
npcHandler:say('You don\'t have enough level. ['..level..']',cid)
Topic[cid] = nil
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
The errors are down here:
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/addons.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/addons.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/addons.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/default.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/runes.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/runes.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/runes.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/addons.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/addons.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/addons.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/default.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:26] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua
[19/02/2016 20:40:26] [Error - Npc interface]
[19/02/2016 20:40:26] data/npc/scripts/furniture.lua
[19/02/2016 20:40:26] Description:
[19/02/2016 20:40:27] data/npc/scripts/furniture.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:27] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/furniture.lua
[19/02/2016 20:40:27] [Error - Npc interface]
[19/02/2016 20:40:27] data/npc/scripts/furniture.lua
[19/02/2016 20:40:27] Description:
[19/02/2016 20:40:27] data/npc/scripts/furniture.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[19/02/2016 20:40:27] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/furniture.lua