I recently started using rpgvxa from the humble bundle some time back, and I've been learning ruby and rgss3. This project I'm working on requires me to change a tile's region in-game. I have this script currently:
class Game_Map
def change_region(mapid, x, y, region)
targetmap = load_data("Data/Map" + mapid + ".rvdata2")
targetmap.data[x, y, 3] = ((targetmap.data[x, y, 3] & 255) | (region << 8))
end
end
It runs without errors or crashes, and it returns with the correct 4-bit binary stuff for layer 3. But when I call $game_map.region_id(x, y) after change_region on any of the affected tiles, it returns with what the region was set to before, in the actual editor. This makes me think that I'm missing something to actually push the changes to the map, but I can't find anything about that online. Am I missing something obvious, like a quick function call, or am I completely off on everything here?
class Game_Map
def change_region(mapid, x, y, region)
targetmap = load_data("Data/Map" + mapid + ".rvdata2")
targetmap.data[x, y, 3] = ((targetmap.data[x, y, 3] & 255) | (region << 8))
end
end
It runs without errors or crashes, and it returns with the correct 4-bit binary stuff for layer 3. But when I call $game_map.region_id(x, y) after change_region on any of the affected tiles, it returns with what the region was set to before, in the actual editor. This makes me think that I'm missing something to actually push the changes to the map, but I can't find anything about that online. Am I missing something obvious, like a quick function call, or am I completely off on everything here?