Daimonin
Members login
Sign Up!      problems?
N F
* Daimonin Forum
Home Help Search Calendar

Welcome Guest, you have to register to post here.
Search

News

Stats
75655 Posts in 6829 Topics by 8142 Members
Latest Member: mattj
Daimonin Forum  |  Development  |  Scripts  |  Topic: quest_builder.lua « previous next »
Pages: 1 2 [3] 4 Go Down Print
Topic: quest_builder.lua  (Read 2636 times)
smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #30 on: April 19, 2008, 02:43:42 pm »

Here's the code (at the end):
Code:
-------------------
-- qb:Build() builds up the qb table based on the entries passed to it
-- previously by qb:AddQuest() so that qm can handle it.
-- player is the player for whom the quest(s) will be registered.
--   It must be a player object.
-------------------
function QuestBuilder:Build(player)
    assert(type(player) == "GameObject" and player.type == game.TYPE_PLAYER, "Arg #1 must be player GameObject!")

    local questnr
    for i, v in ipairs(self) do
        table.insert(v, 1, player)
        v.player = player
        v.qm = QuestManager(v.player, v.name, v.level, v.skill) -- qm is a standard questmanager table for the quest
        if v.mode == game.QUEST_NORMAL and v.qm:GetStatus() == game.QSTAT_NO then
            v.qm:SetFinalStep(v.finalstep)
        end
        if type(v.required) == "table" then
            for j, w in ipairs(v.required) do
                v.qm:AddRequiredQuest(w)
            end
        end
        local qstat = v.qm:GetStatus()
        if questnr == nil and qstat ~= game.QSTAT_DISALLOW and qstat ~= game.QSTAT_DONE then
            questnr = i
        end
    end
    return questnr
end
So apparently DISALLOW and DONE are not relevant.

Lets think. DONE is irrelevant because if one quest is DONE the next quest (or nil) is the one to think about.

So by the same (approx) token we needn't think about the next quest if it is DISALLOWed.

Hm, but ISTR contending with the problem you mention... Have to do some tests I think.
Logged

smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #31 on: April 19, 2008, 05:36:14 pm »

Because I played over a few days, when I came back for the final part, I only just about remembered what I was supposed to do to be able to complete it, and where I had to go first. The quest summary (Q) did not remind me of this - that information should be made available.
On this point, look at the fanrir.lua example.

After you have accepted a quest you can say 'quest' to him again to get him to repeat how he introduced the quest like:
Code:
            ib:SetMsg("So now you know about Felix. Well, here's something you probably don't know yet.\n")
            ib:AddMsg("\nI caught Felix, tied him up, and trapped him in my larder! " ..
                      "Unfortunately, the mice eventually gnawed through the ropes and Felix, unbound, " ..
                      "discovered a secret door down there that even I did not know about!\n")
            ib:AddMsg("\nNow he's hidden himself deep inside the dungeon beyond that secret door and, I believe, " ..
                      "established himself as Marquis of the Mice! He's the one sending them after my food. " ..
                      "Don't ask me how I can tell, but those two tails you brought back only confirm this; " ..
                      "they've got Felix written all over them!\n")
            ib:AddMsg("\nAs luck would have it, I have recently discovered the whereabouts of the secret door. " ..
                      "All I need now is for someone -- you -- to go down there and slay Felix. " ..
                      "I don't think the mice will be such a trouble without their leader. Will you do it?")
            ib:AddMsg("\nComplete this quest and I'll reward you with ~a silver coin~.")
(ie, in character).

But the quest list version is a simple utilitarian version of this, like :
Code:
    -- most quests won't have the |Hint| stuff so ignore it
    ib:SetTitle(qb:GetName(questnr))
    ib:SetDesc("Back you go to Fanrir's larder. Find the secret door and explore the dungeon beyond. " ..
               "When you find Felix, slay him.", 0, 1, 0, 0)
(ie, out of character, simple gameplay instructions).
« Last Edit: April 19, 2008, 05:43:53 pm by smacky » Logged

