[Solved] A button in the options that let's you skip certain type of scenes?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

[Solved] A button in the options that let's you skip certain type of scenes?

#1 Post by Ace94 » Sat Mar 31, 2018 6:29 pm

Hi. I am curious if anyone knows how to do this? Can I add a button in the main menu's options (where the music volume is and so on) that when turned off will let the player skip a particular type of scenes?
Like for example if he enabled Gore on he will see scenes that contain gore, but if it's off the game will skip that content until it shows no gore in the story and so on. Thanks in advance!
Last edited by Ace94 on Mon Apr 02, 2018 11:20 pm, edited 1 time in total.

User avatar
starshine001
Newbie
Posts: 23
Joined: Fri Feb 02, 2018 9:16 am
Completed: None
Projects: The Nightfall [Vampire Thriller]
Organization: None
Contact:

Re: A button in the options that let's you skip certain type of scenes?

#2 Post by starshine001 » Sun Apr 01, 2018 1:33 pm

I would just define a variable "gore" and let the player set it to True/False. Before scenes that contain gore I would let Ren'py check and, if "gore" is false, skip the scene. Once I'm home I can give a more detailed explanation.
Looking cool, Joker!
-Morgana, 2017
----------------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------
My dreams dictate my reality

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: A button in the options that let's you skip certain type of scenes?

#3 Post by Ace94 » Sun Apr 01, 2018 1:42 pm

starshine001 wrote:
Sun Apr 01, 2018 1:33 pm
I would just define a variable "gore" and let the player set it to True/False. Before scenes that contain gore I would let Ren'py check and, if "gore" is false, skip the scene. Once I'm home I can give a more detailed explanation.
Thank you for the reply! Whenever you can give a more detailed explanation I'd love to see it! Since I am not the best in the coding I'd love to get any help I can get.

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: A button in the options that let's you skip certain type of scenes?

#4 Post by Ace94 » Mon Apr 02, 2018 8:02 pm

So the only way I see I can do this is by using conditional switch like so:

Code: Select all

"Do you want to see Gore scenes?"
"Yes":
       $ gore = True
"No":
       $ gore = False
and then whenever a gore scenes in the story appear I check with the if statement? Is there any other better way to do this? I was hoping to add an option in the main menu and then check it with a simple command if the player has chosen one or the other and have the default to true.

User avatar
erickcire95
Regular
Posts: 33
Joined: Tue Dec 26, 2017 7:38 pm
Contact:

Re: A button in the options that let's you skip certain type of scenes?

#5 Post by erickcire95 » Mon Apr 02, 2018 8:57 pm

It is possible to add an option in the Main menu or in the Preferences (which I think is better). First of all you need to create a new persistent variable, call it show_gore or something, and set it default to True or False (It might be better to set it False as default).

Do this by adding

Code: Select all

default persistent.show_gore = True
at the top of your script.rpy file

Then let's add the option in the Preferences screen. open your screens.rpy file, around line 758 you'll find some commented lines like this

Code: Select all

## Additional vboxes of type "radio_pref" or "check_pref" can be
## added here, to add additional creator-defined preferences.
You there place a check box to toggle the show_gore variable. This way.

Code: Select all

vbox:
    style_prefix "check"
    label _("Gore Scenes")
    textbutton _("Gore On") action ToggleField(persistent, "show_gore")
Make sure to have proper identation (it should match the previous vbox) and there is it!

Now you can use it, in your game script, before a Gore scene you can check if the persistent variable show_gore is activated and then skip the Gore scene.
Something like this:

Code: Select all

#A gore scene is about to start

if not persistent.show_gore:
    jump aftergore1

#Here starts the gore scene
#...
and make a label after the gore scene is finished

Code: Select all

#Here ends the gore scene
label aftergore1:
#continue here
And now you have an option in the preferences screen to skip gore :D
Last edited by erickcire95 on Mon Apr 02, 2018 10:33 pm, edited 3 times in total.

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: A button in the options that let's you skip certain type of scenes?

#6 Post by Ace94 » Mon Apr 02, 2018 9:36 pm

erick Thank you so much!!! I will be trying this a bit later, but the code looks great and I am sure it will work. Thank you again.

User avatar
erickcire95
Regular
Posts: 33
Joined: Tue Dec 26, 2017 7:38 pm
Contact:

Re: A button in the options that let's you skip certain type of scenes?

#7 Post by erickcire95 » Mon Apr 02, 2018 10:43 pm

Just tested it, it works fine, however I edited it to make a little changes and offer an alternative way for the last part.

Instead of creating a label and jumping to it, it might be a bit simpler to change the "if not" to an "if" and then just indent the gore scene. For example:

Code: Select all

#A gore scene is about to start

if persistent.show_gore:
    #Gore scene
    "This is a bloody scene"
    "Blood, blood, blood..."

#Here continues the non gore scene
"At the next day..."
#...
This way, the indented block will show only when the variable show_gore is True and it will show the non-indented block in any case.

It is up to you to chose which way you want to use. It depends on how you feel more comfortable (creating labels vs indenting lines)

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: A button in the options that let's you skip certain type of scenes?

#8 Post by Ace94 » Mon Apr 02, 2018 11:20 pm

Amazing! Thank you very much eric. I did test it and it works wonderful. I am very thankful for your help!

User avatar
starshine001
Newbie
Posts: 23
Joined: Fri Feb 02, 2018 9:16 am
Completed: None
Projects: The Nightfall [Vampire Thriller]
Organization: None
Contact:

Re: [Solved] A button in the options that let's you skip certain type of scenes?

#9 Post by starshine001 » Wed Apr 04, 2018 10:42 am

Oof, I completely forgot that I promised to help on this xD
Sorry, Ace. But it seems your question's already been answered. I hope you project will turn out well.
Looking cool, Joker!
-Morgana, 2017
----------------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------
My dreams dictate my reality

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], jamesm80