How to use set_cell() with autotile?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AndrewD

I have two tilemaps: First don’t have autotiles, and second have auto tiling. Im setting cells in second tilemap based on first. But when I call set_cell() it also needs an tile id. But if I setting tile id, autotiling isn’t working.
So, how to make autotiling work when I setting cell from the code?

:bust_in_silhouette: Reply From: rossunger

I’m not sure this makes sense… are you saying you want to override the auto-tile on just those selected cells? if so, maybe you should be having a 3rd tilemap that gets it’s cells from the autotile map, and then you can set_cell() on this tilemap?

I don’t think you can override specific cells on an autotile… but I may be wrong!

As it turned out, there is a function update_bitmask_region(). This solved my problem.

AndrewD | 2022-01-29 11:12

:bust_in_silhouette: Reply From: AndrewD

I found the solution myself: Tilemap has an update_bitmask_region() function that solved my problem.