Hey, I'm playing with the structure for my game and I was hoping to use ExtraDatabase component for certain things. Such as, controlling an entire minigame in dialogue.
This one complex conversation has lots of variables, but they only matter from the beginning to end of the 'conversation' (which encapsulates the full minigame loop). I was hoping that the variables would be usable when I merged in the minigame's database at runtime, but the values are all nil and cannot be set.
Is there any way I could get the variables to merge in? If not, is there a way to declare new variables at runtime or within a conversation (maybe by using a custom sequence command)? It would be very suboptimal to have all variables, including these very temporary ones, in the initial/main database, which I would like to only hold things that I would put in a player's save file. Is there something I'm missing that can do this, or is the backend lua system not quite set up for this use-case?
Thanks for any help!
Extra Database - Accessing Variables
Re: Extra Database - Accessing Variables
Hi,
When the Extra Databases component loads extra databases into memory, it should also load and initialize all variables defined in those databases. Are you sure the databases are being loaded? If the database(s) should load when you start a specific scene, set the Add Trigger to OnStart and assign your database(s) to the Databases list. To automatically unload the database and its variables from memory when leaving the scene, set the Remove Trigger to OnDestroy.
To answer your other question, you can define new variables at runtime simply by setting them.
When the Extra Databases component loads extra databases into memory, it should also load and initialize all variables defined in those databases. Are you sure the databases are being loaded? If the database(s) should load when you start a specific scene, set the Add Trigger to OnStart and assign your database(s) to the Databases list. To automatically unload the database and its variables from memory when leaving the scene, set the Remove Trigger to OnDestroy.
To answer your other question, you can define new variables at runtime simply by setting them.
- Dialogue Text: "This node creates a new variable Foo and sets its value to 42."
- Script: Variable["Foo"] = 42
Re: Extra Database - Accessing Variables
Hmm ok that sounds like how I'd expect it to work. Weirdly, I cannot reproduce today what I saw yesterday, now after I switch scenes the conversation doesn't run. All I know is that I have the extra database component with "Once" checked, in my 2nd scene, and that component disappears at runtime (presumably because the databases merged ok, no console output is shown to make me think otherwise).
However, I might be running into ID conflicts. I'm trying to redo my database with the BaseID set, but I don't see that property anywhere as described in the docs: "On the Dialogue Editor's Database tab, you can assign values to Database Properties > Base ID for each database." In my "database properties" I see Author, Version, Description, Global User Script, and Emphasis Settings. I've looked around in the editor but can't find BaseID. So that may be the cause of my issues.
Might be worth adding that I'm not up to the latest version, I'm on 2.2.6 so maybe BaseID is super brand new, idk.
However, I might be running into ID conflicts. I'm trying to redo my database with the BaseID set, but I don't see that property anywhere as described in the docs: "On the Dialogue Editor's Database tab, you can assign values to Database Properties > Base ID for each database." In my "database properties" I see Author, Version, Description, Global User Script, and Emphasis Settings. I've looked around in the editor but can't find BaseID. So that may be the cause of my issues.
Might be worth adding that I'm not up to the latest version, I'm on 2.2.6 so maybe BaseID is super brand new, idk.
Re: Extra Database - Accessing Variables
Thanks for all the help. After running the two db's in the unique id tool things are working well. I'm going to look into upgrading the version to set baseID still, because I'd like having that level of control going forward.
Re: Extra Database - Accessing Variables
Sounds good! Back up your project before updating (just to be safe), and also look over the release notes for any new features or changes you might want to take advantage of.