Ir para conteúdo
  • Cadastre-se

[PEDIDO] Npc The Oracle Estilo 8.1


Posts Recomendados

Loldinis, em 15 Fev 2015 - 12:27 PM, disse:

Hoje ele envia você pra ilha, e na ilha você escolhe a vocação

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg) 		npcHandler:onCreatureSay(cid, type, msg)	end
function onThink() 							npcHandler:onThink()						end

function oracle(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local cityNode = node:getParent():getParent()
	local vocNode = node:getParent()

	local destination = cityNode:getParameters().destination
	local town = cityNode:getParameters().town
	local vocation = vocNode:getParameters().vocation

	if(destination ~= nil and vocation ~= nil and town ~= nil) then
		if(getPlayerLevel(cid) < parameters.level) then
			npcHandler:say('Você deve primeiro atingir level ' .. parameters.level .. '!', cid)
		else
			if getPlayerVocation(cid) > 0 then
				npcHandler:say('Desculpe, você já tem uma vocação!')
			else
				doPlayerSetVocation(cid, vocation)
				doPlayerSetTown(cid, town)
	        	doTeleportThing(cid, destination)
				doSendMagicEffect(destination, CONST_ME_MAGIC_BLUE)
			end
        end
	end
	npcHandler:resetNpc()
	return true
end

function greetCallback(cid)
	if(getPlayerLevel(cid) < 8) then
		npcHandler:say('Volte quando crescer, filho!')
		return false
	else
		return true
	end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Você está preparado para enfrentar o seu destino?')

local yesNode = KeywordNode:new({'sim'}, oracle, {level = 8})
local noNode = KeywordNode:new({'nao'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then what vocation do you want to become?'})

local node1 = keywordHandler:addKeyword({'sim'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você deseja viajar para Carlin ,Venore ou Thais?'})
	local node2 = node1:addChildKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 12, destination = {x=1255, y=1565, z=7}, text = 'Entao, qual vocação você deseja tornar-se? {Sorcerer}, {druid}, {paladin} or {knight}?'})
		local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, vocation = 1, onlyFocus = true, text = 'Então, você deseja ser um mago poderoso? Tem certeza sobre isso? Esta decisao é irreversível!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'Tem certeza de que um druida é o que você deseja tornar-se? Esta decisão é irreversível!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'Um mestre da pontaria. Tem certeza? Esta decisão é irreversível!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, vocation = 4, onlyFocus = true, text = 'Um poderoso guerreiro. Será mesmo a sua decisão final? Esta decisão é irreversível!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
	local node2 = node1:addChildKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 1, destination = {x=159, y=387, z=6}, text = 'thais, eh? So what vocation do you wish to become? {Sorcerer}, {druid}, {paladin} or {knight}?'})
		local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, vocation = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, vocation = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
	local node2 = node1:addChildKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 1, destination = {x=469, y=172, z=7}, text = 'venore, eh? So what vocation do you wish to become? {Sorcerer}, {druid}, {paladin} or {knight}?'})
		local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, vocation = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, vocation = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
keywordHandler:addKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Entao volte quando estiver pronto.'})

npcHandler:addModule(FocusModule:new())
Amigo estou usando este aqui em meu servidor,para mim esta funcionando normal,utilizo um servidor 8.6 - TFS0.4,teste e diga se funcionou,boa sorte!

OBS,:Edite o idioma e posições ao seu gosto,hehe

Editado por Lyon (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo