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

Permanently delete objects

Squin

Member
Is it possible to permanently delete an object from a room even though the room isn't persistent? Like delete the instance than leave the room and come back and its still gone?
 

TsukaYuriko

☄️
Forum Staff
Moderator
Object no, instance yes. If the room is not persistent, use something else that is persistent - such as a global variable, or an array thereof - and reference it to check if the thing should destroy itself as soon as it is created or not.
 

kburkhart84

Firehammer Games
You could look up traditional RPG tutorials, or some on Metroidvanias. Both of those typically have something like treasure chests that stay open once you get the item. That data gets saved along with the save file(which would contain character stats and locations and quest data as well).

1. Have a global array/list that stores a bunch of true/false values. It is up to you to interpret true as opened or true as available.
2. Each instance of a chest(or object location) has to know what index into the array/list it is using. You can use the instance editor in the room for that in the variable dialog, or you can use instance create events(not as viable but still works).
3. The create event of the instance checks the variable to know the index to check into the array/list. It then checks that and destroys itself or not based on that. You could also swap to an opened chest instance instead of that makes sense for your game.
4. You global controllers that handle the game loading and saving need to be aware of that array/list so it gets saved along with the other game data.
 
Top