<parameter key="message_greet" value="Hello, |PLAYERNAME|. Do you want to {help} me? I can give you a reward..."/>
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, 'help')) then
selfSay('Are you sure can help me? I need you kill 3 bosses for me. The {first}, the {second} and the {third}. When you answer, I will teleport you until them, caution!', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'first')) then
if (getPlayerStorageValue(cid,10091) == -1) then
selfSay('Kill him and I teleport you back.', cid)
doTeleportThing(cid,{x=POS DO BOSS 1, y=POS DO BOSS 1, z=POS DO BOSS 1})
else
elseif (getPlayerStorageValue(cid,10091) == 1) then
selfSay('You already killed the first boss.', cid)
else
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'second')) then
if (getPlayerStorageValue(cid,10092) == -1) then
selfSay('Kill him and I teleport you back.', cid)
doTeleportThing(cid,{x=POS DO BOSS 2, y=POS DO BOSS 2, z=POS DO BOSS 2})
else
elseif (getPlayerStorageValue(cid,10092) == 1) then
selfSay('You already killed the second boss.', cid)
else
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'third')) then
if (getPlayerStorageValue(cid,10093) == -1) then
selfSay('Kill him and I teleport you back. When you return, I will give you the {reward}!', cid)
doTeleportThing(cid,{x=POS DO BOSS 3, y=POS DO BOSS 3, z=POS DO BOSS 3})
else
elseif (getPlayerStorageValue(cid,10093) == 1) then
selfSay('You already killed the third boss.', cid)
else
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'reward')) then
if (getPlayerStorageValue(cid,10093) == -1) then
selfSay('You dont killed all of the bosses yet.', cid)
else
elseif (getPlayerStorageValue(cid,10093) == 1) then
doPlayerAddItem(cid,ITEM,QUANTIDADE)
selfSay('Congratulations! Here is my reward.', cid)
else
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Agora vá em creaturescripts/scripts e crie um arquivo chamado hunter.lua. Adicione:
function onKill(cid, target, lastHit)
if(isMonster(cid)) and getCreatureName(cid) == NOME DO BOSS 1 then
setPlayerStorageValue(lastHit, 10091, 1)
doTeleportThing(lastHit,{x=POS DO NPC, y=POS DO NPC, z=POS DO NPC})
elseif(isMonster(cid)) and getCreatureName(cid) == NOME DO BOSS 2 then
setPlayerStorageValue(lastHit, 10092, 1)
doTeleportThing(lastHit,{x=POS DO NPC, y=POS DO NPC, z=POS DO NPC})
elseif(isMonster(cid)) and getCreatureName(cid) == NOME DO BOSS 3 then
setPlayerStorageValue(lastHit, 10093, 1)
doTeleportThing(lastHit,{x=POS DO NPC, y=POS DO NPC, z=POS DO NPC})
endreturn trueend
Em creaturescripts.xml adicione a linha:
<event type="kill" name="Hunter" event="script" value="hunter.lua"/>
Em creaturescripts/scripts/login.lua, adicione:
registerCreatureEvent(cid, "Hunter")
Observações:
- O script não foi testado, podendo apresentar pequenas falhas. Caso tenha dúvidas, poste-as aqui;
- Os monstros devem ficar em locais diferentes e acessíveis somente por teleport (ou seja, isolados do resto do mapa, para que não seja possível matá-los em qualquer ordem)