This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

I started working on a quest system and been constantly running into walls with it and cant seem to get a full working system with no holes. I'm starting over completely and am still planning to make one. But my question is, is it good to use a dictionary or array for a quest system or is there a better way to go about it. In my case I tried using both arrays and dicts to hold the names of the quest and the summary. But then I have no where to put the reward. I also used for loops, global scrips, and the list-item node along side them.

So is using arrays and dictionaries ideal for a quest system or is there a better way to store the quest? also any tips would be appreciated. Thanks!

in Engine by (831 points)

1 Answer

+3 votes
Best answer

Yes it's fine to use arrays and dictionaries. If you feel comfortable using them and know well about how to use them together, it can be a very useful way to control systems like quests.
You can use one array to save all the quests info, each quest as a dictionary saved inside the array.
For example:

var quests = []
func _ready():
    new_quest({"Name": "Killing 10 Slimes and save 5 Villiagers", "Type": "Main_Quest", "Accomplish_conditions": [{"Type": "Kill monsters", "monster_Type": "Slime", "amount_required": 10}, {"Save NPC", "NPC_Type": "Villager", "amount_required": 5}]})
    #Here is just an example of how to use arrays and dictionaries to control a big complex quests system. Using them in similar ways can do things that are not just for quests, but also for many other things in your game, like characters, spells, etc.

function new_quest(quest):

#.....Add more methods according to how you want to construct your program. For example: quest_accomplished(quest), are_quest_accomplish_conditions_satisfied(quest), etc. It goes on and on. It's very flexisble, and you can do lots of things.

If you prefer using scenes instead of tons of infos inside arrays and dictionaries, the idea is the same, instead of adding a dictionary into the array, using an instance of the quest scene, or a dictionary like: {"Info": quest.get("info"), "node": quest}

by (813 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.