Adding new Quest Entries messes up listeners/Entry references
Posted: Thu May 06, 2021 10:08 am
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
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