Adding new Quest Entries messes up listeners/Entry references

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Lauri K
Posts: 8
Joined: Tue Aug 04, 2020 3:08 pm

Adding new Quest Entries messes up listeners/Entry references

Post by Lauri K »

Hi!

in our game we have Quests, that have Entries (Subtasks). So I might make a Quest ("Main Mission") that consists of for example 5 Quest Entries. Then I make e.g. a gameobject, which listens to a Quest Entry state when the level is loaded to latest checkpoint. Lets say as an example, a door, that is locked or unlocked based on the Quest Entry number 3's ("Kill enemies") state. So the Quest State Listener has a Lua condition that might look like this:

CurrentQuestEntryState("Main Mission", 3) == "active"

And then I would use the llistener's Unity Event to do things like open or close the door depending on the Entry state, when the level is loaded. If the state is 'active', door would be closed, and if it was 'success' the door would be open, and so on.

But the issue I've bumped into is that what if I add a NEW Quest Entry inside the Quest: let's say I add a new Quest entry between original entries 2 and 3. So now I have entries 1-6, and the "Kill enemies" entry number is now 4, as it was earlier 3. Still, my Lua code references to the entry number "3", and doesn't automatically (of course) update to the right entry number it now has, which is "4".

I hope you get my issue here: how can I safely add entries to a Quest without messing up earlier references to entry numbers? As far as I know there are no unique identification ways for Quest Entries - they just get a running number that can change depending of their order in under the Quest Element? Maybe I need to revise the whole way I'm trying to do things based on the Quest entrie's state to setup the level? I would just love to setup level conditions based on the Quest or Quest Entry states, without the need to start creating additional variables that hold data.

Cheers,
Lauri
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding new Quest Entries messes up listeners/Entry references

Post by Tony Li »

Hi Lauri,

That's a drawback of the way quest entries work.

This solution isn't automatic, but you can use the Database page's Global Search & Replace to replace:

("Main Mission", 3)

with:

("Main Mission", 4)
Lauri K
Posts: 8
Joined: Tue Aug 04, 2020 3:08 pm

Re: Adding new Quest Entries messes up listeners/Entry references

Post by Lauri K »

Hi Tony,

again thanks for the quick reply, highly appreciate it. At least I know now that this is an actual limitation/functionality so I can try either figure out a workaround or go with your suggestion of search & replace.

Cheers,
Lauri
Post Reply