(See the best response by Devourer Of Souls.)


Problem description:

So, the code posted is for the dirt tile, then the grass edges that will lay on top of it. For some reason, anywhere that the grass edges overlap the dirt, the dirt itself doesn't randomize on run time. I'll show what I mean in the image below:

As you can see, in the bottom dirt patch, the only tile that has changed is the center tile with no grass overlapping it.

I'm not sure if there is something off with the code or if it's a bug, considering how simple the code it.
Best response
I assume you're layering a turf on another turf. There can only be one turf in a specific tile.

When you put a new turf on a tile in the map editor, if the turf is fully opaque (IE, the icon itself covers every pixel in the 32x32 icon), it will replace it. However, in instances like this, where the edge of the grass does not, it will add the turf below it as an underlay instead.

Since it's an underlay, the Dirt turf's New() proc will never trigger. This is why you are not seeing any randomization.

If you wanted to achieve a similar effect, you could make the edges objs instead, and have them added to the turf as an overlay like so:


You'd want to add them as an overlay instead of leaving them as an obj because it's faster for SendMaps to process. One downside to this method is that it's harder to alter in the map editor since you're using objs (and can't just paint over them).

Practically speaking, it may be better to just keep them both as turfs and accept there will be no randomization near the edges. You can also look into autotile libraries to make this whole process much simpler.
Oh, I see, thank you for clearing that up for me. I suppose I should look at some autotile libraries then.