I have a quest log showing active quests and am trying to remove a quest once it has been completed. But the quest log (specifically the itemlist showing the active quests) behaves a bit weird:
The quests are added by calling the add_quest() function, which works fine.
var activequests = QM.Quests.ActiveQuests
if quest_act < activequests.size():
quest_act += 1
Without the removal, getting the second quest from the NPC just adds a new item with its proper description when pressed, as intended. However, when I implement the following remove_quest() function, things look strange to me:
func remove_quest(questname, questdesc):
if questname in QM.Quests.ActiveQuests:
var removed_quest = QM.Quests.ActiveQuests.find(questname)
$QuestDescription.text = ""
quest_act -= 1
The item gets deleted properly (as verified with print statements for debugging), but when I open the quest log again after completing the quest, the item is still displayed. Of course when I click it, I get the error "Invalid get index '0' (on base: 'Array')."
var quest_description = QM.Quests.QuestDescription[index]
$QuestDescription.text = quest_description
However, if I complete Quest1 and then accept Quest2 (thus removing one and adding a new item), the quest log then still shows the item "Quest1", but when selected displays the correct quest description for Quest2.
Does anyone have an idea what is going on here? The entire GUI is set to Process, so that shouldn't be the issue.