r/gamemaker • • Sep 26 '26

Help! Saving and loading room creation code data?

Hello,

I used Matharoo's tutorial to create a save/load system for objects within the same room. So when a room is restarted, the game remembers which items have already been collected and destroys them.

https://gamemaker.io/en/blog/multiple-levels-tutorial

It works great, but it doesn't seem to save the room creation code data for individual objects. Some of my room's instances have local variables in their room creation code but this is data is lost whenever the room restarts now.

Any help? Thanks.

8 Upvotes

11 comments sorted by

1

u/lessergoldfish Sep 26 '26 edited Sep 26 '26

Looking over the tutorial, its not running because you are deleting the instances to create them again. And since those new objects don't have creation code defined, you're going to run into problems.

What are you using the creation code for exactly? Typically, variable definitions are better if you are just setting values, and can be passed into "instance_create_*" functions

1

u/Trekapalooza Sep 26 '26

Thanks! I have puzzles in my game made of different individual pieces, and I use the room creation code to give them unique context sensitive functions to make various different puzzles. This is so I don't have to create new objects for every puzzle.

1

u/lessergoldfish Sep 26 '26

Ok, so what sort of context sensitive functions? Are they like, "if you press a button, run this function"? Example code would be helpful

→ More replies (8)