Torchwood
MapMaster
*
*
*


Karma: +35/-5
Posts: 968



View Profile
« Reply #32 on: April 19, 2008, 05:54:49 pm »


Yes, its probably the SetDesc stuff I haven't done properly.  In fact, I haven't done this in the quest I just rewrote - so I need to go back and do that.

We've got to have QSTAT_DISALLOW as a valid state returned by quest_builder (IMO).  At the moment, you can't tell between 'all quests completed' and 'next quest disallowed', so we don't know whether the NPC should say something like "thanks - you're all done!" or "you need to come back later".

(Just tested this, and yes - questnr == nil, so my script assumes all quests are complete and the NPC says "thanks, I'm safe now", when in fact my test char has not done any of the quest at all yet.)

Also, from the player's point of view, they need some clue that the NPC does have a quest for them ... otherwise, every time they level up, they have to go and talk to each NPC just to see if they are now eligible for a quest.
Logged

smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #33 on: April 19, 2008, 06:59:46 pm »

OK, good points.

I can change iit then so instead of
Code:
questnr == nil (all quest done OR next quest disallowed) | number (current quest)
it is
Code:
questnr = false (all quests done) | true (next quest disallowed, but there *is* a next quest) | number (current quest)

You would still not be able to access the details of the next quest but at least you could indicate that there was one.

