You can try changing the exact tile (as you would in the editor).
Try this:
#==============================================================================
# ** Change Map Data
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 0.2
# 2008-12-09
#==============================================================================
class Game_Map
alias_method :seph_changemapdata_gmmap_data, :data
def data
d = seph_changemapdata_gmmap_data
if changed_data.has_key?(@map_id)
changed_data[@map_id].each do |xyz, tile_id|
x, y, z = *xyz
d[x, y, z] = tile_id
end
end
self.data = d
end
def data=(data)
@map.data = data
end
def changed_data
@changed_data = {} if @changed_data == nil
return @changed_data
end
def change_tile(x, y, z, tile_id = 0)
@changed_data = {} if @changed_data == nil
@changed_data[@map_id] = {} unless @changed_data.has_key?(@map_id)
@changed_data[@map_id][[x, y, z]] = tile_id
end
def clear_changed_data(map_id = 0)
@changed_data = {} if map_id == 0
@changed_data[@map_id] = {} if map_id != 0
end
end
To temporarily change a tile, say 5, 4 on the second layer, you would use:
$game_map.data[5, 4, 2] = tile_id
When the map changes and you go back the tile will be back to its original form.
To premanetly change a tile, use:
$game_map.change_tile(x, y, z, tile_id)
To clear these changes, use:
$game_map.clear_changed_data(map_id)
Replace map_id with the map data you wish to clear or 0 for all maps.
To figure out what tile_id you are looking for you can either:
A) Map a new map with your tileset on it and in the [0, 0] position (1st layer), put your desired tile. Make an event with:
p $game_map.data[0, 0, 0]
and click on your event in game. That will tell you your tile.
B) Mathematics. Start with 384. For every tile (on your tileset) you go down, add 8 * number down. For every tile you go right, add 8. So for instance, in the basic grassland tileset, the pink flower.
384
2 down = 384 + 8 * 2 = 400
7 right = 400 + 7 = 407
So to change any tile to the flower, your tile_id is 407.
Let me know if you need any help.