• 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!

Legacy GM How to make changes in another room

Icacio

Member
Hello, everyone.
I'm trying to change things by changing between rooms. Basically, I have my "obj_door" that simply does "room_goto()", but I need this to move objects or trigger events. What I have thought is to add "with (obj_player)" after changing the room, but I realised that it doesn't change the room in that moment, so it only works if the obj_player is already there in the room and is persistent, but if I want to move objects in another room, they won't be there. I thought I could create an object after changing the room, so it would be created in the next room, not in current, it worked, but I don't feel confortable though, because technically the room change is until the end of the step, so it's uncertain where I'm executing that code. Anyway, the big deal is when I need to move instances in the next room, I don't know how to track them. The room editor has an ID for each instance, but I don't know if the "inst_????????" it's an actual variable, constant, or should I use it as a string. And it is supposed to be used only in the same room, so, if I'm using the creation code on another room, I don't think it will work. And finally where should I put the code, I don't need the door to change position always, and the creation code is only that, "Creation", if I need to place additional code in the event when the room is changed, where should I put that...? Like if I need to change view or do something else, but only once, I think my door object would be filled with one time code, and then, it would be hard to know when to call that code, and hard to read it.
So, as you can see, this is a mess, and I don't really have an idea of where to start. So I accept any suggestion.
 

woods

Member
hmmm... sounds like an awkward way to handle it... but worth a shot in the dark..

in the first room of the game have a master controller object that creates/stores everything in all the rooms.
have a separate code block for each room for ease of access.
as changes are made, have it adjust it in this master script.

if the master controller object is persistent and never destroyed and called in the beginning of the game, that should work ??
 

Psycho_666

Member
Oh that's not difficult at all...
You have one persistent object, that acts as database for the objects that will change.
When you do something and you need objects in other rooms to change locations or anything, you save that in your database object.
Then at the room start you just reference the database object and do the necessary actions - you move objects or you do whatever needs to be done.

The database is persistent so you can change it from every room and at room start only the objects that can be changed will call to the database and do whatever needs to be done. It's really not that difficult.
 
Top