• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Save and Load rooms?

Galla

Member
Hi, I follow the Shaun Spalding Best Save and Load tutorial 2.3.1+ and I'm trying to figure out how to save in what room I'm currently in and later on load the level. What i tried ( rooms : room_get_name(room), ) it saves the Name of the room but I can't access it via load ( room_goto(_loadEntity.rooms) ) any help is appreciated. Thank you in advance.
 

Nidoking

Member
If you're saving the name as a string, then you need to get the asset ID for the room with that name. Any translation you do has to go both ways.
 
I tried to figure this out too, and I did


In the save code type

currentRroom : room;

In the load code type

room = _loadenetity.currentRoom

(I forgot if it was an = or : in the load code, sorry! If the = doesn’t work than you know why)
 

Nidoking

Member
currentRroom : room;
Bad idea. Very bad idea. If the room indices ever change in a future update (of your own game or of Game Maker), all of your save files are broken. Never save asset IDs by number. Always save asset names by name. Better still, map some known strings to your asset IDs so you can change the asset names without invalidating the saves, just in case you ever feel the need to do that.
 

Galla

Member
I tried to figure this out too, and I did


In the save code type

currentRroom : room;

In the load code type

room = _loadenetity.currentRoom

(I forgot if it was an = or : in the load code, sorry! If the = doesn’t work than you know why)
Thank you its working. I did not know i can just grab the room and save it that way.
 

Galla

Member
Bad idea. Very bad idea. If the room indices ever change in a future update (of your own game or of Game Maker), all of your save files are broken. Never save asset IDs by number. Always save asset names by name. Better still, map some known strings to your asset IDs so you can change the asset names without invalidating the saves, just in case you ever feel the need to do that.
I don't get how to do it :p
 
Top