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

How EXACTLY Persistent works

W

Wild_West

Guest
This is a problem that's been plaguing me for a long time now and I don't know how to find the answer so I'm just gonna ask and hope someone here knows, but how exactly does persistent work in game maker?

See I've been using this setup in my platformer that starts the room, sets it to persistent upon entering and resets it to not persistent upon exiting the room save for menus and pausing obviously. And it works fine except for when I try to go to another room where the objects placed are in different locations. For some reason the objects from the last room I was in are being carried over to the next room I enter even though NONE of those objects are persistent or making instances through code, and the room previous to the next one was set to not persistent after I left. So why are objects being carried between rooms like this?

I know they're there because the positions of solids I bump into are exactly the same as the room I was just in but the objects are invisible as well, like ghost instances haunting me or something :p
 

Jabbers

Member
That is quite odd. I believe the instances should remain in the persistent room unless those instances are persistent, but you are absolutely sure they are not? You aren't using a collision map are you?

Could be a bug, but maybe someone else can explain this behaviour.
 
W

Wild_West

Guest
That is quite odd. I believe the instances should remain in the persistent room unless those instances are persistent, but you are absolutely sure they are not? You aren't using a collision map are you?

Could be a bug, but maybe someone else can explain this behaviour.
I don't even know what a collision map is lol but yes I am 100% certain none of the objects are persistent except for the ones without sprites, that control money, points, player heath handle music ect..
But this post has been up for a while now and you're the only one to say anything :p so I dunno about anyone else. I mean I know it's impossible to figure out just off of that but I don't know what else it could be.
If it helps I do save before every room is exited except the map and shop. But I only save stage progress, player stats and money.
 

Jabbers

Member
There was an example of a collision map in the platformer example / tutorial, I think Mike Dailly wrote it. It uses a data structure to plot out points at x/y on a tile grid. You can then place tiles in the room (e.g an invisible layer where each tile goes over the walls in the game) and the collision map registers that there is a tile at that point, updates the data structure, and then the player character uses a simple equation to check the data structure to see if it has a tile there (else it returns -1 for no tile). It's a super fast and convenient way of doing collisions.

I mentioned this only because I wondered if you had used an example, or an engine, or a collision system from another project that could be interfering with your game. Is it possible there is code somewhere setting the object to persistent? I really have no clue why you are having this problem, but I never use persistent rooms and I'm not the best person to give advice about it. All I know is they can be a pain lol.
 

Xer0botXer0

Senpai
Are those objects not inheriting persistence of their parents if they have any ?
As far as I know, room persistence will save the states of instances within a room when you leave that room, and instance persistence carries instances over through rooms.
 
Last edited:
W

Wild_West

Guest
There was an example of a collision map in the platformer example / tutorial, I think Mike Dailly wrote it. It uses a data structure to plot out points at x/y on a tile grid. You can then place tiles in the room (e.g an invisible layer where each tile goes over the walls in the game) and the collision map registers that there is a tile at that point, updates the data structure, and then the player character uses a simple equation to check the data structure to see if it has a tile there (else it returns -1 for no tile). It's a super fast and convenient way of doing collisions.

I mentioned this only because I wondered if you had used an example, or an engine, or a collision system from another project that could be interfering with your game. Is it possible there is code somewhere setting the object to persistent? I really have no clue why you are having this problem, but I never use persistent rooms and I'm not the best person to give advice about it. All I know is they can be a pain lol.
No I've been checking everything for the past bunch of days there's nothing anywhere that deals with persistent objects, but my level controller does set rooms to persistent upon the room's start, and then they go back to not persistent after I've cleared the stage in game
 

Xer0botXer0

Senpai
How do you create your room instances ? do you use instance_create or room_instance_add, perhaps your code is creating instances when you enter a new room.
 
W

Wild_West

Guest
Are those objects not inheriting persistence of their parents if they have any ?
As far as I know, room persistence will save the states of instances within a room when you leave that room, and instance persistence carries instances over through rooms.
what do you mean? The issue is the objects are being carried over rooms when they shouldn't be.
It's mostly with the wall objects and various blocks which aren't persistent.
 
