Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

As we have talked on Discord, you cannot layer_tilemap_get_id on dynamically created layers.

You will have to make a small script like

/// layer_tilemap_get_id_fixed(layer)
var els = layer_get_all_elements(argument0);
var n = array_length_1d(els);
for (var i = 0; i < n; i++) {
    var el = els[i];
    if (layer_get_element_type(el) == layerelementtype_tilemap) {
        return el;
    }
}
return -1;

Worked like a charm, most appreciated!

Great to hear that this worked for the other person too. Due to some poor planning, it would have been a headache to try and send you a project that demonstrated the issue (since the extension is integrated into a big project at the moment), and given that nobody else seemed to have the same problem, I would much sooner assume it was my own fault rather than a problem with Game Maker, so I sort of gave up on it. But once again, YellowAfterlife comes to the rescue and sets us all straight <3 Thanks so much for the explanation and script.