Ir para conteúdo

Duvida Otserver Global 8.7 Erro No Console


rDs7008

Posts Recomendados

Estou tendo erros no console em relação a todos npcs, segue a mensagem que aparece para cada um dos npcs:

[02/04/2011 14:46:49] Lua Script Error: [Npc interface]

[02/04/2011 14:46:49] data/npc/scripts/Sell/food.lua

[02/04/2011 14:46:49] data/npc/scripts/Sell/food.lua:1: attempt to index global 'KeywordHandler' (a nil value)

[02/04/2011 14:46:49] stack traceback:

[02/04/2011 14:46:50] [C]: in function '__index'

[02/04/2011 14:46:50] data/npc/scripts/Sell/food.lua:1: in main chunk

[02/04/2011 14:46:50] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/Sell/food.lua

[02/04/2011 14:46:50] cannot open santaclaus.lua: No such file or directory

 

 

e tambem um outro erro no npc system que aparece no final:

[02/04/2011 14:48:43] Lua Script Error: [Npc interface]

[02/04/2011 14:48:43] data/npc/lib/npc.lua

[02/04/2011 14:48:43] cannot open npc/lib/npcsystem/keywordhandler.lua: No such file or directory

[02/04/2011 14:48:43] stack traceback:

[02/04/2011 14:48:43] [C]: ?

[02/04/2011 14:48:43] [C]: in function 'dofile'

[02/04/2011 14:48:43] data/npc/lib/npcsystem/npcsystem.lua:6: in main chunk

[02/04/2011 14:48:44] [C]: in function 'dofile'

[02/04/2011 14:48:44] data/npc/lib/npc.lua:2: in main chunk

[02/04/2011 14:48:44] Warning: [NpcScriptInterface::loadNpcLib] Can not load data/npc/lib/npc.lua

[02/04/2011 14:48:44] Warning: [Npc::loadInteraction] Missing time attribute for onidle event

 

 

Meu server eh global 8.7 tfs preciso muito de ajuda pra solucionar esse bug.

plz :X

 

vou colocar em spoiler os arquivos.

npc.lua

 

 

 

-- Including the Advanced NPC System

dofile('data/npc/lib/npcsystem/npcsystem.lua')

 

do

doPlayerAddStackable = doPlayerAddItem

--Returns table with UIDs of added items

doPlayerAddItem = function(cid, itemid, amount, subType)

local amount = amount or 1

local subAmount = 0

local subType = subType or 0

 

if(isItemStackable(itemid) == TRUE) then

return doPlayerAddStackable(cid, itemid, amount), amount

end

 

local items = {}

local ret = 0

local a = 0

for i = 1, amount do

items = doCreateItemEx(itemid, subType)

ret = doPlayerAddItemEx(cid, items, 1)

if(ret ~= RETURNVALUE_NOERROR) then

break

end

a = a + 1

end

 

return items, a

end

end

 

function getDistanceToCreature(id)

if id == 0 or id == nil then

selfGotoIdle()

end

 

local creaturePosition = getCreaturePosition(id)

cx = creaturePosition.x

cy = creaturePosition.y

cz = creaturePosition.z

if cx == nil then

return nil

end

 

sx, sy, sz = selfGetPosition()

return math.max(math.abs(sx - cx), math.abs(sy - cy))

end

 

function moveToPosition(x,y,z)

selfMoveTo(x, y, z)

end

 

function moveToCreature(id)

if id == 0 or id == nil then

selfGotoIdle()

end

 

tx, ty, tz = getCreaturePosition(id)

if tx == nil then

selfGotoIdle()

else

moveToPosition(tx, ty, tz)

end

end

 

function selfGotoIdle()

following = false

attacking = false

selfAttackCreature(0)

target = 0

end

 

function isPlayerPremiumCallback(cid)

return isPremium(cid) == TRUE and true or false

end

 

function msgcontains(message, keyword)

local message, keyword = message:lower(), keyword:lower()

if message == keyword then

return true

end

return message:find(keyword) and not message:find('(%w+)' .. keyword)

end

 

function selfSayChannel(cid, message)

return selfSay(message, cid, FALSE)

end

 

function doPosRemoveItem(_itemid, n, position)

local thing = getThingfromPos({x = position.x, y = position.y, z = position.z, stackpos = 1})

if thing.itemid == _itemid then

doRemoveItem(thing.uid, n)

else

return false

end

return true

end

 

 

npcsystem.lua

 

 

