locking a book?

Forum organization and occasional community-building.
Forum rules
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
lunawolf86
Newbie
Posts: 4
Joined: Mon Jun 03, 2019 3:30 pm
Contact:

locking a book?

#1 Post by lunawolf86 »

been working awhile on this and now i have run into another problem... i got the prologue done to my novel and i set up the 3 separate books i needed but i want it set up where the third book is locked until the first two are finished any ideas would help.. and yes for the most part i am learning renpy/coding on my own so that being said it takes a bit for me to figure things out if not i do ask for help haha

Mutive
Veteran
Posts: 344
Joined: Tue Nov 21, 2017 2:23 am
Completed: Eidolon, Minion!, Love Furever, Epilogue
Contact:

Re: locking a book?

#2 Post by Mutive »

You'd want to use some kind of persistent condition. You'd wait until whatever conditions you needed for the book to be unlocked to be achieved, then would do something along the lines of:

Code: Select all

$ persistent.book3unlocked = True
Let's say that the conditions you wanted were for book1 and book2 to be completed before the player could open book3. At the bottom of book1's playthrough you'd put something like:

Code: Select all

$ persistent.book1 = True
And then do the same for book2 (just change the variable to persistent.book2).

Then at the top of your game (probably after "label start:", you'd have something like:

Code: Select all

if persistent.book1 == true and persistent.book2 == True:
		$ persistent.book3unlocked = True
Then your code might read something like where you wanted to ask the player which book they wanted to play through:

Code: Select all

menu:
		"Which book do you want to play through?"
		"Book 1":
			jump book1
		"Book 2":
			jump book2
		"Book 3" if persistent.book3unlocked == True:
			jump book3
There are a lot of ways of doing this, though, depending on precisely how you want your game/code to look.
Enjoy Eidolon, my free to play game at: https://mutive.itch.io/eidolon, Minion! at: https://mutive.itch.io/minion or Epilogue at: https://mutive.itch.io/epilogue

lunawolf86
Newbie
Posts: 4
Joined: Mon Jun 03, 2019 3:30 pm
Contact:

Re: locking a book?

#3 Post by lunawolf86 »

Mutive wrote: Mon Jun 24, 2019 12:30 pm You'd want to use some kind of persistent condition. You'd wait until whatever conditions you needed for the book to be unlocked to be achieved, then would do something along the lines of:

Code: Select all

$ persistent.book3unlocked = True
Let's say that the conditions you wanted were for book1 and book2 to be completed before the player could open book3. At the bottom of book1's playthrough you'd put something like:

Code: Select all

$ persistent.book1 = True
And then do the same for book2 (just change the variable to persistent.book2).

Then at the top of your game (probably after "label start:", you'd have something like:

Code: Select all

if persistent.book1 == true and persistent.book2 == True:
		$ persistent.book3unlocked = True
Then your code might read something like where you wanted to ask the player which book they wanted to play through:

Code: Select all

menu:
		"Which book do you want to play through?"
		"Book 1":
			jump book1
		"Book 2":
			jump book2
		"Book 3" if persistent.book3unlocked == True:
			jump book3
There are a lot of ways of doing this, though, depending on precisely how you want your game/code to look.

thank you ill finagle it from here :)

Post Reply

Who is online

Users browsing this forum: No registered users