EDIT: Or maybe if the next quest is disallowed, questnr = negative number? So nil, positive or negative. That way the script could access details for a disallowed quest without increasing the complexity of using qb.lua (although I suggest that NPCs don't get too specific:
Code:
if questnr ~= nil and questnr < 0 then
    ib:SetMsg("I have nothing for you now. Come back when you're level " .. qb:GetLevel(questnr) .. "."
end
« Last Edit: April 19, 2008, 07:08:53 pm by smacky » Logged

Torchwood
MapMaster
*
*
*


Karma: +35/-5
Posts: 968



View Profile
« Reply #34 on: April 19, 2008, 07:25:59 pm »


Yes - negative is OK I suppose ... then the NPC can make a sensible comment.  In your example, "come back when you are level X", if you have several quests, and you decide to have a progression of levels (quest 1 lvl req = 5, quest 2 = 7, quest 3 = 9), then by knowing which quest is next, you can fill in the X in the NPC's conversation (or at least, give a meaningful dialogue).

Still not sure I really understand why you don't just return the quest number and allow QSTAT_DISALLOW ...
Logged

smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #35 on: April 19, 2008, 08:09:22 pm »

Still not sure I really understand why you don't just return the quest number and allow QSTAT_DISALLOW ...
That'd mean:
Code:
if questnr = 1 and qb:GetStatus(1) == game.QSTAT_DISALLOW then

Whereas with negatives you just do:
Code:
if questnr == -1 then
Logged

grommit
Administrator
*
*
*
*


Karma: +28/-3
Posts: 2529



View Profile
« Reply #36 on: April 19, 2008, 09:23:38 pm »

Yes it was the SetDesc stuff that didn't have the info. I am not about to trek halfway across the world to ask the quest giver to remind me what I am supposed to be doing. And knowing me, by the time I got there, I'd have forgotten why I wanted to be there. Cheesy
Logged
smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #37 on: April 19, 2008, 09:59:48 pm »

hehe Yeah that's why you put the condensed version in quest list. (It will also make player files quite a bit smaller (few hundred bytes per quest?).
Logged

Torchwood
MapMaster
*
*
*


Karma: +35/-5
Posts: 968



View Profile
« Reply #38 on: April 20, 2008, 03:02:35 pm »


Ummm ... I think Grommit's post in the wrong thread?  Should be in here:

http://www.daimonin.com/the_tower_of_bebeniss-t5874.0.html;msg70612#msg70612

Anyway, can you confirm ... what goes into the quest summary is the entire contents of the IB at the time the qb:Register command is issued?
Logged

grommit
Administrator
*
*
*
*


Karma: +28/-3
Posts: 2529



View Profile
« Reply #39 on: April 20, 2008, 03:28:06 pm »

Ummm ... I think Grommit's post in the wrong thread?
Don't think so. Smacky quoted me and was talking about getting info from the quest giver as opposed to from the quest summary. I was replying to that.
Logged
smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #40 on: April 20, 2008, 03:50:58 pm »

Stop fighting. Wink Yes, Grommit's post was in relation to the quest list vs quest topic of an NPC, not ToB so it's in the right place.

Anyway, can you confirm ... what goes into the quest summary is the entire contents of the IB at the time the qb:Register command is issued?
Header, title, buttons, textfield do not Or rather IIRC they are saved to the quest object which is part of the player but are then overwritten by the server.

Also ^ characters are removed by ib.lua (they won't work in a quest list anyway. I can't remember what happens to links and icon.

Basically stick to message body and desc body (and coins). Hm, icons must be reproduceable in the quest list actually but would be in preview mode (so no selecting selectables).
Logged

Torchwood
MapMaster
*
*
*


Karma: +35/-5
Posts: 968



View Profile
« Reply #41 on: April 20, 2008, 05:39:59 pm »

Ah - I see what's gone on.  Smacky quoted in this thread from Grommits comment in my ToB thread!  So yes, my fault ... Embarrassed

However, I just tested my ToB scripts and there is info in the /qlist for each stage of the quest.  True, I don't use SetDesc(), but the message body contains the rough information on what to do on the quest.  I had thought this was OK (but then I wrote the quest, so I'm not objective about what is easy to understand!) ... but I guess Grommit, you are saying you'd like the instructions to be a bit more specific?

(For reference, if you are /dm on test server, you can goto /unofficial/torchwood/tower/quest_test where you can do the whole quest on one map, incase you want to review the wording I used)

EDIT:  Ooops - no you can't!  Thats only on my local server, I never commited my quest_test map for ToB Sad
« Last Edit: April 20, 2008, 05:58:14 pm by Torchwood » Logged

smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #42 on: April 20, 2008, 06:54:14 pm »

Quote
smacky * r3417 /trunk/maps/lua/quest_builder.lua:
Updated to understand negative questnr as disallowed quest.
When passing a questnr to one of the methods it is math.abs() so the negativity is read only, only relevant to qb:Build() and qb:GetNumber().
I have not updated the wiki yet, but the script is commented. So try, break, report. Smiley

On a different note, the current NPC GUI cannot highlight (| or ~) sentences across linebreaks. So for example,
Code:
            ib:AddMsg("\nCould you kill some of the mice please? " ..
                      "I'll pay you ~10 copper coins~ if you can bring back two of their tails.")
Will display as:
Quote
Could you kill some of the mice please? I'll pay you 10
copper coins if you can bring back two of their tails.
In the current GUI. This issue is fixed in SENTInce. But clickable keywords (^) cannot be extended across lines in either case.
Logged

Torchwood
MapMaster
*
*
*


Karma: +35/-5
Posts: 968



View Profile
« Reply #43 on: April 20, 2008, 10:23:53 pm »

Quote
So try, break, report

Tried it ... didn't break it.  Worked well - conversion of my script from using QSTAT_DISALLOW to using (questnr < 0) took all of 5 minutes and I have the functionality I need now.
Logged

smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #44 on: April 20, 2008, 11:28:19 pm »

Great! Smiley

I have several quest scripts to write and rewrite over the next few days so that should give it a pretty thorough testing. Then if all goes well I'll update the wiki doc and do something about better (shorter more specific) examples.
Logged

Pages: 1 2 [3] 4 Go Up Print 
Daimonin Forum  |  Development  |  Scripts  |  Topic: quest_builder.lua « previous next »
Jump to:  

Page created in 0.142 seconds with 19 queries.
Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks
Copyright 2008 Daimonin MMORPG  •  Terms of Service  •  XHTML  •  Daimonin sourceforge open source project