-- Advanced NPC System (Created by Jiddo),

-- Modified by Talaturen.

 

if(NpcSystem == nil) then

-- Loads the underlying classes of the npcsystem.

dofile('npc/lib/npcsystem/keywordhandler.lua')

dofile('npc/lib/npcsystem/queue.lua')

dofile('npc/lib/npcsystem/npchandler.lua')

dofile('npc/lib/npcsystem/modules.lua')

 

-- Global npc constants:

 

-- Keyword nestling behavior. For more information look at the top of keywordhandler.lua

KEYWORD_BEHAVIOR = BEHAVIOR_NORMAL_EXTENDED

 

-- Greeting and unGreeting keywords. For more information look at the top of modules.lua

FOCUS_GREETWORDS = {'hi', 'hello', 'hey'}

FOCUS_FAREWELLWORDS = {'bye', 'farewell', 'cya'}

 

-- The word for requesting trade window. For more information look at the top of modules.lua

SHOP_TRADEREQUEST = {'offer', 'trade'}

 

-- The word for accepting/declining an offer. CAN ONLY CONTAIN ONE FIELD! For more information look at the top of modules.lua

SHOP_YESWORD = {'yes'}

SHOP_NOWORD = {'no'}

 

-- Pattern used to get the amount of an item a player wants to buy/sell.

PATTERN_COUNT = '%d+'

 

-- Talkdelay behavior. For more information, look at the top of npchandler.lua.

NPCHANDLER_TALKDELAY = TALKDELAY_ONTHINK

 

-- Conversation behavior. For more information, look at the top of npchandler.lua.

NPCHANDLER_CONVBEHAVIOR = CONVERSATION_PRIVATE

 

-- Constant strings defining the keywords to replace in the default messages.

-- For more information, look at the top of npchandler.lua...

TAG_PLAYERNAME = '|PLAYERNAME|'

TAG_ITEMCOUNT = '|ITEMCOUNT|'

TAG_TOTALCOST = '|TOTALCOST|'

TAG_ITEMNAME = '|ITEMNAME|'

TAG_QUEUESIZE = '|QUEUESIZE|'

 

NpcSystem = {}

 

-- Gets an npcparameter with the specified key. Returns nil if no such parameter is found.

function NpcSystem.getParameter(key)

local ret = getNpcParameter(tostring(key))

if((type(ret) == 'number' and ret == 0) or ret == nil) then

return nil

else

return ret

end

end

 

-- Parses all known parameters for the npc. Also parses parseable modules.

function NpcSystem.parseParameters(npcHandler)

local ret = NpcSystem.getParameter('idletime')

if(ret ~= nil) then

npcHandler.idleTime = tonumber(ret)

end

local ret = NpcSystem.getParameter('talkradius')

if(ret ~= nil) then

npcHandler.talkRadius = tonumber(ret)

end

local ret = NpcSystem.getParameter('message_greet')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_GREET, ret)

end

local ret = NpcSystem.getParameter('message_farewell')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_FAREWELL, ret)

end

local ret = NpcSystem.getParameter('message_decline')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_DECLINE, ret)

end

local ret = NpcSystem.getParameter('message_needmorespace')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_NEEDMORESPACE, ret)

end

local ret = NpcSystem.getParameter('message_needspace')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_NEEDSPACE, ret)

end

local ret = NpcSystem.getParameter('message_sendtrade')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_SENDTRADE, ret)

end

local ret = NpcSystem.getParameter('message_noshop')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_NOSHOP, ret)

end

local ret = NpcSystem.getParameter('message_oncloseshop')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_ONCLOSESHOP, ret)

end

local ret = NpcSystem.getParameter('message_onbuy')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_ONBUY, ret)

end

local ret = NpcSystem.getParameter('message_onsell')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_ONSELL, ret)

end

local ret = NpcSystem.getParameter('message_missingmoney')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_MISSINGMONEY, ret)

end

local ret = NpcSystem.getParameter('message_needmoney')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_NEEDMONEY, ret)

end

local ret = NpcSystem.getParameter('message_missingitem')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_MISSINGITEM, ret)

end

local ret = NpcSystem.getParameter('message_needitem')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_NEEDITEM, ret)

end

local ret = NpcSystem.getParameter('message_idletimeout')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_IDLETIMEOUT, ret)

end

local ret = NpcSystem.getParameter('message_walkaway')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_WALKAWAY, ret)

end

local ret = NpcSystem.getParameter('message_alreadyfocused')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_ALREADYFOCUSED, ret)

