SOLVED I'm getting the wrong asset ID. Is my project file corrupted? And if so, what can I try to repair it?

jobjorgos

Member
For debug purposes I want to turn on/off some specific tileset layers in the room while playing.

It indeed turns on/off layers while toggling in the room, but it are the wrong ones!

1612914633352.png
The function you see in the image above should toggle the tileset layers:
"Col", "Silhouette", "Liquid", "Pavement", "Foilage", "Deck_0", "Deck_1", "Deck_2", "Deck_3"

but when i am in the game and toggle, it switches these tileset layers instead:
"Col", "Silhouette", "Liquid", "Pavement", "Deck_3_Overlay", "Deck_0"

"Deck_1", "Deck_2", "Deck_3"
doesnot change at all and "Deck_3_Overlay" was not even on the list at all!

1612915511227.png
This image shows how the tileset layers look in the room editior.


I'm working on this project with someone else and we push/pull updates with github. To prevent conflict we never work in the project at the same time and we both use the same version of GameMaker (2.3.1.409).
But there's always a chance we made a small change before pulling the update, or github doesnot register some change causing a small project file corruption I guess.
Is it possible that the project file is not up to date with the actual sprites/tilesets assets causing the asset_index_number of the project to mess up?

1612915863272.png
Also when I export the game, and try to open the exported module, first nothing happens, second attempt it opens the project saying that all the sprites are missing which to me looks very much like a corrupted project file.

So is my project file corrupted? And if so, what can I try to repair it. This is a 4 year long project started in GameMaker 1.4 and this is the first time experiencing this wrong asset problem.
 
Last edited:

jobjorgos

Member
I would try clearing the compiler cache with that button that looks like brush before I did anything else.
was good to try, but still the wrong layer / asset number problem occurs.

Also after having cleaned the cache and try to "Export Game" I got the following crash:
1612918505131.png

I restarted GameMaker, then it succeeded to export:
1612920064665.png

Then when I open the exported module, GameMaker extract the project to the desired diretory:
1612920030077.png

But then when the extracting is 100%, nothing happens and GameMaker Studio freezes.
Then when I go to the extracted directory, I only see empty maps:

1612920013032.png

So my project file is much likely corrupted. And if not, HOW the heck can tileset layer Deck_3_Overlay turn on/off, while I dont have it ANYWHERE in code?
 
Last edited:

chamaeleon

Member
layer_tilemap_get_id() does not return a layer id, does it? So using it as an argument expected to be a layer id for layer_set_visible() would yield undefined behavior (or rather, whatever numerical value is returned more than likely does not correspond to the desired layer)?
 

jobjorgos

Member
layer_tilemap_get_id() does not return a layer id, does it? So using it as an argument expected to be a layer id for layer_set_visible() would yield undefined behavior (or rather, whatever numerical value is returned more than likely does not correspond to the desired layer)?
aaaw that was the problem! I just tested it now and no strange behavior anymore, every tileset layers turns off/on now correctly! I was wrongly thinking so hard that there was might a project file corruption or something. im very glad it got solved thanks for the help
 
Top