W

Wild_West

Guest
How do you create your room instances ? do you use instance_create or room_instance_add, perhaps your code is creating instances when you enter a new room.
No it's just simple room editor stuff. stick em in and run the game
 
W

Wild_West

Guest
How do you create your room instances ? do you use instance_create or room_instance_add, perhaps your code is creating instances when you enter a new room.
Since the game is set to save after I complete every stage played is there any chance it's some kind of data leak thing?
I mean I don't use any data structures when I run the save code it's all just ini file stuff for points, player stats, and stage clear progress ect.. but I dunno.
 

Xer0botXer0

Senpai
Alright so you generate rooms via the room editor, none of the objects that are carrying over are persistent and you aren't saving any of those objects that are carrying over in your ini files and loading them up by accident in the new room ?

I think we willl have to see your code.
 

Jabbers

Member
What about the room creation code? It's a bit of a stretch, but it is worth checking there is nothing in the room creation code by accident.
 
I

icuurd12b42

Guest
persistent object (instances) follow you from room to room. the setting is useful for a controller object that handles events throughout the game.

you should never place such instances in rooms that are re-visited. else you will end up with a ton of instances following you around... as every time you visit the room a new instance is creates on top of the one that is following you.

persistent object should be in your boot room. A room that only shows on game start, which I use to show company logo and stuff.

if you must have the instance in a re-visited room, add this line to the create.
if(instance_number(object_index)>1) instance_destroy();
this will prevent the instance from cloning itself over and over

Persistent rooms stay as you left them. when you re-visit the room, things are as you left them. You also need to be careful where you turn persistent on or off with code. On room end is a good place for this. some people write such code:
room_goto(some_room);
persistent = false;
which is a fail. It's too late to set the persistent flag there, at least it used to be. (Code after room_goto is skipped)

Point To Confuse
A persistent object in a persistent room, there was issues about this in the past. if in the room editor you dropped a persistent object in the persistent room. it should be created the first time you visit the room but not when you re-visit the room.
[edit]
fixed the create code to use instance_number
if(instance_number(object_index)>1) instance_destroy();
 
Last edited by a moderator:
A

ajan-ko

Guest
sets it to persistent upon entering and resets it to not persistent upon exiting the room save for menus and pausing obviously
What is your goal to do this?
 
W

Wild_West

Guest
What about the room creation code? It's a bit of a stretch, but it is worth checking there is nothing in the room creation code by accident.
Never used room creation code. I'm not even sure what it would be used for honestly.
 
W

Wild_West

Guest
sets it to persistent upon entering and resets it to not persistent upon exiting the room save for menus and pausing obviously
What is your goal to do this?
The menus are different rooms so I need to keep things in the current level as they are when I open a menu and then return to the game, hence the persistent at room start. The menus are never set to persistent though I put in a check for what room a variable called current_room is set to. Then when the level is cleared I need to be able to play through it again right? so just reset the room before you leave.
 
W

Wild_West

Guest
persistent object (instances) follow you from room to room. the setting is useful for a controller object that handles events throughout the game.

you should never place such instances in rooms that are re-visited. else you will end up with a ton of instances following you around... as every time you visit the room a new instance is creates on top of the one that is following you.

persistent object should be in your boot room. A room that only shows on game start, which I use to show company logo and stuff.

if you must have the instance in a re-visited room, add this line to the create.
if(instance_exists(object_index)) instance_destroy();
this will prevent the instance from cloning itself over and over

Persistent rooms stay as you left them. when you re-visit the room, things are as you left them. You also need to be careful where you turn persistent on or off with code. On room end is a good place for this. some people write such code:
room_goto(some_room);
persistent = false;
which is a fail. It's too late to set the persistent flag there, at least it used to be. (Code after room_goto is skipped)

Point To Confuse
A persistent object in a persistent room, there was issues about this in the past. if in the room editor you dropped a persistent object in the persistent room. it should be created the first time you visit the room but not when you re-visit the room.

