• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua About questing & questlogs

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,084
Solutions
15
Reaction score
379
Location
Sweden
YouTube
Joriku
Alright, so I am trying to create an quest.
It's about a mystic key that's needed in-order to open a door after talking to the npc

so first: (Quest explanation below in the post)
I am trying to make a simple quest, to learn it and evolve my quests.

I am trying to create "ThemysteriouskeyQuest" - CastleshieldQuest as an table/storage.

What I am having troubles with:
  • Npc, make him into the main mission. Add achievement + quest log
  • Add quest log onto the achievement given in the chest
  • Create the key, being able to unlock it with key: 2088 / silver key. Only entrance if achievement is made

This is what I've got:

Npc: -- where and how would a quest + ach be added in here?
Lua:
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 voices = { {text = 'I wounder where this damn key could be..'} }
npcHandler:addModule(VoiceModule:new(voices))

-- Basic
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = "I am an old wizard, looking for answers."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = "Just call me Mr Luchan."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, text = "We still dont fully know what time is.."})
keywordHandler:addKeyword({'key'}, StdModule.say, {npcHandler = npcHandler, text = "It is said to be found near {Stefans shed}."})
keywordHandler:addKeyword({'stefans shed'}, StdModule.say, {npcHandler = npcHandler, text = "You can find him south-east of our city temple, his beer is legendary."})
keywordHandler:addKeyword({'stefan'}, StdModule.say, {npcHandler = npcHandler, text = "You can find him south-east of our city temple, his beer is legendary."})

npcHandler:setMessage(MESSAGE_GREET, "Oh, hi. I usually dont see people around those parts of the world.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, may we meet again.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Well well, this place ain't for everyone.")

npcHandler:addModule(FocusModule:new())

