<?xml version="1.0" encoding="UTF-8"?>
<quests>
<quest name="Example Quest I" startstorageid="45001" startstoragevalue="1">
<mission name="Example Mission 1" storageid="45001" startvalue="1" endvalue="2" >
<missionstate id="1" description="Ask for quest again at the npc." />
<missionstate id="2" description="You successfully finished the quest." />
</mission>
</quest>
</quests>
local storage = 45001
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 function greetCallback(cid)
npcHandler.topic[cid] = 0
return true
end
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if msgcontains(msg, "quest") then
local storageValue = player:getStorageValue(storage)
if storageValue < 1 then
npcHandler:say("Would you like to start this quest?", cid)
npcHandler.topic[cid] = 1
return true
elseif storageValue == 1 then
npcHandler:say("Would you like to complete this quest?", cid)
npcHandler.topic[cid] = 1
return true
else
npcHandler:say("I have no more quests for you.", cid)
npcHandler.topic[cid] = 0
return true
end
elseif npcHandler.topic[cid] == 1 then
if not msgcontains(msg, "yes") then
npcHandler:say("Another time then.", cid)
npcHandler.topic[cid] = 0
return true
end
if player:getStorageValue(storage) < 1 then
player:setStorageValue(storage, 1)
npcHandler:say("Cool. You have started the quest.", cid)
npcHandler.topic[cid] = 0
return true
end
player:setStorageValue(storage, 2)
npcHandler:say("Awesome. You have finished the quest.", cid)
npcHandler.topic[cid] = 0
return true
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
I do not have this address in my data data/xml/quests.luaThe Quest Log is just a storage value checker.
If the player has the storage value, the quest log will automatically update.
So all you really need is a basic npc, and a way to give a storage value.
But here's both anyway. xD
data/xml/quests.xml
XML:<?xml version="1.0" encoding="UTF-8"?> <quests> <quest name="Example Quest I" startstorageid="45001" startstoragevalue="1"> <mission name="Example Mission 1" storageid="45001" startvalue="1" endvalue="2" > <missionstate id="1" description="Ask for quest again at the npc." /> <missionstate id="2" description="You successfully finished the quest." /> </mission> </quest> </quests>
Lua:local storage = 45001 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 function greetCallback(cid) npcHandler.topic[cid] = 0 return true end local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, "quest") then local storageValue = player:getStorageValue(storage) if storageValue < 1 then npcHandler:say("Would you like to start this quest?", cid) npcHandler.topic[cid] = 1 return true elseif storageValue == 1 then npcHandler:say("Would you like to complete this quest?", cid) npcHandler.topic[cid] = 1 return true else npcHandler:say("I have no more quests for you.", cid) npcHandler.topic[cid] = 0 return true end elseif npcHandler.topic[cid] == 1 then if not msgcontains(msg, "yes") then npcHandler:say("Another time then.", cid) npcHandler.topic[cid] = 0 return true end if player:getStorageValue(storage) < 1 then player:setStorageValue(storage, 1) npcHandler:say("Cool. You have started the quest.", cid) npcHandler.topic[cid] = 0 return true end player:setStorageValue(storage, 2) npcHandler:say("Awesome. You have finished the quest.", cid) npcHandler.topic[cid] = 0 return true end return true end npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
I do not have this address in my data data/xml/quests.lua
i am using otbr tfs 1.3forgottenserver/data/XML at master · otland/forgottenserver
A free and open-source MMORPG server emulator written in C++ - otland/forgottenservergithub.com
It's definitely there.
If you're not using the official TFS server, I have no idea where it's located.
Looks like they've moved their quests over to Luai am using otbr tfs 1.3 View attachment 57335
I understand, this scripts that you made will make the NPC give me this Quest Log?forgottenserver/data/XML at master · otland/forgottenserver
A free and open-source MMORPG server emulator written in C++ - otland/forgottenservergithub.com
It's definitely there.
If you're not using the official TFS server, I have no idea where it's located.
I understand, this scripts that you mView attachment 57337ade will make the NPC give me this Quest Log?
Can someone help me to make an npc that will give you a quest log with mission?
I had already done this, I had simply placed it in freequest, but I would like it to be with an NPC.Nope.
I helped you create this.
Now it's up to you to learn from the example I provided, to do the thing you want to do.
What are you talking about?I had already done this, I had simply placed it in freequest, but I would like it to be with an NPC.
I get it, ah but it didn't work for me, can you help me create an NPC that will give you that QuestLog?What are you talking about?
You wanted a quest log.
I gave you that. (albeit the wrong one for your server version, because you didn't provide that information in your main post)
You wanted an NPC.
I gave you that as well.
--
Am I missing something?
I get it, ah but it didn't work for me, can you help me create an NPC that will give you that QuestLog?
I would like the NPC to say "Hi, Mission" to give you this Quest Log from Grave Danger
I understand that the startstorageID but I changed it and it didn't work lolI get it, ah but it didn't work for me, can you help me create an NPC that will give you that QuestLog?
I would like the NPC to say "Hi, Mission" to give you this Quest Log from Grave Danger