sorry but I already know all of that too, I initialize every persistent control object for music ,player stats, level progress tracking, inventory and money handling ect in the title screen room that starts the game but isn't revisited unless you exit the game.
I should move them to the splash screen of course now that you mention it, but I never revisited the title screen while testing for this bug so I don't know why tat'd be the issue.
and nothing else in the game is persistent.

I don't actually have my room_persistent on room end it's in a collision with an object that saves the game and takes me back to map select
 
W

Wild_West

Guest
Alright so you generate rooms via the room editor, none of the objects that are carrying over are persistent and you aren't saving any of those objects that are carrying over in your ini files and loading them up by accident in the new room ?

I think we willl have to see your code.
Like what? the object dealing with the persistent variable?
 
Z

zendraw

Guest
why dont you just disable all objects and enable them again? i cant answer about persistency but this a suggestion. i also am confused aboutpersistency.
 
A

ajan-ko

Guest
The menus are different rooms so I need to keep things in the current level as they are when I open a menu and then return to the game, hence the persistent at room start. The menus are never set to persistent though I put in a check for what room a variable called current_room is set to. Then when the level is cleared I need to be able to play through it again right? so just reset the room before you leave.
So, basically,

you want to:

1. Set the room_persistent = true;
2. Change the room into your inventory room
3. Change your item slot
4. Turn into your room before
5. Set the room_persistent = false;

Where you put your room persistent code? On what event?
Use search -> search in script -> room_persistent
in case maybe you're forgeting some code in some object.

also

Check your solid object, is that solid object is persistent or not? If they persistent, if you're changing the room, the object basically still in there, thus creating ghost object.

Room persistent => making your room as were before you changing room.
Object persistent => the object never get destroyed even when you're changing room.
 
Last edited:
W

Wild_West

Guest
So, basically,

you want to:

1. Set the room_persistent = true;
2. Change the room into your inventory room
3. Change your item slot
4. Turn into your room before
5. Set the room_persistent = false;

Where you put your room persistent code? On what event?
Use search -> search in script -> room_persistent
in case maybe you're forgeting some code in some object.

also

Check your solid object, is that solid object is persistent or not? If they persistent, if you're changing the room, the object basically still in there, thus creating ghost object.

Room persistent => making your room as were before you changing room.
Object persistent => the object never get destroyed even when you're changing room.

I'm sure none of the objects are persistent, I literally checked everything. I've been on this problem for weeks, But I'll look again.
 
W

Wild_West

Guest
why dont you just disable all objects and enable them again? i cant answer about persistency but this a suggestion. i also am confused aboutpersistency.
disable them? with instance deactivate? How would that work?
 
A

ajan-ko

Guest
I'm sure none of the objects are persistent, I literally checked everything. I've been on this problem for weeks, But I'll look again.
I don't actually have my room_persistent on room end it's in a collision with an object that saves the game and takes me back to map select
probably this. Btw, can I know on what event you put the persistent code?
use the search function.

also, check your solid checkbox too...
 
Z

zendraw

Guest
disable them? with instance deactivate? How would that work?
just make an object and put in its create event instance_deactivate_all()
and in its destroy event instance activate w/e instances you need or all.
also if you need some instances to be active during that time simply activate them right after you deactivate all.
and that object will controll w/e you will be doing in that menu room you were speaking of.
it shuld look somthing like this in the object.
CREATE:
instance_deactivate_all();
instance_activate_object(o_controll)//assuming you have an object you need active

STEP: or w/e
do what you need

DESTROY:
instance_actiavte_all();
or instance_activate_region();
//it all depends on you

your menu object may be that object.
 
W

Wild_West

Guest
just make an object and put in its create event instance_deactivate_all()
and in its destroy event instance activate w/e instances you need or all.
also if you need some instances to be active during that time simply activate them right after you deactivate all.
and that object will controll w/e you will be doing in that menu room you were speaking of.
it shuld look somthing like this in the object.
CREATE:
instance_deactivate_all();
instance_activate_object(o_controll)//assuming you have an object you need active

STEP: or w/e
do what you need

DESTROY:
instance_actiavte_all();
or instance_activate_region();
//it all depends on you