end

local ret = NpcSystem.getParameter('message_placedinqueue')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, ret)

end

local ret = NpcSystem.getParameter('message_buy')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_BUY, ret)

end

local ret = NpcSystem.getParameter('message_sell')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_SELL, ret)

end

local ret = NpcSystem.getParameter('message_bought')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_BOUGHT, ret)

end

local ret = NpcSystem.getParameter('message_sold')

if(ret ~= nil) then

npcHandler:setMessage(MESSAGE_SOLD, ret)

end

 

-- Parse modules.

for parameter, module in pairs(Modules.parseableModules) do

local ret = NpcSystem.getParameter(parameter)

if(ret ~= nil) then

local number = tonumber(ret)

if(number ~= 0 and module.parseParameters ~= nil) then

local instance = module:new()

npcHandler:addModule(instance)

instance:parseParameters()

end

end

end

end

end

 

 

 

 

se precisar de mais algum deixa mp ou posta repply aki.

grato

Link para o comentário
Compartilhar em outros sites

Tenta esse noc system aki

 

-- Advanced NPC System (Created by Jiddo), -- Modified by Talaturen. if(NpcSystem == nil) then -- Loads the underlying classes of the npcsystem. dofile('data/npc/lib/npcsystem/keywordhandler.lua') dofile('data/npc/lib/npcsystem/queue.lua') dofile('data/npc/lib/npcsystem/npchandler.lua') dofile('data/npc/lib/npcsystem/modules.lua') -- Global npc constants: -- Keyword nestling behavior. For more information look at the top of keywordhandler.lua KEYWORD_BEHAVIOR = BEHAVIOR_NORMAL_EXTENDED -- Greeting and unGreeting keywords. For more information look at the top of modules.lua FOCUS_GREETWORDS = {'hi', 'hello', 'hey'} FOCUS_FAREWELLWORDS = {'bye', 'farewell', 'cya'} -- The word for requesting trade window. For more information look at the top of modules.lua SHOP_TRADEREQUEST = {'offer', 'trade'} -- The word for accepting/declining an offer. CAN ONLY CONTAIN ONE FIELD! For more information look at the top of modules.lua SHOP_YESWORD = {'yes'} SHOP_NOWORD = {'no'} -- Pattern used to get the amount of an item a player wants to buy/sell. PATTERN_COUNT = '%d+' -- Talkdelay behavior. For more information, look at the top of npchandler.lua. NPCHANDLER_TALKDELAY = TALKDELAY_ONTHINK -- Conversation behavior. For more information, look at the top of npchandler.lua. NPCHANDLER_CONVBEHAVIOR = CONVERSATION_PRIVATE -- Constant strings defining the keywords to replace in the default messages. -- For more information, look at the top of npchandler.lua... TAG_PLAYERNAME = '|PLAYERNAME|' TAG_ITEMCOUNT = '|ITEMCOUNT|' TAG_TOTALCOST = '|TOTALCOST|' TAG_ITEMNAME = '|ITEMNAME|' TAG_QUEUESIZE = '|QUEUESIZE|' NpcSystem = {} -- Gets an npcparameter with the specified key. Returns nil if no such parameter is found. function NpcSystem.getParameter(key) local ret = getNpcParameter(tostring(key)) if((type(ret) == 'number' and ret == 0) or ret == nil) then return nil else return ret end end -- Parses all known parameters for the npc. Also parses parseable modules. function NpcSystem.parseParameters(npcHandler) local ret = NpcSystem.getParameter('idletime') if(ret ~= nil) then npcHandler.idleTime = tonumber(ret) end local ret = NpcSystem.getParameter('talkradius') if(ret ~= nil) then npcHandler.talkRadius = tonumber(ret) end local ret = NpcSystem.getParameter('message_greet') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_GREET, ret) end local ret = NpcSystem.getParameter('message_farewell') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_FAREWELL, ret) end local ret = NpcSystem.getParameter('message_decline') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_DECLINE, ret) end local ret = NpcSystem.getParameter('message_needmorespace') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_NEEDMORESPACE, ret) end local ret = NpcSystem.getParameter('message_needspace') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_NEEDSPACE, ret) end local ret = NpcSystem.getParameter('message_sendtrade') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_SENDTRADE, ret) end local ret = NpcSystem.getParameter('message_noshop') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_NOSHOP, ret) end local ret = NpcSystem.getParameter('message_oncloseshop') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_ONCLOSESHOP, ret) end local ret = NpcSystem.getParameter('message_onbuy') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_ONBUY, ret) end local ret = NpcSystem.getParameter('message_onsell') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_ONSELL, ret) end local ret = NpcSystem.getParameter('message_missingmoney') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_MISSINGMONEY, ret) end local ret = NpcSystem.getParameter('message_needmoney') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_NEEDMONEY, ret) end local ret = NpcSystem.getParameter('message_missingitem') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_MISSINGITEM, ret) end local ret = NpcSystem.getParameter('message_needitem') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_NEEDITEM, ret) end local ret = NpcSystem.getParameter('message_idletimeout') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_IDLETIMEOUT, ret) end local ret = NpcSystem.getParameter('message_walkaway') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_WALKAWAY, ret) end local ret = NpcSystem.getParameter('message_alreadyfocused') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_ALREADYFOCUSED, ret) end local ret = NpcSystem.getParameter('message_placedinqueue') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, ret) end local ret = NpcSystem.getParameter('message_buy') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_BUY, ret) end local ret = NpcSystem.getParameter('message_sell') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_SELL, ret) end local ret = NpcSystem.getParameter('message_bought') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_BOUGHT, ret) end local ret = NpcSystem.getParameter('message_sold') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_SOLD, ret) end -- Parse modules. for parameter, module in pairs(Modules.parseableModules) do local ret = NpcSystem.getParameter(parameter) if(ret ~= nil) then local number = tonumber(ret) if(number ~= 0 and module.parseParameters ~= nil) then local instance = module:new() npcHandler:addModule(instance) instance:parseParameters() end end end end end

 

 

