What do you mean by "won't work"? What do you expect to happen and what happens instead? Do you get any errors or warnings? How does Quest.quest_list
look like? I tried to reproduce your issues, but couldn't. Here's what I did:
extends ItemList
var quest_list = ["Find the Bug?", "Squash It!"]
func add_quest(quest_num):
print("adding quest #", quest_num, ": ", quest_list[quest_num])
self.add_item(quest_list[quest_num])
func get_quests(id):
print("total quests count: ", self.get_item_count())
print("quest #", id, ": ", self.get_item_text(id))
I'm then calling this from another scene like this:
Global.add_quest(0)
Global.get_quests(0)
Global.add_quest(1)
Global.get_quests(1)
And it (correctly) prints the following:
adding quest #0: Find the Bug?
total quests count: 1
quest #0: Find the Bug?
adding quest #1: Squash It!
total quests count: 2
quest #1: Squash It!
Of course there will be issues, when you provide a quest_num
bigger than the quest_list
(for example because you're forgetting it's zero-indexed), but that should result in an error - not just simply "don't work".