your menu object may be that object.
But if I do that I'll have to add in literally every object, enemy and what have you that's unique to that room. Plus how is it gonna work for duplicate objects that are still there, vs enemies or objects of the same kind that I need in that level, like every wall? or money?
 
Z

zendraw

Guest
instance deactivate/activate doesnt destroy the instances, you simply switch them on/off. once you turn them on with either instance_activate, they will be there in the same state they were when you deactivated them.
 
W

Wild_West

Guest
I don't actually have my room_persistent on room end it's in a collision with an object that saves the game and takes me back to map select
probably this. Btw, can I know on what event you put the persistent code?
use the search function.

also, check your solid checkbox too...
Room start for the level controller object. I moved room_persistent to false in the warp object's room end event but if I do that anytime I open a menu or pause now the rom will be reset, so I'd have to say when te instance collides with the player, set it to false on room end but isn't that the same as the collision event I already had it in since the room ends when I reach that object anyway?
 
W

Wild_West

Guest
instance deactivate/activate doesnt destroy the instances, you simply switch them on/off. once you turn them on with either instance_activate, they will be there in the same state they were when you deactivated them.
No what I'm saying is, if I say instance deactivate all, then activate object, if the instances of objects that were being carried over rooms by the bug are still there, how is this gonna stop them from just being put back where they were.
 

Xer0botXer0

Senpai
you know what you can do, just use a toggle button..

if bool_paused != true
{
//check for save data.. if save data for this instance exists, load its variables and relevant info..create instance with this info
} else
{
//save instance information and destroy instance
save variables,coordinates, image index, position, what ever is vital to retain..
destroy instance..
}
if all else fails. But Im sure if you carry on looking you'll find out what's up.
 
Z

zendraw

Guest
i dont quite understand your last question, but id suggest drop the method with room persistance, after all you dont want the room to be the same once you leave it? you want it to be the same only when you enter the menu room right?
so my suggestion is simply dont exit or reenter the room but just deactivate the instances when the menu is up and activate them back when you close the menu. do i understand you correctly?
 
A

ajan-ko

Guest
Room start for the level controller object. I moved room_persistent to false in the warp object's room end event but if I do that anytime I open a menu or pause now the rom will be reset, so I'd have to say when te instance collides with the player, set it to false on room end but isn't that the same as the collision event I already had it in since the room ends when I reach that object anyway?
1. Check your warp object, check room end, delete the code that room_persistent=false on room end,
also check every room end event and delete any room_persistent=false

2. Give room_persistent=false to your colision warp object

I'm asumming your code not working because when you're about changing to menu, it will trigger the room_end_event and thus your room_persistent always get false.
 
Last edited:
W

Wild_West

Guest
1. Check your warp object, check room end, delete the code that room_persistent=false on room end, also check every room end event and delete any room_persistent=false
2. Give room_persistent=false to your colision warp object

I'm asumming your code not working because when you're about changing to menu, it will trigger the room_end_event and thus your room_persistent always get false.
why would I remove room_persistent = false if that'd stop the rooms being reset?

I want room_persistent to be false after you're done playing through the room it should be reset so you can play it again, and it is being reset, but the object instances from that room are carrying over to other rooms after I leave, that's what I don't get here. what is causing that?
 
W

Wild_West

Guest
i dont quite understand your last question, but id suggest drop the method with room persistance, after all you dont want the room to be the same once you leave it? you want it to be the same only when you enter the menu room right?
so my suggestion is simply dont exit or reenter the room but just deactivate the instances when the menu is up and activate them back when you close the menu. do i understand you correctly?
The menus and pause screens are separate rooms, can you even deactivate instances that are in another room? because I'm pretty sure you can't. resetting rooms isn't my problem, it's just te object instances that are being carried over rooms when they shouldn't be and can't even be seen.
I can see them IN the rooms I PUT them in using the room editor but when they carry over I can't see them but they still exist because I interact with them. That's what's wrong.
 
A

ajan-ko

Guest
why would I remove room_persistent = false if that'd stop the rooms being reset?

