Ir para conteúdo
  • 0

Npc Que Da Vocaçao


nbb147

Pergunta

bom gente, procurei muito esse script aki e nao encontrei :x

e assim eu quero um npc que da tal vocaçao, mais tipo ele so da essa vocação a voce se vc for tal vocaçao, num sei se isso e facil, mais espéro q mim ajudem.. :D

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

Script do NPC:

 

Abra a pasta data/npc/script de seu OT, copie qualquer arquivo, renomeie a seu gosto, apague tudo dentro e cole:

 

 

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

 

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})

node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

 

local node2 = keywordHandler:addKeyword({'second promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})

node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

 

npcHandler:addModule(FocusModule:new())

 

 

 

Mas em seu Vocation.XML tem que estar os "fromvoc" todos compatíveis.

 

 

Ajudei ? REP+

Editado por VictorTasquin
Link para o comentário
Compartilhar em outros sites

  • 0

Fiz um aqui.

 

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

local NPC_PROMOTION_MODE = "items" -- "money" or "items"

local NPC_NEED_VOCATION = 4 -- Vocação necessária
local NPC_NEED_LEVEL = 200 -- Level necessário
local NPC_NEED_PROMOTION = 0 -- Promotion necessária


local NPC_PROMOTION_MONEY = 10000 -- Dinheiro (Todos os tipos: Crystal coins, Platinum Coins e Gold coins)
local NPC_PROMOTION_ITEMS = {{9971, 1}} -- Itens, caso o modo de promotion seja "items"

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 onGreetCallback(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if getPlayerVocation(cid) == NPC_NEED_VOCATION and getPlayerLevel(cid) >= NPC_NEED_LEVEL and getPlayerPromotionLevel(cid) == NPC_NEED_PROMOTION then
	npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|. Do you want the {promotion}?")
	talkState[talkUser] = 1
	return true
end

if getPlayerVocation(cid) ~= NPC_NEED_VOCATION then
	selfSay("I do not want to talk with you", cid)
	return false
elseif getPlayerLevel(cid) < NPC_NEED_LEVEL or getPlayerPromotionLevel(cid) < NPC_NEED_PROMOTION then
	selfSay("Sorry, you are not strong enough.", cid)
	return false
elseif getPlayerPromotionLevel(cid) > NPC_NEED_PROMOTION then
	selfSay("Sorry, but you are already promoted.", cid)
	return false
end

npcHandler:setMessage(MESSAGE_GREET, "Do you want the {promotion}, |PLAYERNAME|?", cid)
return true
end

function onCreatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
	return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if talkState[talkUser] == 1 then
	if msgcontains(msg, "promotion") then
		if NPC_PROMOTION_MODE == "money" then
			selfSay("So do you want to be promoted, heh? I need ".. NPC_PROMOTION_MONEY .." gold pieces to promote you. Agreed?", cid)
			talkState[talkUser] = 2
		else
			local say = "So do you want to be promoted, heh? I need"

			for n = 1, #NPC_PROMOTION_ITEMS do
				local sep = (n == 1 and " " or (n == #NPC_PROMOTION_ITEMS and " and " or ", "))
				say = say .. sep .. math.max(1, NPC_PROMOTION_ITEMS[n][2]) .." ".. getItemNameById(NPC_PROMOTION_ITEMS[n][1])
			end
			selfSay(say, cid)
			talkSate[talkUser] = 3
		end
	end
elseif talkState[talkUser] == 2 then
	if msgcontains(msg, "yes") then
		if doPlayerRemoveMoney(cid, NPC_PROMOTION_MONEY) then
			selfSay("May the Gods bless you. You are now promoted.", cid)
			doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
		else
			selfSay("You do not have all the money I need.", cid)
			npcHandler:releaseFocus(cid)
		end
	elseif msgcontains(msg, "no") then
		selfSay("Alright.")
		npcHandler:releaseFocus(cid)
	end
elseif talkState[talkUser] == 3 then
	if msgcontains(msg, "yes") then
		local ret = {}

		for _, item in ipairs(NPC_PROMOTION_ITEMS) do
			local g = getPlayerItemById(cid, true, item[1])
			if g.uid > 0 and math.max(1, g.type) > item[2] then
				table.insert(ret, {g.uid, item[2]})
			else
				ret = {}
				break
			end
		end

		if #ret > 0 then
			for _, item in ipairs(ret) do
				doRemoveItem(item[1], item[2])
			end

			selfSay("May the Gods bless you. You are now promoted.", cid)
			doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
		else
			selfSay("You do not have all the items I need", cid)
			npcHandler:releaseFocus(cid)
		end
	elseif msgcontains(msg, "no") then
		selfSay("Alright.")
		npcHandler:releaseFocus(cid)
	end
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, onGreetCallback)
npcHandler:addModule(FocusModule:new())

 

Só mudar a vocação necessária nessa linha:

 

NPC_NEED_VOCATION = 4

Editado por Oneshot
Link para o comentário
Compartilhar em outros sites

  • 0

Fiz um aqui.

 

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

local NPC_PROMOTION_MODE = "items" -- "money" or "items"

local NPC_NEED_VOCATION = 4 -- Vocação necessária
local NPC_NEED_LEVEL = 200 -- Level necessário
local NPC_NEED_PROMOTION = 0 -- Promotion necessária


local NPC_PROMOTION_MONEY = 10000 -- Dinheiro (Todos os tipos: Crystal coins, Platinum Coins e Gold coins)
local NPC_PROMOTION_ITEMS = {{9971, 1}} -- Itens, caso o modo de promotion seja "items"

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 onGreetCallback(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if getPlayerVocation(cid) == NPC_NEED_VOCATION and getPlayerLevel(cid) >= NPC_NEED_LEVEL and getPlayerPromotionLevel(cid) == NPC_NEED_PROMOTION then
	npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|. Do you want the {promotion}?")
	talkState[talkUser] = 1
	return true
end

if getPlayerVocation(cid) ~= NPC_NEED_VOCATION then
	selfSay("I do not want to talk with you", cid)
	return false
elseif getPlayerLevel(cid) < NPC_NEED_LEVEL or getPlayerPromotionLevel(cid) < NPC_NEED_PROMOTION then
	selfSay("Sorry, you are not strong enough.", cid)
	return false
elseif getPlayerPromotionLevel(cid) > NPC_NEED_PROMOTION then
	selfSay("Sorry, but you are already promoted.", cid)
	return false
end

npcHandler:setMessage(MESSAGE_GREET, "Do you want the {promotion}, |PLAYERNAME|?", cid)
return true
end

function onCreatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
	return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if talkState[talkUser] == 1 then
	if msgcontains(msg, "promotion") then
		if NPC_PROMOTION_MODE == "money" then
			selfSay("So do you want to be promoted, heh? I need ".. NPC_PROMOTION_MONEY .." gold pieces to promote you. Agreed?", cid)
			talkState[talkUser] = 2
		else
			local say = "So do you want to be promoted, heh? I need"

			for n = 1, #NPC_PROMOTION_ITEMS do
				local sep = (n == 1 and " " or (n == #NPC_PROMOTION_ITEMS and " and " or ", "))
				say = say .. sep .. math.max(1, NPC_PROMOTION_ITEMS[n][2]) .." ".. getItemNameById(NPC_PROMOTION_ITEMS[n][1])
			end
			selfSay(say, cid)
			talkSate[talkUser] = 3
		end
	end
elseif talkState[talkUser] == 2 then
	if msgcontains(msg, "yes") then
		if doPlayerRemoveMoney(cid, NPC_PROMOTION_MONEY) then
			selfSay("May the Gods bless you. You are now promoted.", cid)
			doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
		else
			selfSay("You do not have all the money I need.", cid)
			npcHandler:releaseFocus(cid)
		end
	elseif msgcontains(msg, "no") then
		selfSay("Alright.")
		npcHandler:releaseFocus(cid)
	end
elseif talkState[talkUser] == 3 then
	if msgcontains(msg, "yes") then
		local ret = {}

		for _, item in ipairs(NPC_PROMOTION_ITEMS) do
			local g = getPlayerItemById(cid, true, item[1])
			if g.uid > 0 and math.max(1, g.type) > item[2] then
				table.insert(ret, {g.uid, item[2]})
			else
				ret = {}
				break
			end
		end

		if #ret > 0 then
			for _, item in ipairs(ret) do
				doRemoveItem(item[1], item[2])
			end

			selfSay("May the Gods bless you. You are now promoted.", cid)
			doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
		else
			selfSay("You do not have all the items I need", cid)
			npcHandler:releaseFocus(cid)
		end
	elseif msgcontains(msg, "no") then
		selfSay("Alright.")
		npcHandler:releaseFocus(cid)
	end
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, onGreetCallback)
npcHandler:addModule(FocusModule:new())

 

Só mudar a vocação necessária nessa linha:

 

NPC_NEED_VOCATION = 4

 

e se for colocar mais de uma vocaçao exemplo, só kina e pala, como faz? poe a virgula e acressenta? e tambem vai funfar pra rp e ek ou só pras vocações normais?

Link para o comentário
Compartilhar em outros sites

  • 0

Em data/actions/scripts crie um arquivo.lua, nomeio para changevoc e adicione:

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid,1992) == 1 then

doCreatureSay(cid, "Você ja recebeu a nova vocaçao", TALKTYPE_ORANGE_1)

else if getPlayerLevel(cid) >= 20 then

doCreatureSay(cid, "você recebeu uma nova vocaçao!", TALKTYPE_ORANGE_1)

if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then

doPlayerSetVocation(cid, 9)

end

if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 then

doPlayerSetVocation(cid, 10)

end

if getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then

doPlayerSetVocation(cid, 11)

end

if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then

doPlayerSetVocation(cid, 12)

end

doSendMagicEffect(fromPosition, 2)

doRemoveItem(item.uid)

setPlayerStorageValue(cid,1992,1)

return TRUE

else

doCreatureSay(cid, "Você deve ter level 20 ou mais para usar o Item!",TALKTYPE_ORANGE_1)

end

end

end

Editando:

 

-Vermelho: Mensagem quando o item for ativado

-Verde: Level necessário para usar o item

-Marrom: Vocações antigas

-Laranja: Vocações novas

-Roxo: Efeito (/z)

-Rosa: Mensagem quando cancela (abaixo do level 20 do caso)

 

Em actions.xml adicione:

<action itemid="1965" script="changevoc.lua"/>

Editando:

 

-Vermelho: Id do item

Link para o comentário
Compartilhar em outros sites

  • 0

Eu fiz para o criador do tópico, ele quis apenas para uma vocação, então o fiz assim.

 

Abraços.

 

eu entendi pow, n precisava ser ignorante, só queria saber como eu faço caso eu queira adicionar mais uma vocaçao...

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...