Acho que já responde as duas.. basta você mesmo configurar.( Caso não saiba exclareça sua dúvida aqui )
Em data/npc crie um arquivo chamado vocationseller.xml e adicione este código:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Vocation seller" script="data/npc/scripts/vocation.lua" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="128" head="20" body="100" legs="50" feet="99" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|. Caso queira ser promotion diga {promotion}." />
</parameters>
</npc>
E em data/npc/scripts crie um arquivo chamado vocation.lua e adicione o seguinte código:
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
-- Script by Focost CONFIGURACAO
lvl = 1 -- Level necessario
iditem = 7410 -- ID do item que e necessario
quanty = 1 -- Quantidade do item acima que e necessario
idvoc = 1 -- ID da vocacao que ira receber
msgyes = "agora você tem promotion" -- msg que aparece Se vocação for recebida
msgno = "você não pode ter promotion" -- msg que aparece Se caso o player nao ter os items necessarios
function promotion(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerLevel(cid) >= lvl then
if getPlayerItemCount(cid,iditem) >= quanty then
doPlayerRemoveItem(cid,iditem,quanty)
npcHandler:say(msgyes, cid)
doPlayerSetVocation(cid, idvoc)
else
npcHandler:say(msgno, cid)
end
end
end
local node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Deseja trocar 10 apples pela prommotion?'})
node1:addChildKeyword({'yes'}, promotion, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, volte quando quizer.', reset = true})
npcHandler:addModule(FocusModule:new())
Espero ter ajudado!