[Npc] Problema Com Npc

JNLPB
Por JNLPB
em Scripts

JNLPB

Hail Odin!
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 13/01/08Posts: 25Char no Tibia: Diabolling

Olá. Eu estava precisando de um NPC que trocasse Worn Soft Boots por Soft Boots novas. Então, peguei um NPC que trocava items por outros items, e editei para que ele trocasse Soft Boots. Mais acontece que não deu certo, o NPC não responde a "hi", "hello", nem nada. Será que alguém pode me dizer o que há de errado com ele? O script está abaixo.

 

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local addon_state = 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('Olá ' .. getCreatureName(cid) .. '... Olá... Você gostaria que eu reparasse sua worn {soft boots}?')
	focus = cid
	talk_start = os.clock()

elseif focus == cid then
	talk_start = os.clock()
	if msgcontains(msg, 'repair') or msgcontains(msg, 'soft boots') then
		if doPlayerRemoveItem(cid,6530,1) and doPlayerRemoveItem(cid,2160,1) == 0 then
			selfSay('Desculpe, voce nao tem uma Worn Soft Boots e/ou o dinheiro necessario.')
                               addon_state = 0
		else 
			selfSay('Prontinho. Aqui está seu par de soft boots.')
			doPlayerAddItem(cid,2460, 1)
			talk_start = 0
		end 

	elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
		selfSay('Adeus, ' .. getCreatureName(cid) .. '! Volte quando quiser..')
		focus = 0
		talk_start = 0
	end
end
end

function onCreatureChangeOutfit(creature)
end

function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 60 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

 

Esqueci de dizer a versão do server em que testei... Que eh TFS 0.3.1 8.40

 

Agradeço desde já!

LPnewot 8.60

 

Servidor baseado na Mitologia Nórdica!

 

4 novas vocações, Eventos diários, Sistema de refinamento e pets, runas e munições infinitas e Guild War System global (em breve)

 

Rates:

 

Exp: Stages começando em: 400x

-Sistema de reset (lvl 600)

 

Skills: 200x

 

Magic Level: 130x / Loot: 2.5x

 

Ip: lpnewot.no-ip.biz

Porta:7171 Account Manager: 1/1[/b]

Comunidade LPnewOt no orkut!

Lordfire

TFS Maintainer
avatar
Lenda
Lenda

INFOS

Grupo: LendaRegistrado: 04/10/06Posts: 2605Gênero: MasculinoChar no Tibia: Knight Orion

Tenta usar assim

 

        if ((msgcontains(msg, 'hi')) and (focus == 0) and (getDistanceToCreature(cid) < 4)) then
               selfSay('Olá ' .. getCreatureName(cid) .. '... Olá... Você gostaria que eu reparasse sua worn {soft boots}?')
               focus = cid
                talk_start = os.clock()

 

 

 

JNLPB

Hail Odin!
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 13/01/08Posts: 25Char no Tibia: Diabolling

Deu certo. Vlw pela ajuda, Lord! xD

LPnewot 8.60

 

Servidor baseado na Mitologia Nórdica!

 

4 novas vocações, Eventos diários, Sistema de refinamento e pets, runas e munições infinitas e Guild War System global (em breve)

 

Rates:

 

Exp: Stages começando em: 400x

-Sistema de reset (lvl 600)

 

Skills: 200x

 

Magic Level: 130x / Loot: 2.5x

 

Ip: lpnewot.no-ip.biz

Porta:7171 Account Manager: 1/1[/b]

Comunidade LPnewOt no orkut!