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
if(msgcontains(msg, 'promotion') or msgcontains(msg, 'promote')) then
if(getPlayerPromotionLevel(cid) >= 1) then
return selfSay('You are already promoted!.', cid)
end
setPlayerPromotionLevel(cid, 1)
selfSay('Congratulations! You are now promoted.', cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
- Fórum
- xTibia - Notícias e Suporte
- Soluções
- Archived
- Pedido Promotion Quest
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

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

XML...
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Npc Name" script="data/npc/scripts/default.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="142" head="57" body="59" legs="40" feet="76" addons="0"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|, Diga promote para ser promovido."/>
<parameter key="message_farewell" value="Adeus |PLAYERNAME|."/>
</parameters>
</npc>
Vodkart, entra no msn.
Editado Março 12 por Demonbholder
info
Grupo: Campones
Registrado: 06/11/10
Posts: 3
Reputação: +2
Char no Tibia: Dav Sciter

Para fazer eu NPC em XML
Bem se seu Servidor for XML (DO SECULO PASSADO) tente este Script.
Vá em Data/NPCs, crie um arquivo .lua com o seguinte nome: promotionpc.lua
Abra-o e cole isto:
<?xml version="1.0"?>
<npc name="Promotion" script="data/npc/scripts/promotionpcscript.lua" access="3" autowalk="25" lookdir="1">
<health now="1000" max="1000"/>
<look type="140" head="0" body="0" legs="0" feet="0" addons="0" corpse="3128"/>
</npc>
No local em vermelho edite para o nome que desejar.
Depois vá até Data/Npcs/Scripts, crie um arquivo promotionpcscript.lua e cole isto dentro dele:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Ola ' .. creatureGetName(cid) .. ',o que o traz até mim?')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Desculpe, ' .. creatureGetName(cid) .. ' estou ocupada! Falo com voce daqui a pouco.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'hail the queen') then
selfSay('O que o traz até mim?')
talk_state = 0
elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then
selfSay('Voce quer ser promovido por 10 Crystal Coin?')
talk_state = 0
elseif msgcontains(msg, 'yes') then
if getPlayerVocation(cid) > 4 then
selfSay('Desculpe, voce ja foi promovido.')
talk_state = 0
elseif getPlayerLevel(cid) < 100 then
selfSay('Desculpe, voce precisa ser nivel 100 para ser promovido.')
talk_state = 0
elseif not isPremium(cid) then
selfSay('Sorry, you must be premium to buy promotion.')
talk_state = 0
elseif doPlayerRemoveItem(cid,2160,10) == 1 then
doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
doSendAnimatedText(getPlayerPosition(cid), "Promoted", TEXTCOLOR_WHITE_EXP)
doSendMagicEffect(getPlayerPosition(cid),14)
selfSay('Parabéns agora você esta mais poderoso.')
talk_state = 0
else
selfSay('Voce não tem dinheiro suficiente para promotion. [100k]')
talk_state = 1
end
elseif msgcontains(msg, 'hi') or msgcontains(msg, 'hello') then
selfSay('Please Respect Child!')
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 10 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Locais em Verde edite para o valor da Promotion.
Locais em Azul edite para o Level necessário
Espero ter Ajudado!
Created by Max Linux
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

não ajudou não,primeiro porque você não leu o tópico,se tivesse lido saberia que o npc que ele pediu é bem diferente do seu, e segundo o tópico já foi respondido,não tinha necessidade de colocar outro script,a não ser que o meu não tenha funcionado.
faloust =*
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

---- Edit:
Obrigado Vodkart pelo Script e obrigado Demonbholder pela Xml do npc, mas eu queria fazer uma pergunta boba, aonde eu coloco a ID da Vocation pra promove ele?
Att
Não precisa colocar id de vocação no script, ele vai promover os jogadores que são kina, sorc, druid e paly para suas devidas promoções. Caso esteja se referindo ao vocations.xml, deve se editar o fromvoc="" da vocação promotion, e colocar o id da vocação que sucede a promoção.



info
Grupo: Campones
Registrado: 26/04/09
Posts: 6
Reputação: +3
Eae galera, blz?
Eu queria saber se alguem poderia me passar algum script de Promotion Quest, ele é mais ou menos assim:
Eu crio no meu mapa um monte de bichos e no final tem um Npc que Você fala assim:
Hi, promotion, yes
Ou só assim:
Hi, promotion
E o Npc não pede nada em troca, ou seja, a Promotion é de graça
E se possível eu queria que tivesse outra fala com o Npc assim:
Quando o player não sabe como ganhar a Promotion ele fala assim:
Help
Depois o Npc explica como ganhar a Promotion
Obrigado desde já
---- Edit:
Obrigado Vodkart pelo Script e obrigado Demonbholder pela Xml do npc, mas eu queria fazer uma pergunta boba, aonde eu coloco a ID da Vocation pra promove ele?
Att
---- Edit: (29/03/2011)
Resolvido, pode dar Closed, por favor, Obrigado
Era só mudar na parte de Vocations.xml no fromvoc=""
Att, Alexandre
Editado Março 29 por Alexandre Ferreira