Chest: (Quests.lua)
Lua:
[47] = {
            name = "The mystic key Quest",
            startStorageId = Storage.Quest.CastleShieldQuest.Questline,
            startStorageValue = 1,
            missions = {
                [1] = {
                    name = "Talk to Mr Lushan.",
                    storageId = Storage.Quest.CastleShieldQuest.TheMysticKey,
                    missionId = 10399,
                    startValue = 1,
                    endValue = 1,
                    description = "You fought brave and finished your goal, by taking home a new shiny blade."
                },
                [2] = {
                    name = "Find the mysterious key.",
                    storageId = Storage.Quest.CastleShieldQuest.TheLostAmulet,
                    missionId = 10400,
                    startValue = 1,
                    endValue = 3,
                    states = {
                        [1] = "Mr Lushan asked you to go find the mysterious key somewhere located north-west of Stefan's shed.",
                        [2] = "You found the key, you should go back to Mr Lushan to tell him your findings.",
                        [3] = "Mr Lushan thanked you for the help and wishes you well."
                    }
                },
            }

Achievement lib: (Achievements_lib.lua)
Lua:
[481] = {name = "ThemysteriousKey", grade = 2, points = 4, secret = true, description = "You found an unkown key, wounder what this can open up."}

Chest for the item on location: (storages.lua)
Lua:
CastleShieldQuest = {
            QuestLine = 10116, -- ment to give questlog, sadly doesn't work
            Reward = 10117
        },


Then about the door for the key... I have nothing.. :(
don't really understand the meaning of it yet
Lua:
-- These are the doors for missions, they need access from some mission (storage) to be able to enter. Put the storage value in the action id of the door and it will open only to the player who has the storage value.
QuestDoorTable = {
    { closedDoor = 1223, openDoor = 1224 },
    { closedDoor = 1225, openDoor = 1226 },
    { closedDoor = 1241, openDoor = 1242 },
    { closedDoor = 1243, openDoor = 1244 },
    { closedDoor = 1255, openDoor = 1256 },
    { closedDoor = 1257, openDoor = 1258 },
    { closedDoor = 3542, openDoor = 3543 },
    { closedDoor = 3551, openDoor = 3552 },
    { closedDoor = 5105, openDoor = 5106 },
    { closedDoor = 5114, openDoor = 5115 },
    { closedDoor = 5123, openDoor = 5124 },
    { closedDoor = 5132, openDoor = 5133 },
    { closedDoor = 5288, openDoor = 5289 },
    { closedDoor = 5290, openDoor = 5291 },
    { closedDoor = 5748, openDoor = 5749 },
    { closedDoor = 6202, openDoor = 6203 },
    { closedDoor = 6204, openDoor = 6205 },
    { closedDoor = 6259, openDoor = 6260 },
    { closedDoor = 6261, openDoor = 6262 },
    { closedDoor = 6898, openDoor = 6899 },
    { closedDoor = 6907, openDoor = 6908 },
    { closedDoor = 7040, openDoor = 7041 },
    { closedDoor = 7049, openDoor = 7050 },
    { closedDoor = 8551, openDoor = 8552 },
    { closedDoor = 8553, openDoor = 8554 },
    { closedDoor = 9175, openDoor = 9176 },
    { closedDoor = 9177, openDoor = 9178 },
    { closedDoor = 9277, openDoor = 9278 },
    { closedDoor = 9279, openDoor = 9280 },
    { closedDoor = 10278, openDoor = 10279 },
    { closedDoor = 10280, openDoor = 10281 },
    { closedDoor = 10475, openDoor = 10476 },
    { closedDoor = 10484, openDoor = 10485 },
    { closedDoor = 10782, openDoor = 10783 },
    { closedDoor = 10791, openDoor = 10792 },
    { closedDoor = 12104, openDoor = 12105 },
    { closedDoor = 12195, openDoor = 12196 },
    { closedDoor = 12204, openDoor = 12205 },
    { closedDoor = 13022, openDoor = 13023 },
    { closedDoor = 19847, openDoor = 19848 },
    { closedDoor = 19856, openDoor = 19857 },
    { closedDoor = 19987, openDoor = 19988 },
    { closedDoor = 19996, openDoor = 19997 },
    { closedDoor = 20280, openDoor = 20281 },
    { closedDoor = 20289, openDoor = 20290 },
    { closedDoor = 22821, openDoor = 22822 },
    { closedDoor = 22830, openDoor = 22831 },
    { closedDoor = 25162, openDoor = 25163 },
    { closedDoor = 25164, openDoor = 25165 },
    { closedDoor = 34679, openDoor = 34680 },
    { closedDoor = 34681, openDoor = 34682 },
    { closedDoor = 34683, openDoor = 34684 },
    { closedDoor = 34685, openDoor = 34686 },
    { closedDoor = 36403, openDoor = 36404 },
    { closedDoor = 36405, openDoor = 36406 },
}



Quest quickly explained:
So, you enter the tp for the quest.
cce5e4fa6c326d3a835cd27aca9456f2.png


Find the lever after slaying some nasty monsters or dying on the way there.
389c4822c9d1a5dd5d77cb4b71a81d87.png


Find the entrence before it's gone
f343349871edc72826ebd8f3d22c5e6b.png


Talk to Mr Lushan - Quest log
7856f9306050ddb6bebb9ce78d2979ff.jpg


Find Stefan & talk to him for the clue + mission (ach needed for a tile, walkback if ach. is missing) - Quest logs
47deade9d312f795caa74178f54b26cf.jpg


Find the silver key - Ach + quest log
0b07f988b3827aa252c2a5a432a5ef02.png


Get back and talk to mr luchan, gain access into the room. Auto.Close door on walk-in - questlog
60df215393341546987884bde4e1cade.jpg
 
I don't know if you have already done this step, but you must have the registered mission in XML/quests.xml

Once you have the storage in quests.xml just add it to the player with:
Lua:
player:setStorageValue(xxxx, y)

Where: xxxx - Storage Value
y - Value

For achivement use the command:
Code:
player:addAchievement("Name of achivement")

for key I just create a key in a variable and then add the action id, like this:
Code:
local key = player:addItem(2088, 1)
key:setAttribute(ITEM_ATTRIBUTE_ACTIONID, actionid)

Doors need a little modifications in your scripts/action/others/doors.lua

Of course, this is all if you use TFS 1.X
 
I don't know if you have already done this step, but you must have the registered mission in XML/quests.xml

Once you have the storage in quests.xml just add it to the player with:
Lua:
player:setStorageValue(xxxx, y)

Where: xxxx - Storage Value
y - Value

For achivement use the command:
Code:
player:addAchievement("Name of achivement")

for key I just create a key in a variable and then add the action id, like this:
Code:
local key = player:addItem(2088, 1)
key:setAttribute(ITEM_ATTRIBUTE_ACTIONID, actionid)

Doors need a little modifications in your scripts/action/others/doors.lua

Of course, this is all if you use TFS 1.X
Sorry for late response, finally picking this up again.
About the XML part, sadly. There's none existing. (OTBR) - for the moment being.

edc7cff1a09dcb42aceb9b3c21106770.png


I'll check the door out, thanks!
 
Back
Top