retired.
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

Editado Março 13 por Demonbholder
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local vip = 8302
if(msgcontains(msg, 'promote') or msgcontains(msg, 'promotion') then
selfSay('Voce gostaria de ser promovido a essa vocaçao por 3 vip orbs?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerLevel(cid) >= 20 and getPlayerVocation(cid) < 5) then
if(doPlayerRemoveItem(cid, vip, 3) == TRUE) then
setPlayerPromotionLevel(cid, 1)
selfSay('Voce foi promovido.', cid)
else
selfSay('Voce nao tem 3 vips orbs.', cid)
end
else
selfSay('Descupe, voce ja foi promovido ou nao tem o nivel necessario.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('ate mais.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Ta assim o Script, mas eu falo hi, e não da nada ![]()
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

Tenta agora:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local vip = ID_DO_ITEM_VIP
if(msgcontains(msg, 'promote') or msgcontains(msg, 'promotion')) then
selfSay('Voce gostaria de ser promovido a essa vocaçao por 3 vip orbs?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerLevel(cid) >= 20 and getPlayerVocation(cid) < 5) then
if(doPlayerRemoveItem(cid, vip, 3) == TRUE) then
setPlayerPromotionLevel(cid, 1)
selfSay('Voce foi promovido.', cid)
else
selfSay('Voce nao tem 3 vips orbs.', cid)
end
else
selfSay('Descupe, voce ja foi promovido ou nao tem o nivel necessario.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('ate mais.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
tinha esquecido de fechar um parênteses antes.
Editado Março 13 por Demonbholder
Vlw, 100%!
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

então tranquilo, reportando aqui.


info
Grupo: Campones
Registrado: 04/03/11
Posts: 15
Reputação: 0
Olá Galera =D
To precisando de uma Ajuda, Bom, no meu Server eu estou pensando em colocar um Sistema de Promotion, sendo que, Voc 1-Master Sorc
2-Elder Druid
3-Royal Paladin
4-Elite Knight
5-Demoniac Enchanter
6-Dark Warlock
7-Divine Elf
8-Collossal Warrior
Seguinte
Eu quero colocar o NPC Johnny fazendo um Master Sorc ( no caso ) virar Demoniac Enchanter...
MAS !
o Johnny pede 20k pra ser Promovido, e eu quero TIRAR esses 20k e colocar 3 Vip Orb(s) no lugar...
Meu Script é
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())
O Id da Orb é 8302
Fast Plx ._.