Download

Storing game variable for a longer time

Hi Folks,

I’m currently trying to implement a quest and dialog system in blueprint and I’m stuck at a point where I’m trying to figure out a way to store values like information about quests that have finished, to prevent doing the same quest over and over again. Same goes for dialog, preventing to have the same dialog over and over again even if the game has moved on and the story is somewhere else.

First I was thinking to use data tables but the drawback is that I can’t edit entries, so I can’t mark a quest as “finished”. Another option would be to use variables on the pawns (NPCs) but you would need to track it on every NPC, store it with every save and so on.

Is there a general approach? How is it usually done?

Regards,
Damir

Elder scrolls games use global variable arrays. Every quest has a bool in it and states.
All dialog is bound to the states.
People can only say certain things and do certain things if the state is active for that questID that has the bool" HasStarted

So you kinda want to create a gamestate with a bool array.
Every quest gets one only one array ID for every stored variable.

You talk to a npc and the hasstarted bool for the quest with that id will be created.

Thats just one technique

Currently, in my project every quest is a structure, which has a state, like New, Running, Finished, TurnedIn. I was thing maybe to store every finished quest into a global variable, as you say maybe in the game instance and always check if a quest is in this array before offering it to the player, if it is, and has state "finished, don’t offer it.

From a performance point of view, is a solution like that having too much impact?

Performance? Start about thinking on how to save the whole game. Then you will have a certain answer. A huge problem.