Boa Noite, sou novo no ramo de OT Server e estou com um problema nos meus NPC Barco.... eles não conversam com os player, estou passando um apuro, pois não consigo fazer eles falarem !!
Se alguém puder me ajudar eu agradeceria MUITO, vou postar meu XML e Script de um NPC para que possam me ajudar !!
Ja vi vários tópicos de pessoas falando de vários jeito de fazer eles falarem, mais não consegui, se alguém tiver um jeito mais simples e puder me mostrar como editar eu agradeceria muito.
Desde já muito Obrigado.
XML :
<?xml version="1.0"?>
<npc name="Captain Frenburg" script="data/npc/scripts/boat_ricarten.lua" access="3">
<look type="129" head="114" body="119" legs="114" feet="114"/>
</npc>
SCRIPT :
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
selfSay('Posso Te Levar Para Pillai, Por 50gps.') -- Its greeting sentence, when something appears
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
if isPremium(cid) then
selfSay('Hello ' .. creatureGetName(cid) .. '! I can take you to Navisko (50gp), to Ruinen Village (50gp) or Pillai (50gp). Where do you want to go?')
focus = cid
talk_start = os.clock()
else
selfSay('Sorry, only premium players can travel by boat.')
focus = 0
talk_start = 0
end
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'pillai') then
if pay(cid,50) then
selfSay('Let\'s go!')
Travel(cid, 0, 1736, 785, 6)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don\'t have enough money.')
end
elseif msgcontains(msg, 'navisko') then
if pay(cid,50) then
selfSay('Let\'s go!')
Travel(cid, 0, 1545, 699, 6)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don\'t have enough money.')
end
elseif msgcontains(msg, 'ruinen') then
if pay(cid,50) then
selfSay('Let\'s go!')
Travel(cid, 0, 1459, 737, 6)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don\'t have enough money.')
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Você tem o código disponível? Se tiver publique-o aqui:
Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.
Aparece esse Erro também quando tento falar com os NPC Barco
[21:10:56.674] [Error - NpcScript Interface]
[21:10:56.685] data/npc/scripts/boat_ricarten.lua:onCreatureSay
[21:10:56.692] Description:
[21:10:56.697] data/npc/scripts/boat_ricarten.lua:41: attempt to call global 'creatureGetName' (a nil value)
[21:10:56.713] stack traceback:
[21:10:56.721] data/npc/scripts/boat_ricarten.lua:41: in function <data/npc/scripts/boat_ricarten.lua:36>