I want room_persistent to be false after you're done playing through the room it should be reset so you can play it again, and it is being reset, but the object instances from that room are carrying over to other rooms after I leave, that's what I don't get here. what is causing that?
Because you said, you want everything still the same when you go into menu_room
if you set room_persistent = false on room end
then you're trying to change your room into menu_room, it will put your room_persistent into false first, THEN changing the room to your menu_room. Even if you're not touching the object.
thus your room become reset when you go back into your last_room from your menu_room.

room_end_event will trigger everytime BEFORE room_goto(), no matter you touch your object or not, as long it exist on your room.
 
Last edited:
W

Wild_West

Guest
Because you said, you want everything still the same when you go into menu_room
if you set room_persistent = false on room end
then you're trying to change your room into menu_room, it will put your room_persistent into false first, THEN changing the room to your menu_room. Even if you're not touching the object.
thus your room become reset when you go back into your last_room from your menu_room.

room_end_event will trigger everytime BEFORE room_goto(), no matter you touch your object or not, as long it exist on your room.
I made a script already though that keeps the room persistent and doesn't reset if I open a menu so it's just the warp object that I'm concerned with. That resets the room or when I play it again, but if I go to a different room, the instances from the last level carry over. Do you see what I'm saying? I just want to know what is causing this error, the room changing cde is all fine, it's he instances moving between rooms I don't want
 
A

ajan-ko

Guest
I made a script already though that keeps the room persistent and doesn't reset if I open a menu so it's just the warp object that I'm concerned with. That resets the room or when I play it again, but if I go to a different room, the instances from the last level carry over. Do you see what I'm saying? I just want to know what is causing this error, the room changing cde is all fine, it's he instances moving between rooms I don't want

Then, try to search your script via search script (ctrl shift F)

object_set_persistent
or
persistent=true //or any persistent variable

probably you set your object become persistent when you're trying to delete the room_ from renaming (replace)

that's the last thing in my mind.
 
W

Wild_West

Guest
Then, try to search your script via search script (ctrl shift F)

object_set_persistent
or
persistent=true //or any persistent variable

probably you set your object become persistent when you're trying to delete the room_ from renaming (replace)

that's the last thing in my mind.
I didn't. None of them are persistent, I checked everything like I said.
 
I

icuurd12b42

Guest
I dont think we can help you much more unless you actually post your code. if this is not a GameMaker bug then it's your code. I played with turning room persistence on and off and using persistent object. I had issues but it's always been my code...
 
W

Wild_West

Guest
I dont think we can help you much more unless you actually post your code. if this is not a GameMaker bug then it's your code. I played with turning room persistence on and off and using persistent object. I had issues but it's always been my code...

Code:
Information about object: warp_hole_object
Sprite: warp_hole_sprite
Solid: false
Visible: true
Depth: -2000
Persistent: false
Parent: 
Children: 
Mask: 

No Physics Object
Create Event:

execute code:

image_alpha = 0.5;

Step Event:

execute code:

spin(10);

/*if(distance_to_object(player_parent_object) < 150) and (room!= the_6_bonuses_room)
{ if(tile_exists(stage_complete_tile) == false){tile_add(stage_complete_tile,0,0,370,78,x-190,y-150,-2050);}
  if(audio_exists(stage_complete_sound) == false){audio_play_sound(stage_complete_sound,2,false);}
}*/

//1st Region stages set
set_current_room(anthromere_lv_1,anthromere_lv_2,anthromere_lv_3,anthromere_lv_4,anthromere_lv_5,anthromere_lv_6);

//2nd Region stages set
set_current_room(quiMyst_lv_1,quiMyst_lv_2,quiMyst_lv_3,quiMyst_lv_4,quiMyst_lv_5,quiMyst_lv_6);

//3rd Region stages set
set_current_room(van_diagos_lv_1,van_diagos_lv_2,van_diagos_lv_3,van_diagos_lv_4,van_diagos_lv_5,van_diagos_lv_6,);

//4th Region stages set
set_current_room(pixie_hollows_lv_1,pixie_hollows_lv_2,pixie_hollows_lv_3,pixie_hollows_lv_4,pixie_hollows_lv_5,pixie_hollows_lv_6);

