Theoallen fog of war modification

I need to slightly edit this fog of war script.


First, right now, even with the minimum settings, each time the character moves, one tile on each side of the character is revealed to the player, but I only want the tile the character is standing on to be revealed.

Second, I need to make the fog of war reappear on certain maps. (ie add certain notetag in the maps notes). This is especially necessary for a roguelike where certain maps will be repeated and so that they don't appear explored to the player.

Thank you in advance.
Hello,

I wrote this small script but I did not test it:
Ruby:
module TIM
  module REGEXP
    TheoFogReset = /<reset_fog>/i
  end #REGEXP
end #TIM

#==============================================================================
# Game_System
#==============================================================================
class Game_System
  def clear_revealed_tiles(map_id)
    @revealed_map ||= {}
    @revealed_map[map_id] = []
  end
end #Game_System

#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # new method: reset_fog?
  #--------------------------------------------------------------------------
  def reset_fog?
    @map.note[TIM::REGEXP::TheoFogReset]
  end
 
  #--------------------------------------------------------------------------
  # alias method: setup
  #--------------------------------------------------------------------------
  alias tim_theo_fog_setup setup
  def setup(map_id)
    tim_theo_fog_setup(map_id)
    $game_system.clear_revealed_tiles(map_id) if reset_fog?
  end
 
  #--------------------------------------------------------------------------
  # alias method: reveal_tiles -> handle 0 distance case
  #--------------------------------------------------------------------------
  alias tim_theo_fog_reveal_tiles reveal_tiles
  def reveal_tiles(x, y, distance = Theo::VisiRange, reveal = true)
    return tim_theo_fog_reveal_tiles(x,y,distance,reveal) unless distance <= 0
    return if no_fog?
    node = Revealed_Node.new(x, y)
    return if $game_system.revealed_tiles.include?(node)
    spriteset = SceneManager.scene.spriteset
    spriteset.fogofwar.reveal_tiles([node]) if spriteset
    $game_system.revealed_tiles.push(node)
  end
end #Game_Map

You can set in your map notetags <reset_fog>so that when the map is reloaded, the fog restarts.
Or you can also use script call:
$game_system.clear_revealed_tiles(map_id)
To reset the fog of the given map.

Original thread: https://forums.rpgmakerweb.com/threads/theoallen-fog-of-war-modification.181476/