Olha, estou com problemas nos scripts dos NPCs do Warmaster Addon 1 e 2... quando alguém fala com esses NPCs surge os seguintes erros no console, e o NPC não está pegando os itens necessários para fazer o addon, segue os erros do console:
[01/01/2013 19:20:09] [Error - Npc interface]
[01/01/2013 19:20:09] data/npc/scripts/Warmaster Addon 1.lua:onThink
[01/01/2013 19:20:09] Description:
[01/01/2013 19:20:09] data/npc/scripts/Warmaster Addon 1.lua:104: attempt to compare number with nil
[01/01/2013 19:20:10] stack traceback:
[01/01/2013 19:20:10] data/npc/scripts/Warmaster Addon 1.lua:104: in function <data/npc/scripts/Warmaster Addon 1.lua:94>
[01/01/2013 19:11:37] [Error - Npc interface]
[01/01/2013 19:11:37] data/npc/scripts/Warmaster Addon 2.lua:onCreatureSay
[01/01/2013 19:11:37] Description:
[01/01/2013 19:11:37] data/npc/scripts/Warmaster Addon 2.lua:80: attempt to call global 'creatureGetName' (a nil value)
[01/01/2013 19:11:37] stack traceback:
[01/01/2013 19:11:37] data/npc/scripts/Warmaster Addon 2.lua:80: in function <data/npc/scripts/Warmaster Addon 2.lua:33>
Segue o script dos NPCs:
Warmaster addon 1:
local focus = 0
local talk_start = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hiho ' .. getCreatureName(cid) .. ' Eu posso lhe conceder o Warmaster addon 1, para mais infos. diga help...')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Eu falo com você em um minuto.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'help') then
selfSay('Para saber o que eh preciso para obter o Warmaster addon 1 diga: addon 1')
elseif msgcontains(msg, 'addon 1') then
if getPlayerStorageValue(cid,999999) >= 2 then
selfSay('Voce ja tem esse addon.')
else if getPlayerStorageValue(cid,999999) == 1 then
selfSay('Preciso de uma zaoan sword e de 100k, você trouxe para mim?')
addon_state = 2
else
setPlayerStorageValue(cid,999999,1)
selfSay('Preciso de uma zaoan sword e de 100k, você trouxe para mim?')
end
end
elseif msgcontains(msg, 'yes') and addon_state == 2 then
if doPlayerRemoveItem(cid,2160, 10) == 0 or doPlayerRemoveItem(cid,11301, 1) == 0 then
selfSay('Desculpe mas você não os tem 100k...')
else
selfSay('Obrigado, agora você tem o novo addon da terra dos Warmasters!')
if getPlayerSex(cid) == 0 then
doPlayerAddOutfit(cid, 335, 1)
setPlayerStorageValue(cid,999999,2)
else
doPlayerAddOutfit(cid, 336, 1)
setPlayerStorageValue(cid,999999,2)
talk_state = 1
end
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Adeus ' .. creatureGetName(cid) .. ', Volte sempre.')
focus = 0
talk_start = 0
elseif msg ~= "" then
selfSay('Como? Eu não entendi!')
talk_state = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Proximo!...')
end
focus = 0
talk_start = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good Bye')
focus = 0
talk_start = 0
end
end
end
Warmaster addon 2:
local focus = 0
local talk_start = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hiho ' .. getCreatureName(cid) .. ' Eu posso lhe conceder o Warmaster addon 2, para mais infos. diga help...')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Eu falo com você em um minuto.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'help') then
selfSay('Para saber o que eh preciso para obter o Warmaster addon 2 diga: addon 2')
elseif msgcontains(msg, 'addon 2') then
if getPlayerStorageValue(cid,999998) >= 2 then
selfSay('Voce ja tem esse addon.')
else if getPlayerStorageValue(cid,999998) == 1 then
selfSay('Preciso de uma baiak sword e 100k , você trouxe para mim ?')
addon_state = 2
else
setPlayerStorageValue(cid,999998,1)
selfSay('Preciso de uma baiak sword e 100k, você trouxe para mim ?')
end
end
elseif msgcontains(msg, 'yes') and addon_state == 2 then
if doPlayerRemoveItem(cid,2160, 10) == 0 or doPlayerRemoveItem(cid,8931, 1) == 0 then
selfSay('Desculpe mas você não tem os 100k...')
else
selfSay('Obrigado, agora você tem o novo addon da terra dos Warmasters!')
if getPlayerSex(cid) == 0 then
doPlayerAddOutfit(cid, 335, 2)
setPlayerStorageValue(cid,999998,2)
else
doPlayerAddOutfit(cid, 336, 2)
setPlayerStorageValue(cid,999998,2)
talk_state = 1
end
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Adeus ' .. creatureGetName(cid) .. ', Volte Sempre.')
focus = 0
talk_start = 0
elseif msg ~= "" then
selfSay('Como? Eu não entendi!')
talk_state = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Proximo!!...')
end
focus = 0
talk_start = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good Bye')
focus = 0
talk_start = 0
end
end
end
Alguém saberia me dizer o que há de errado nos scrripts!?
Pergunta
juliok80 17
Olá xtibianos, blz!?
Olha, estou com problemas nos scripts dos NPCs do Warmaster Addon 1 e 2... quando alguém fala com esses NPCs surge os seguintes erros no console, e o NPC não está pegando os itens necessários para fazer o addon, segue os erros do console:
Segue o script dos NPCs:
Warmaster addon 1:
Warmaster addon 2:
Alguém saberia me dizer o que há de errado nos scrripts!?
Obrigado!
Upa upa cavalinho alazão!
Alguém me ajuda!?
Link para o comentário
Compartilhar em outros sites
7 respostass a esta questão
Posts Recomendados