Ir para conteúdo
  • 0

[PEDIDO] npc que da vocação


rafersiq

Pergunta

9 respostass a esta questão

Posts Recomendados

  • 0

Olá Boa noite.

 

Copie um npc.xml qual quer e adicione este script a ele editando a pate script = ""

 

NPC

promotion.lua

Funciona tanto para ITEMS ou seja troca items pela vocação FÁCIL DE SE CONFIGURAR.

Quanto para Dinheiro Basta trocar em uma única linha de items para money.

Código com instruções para edição.

O Código se base no baseVocation do Vocation.xml ou seja ele adiciona uma vocação a mais na vocação que o personagem esta seguindo.

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
				--- CONFIGURE SEU NPC AQUI --
local NPC_PROMOTION_MODE = "items" -- "money" or "items"
local NPC_TELEPORT_POS = {x = 99, y = 189, z = 7}-- Posição que sera teleportado
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"


			--- DO NOT TOUCH HERE IF YOU DO NOT KNOW WHAT ARE YOU DOING--


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)
			doTeleportThing(cid, NPC_TELEPORT_POS)
		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())

 

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

  • 0
9 horas atrás, underewarr disse:

Olá Boa noite.

 

Copie um npc.xml qual quer e adicione este script a ele editando a pate script = ""

Ola eu vou testar hoja

10 horas atrás, underewarr disse:

{promotion}?")

ou mano em qual lugar do script muda essa palavra?

10 horas atrás, underewarr disse:

local NPC_NEED_VOCATION = 4 -- Vocação necessária

nesse local eu coloco a vocaçao que o player vai ganhar ou a que ele presisa?

14 horas atrás, underewarr disse:

Funciona tanto para ITEMS ou seja troca items pela vocação FÁCIL DE SE CONFIGURAR.

em qual lugar colocar a vocaçao que ira ganhar?

 

Link para o comentário
Compartilhar em outros sites

  • 0
6 horas atrás, rafersiq disse:

Ola eu vou testar hoja

ou mano em qual lugar do script muda essa palavra?

nesse local eu coloco a vocaçao que o player vai ganhar ou a que ele presisa?

em qual lugar colocar a vocaçao que ira ganhar?

 

Vou te dar um exemplo se voce quer que o jogador passe da vocação 4 para a vocação 5 você pode ver que no xml existe uma tag chamada FromVoc então se o FromVoc da vocação 5 for a 4 ele vai atualizar de 4 para 5.

Caso tenha ainda ficado com duvida nessa questão 

 

Esse comando adiciona + 1 na linha de vocações ou seja o Knight é vocação 4 O elite knight é vocação 8 e o

FromVoc do elite knight é 4 quando você coloca promotion ele vai para 8,acredito que deu para entender

Link para o comentário
Compartilhar em outros sites

  • 0
18 horas atrás, underewarr disse:

Esse comando adiciona + 1 na linha de vocações ou seja o Knight é vocação 4 O elite knight é vocação 8 e o

FromVoc do elite knight é 4 quando você coloca promotion ele vai para 8,acredito que deu para entender

ola eu tou criando um poketibia e quero colocar 4 tipos de profição como eu faço?

Link para o comentário
Compartilhar em outros sites

  • 0
Citar

<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" name="Vocation excluida 01" description="a vocation excluida 01" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="1" name="treinador" description="a treinador" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="2" name="TV" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="3" name="PC" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="0" gainhpamount="0" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0">
        <formula meleeDamage="0.7" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="4" name="Treinador de Elite" description="a treinador de elite" needpremium="1" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="4" lessloss="10">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>

    <vocation id="7" name="Duel System2" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="8" name="Duel System" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>

    <vocation id="9" name="Pokedex System" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="10" name="Engineer" description="a Engineer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
</vocations>

esse e vocation.xml do meu server

2 horas atrás, underewarr disse:

Me manda o seu Vocation.xml e o detalhes das novas vocações

desse jeito ou que o dawnload do vocation.xml?

Link para o comentário
Compartilhar em outros sites

  • 0
2 minutos atrás, rafersiq disse:

as vocaçoe sao:

Stylist

Engineer

Adventurer

Teacher

Ta ai, não se esqueça de sempre editar a Tag = FromVoc para o id atual da vocação se não ao relogar ele ira voltar para vocação Do FromVoc caso não tenha recebido a promotion de forma correta.

 

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" name="Vocation excluida 01" description="a vocation excluida 01" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="1" name="treinador" description="a treinador" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="2" name="TV" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="3" name="PC" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="0" gainhpamount="0" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0">
        <formula meleeDamage="0.7" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="4" name="Treinador de Elite" description="a treinador de elite" needpremium="1" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="4" lessloss="10">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>

    <vocation id="7" name="Duel System2" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="8" name="Duel System" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>

    <vocation id="9" name="Pokedex System" description="a pokemon trainer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
    <vocation id="10" name="Engineer" description="a Engineer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="10" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
	   <vocation id="11" name="Stylist" description="a Stylist" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="11" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
	   <vocation id="12" name="Adventurer" description="a Engineer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="12" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
	   <vocation id="13" name="Teacher" description="a Engineer" needpremium="0" gaincap="0" gainhp="60" gainmana="0" gainhpticks="2" gainhpamount="3" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="13" lessloss="0">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="-1" magdefense="-1" armor="1.0"/>
        <skill fist="1.0" club="1.0" sword="0" axe="1.0" distance="1.0" shielding="1.0" fishing="1.0" experience="1.0"/>
    </vocation>
</vocations>

 

 

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...