0 votes

Heey Guys and Gilrs

First sorry English is not my first language.
No my problem I have written a Quest dictionary.

"QUEST0":{
'QuestName':"Farming",
'is
Quest_active':false,
....
}

Now I want the variable isQuestactive set to ture with the funtion:

func activateQuest(QuestID):
QuestDictionary[Quest
ID]["isQuestactive?"] = true

What happens now is that the variable isQuestactive remains false and a new entry is added to the dictionary with variable isQuestactive: true

How can i set isQuestactive to true?

can someone help me with this problem? thanks in advance :)

asked Apr 18 in Projects by liti (12 points)

1 Answer

+1 vote

You named the key is_Quest_active but are setting the key is_Quest_active? (with a question mark in the end). Here's a working example:

var QuestDictionary = {
    "QUEST0": {
        "Quest_Name": "Farming",
        "is_Quest_active": false
    },
    "QUEST1": {
        "Quest_Name": "Mining",
        "is_Quest_active": false
    }
}

func _ready():
    print("Quests before: ", QuestDictionary)
    activate_Quest("QUEST0")
    print("Quests after: ", QuestDictionary)

func activate_Quest(QuestID):
    QuestDictionary[QuestID]["is_Quest_active"] = true
answered Apr 18 by njamster (8,904 points)
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 How to use this Q&A? before posting your first questions.