Coloca esse aki tanbem o npc.lua

 

-- Including the Advanced NPC System

dofile('data/npc/lib/npcsystem/npcsystem.lua')

 

do

doPlayerAddStackable = doPlayerAddItem

--Returns table with UIDs of added items

doPlayerAddItem = function(cid, itemid, amount, subType)

local amount = amount or 1

local subAmount = 0

local subType = subType or 0

 

if(isItemStackable(itemid) == TRUE) then

return doPlayerAddStackable(cid, itemid, amount), amount

end

 

local items = {}

local ret = 0

local a = 0

for i = 1, amount do

items = doCreateItemEx(itemid, subType)

ret = doPlayerAddItemEx(cid, items, 1)

if(ret ~= RETURNVALUE_NOERROR) then

break

end

a = a + 1

end

 

return items, a

end

end

 

function getDistanceToCreature(id)

if id == 0 or id == nil then

selfGotoIdle()

end

 

local creaturePosition = getCreaturePosition(id)

cx = creaturePosition.x

cy = creaturePosition.y

cz = creaturePosition.z

if cx == nil then

return nil

end

 

sx, sy, sz = selfGetPosition()

return math.max(math.abs(sx - cx), math.abs(sy - cy))

end

 

function moveToPosition(x,y,z)

selfMoveTo(x, y, z)

end

 

function moveToCreature(id)

if id == 0 or id == nil then

selfGotoIdle()

end

 

tx, ty, tz = getCreaturePosition(id)

if tx == nil then

selfGotoIdle()

else

moveToPosition(tx, ty, tz)

end

end

 

function selfGotoIdle()

following = false

attacking = false

selfAttackCreature(0)

target = 0

end

 

function isPlayerPremiumCallback(cid)

return isPremium(cid) == TRUE and true or false

end

 

function msgcontains(message, keyword)

local message, keyword = message:lower(), keyword:lower()

if message == keyword then

return true

end

return message:find(keyword) and not message:find('(%w+)' .. keyword)

end

 

function selfSayChannel(cid, message)

return selfSay(message, cid, FALSE)

end

 

function doPosRemoveItem(_itemid, n, position)

local thing = getThingfromPos({x = position.x, y = position.y, z = position.z, stackpos = 1})

if thing.itemid == _itemid then

doRemoveItem(thing.uid, n)

else

return false

end

return true

end

 

Nao esqueçe do +rep se te ajudei

Editado por Mdgabrielzim
Link para o comentário
Compartilhar em outros sites

  • 4 months later...

Alguns vão falar porque reviver um tópico velho, mas quando eu resolvi o meu problema eu procurei neste post e não achei

 

A questão do seu problema é o diretorio do script no xml do npc exemplo

 

No meu tava assim

script="tools.lua"...

 

Coloque assim

script="data/npc/scripts/Sell/tools.lua"...

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...