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())




info
Grupo: Visconde
Registrado: 18/03/19
Posts: 390
Reputação: +22
Gênero: Masculino
Char no Tibia: Rafersiq
Ola pessoal do forum estou procurando um npc que da determinada vocaçao e logo a pos te teleporta pra X posição