[solved] problem with saving and loading

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
User avatar
Vaendryl
Regular
Posts: 39
Joined: Thu Dec 26, 2013 10:10 pm
Projects: Sunrider
Organization: Love in Space
IRC Nick: vaendryl
Contact:

[solved] problem with saving and loading

#1 Post by Vaendryl »

EDIT:
turned out I didn't put a return statement at the end of an after_load label. D'OH!

I'm using the in-built spritemanager to make a minigame combining pygame, custom displayables and unit objects (using python quite heavily), but when I end the interaction and tell renpy to save and load, all save files seem to fully restart the game

I've tried various things to make sure renpy saves the related data but no success so far and I can't think of anything else to try, so I'm hoping any of you have any ideas what I could try next.

basic outline of my code is as follows:

Code: Select all

label start:
    
    python:
        #initialize the battle
        store.BM = BattleManager()

        #create a test unit
        create_unit(TestUnit,(10,10))
        
    show expression BM.sprite_manager as bmbattle onlayer master
    $config.rollback_enabled = False
    "test battle starts now"
    
    jump active_battle    
    
label active_battle:
    
    #wait on an interaction. a right mouse click will return the string "show save menu"
    $interact_result = ui.interact()
    #making a checkpoint shouldn't be needed as far as I know. ending the interaction should be enough
    #trying anyway
    $renpy.checkpoint()
    #display a string to really make sure renpy is rolling forward
    "opening save menu"
    if interact_result == "show save menu":
        call screen save #show the save screen. this all works as intended
    #loop back to the interaction again after the save menu closes
    jump active_battle
when I try and make a save and load it again, the game will start all the way back at the string 'test battle starts now' and all the mini-game units are in the initial locations - as if the game completely restarted. If anyone has any idea what I'm doing wrong I'd really like to hear it.

Post Reply

Who is online

Users browsing this forum: Google [Bot]