Hello!
We're designing a huge medieval library in our game that contains 270 books.
Now, I want to make a mechanic where the player can only read 5 books per day Variable["Theodor.Books_Max"]
And each time the player reads a book he hasn't already read (ex.: Library.Book_EpicOfGilgamesh bool) then I increment Variable["Theodor.Books_Read"] by one. This works fine.
Now, I'm struggling to find the correct way to configure these conditions. It seems any solution I try to apply results in the dialogue box being blank and unable to continue...
Huge library game concept, with daily reading limitation
-
- Posts: 20
- Joined: Tue Apr 22, 2025 3:33 pm
Huge library game concept, with daily reading limitation
- Attachments
-
- Capture.PNG (159.37 KiB) Viewed 986 times
-
- Capture.PNG (388.29 KiB) Viewed 986 times
Re: Huge library game concept, with daily reading limitation
Hi,
270 books is a lot of conversations to link. It might be better to handle it in code.
For example -- although you may already be doing this -- you can increment the variable in C#:
270 books is a lot of conversations to link. It might be better to handle it in code.
For example -- although you may already be doing this -- you can increment the variable in C#:
Code: Select all
// Call this at the start of each new day:
void StartNewDay() => DialogueLua.SetVariable("Theodor.Books_Read", 0);
// Call this when trying to read a book:
void TryToReadBook(string bookConversationTitle)
{
int numNewBooksReadToday = DialogueLua.GetVariable("Theodor.Books_Read").asInt;
var bookVariableName = $"Library.Book_{bookConversationTitle}";
var hasReadBookBefore = DialogueLua.GetVariable(bookVariableName).asBool;
if (!hasReadBookBefore)
{
if (numNewBooksReadToday >= 5)
{
DialogueManager.StartConversation("Can't Read More Books Today");
return; // Exit early. Can't read any more today.
}
else
{
// Increment # new books read and mark this book as read:
numNewBooksReadToday++;
DialogueLua.SetVariable("Thedor.Books_Read", numNewBooksReadToday );
DialogueLua.SetVariable(bookVariableName, true);
}
}
DialogueManager.StartConversation(bookConversationTitle);
}
-
- Posts: 20
- Joined: Tue Apr 22, 2025 3:33 pm
Re: Huge library game concept, with daily reading limitation
I don't mind the monkey work.
I was dividing my conversations like alleys in an actual library: Library/History, Library/Theology, Library/NaturalScience, etc.
But ok I'll show this to my programmer. Thanks!

But ok I'll show this to my programmer. Thanks!
Re: Huge library game concept, with daily reading limitation
Alleys is smart -- it reduces the number of nodes whose Conditions you need to check when starting the conversation. But it'll be even more efficient if your programmer can implement something like the idea above. And it might be more scalable if you add or remove books.
-
- Posts: 20
- Joined: Tue Apr 22, 2025 3:33 pm
Re: Huge library game concept, with daily reading limitation
but just for my own curiosity, was there something wrong with using
Variable["Theodor.Books_Read"] < Variable["Theodor.Books_Max"]
for the books that can be read and
Variable["Theodor.Books_Read"] >= Variable["Theodor.Books_Max"]
for when the daily limit has been attained or surpassed?
I'm curious as to why the dialogue manager didn't know what node to pick and returned blank.
Variable["Theodor.Books_Read"] < Variable["Theodor.Books_Max"]
for the books that can be read and
Variable["Theodor.Books_Read"] >= Variable["Theodor.Books_Max"]
for when the daily limit has been attained or surpassed?
I'm curious as to why the dialogue manager didn't know what node to pick and returned blank.
Re: Huge library game concept, with daily reading limitation
That should work in concept. Maybe there's a typo or something. You could temporarily add a Lua Console to the scene. Then press ~+L to open it, and enter:
to see what it returns (true or false).
Code: Select all
return Variable["Theodor.Books_Read"] >= Variable["Theodor.Books_Max"]
-
- Posts: 20
- Joined: Tue Apr 22, 2025 3:33 pm
Re: Huge library game concept, with daily reading limitation
Oh wowww that's a thing?!?
That's going to be very helpful! THank you again!
That's going to be very helpful! THank you again!