Refer to this post on how I create my inventory and store class.
viewtopic.php?f=8&t=49802
Each time I reload my script or from a save, the items in the store and inventory disappears. How to prevent this?
How to keep items in inventory when reloading?
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.
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.
-
- Newbie
- Posts: 7
- Joined: Mon Apr 23, 2018 5:56 am
- Contact:
Re: How to keep items in inventory when reloading?
Try using default instead of define to create your objects.
Code: Select all
default inv = Inventory()
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: How to keep items in inventory when reloading?
In addition to needing to create your variables with default rather than define, when creating your classes they need to inherit from object or they will not be able to participate properly in saving and rolling back and all that goodness.
In this post of mine, see the way I defined my classes and you notice how the have the word object in their definition. Make sure your classes do the same.
viewtopic.php?p=359964#p359964
In this post of mine, see the way I defined my classes and you notice how the have the word object in their definition. Make sure your classes do the same.
viewtopic.php?p=359964#p359964
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Who is online
Users browsing this forum: Ocelot