//5th Region stages set
set_current_room(chamberlain_lv_1,chamberlain_lv_2,chamberlain_lv_3,chamberlain_lv_4,chamberlain_lv_5,chamberlain_lv_6);

//6th Region stages set
set_current_room(everWinter_lv_1,everWinter_lv_2,everWinter_lv_3,everWinter_lv_4,everWinter_lv_5,everWinter_lv_6);

//7th Region stages set
set_current_room(skyWay_lv_1,skyWay_lv_2,skyWay_lv_3,skyWay_lv_4,skyWay_lv_5,skyWay_lv_6);

//8th Region stages set
set_current_room(adventure_ocean_lv_1,adventure_ocean_lv_2,adventure_ocean_lv_3,adventure_ocean_lv_4,adventure_ocean_lv_5,adventure_ocean_lv_6);

// Ogre Rock Island stages set
set_current_room(ogre_rock_isle_lv_1,ogre_rock_isle_lv_2,ogre_rock_isle_lv_3,ogre_rock_volcano_lv_1,ogre_rock_volcano_lv_2,ogre_rock_isle_lv_3);

//9th Region stages set
set_current_room(old_fortunes_lv_1,old_fortunes_lv_2,old_fortunes_lv_3,old_fortunes_lv_4,old_fortunes_lv_5,old_fortunes_lv_6);

//Bonus 10th Region stages set
set_current_room(imp_paradise_lv_1,imp_paradise_lv_2,imp_paradise_lv_3,imp_paradise_lv_4,imp_paradise_lv_5,imp_paradise_lv_6);

Collision Event with object player_parent_object:

execute code:

///Warp Hole Network

room_persistent = false;

fortune_acquired = 0;
skullies_acquired = 0;
imperials_acquired = 0;

save_game();

room_goto(map_select_room);
/*Since Warp Holes only appear at the end of any level, bonus or not, 
this will always set the room this object exists in to not persistent once 
the level is complete so you can play it again, keeping menu, cash and stats persistent.*/


