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})
npcHandler:addModule(FocusModule:new())
NPC não da promotion pra certas vocations
Por nbb147, 10 de mar. de 2013 em Scripts
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

info
Grupo: Visconde
Registrado: 06/04/11
Posts: 350
Reputação: +8
Char no Tibia: Mulekepirado

acho que vc não entendeu meu pedido '-'
eu quero um npc que da promotion com uma diferença, ele so da promotion pra certas vocaçoes no caso druid e sorcerer, ja para knight e paladin ele não vende promotion.
info
Grupo: Banidos
Registrado: 11/01/13
Posts: 576
Reputação: +109
Char no Tibia: Darashia del Shee

Tenta assim :x
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
if playervoc == 1 or playervoc == 2 then
local node1 = keywordHandler:addKeyword({'primeiro treinamento'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para receber esse treinamento você prescisa ter o level 50, você esta possui esse level?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 50, promotion = 1, text = 'Você se saiu bem no treinamento, vejo que você esta mais forte.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você ainda não esta preparado para esse tipo de treinamento.', reset = true})
if player voc == 1 or playervoc == 2 then
local node2 = keywordHandler:addKeyword({'segundo treinamento'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para receber esse treinamento você prescisa ter o level 150, você esta possui esse level?'})
node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 150, promotion = 2, text = 'Parabêns você esta mais forte.'})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você ainda não esta preparado para esse tipo de treinamento.', reset = true})
if playervoc == 1 or playervoc == 2 then
local node3 = keywordHandler:addKeyword({'terceiro treinamento'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para receber esse treinamento você prescisa ter o level 300, você esta possui esse level?'})
node3:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 300, promotion = 3, text = 'Sua forta está ao extremo, o poder esta a te cosumir.'})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você ainda não esta preparado para esse tipo de treinamento.', reset = true})
if playervoc == 3 or playervoc == 4 then
doPlayerSendTextMessage(cid, 23, "Voce nao tem a vocaçao necessaria!."
npcHandler:addModule(FocusModule:new())
info
Grupo: Visconde
Registrado: 06/04/11
Posts: 350
Reputação: +8
Char no Tibia: Mulekepirado

erro:
[11/03/2013 20:09:38] [Error - LuaScriptInterface::loadFile] data/npc/scripts/promot.lua:15: 'then' expected near 'voc'
[11/03/2013 20:09:38] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/promot.lua
[11/03/2013 20:09:38] data/npc/scripts/promot.lua:15: 'then' expected near 'voc'
[11/03/2013 20:09:52] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/promot.xml).
[11/03/2013 20:09:52] Info: failed to load external entity "data/npc/promot.xml"
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 playervoc = getPlayerVocation(cid),
if playervoc == 1 or playervoc == 2 then
local node1 = keywordHandler:addKeyword({'primeiro treinamento'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para receber esse treinamento você prescisa ter o level 50, você esta possui esse level?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 50, promotion = 1, text = 'Você se saiu bem no treinamento, vejo que você esta mais forte.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você ainda não esta preparado para esse tipo de treinamento.', reset = true})
elseif player voc == 1 or playervoc == 2 then
local node2 = keywordHandler:addKeyword({'segundo treinamento'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para receber esse treinamento você prescisa ter o level 150, você esta possui esse level?'})
node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 150, promotion = 2, text = 'Parabêns você esta mais forte.'})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você ainda não esta preparado para esse tipo de treinamento.', reset = true})
elseif playervoc == 1 or playervoc == 2 then
local node3 = keywordHandler:addKeyword({'terceiro treinamento'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para receber esse treinamento você prescisa ter o level 300, você esta possui esse level?'})
node3:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 300, promotion = 3, text = 'Sua forta está ao extremo, o poder esta a te cosumir.'})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você ainda não esta preparado para esse tipo de treinamento.', reset = true})
elseif playervoc == 3 or playervoc == 4 then
doPlayerSendTextMessage(cid, 23, "Voce nao tem a vocaçao necessaria!."
end
npcHandler:addModule(FocusModule:new())
Tente isto

str4ng anonymous -
http://twitter.com/str4nganonEditado Março 11 por str4ng
info
Grupo: Visconde
Registrado: 06/04/11
Posts: 350
Reputação: +8
Char no Tibia: Mulekepirado

resolvido podem moverem, obrigado a todos pela ajuda. darei rep+ para todos q tentaram..
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

Tópico movido para a seção de dúvidas e pedidos resolvidos.





info
Grupo: Visconde
Registrado: 06/04/11
Posts: 350
Reputação: +8
Char no Tibia: Mulekepirado
Estou com problema em fazer com que o npc não de promotion pra certas vocaçoes, tipo assim esse npc ele e pra dar promotion pra sorcerer e druid, japra knight e paladin eles não da promotion, script:
Editado Março 10 por nbb147