I have been able to figure out quite a lot already on my own using this forum and the documentation, I have got to say I love how simple it is to code with renpy!
On to my actual problem:
I have quite a few features added and working happily to my game, but somewhere along the way I have broken the ability to save correctly.
Background on the game I am making:
I want a non-linear story, and the way that I planned to do this was instead of chapter1 jumping to chapter2 and etc. I would have flags that unlocked as you went.
So complete chapter 1 and you get access to chapter 2 and side story 1 and side story 2. side stories are not required to complete the game, but they may be fun chapters to get to know certain characters better (and unlock more side stories) or minigames etc.
How I have implemented this so far, is by setting flags in chapters that you play through. When you complete a chapter, it returns you to a chapter select menu where you can pick where to go next, with more options unlocking as you play.
My problem is that saving breaks after opening this chapter select menu. You can save fine all through prologue (which you are started on to give basic character info such as name/gender etc.) After the prologue, I use jump to get to chapter 1, and make the chapter menu accessible from the quick bar. The chapter menu opens when you either complete chapter 1, or select it from the quick bar. This is where the problem starts. If you complete chapter 1 and are automatically taken to the chapter select screen you can save correctly. If you select it from the quick menu, then no matter how far you play or what chapters you select it will save at the point during the prologue where you clicked the chapter select button from the quick menu, not where you actually are.
I have read through Renpy's documentation on jumps and calling, and on saving, and there is just something I am not understanding about how renpy chooses where to save. I have tried moving to labels using both 'call' and 'jump'. What's more, it behaves similarly if I 'return' from the chapter select menu. Whatever may have happened in between is lost and it returns to the first place I opened the chapter select menu.
The labels in my main script:
Code: Select all
label return_to_menu:
nar "Return to the menu to select your next destination."
#call screen chselect
call ship_menu # above commented out statement had the same effect.
label ship_menu:
call screen chselect # The name of the screen displayed to select chapter
nar "Please make a selection from the ship's menu."
jump ship_menu
Code: Select all
textbutton _("Ship Menu") action ShowMenu('yesno_prompt', 'End current scene and return to ship\'s menu? Progress in this scene will be lost.', [Hide('yesno_menu'), Jump('ship_menu')], [Hide('yesno_menu'), Return()])
Code: Select all
##############################################################################
# Chapter Select
#
# Screen that allows the user to jump to a chapter
screen chselect():
tag menu
# The background of the game menu.
window:
style "gm_root"
# Include the navigation.
use navigation
on "show" action Stop("text_bleeps")
grid 1 1:
style_group "chselect"
xfill True
vbox:
# The left column.
frame:
style_group "chselect"
has vbox
label _("Current Credits: [current_credits]") # For displaying how much money you have.
frame:
style_group "chselect"
has vbox
label _("Missions")
if persistent.prologue_unlocked:
textbutton _("Prologue") action [Hide('menu'), Jump('scene_prologue1')]
if persistent.ch1_unlocked:
textbutton _("Chapter 1") action [Hide('menu'), Jump('scene_ch1_1')]
frame:
style_group "chselect"
has vbox
label _("Jobs")
if persistent.job_asteroid_clearing_1_unlocked:
textbutton _("Asteroid Clearing 1") action [Hide('menu'), Jump('job_asteroid_clearing_1')]
if persistent.job_debugging_unlocked:
textbutton _("DEBUGGING") action [Hide('menu'), Jump('job_debugging')]
init -2:
style chselect_frame:
xfill True
xmargin 5
top_margin 5
style chselect_vbox:
xfill True
style chselect_button:
size_group "chselect"
xalign 1.0
Code: Select all
# all 3 have the same effect it seems.
#jump return_to_menu
call return_to_menu
#return