/*Warp to bonus area
if(room == current_room)
{
    for(search = 0; search < 6; search ++; )
    {
      if(menu_object.held_items[search,1] == key_object)
      {
         room_goto(bonus_stage_room);
         other.x = new_x other.y = new_y;
         menu_object.held_items[search,2] -= 1;
      }
    }
}

Mouse Event for Left Button:

execute code:

if(room == map_select_room) or (room == skyWay_map_select_room)
{
    warp = show_question("Warp to....");
   
    if(warp == false)
    { exit; }else
             {
                destination = get_integer
                             (          
                              "
                               Warp Destination 1 = Gnome Shop.
                       
                               Warp Destination 2 = Domain of The 6.
                               
                               Warp Destination 3 = SkyWay Region/Return to Boken.
                               
                               Warp Destination 4 = Gargantua Land.
                               
                               Warp Destination 5 = The Imp's Paradise.
                         
                               Type any of the values listed to change the Warp Hole Network destination.",
                               
                               0);
                switch(destination)
                {
                   case 0 : room_goto(title_room);
                            break;
                   
                   case 1 : room_goto(gnome_shop_room);
                            break;
                   
                   case 2 : room_goto(the_6_bonuses_room);
                            break;
     
                   case 3 : if(level_unlock_controller.skyWay_region_unlocked = true)
                              {room_goto(skyWay_map_select_room);}else{ show_message("Location Locked..");}
                             
                              //Return from SkyWay to Boken
                              if(room == skyWay_map_select_room){room_goto(map_select_room);}
                            break;
                   
                   case 4 : if(level_unlock_controller.gargantua_land_unlocked = true)
                              {room_goto(gargantua_land_lv_1);}else{show_message("Location Locked..");}
                            break;
                   
                   case 5 : if(level_unlock_controller.imp_paradise_unlocked = true)
                              {room_goto(imp_paradise_stage_select_room);}else{show_message("Location Locked..");}
                            break;
       
                   default : show_message("Invalid Destination Value."); break;
                } 
                               
             }
}
Code:
Information about object: level_reset_controller
Sprite: 
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: 
Children: 
Mask: 

No Physics Object
Step Event:

execute code:

///environment

switch(room)
{
   case everWinter_lv_1 : effect_create_above(ef_snow,0,0,2,c_white);   break;
   case everWinter_lv_2 : effect_create_above(ef_snow,0,0,2,c_white);   break;
   case everWinter_lv_3 : effect_create_above(ef_snow,0,0,2,c_white);   break;
   case everWinter_lv_4 : effect_create_above(ef_snow,0,0,2,c_white);   break;
   case everWinter_lv_5 : effect_create_above(ef_snow,0,0,2,c_white);   break;
   case everWinter_lv_6 : effect_create_above(ef_snow,0,0,2,c_white);   break;
   
   case chamberlain_lv_1 : with(player_parent_object){image_blend = c_black; }
                           with(parent_wall_object)  {image_blend = c_black; }
                           with(enemy_parent_object) {image_blend = c_black; }
   break;
   
   case chamberlain_lv_2 : with(player_parent_object){image_blend = c_black; }
                           with(parent_wall_object)  {image_blend = c_black; }
                           with(enemy_parent_object) {image_blend = c_black; }
   break;
   
   case chamberlain_lv_3 : with(player_parent_object){image_blend = c_black; }
                           with(parent_wall_object)  {image_blend = c_black; }
                           with(enemy_parent_object) {image_blend = c_black; }
   break;
   
   case chamberlain_lv_4 : with(player_parent_object){image_blend = c_black; }
                           with(parent_wall_object)  {image_blend = c_black; }
                           with(enemy_parent_object) {image_blend = c_black; }
   break;
   
   case chamberlain_lv_5 : with(player_parent_object){image_blend = c_black; }
                           with(parent_wall_object)  {image_blend = c_black; }
                           with(enemy_parent_object) {image_blend = c_black; }
   break;
   
   case chamberlain_lv_6 : with(player_parent_object){image_blend = c_black; }
                           with(parent_wall_object)  {image_blend = c_black; }
                           with(enemy_parent_object) {image_blend = c_black; }
   break;
}

Other Event: Room Start:

execute code:

room_persistent = true;
Code:
Information about object: level_unlock_controller
Sprite: 
Solid: false
Visible: false
Depth: 0
Persistent: true
Parent: 
Children: 
Mask: 

No Physics Object

step event

execute code:

///Reset room on exit button confirm
//Set the current room for returning to game


//1st Region stages set
set_current_room(anthromere_lv_1,anthromere_lv_2,anthromere_lv_3,anthromere_lv_4,anthromere_lv_5,anthromere_lv_6);

//2nd Region stages set
set_current_room(quiMyst_lv_1,quiMyst_lv_2,quiMyst_lv_3,quiMyst_lv_4,quiMyst_lv_5,quiMyst_lv_6);

//3rd Region stages set
set_current_room(van_diagos_lv_1,van_diagos_lv_2,van_diagos_lv_3,van_diagos_lv_4,van_diagos_lv_5,van_diagos_lv_6,);

//4th Region stages set
set_current_room(pixie_hollows_lv_1,pixie_hollows_lv_2,pixie_hollows_lv_3,pixie_hollows_lv_4,pixie_hollows_lv_5,pixie_hollows_lv_6);

//5th Region stages set
set_current_room(chamberlain_lv_1,chamberlain_lv_2,chamberlain_lv_3,chamberlain_lv_4,chamberlain_lv_5,chamberlain_lv_6);

//6th Region stages set
set_current_room(everWinter_lv_1,everWinter_lv_2,everWinter_lv_3,everWinter_lv_4,everWinter_lv_5,everWinter_lv_6);

//7th Region stages set
set_current_room(skyWay_lv_1,skyWay_lv_2,skyWay_lv_3,skyWay_lv_4,skyWay_lv_5,skyWay_lv_6);

//8th Region stages set
set_current_room(adventure_ocean_lv_1,adventure_ocean_lv_2,adventure_ocean_lv_3,adventure_ocean_lv_4,adventure_ocean_lv_5,adventure_ocean_lv_6);

// Ogre Rock Island stages set
set_current_room(ogre_rock_isle_lv_1,ogre_rock_isle_lv_2,ogre_rock_isle_lv_3,ogre_rock_volcano_lv_1,ogre_rock_volcano_lv_2,ogre_rock_volcano_lv_3);

//9th Region stages set
set_current_room(old_fortunes_lv_1,old_fortunes_lv_2,old_fortunes_lv_3,old_fortunes_lv_4,old_fortunes_lv_5,old_fortunes_lv_6);

//Bonus 10th Region stages set
set_current_room(imp_paradise_lv_1,imp_paradise_lv_2,imp_paradise_lv_3,imp_paradise_lv_4,imp_paradise_lv_5,imp_paradise_lv_6);
//----------------------------------------------------------------------------------------------------------------------------------------------------


if(room == current_room   ) and (exit_current_stage == true){ room_goto(current_room); room_persistent    = false;  room_goto(map_select_room); }
if(room == map_select_room) and (exit_current_stage == true){ exit_current_stage = false; }
//------------------------------------------------------------------------------------------------------------------------------------------------------
Code:
///set_current_room(stage1, stage2, stage3, stage4, stage5, stage6);


//Arguments will act as the current room location and set the variable to itself so the menu always knows which room to return to.
//When called pass in each stage of every region that has more than one.

switch(room)
{
   case the_6_bonuses_room : current_room = the_6_bonuses_room  break;
     
   case gnome_shop_room    : current_room = gnome_shop_room     break;
   
   case map_select_room    : current_room = map_select_room     break;
   
   case title_room         : current_room = title_room          break;
   
   case anthromere_stage_select_room : current_room = anthromere_stage_select_room break;
   
   case quiMyst_stage_select_room : current_room = quiMyst_stage_select_room break;
   
   case vanDiagos_stage_select_room : current_room = vanDiagos_stage_select_room break;
   
   case pixie_hollows_stage_select_room : current_room = pixie_hollows_stage_select_room break;
   
   case chamberlain_stage_select_room : current_room = chamberlain_stage_select_room break;
   
   case everWinter_stage_select_room : current_room = everWinter_stage_select_room break;
   
   case skyWay_stage_select_room : current_room = skyWay_stage_select_room break;
   
   case adventure_ocean_stage_select_room : current_room = adventure_ocean_stage_select_room break;
   
   case ogre_rock_stage_select_room : current_room = ogre_rock_stage_select_room break;
   
   case old_fortunes_stage_select_room : current_room = old_fortunes_stage_select_room break;
   
   case imp_paradise_stage_select_room : current_room = imp_paradise_stage_select_room break;
   
   case argument0  : current_room = argument0        break;
   
   case argument1  : current_room = argument1        break;
   
   case argument2  : current_room = argument2        break;
   
   case argument3  : current_room = argument3        break;
   
   case argument4  : current_room = argument4        break;
   
   case argument5  : current_room = argument5        break;
   
   case gargantua_land_lv_1 : current_room = gargantua_land_lv_1; break;
     
   case haunts_domain_lv_1  : current_room = haunts_domain_lv_1;  break;
}
That's the whole of the objects that do anything with persistent or room changes
 
I

icuurd12b42

Guest
You set the persistent to true on room start (if the controller is persent in the room)
and to false right before saving and going to another room in the warp
but (1) you dont reset it to false in the mouse button press that also goes to another room

and (2) what happens when you load a game? the room start is not called when that happens so the room persistent will be false

As far as I can tell that is the only 2 discrepancies I can spot.
 
W

Wild_West

Guest
You set the persistent to true on room start (if the controller is persent in the room)
and to false right before saving and going to another room in the warp
but (1) you dont reset it to false in the mouse button press that also goes to another room

and (2) what happens when you load a game? the room start is not called when that happens so the room persistent will be false

As far as I can tell that is the only 2 discrepancies I can spot.
The level reset controller isn't persistent but the level unlock controller is.
I should have clarified something about the warp hole, sorry. It exists in map select too as a way to move between maps and the shop, so you can click on it to activate it but ony in map select, not in any stage you play so I don't neeed to set map select persistent to false since it's never a persistent room.

and loading games always takes you to map select, there's no other way to save than to touch the warp
 
Top