Ir para conteúdo

Posts Recomendados

Como Funciona -

 

Este NPC dá missões para fazer.

Quando o jogador volta após uma missão, o NPC conta o quanto ele fez missões.

Se o jogador fez a quantidade de buscas feitas no NPC, ele irá obter experiência e passar para a próxima missão.

Se todas as missões são feitas, ele vai receber um item como recompensa.

A contagem de quests trabalha com armazenamento, portanto, use o armazenamento que você usa para as suas missões.

 

Vá em data/npc, crie um arquivo .xml e renomeie para Luffy, adicione isso -

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Luffy" script="questmissions.lua" walkinterval="2000" speed="0" floorchange="0">
<health now="150" max="150"/>
<look type="134" head="59" body="76" legs="119" feet="0" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello, I love doing {quests}, some of them are quite hard though."/>
	</parameters>
</npc>

 

Vá na pasta scripts da pasta npc, crie um arquivo .lua e renomeie para questmissions, cole isso -

 

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)

local missions = {
[1] = {amountquests = 10, exp = 10000, confirmmessage = "Well that wasn't so hard was it? Lets go for something a bit more challenging don't you agree?"},
[2] = {amountquests = 25, exp = 25000, confirmmessage = "Well done, want to do more quests?"},
[3] = {amountquests = 50, exp = 50000, confirmmessage = "Good job, do you think you can do more quests?"},
[4] = {amountquests = 75, exp = 100000, confirmmessage = "Great! I have one last mission for you, do you accept?"},
[5] = {amountquests = 100, exp = 200000, confirmmessage = "Amazing, well this is it, or do you want to do more quests?"}
}

local config = {
rewarditem = {id = 2128, count = 1},
maxamountquests = 100,
startstorage = 4000, -- startstorage of your quests
endstorage = 5000 -- endstorage of your quests
}

local storage, stor = 24560, 19837

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local xstorage = getPlayerStorageValue(cid, storage)
local x = missions[xstorage]

if not npcHandler:isFocused(cid) then
return false
end

if(msgcontains(msg, 'quests')) then
if xstorage == -1 then
selfSay("Did you know there are alot of quests around here?", cid)
elseif x then
selfSay("Did you do "..x.amountquests.." quests?", cid)
end
talkState[talkUser] = 1
if not x and xstorage ~= -1 then
selfSay("You did a great job, all those quests, amazing.", cid)
npcHandler:releaseFocus(cid)
end
end
if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if xstorage == -1 then
selfSay("Good, do you want to try some?", cid)
talkState[talkUser] = 2
elseif x then
local amount = 0
 for i = config.startstorage, config.endstorage do
if getPlayerStorageValue(cid, i) >= 1 then
amount = amount +1
end
  end

if amount >= x.amountquests then
if getPlayerStorageValue(cid, stor) ~= getPlayerStorageValue(cid, storage) then
selfSay(""..x.confirmmessage, cid)
doPlayerAddExp(cid, x.exp)
setPlayerStorageValue(cid, stor, getPlayerStorageValue(cid, storage))
else
selfSay("Oh wait, I already asked you this before, well doesn't matter, are you in for more quests?", cid)
end
talkState[talkUser] = 2
else
selfSay("What? You did "..amount.." "..(amount == 1 and "quest" or "quests")..", you need to do "..x.amountquests.." quests.", cid)
talkState[talkUser] = 0
end
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if xstorage == -1 then
setPlayerStorageValue(cid, storage, 1)
xstorage = getPlayerStorageValue(cid, storage)
x = missions[xstorage]
selfSay("Great! You can start with doing "..x.amountquests.." quests, I think that won't be hard for you, good luck!", cid)
elseif x then
setPlayerStorageValue(cid, storage, xstorage + 1)
xstorage = getPlayerStorageValue(cid, storage)
x = missions[xstorage]
if x then
selfSay("Good, now try to do "..x.amountquests.." quests.", cid)
else
selfSay("That's the spirit! But for me "..config.maxamountquests.." quests is more then enough, so I will give you your reward for all your hard work.", cid)
local info = getItemInfo(config.rewarditem.id)
if config.rewarditem.count > 1 then
text = config.rewarditem.count.." "..info.plurar
else
text = info.article.." "..info.name
end
selfSay("Here you are, "..text..", enjoy.", cid)
doPlayerAddItem(cid, config.rewarditem.id, config.rewarditem.count)
end
end
talkState[talkUser] = 0
elseif (msgcontains(msg, 'no')) then
selfSay("Oh well, I guess not then.", cid)
end
return true
end

npcHandler:setMessage(MESSAGE_FAREWELL, "Bye!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye? I guess...")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Se preferir, use este, com mensagens diferentes -

 

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)

