Add Variable and Get All Variables in code
Posted: Tue Apr 30, 2019 9:05 am
We've got a "KnowledgeBase" as we called it in our game. Huge table of true/false keys, containing various information known to player, like "Location01Visited", "Secret04Found" or "NPC07Conversation01Finished"
So any piece of this info might be used in any place in the game. One secret will be opened after another, visited location will be shown on map for example and so on ... and we want to use this pieces of knowledge in conversations as well. Like, add dialogue option if some location is visited. Or on specific dialogue entry in conversation NPC will give player knowledge about something, like a secret passage or other knowledge that'll be used in another conversation with another NPC.
KnowledgeBase got fancy editor to add, categorize etc.
So what I want is to sync our base with Dialogue Variables on edit time. This way we wont have to add same entries with the same name in two different places.
Then I thought to, maybe, specify what variables will be used in specific dialogue, so I'll be able to set current variables from KnowledgeBase to DialogueVariables on conversation start and sync back when dialogues ends from DialogueVariables to KnowledgeBase to check if we've got some Knowledge set to true during the conversation.
Maybe you'll come up with better idea on how to implement this.
Anyways. I tried to dig into the API and figured out that "CreateNewVariable()" is hidden somwhere in Dialogue Editor Scripts.
Maybe I'm missing something, is there some way to add variables with api?
So any piece of this info might be used in any place in the game. One secret will be opened after another, visited location will be shown on map for example and so on ... and we want to use this pieces of knowledge in conversations as well. Like, add dialogue option if some location is visited. Or on specific dialogue entry in conversation NPC will give player knowledge about something, like a secret passage or other knowledge that'll be used in another conversation with another NPC.
KnowledgeBase got fancy editor to add, categorize etc.
So what I want is to sync our base with Dialogue Variables on edit time. This way we wont have to add same entries with the same name in two different places.
Then I thought to, maybe, specify what variables will be used in specific dialogue, so I'll be able to set current variables from KnowledgeBase to DialogueVariables on conversation start and sync back when dialogues ends from DialogueVariables to KnowledgeBase to check if we've got some Knowledge set to true during the conversation.
Maybe you'll come up with better idea on how to implement this.
Anyways. I tried to dig into the API and figured out that "CreateNewVariable()" is hidden somwhere in Dialogue Editor Scripts.
Maybe I'm missing something, is there some way to add variables with api?