Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Eae pessoal, tranquilo?
Estou precisando de ajuda em um script de NPC que vende spells.
Basicamente o problema consiste no seguinte: eu falo hi, ele responde sem problemas, daí eu falo o nome da spell que eu quero comprar e ele simplesmente não reage de forma alguma. Tudo isso sem dar erro nenhum no distro.
Já tentei mudar o nome da spell, já tentei mudar a function pra doPlayerLearnSpell e nada.
Se alguém puder me dar uma luz nisso seria de bom grado.

Servidor: Aries Server to Tibia 8.10 - Version  3.0 (OTServ SVN 0.6.0).
E o script é esse: 

focus = 0
talk_start = 0
target = 0
following = false
attacking = false

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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
 		if getPlayerVocation(cid) == 2 then
 			selfSay('Hello ' .. creatureGetName(cid) .. '! What spell do you want to learn?')
 			focus = cid
 			talk_start = os.clock()
 		else
 			selfSay('Sorry, I sell spells for druids.')
 		end
	elseif string.find(msg, '(%a*)hi(%a*)') 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, 'light healing') then
  			learnSpell(cid,'exura',50)
                elseif msgcontains(msg, 'create food') then
  			learnSpell(cid,'exevo pan', 100)			
                elseif msgcontains(msg, 'force strike') then
  			learnSpell(cid,'exori mort',600)
 		elseif msgcontains(msg, 'heavy magic missle') then
  			learnSpell(cid,'adori gran',600)
 		elseif msgcontains(msg, 'energy strike') then
  			learnSpell(cid,'exori vis',800)
 		elseif msgcontains(msg, 'flame strike') then
  			learnSpell(cid,'exori flam',800)
 		elseif msgcontains(msg, 'magic shield') then
  			learnSpell(cid,'utamo vita',450)
 		elseif msgcontains(msg, 'intense healing rune') then
  			learnSpell(cid,'adura gran',600)
 		elseif msgcontains(msg, 'intense healing') then
  			learnSpell(cid,'exura gran',350)
 		elseif msgcontains(msg, 'heal friend') then
  			learnSpell(cid,'exura sio',800)
 		elseif msgcontains(msg, 'strong haste') then
  			learnSpell(cid,'utani gran hur',1300)
 		elseif msgcontains(msg, 'haste') then
  			learnSpell(cid,'utani hur',600)
 		elseif msgcontains(msg, 'great fireball') then
  			learnSpell(cid,'adori gran flam',1200)
 		elseif msgcontains(msg, 'ultimate healing rune') then
  			learnSpell(cid,'adura vita',1500)
 		elseif msgcontains(msg, 'ultimate healing') then
  			learnSpell(cid,'exura vita',1000)
 		elseif msgcontains(msg, 'explosion') then
  			learnSpell(cid,'adevo mas hur',1800)
 		elseif msgcontains(msg, 'mass healing') then
  			learnSpell(cid,'exevo gran mas res',2200)
 		elseif msgcontains(msg, 'poison storm') then
  			learnSpell(cid,'exevo gran mas pox',3400)
 		elseif msgcontains(msg, 'ultimate light') then
 			learnSpell(cid,'utevo vis lux',1600)
 		elseif msgcontains(msg, 'greater light') then
 			learnSpell(cid,'utevo gran lux',500)
 		elseif msgcontains(msg, 'light') then
 			learnSpell(cid,'utevo lux',100)
		elseif msgcontains(msg, 'invisible') then
 			learnSpell(cid,'utana vid',1000)
		elseif msgcontains(msg, 'summon') then
 			learnSpell(cid,'utevo res',2000)
		elseif msgcontains(msg, 'find person') then
 			learnSpell(cid,'exiva',80)
		elseif msgcontains(msg, 'magic rope') then
 			learnSpell(cid,'exani tera',200)

  		elseif string.find(msg, '(%a*)bye(%a*)')  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

 

Editado por YanRenat (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo