<?xml version="1.0" encoding="UTF-8"?>
<npc name="NOMEDOSEUNPC" script="data/npc/scripts/NOMEDOARQUIVO.lua" walkinterval="5000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="20" body="100" legs="50" feet="99" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|. Bem vindo a minha casa. Em que posso ajudar?"/>
<parameter key="message_farewell" value="Volte quando quiser, |PLAYERNAME|!"/>
<parameter key="module_keywords" value="1" />
</parameters>
</npc>
Em data>npcs>scripts crie um arquivo.lua e cole isto dentro:
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, 'kevnan')) and getPlayerStorageValue(cid, 3987) >= 1 then
selfSay('Voc\ê j\á vingou a morte de meu filho.', cid)
talkState[talkUser] = 0
end
if(msgcontains(msg, 'kevnan')) and getPlayerStorageValue(cid, 3987) <= 0 then
selfSay('Ah você conhece meu filho Kevnan? Que ótimo conhecer você. A vários dias ele saiu em uma jornada perigosa e até então não tenho notícias dele, você sabe algo a respeito?', cid)
elseif(msgcontains(msg, 'botas')) then
selfSay('Voc\ê falou botas? Diga {yes} ou {no}', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'mais')) then
selfSay('Acredito que quem matou meu filho foi um poderoso monstro que anda aterrorizando a região, há boatos que é um dragão jamais visto antes, se você vingar a morte do meu filho vou te dar algo que pertencia a Kevnan, algo que ele gostava muito, volte aqui quando cumprir sua {missao}.', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerItemCount(cid, 6530) >= 1) then
selfSay('Ma.. Mas que triste notícia..... Meu filho querido, mamãe também te ama, que esteja bem onde quer que esteja..Quer saber {mais}?', cid)
talkState[talkUser] = 0
else
selfSay('De quais botas você está falando?', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'missao') and talkState[talkUser] == 2) then
if(getPlayerItemCount(cid, IDITEM1) >= 1) then
if(getPlayerItemCount(cid, IDITEM2) >= 1) then
if(getPlayerItemCount(cid, IDITEM3) >= 1) then
selfSay('Muito obrigado por ter vingado a morte de meu filho Kevnan. Como prometido aqui está a sua recompensa.', cid)
doPlayerRemoveItem(cid, REMOVEITEM1, 1)
doPlayerRemoveItem(cid, REMOVEITEM2, 1)
doPlayerRemoveItem(cid, REMOVEITEM3, 1)
doPlayerAddLevel(cid, 15407, 7)
setPlayerStorageValue(cid, 3987, 1)
talkState[talkUser] = 0
else
selfSay('Ainda n\ão vingou a morte do meu filho Kevnan? Lembre-se que eh um dragão jamais visto antes que esta pelas regioes geladas. Voc\ê precisa trazer algo que prove que foi este monstro que matou meu filho', cid)
talkState[talkUser] = 0
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
ve ae se vai







info
Grupo: Artesão
Registrado: 01/08/10
Posts: 108
Reputação: 0
Char no Tibia: mylorc
Olá,preciso criar um npc de missão,alguém me ajuda?
Assim,preciso de um npc que recolha 3 itens e de recompença ele dara ao player xp (do lvl 1 irá para o lvl 8).
Ajudem por favor.