local missions = {
[1] = {amountquests = 10, exp = 10000, greetmessage = "Oh hello, it's you again", confirmmessage = "Well that wasn't so hard was it? Lets go for something a bit more challenging don't you agree?"},
[2] = {amountquests = 25, exp = 25000, greetmessage = "Huh what? Oh wait, you were doing these quests", confirmmessage = "Well done, want to do more quests?"},
[3] = {amountquests = 50, exp = 50000, greetmessage = "Hey, welcome back", confirmmessage = "Good job, do you think you can do more quests?"},
[4] = {amountquests = 75, exp = 100000, greetmessage = "Hi again", confirmmessage = "Great! I have one last mission for you, do you accept?"},
[5] = {amountquests = 100, exp = 200000, greetmessage = "So, and here you are again", confirmmessage = "Amazing, well this is it, or do you want to do more quests?"}
}

local config = {
rewarditem = {id = 2128, count = 1},
maxamountquests = 100,
startstorage = 4000, -- startstorage of your quests
endstorage = 5000 -- endstorage of your quests
}

local storage, stor = 24559, 19836

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local xstorage = getPlayerStorageValue(cid, storage)
local x = missions[xstorage]

if not npcHandler:isFocused(cid) then
if msgcontains(msg, 'hello') or msgcontains(msg, 'hi') and not msgcontains(msg, 'e') then
if xstorage == -1 then
selfSay("Oh hi! Did you know there are alot of quests around here?", cid)
elseif x then
selfSay(x.greetmessage..", did you do "..x.amountquests.." quests?", cid)
end
npcHandler:addFocus(cid)
talkState[talkUser] = 1
if not x and xstorage ~= -1 then
selfSay("You did a great job, all those quests, amazing.", cid)
npcHandler:releaseFocus(cid)
end
else
return false
end
end

if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if xstorage == -1 then
selfSay("Ah well, I love doing them, I already did alot of them myself, want to try some?", cid)
talkState[talkUser] = 2
elseif x then
local amount = 0
 for i = config.startstorage, config.endstorage do
if getPlayerStorageValue(cid, i) >= 1 then
amount = amount +1
end
  end

if amount >= x.amountquests then
if getPlayerStorageValue(cid, stor) ~= getPlayerStorageValue(cid, storage) then
selfSay(""..x.confirmmessage, cid)
doPlayerAddExp(cid, x.exp)
setPlayerStorageValue(cid, stor, getPlayerStorageValue(cid, storage))
else
selfSay("Oh wait, I already asked you this before, well doesn't matter, are you in for more quests?", cid)
end
talkState[talkUser] = 2
else
selfSay("What? You did "..amount.." "..(amount == 1 and "quest" or "quests")..", you need to do "..x.amountquests.." quests.", cid)
talkState[talkUser] = 0
end
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if xstorage == -1 then
setPlayerStorageValue(cid, storage, 1)
xstorage = getPlayerStorageValue(cid, storage)
x = missions[xstorage]
selfSay("Great! You can start with doing "..x.amountquests.." quests, I think that won't be hard for you, good luck!", cid)
elseif x then
setPlayerStorageValue(cid, storage, xstorage + 1)
xstorage = getPlayerStorageValue(cid, storage)
x = missions[xstorage]
if x then
selfSay("Good, now try to do "..x.amountquests.." quests.", cid)
else
selfSay("That's the spirit! But for me "..config.maxamountquests.." quests is more then enough, so I will give you your reward for all your hard work.", cid)
local info = getItemInfo(config.rewarditem.id)
if config.rewarditem.count > 1 then
text = config.rewarditem.count.." "..info.plurar
else
text = info.article.." "..info.name
end
selfSay("Here you are, "..text..", enjoy.", cid)
doPlayerAddItem(cid, config.rewarditem.id, config.rewarditem.count)
end
end
talkState[talkUser] = 0
elseif (msgcontains(msg, 'no')) then
selfSay("Oh well, I guess not then.", cid)
elseif (msgcontains(msg, 'bye')) then
selfSay("Bye.", cid)
npcHandler:releaseFocus(cid)
end
return true
end

npcHandler:setMessage(MESSAGE_FAREWELL, "Well, what are you waiting for, I don't have all day!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye? I guess...")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

 

 

p_5KUC.png

 

Créditos - Limos

Editado por LuckinhaSan
Link para o comentário
Compartilhar em outros sites

isso dai seria tipo o npc da post office quest? porem ele só "passa" a missão ao jogador, e o scripter cria os scripts das missões, exemplo ir até a um lugar X, usar a pick e ganhar uma storage...

 

 

 

parabens, fico legal kk

Link para o comentário
Compartilhar em outros sites

  • 4 weeks later...
  • 3 months later...
  • 7 months later...
×
×
  • Criar Novo...