Okay I tested Your script on the same map in my personal project.
In Your script we have two problems for now.
1. Is a bug when you click ESC then is a problem with menu transparency. But it is only i my project.
I do not know why this is there but i removed it and it works in my and Your project...
2 Optimization in def fow_update_tilemap. In there Wachunga's wrote too many operations.
Try something like this:
and:
This codes will not work with your script but help with optimization if You try adjust it.
If You want i can send You my script on pw for tests and analysis.
In Your script we have two problems for now.
1. Is a bug when you click ESC then is a problem with menu transparency. But it is only i my project.
I do not know why this is there but i removed it and it works in my and Your project...
Code:
# Perform only for dynamic maps (must be FOW)
if $game_map.fow_dynamic
# If character moved and not game player
if (@x != @last_fow_x or @y != @last_fow_y) and self != $game_player
# Check if character entered or exited player's visual range
$scene.spriteset.update_event_transparency(self)
end
end
2 Optimization in def fow_update_tilemap. In there Wachunga's wrote too many operations.
Try something like this:
Code:
def update_fow_tilemap
dx = ($game_map.display_x / 128).round
dy = ($game_map.display_y / 128).round
visible_range_x = (dx - 1)..(dx + 21)
visible_range_y = (dy - 1)..(dy + 16)
for x in visible_range_x
for y in visible_range_y
next unless $game_map.valid?(x, y)
# Dynamic fog of war (FOW)
if $game_map.fow_dynamic
if $game_map.fow_grid[x, y, 0] == Fog_of_War::REVEALED
@fow_tilemap.map_data[x, y, 1] = 0 # odkryte pole
else
adj = check_adjacent(x, y, 0, $game_map.fow_grid, Fog_of_War::REVEALED)
# Przypisz autotile lub domyślną wartość zasłonięcia
@fow_tilemap.map_data[x, y, 1] = adj ? (@fow_autotiles[adj.to_i] + 48) : 96
end
end
# Static fog of war (FOW)
if $game_map.fow_static
if $game_map.fow_grid[x, y, 1] == Fog_of_War::REVEALED
@fow_tilemap.map_data[x, y, 2] = 0 # odkryte pole
else
adj = check_adjacent(x, y, 1, $game_map.fow_grid, Fog_of_War::REVEALED)
# Przypisz autotile lub domyślną wartość zasłonięcia
@fow_tilemap.map_data[x, y, 2] = adj ? @fow_autotiles[adj.to_i] : 48
end
end
end
end
end
and:
Code:
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player. Its functions include event starting
# determinants and map scrolling. Refer to "$game_player" for the one
# instance of this class.
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Frame Update (jump)
#--------------------------------------------------------------------------
def update_jump
# Inherit original method statements from the Game_Character superclass
super
# only update when about to land, not revealing anything jumped over
if $game_map.fow and @jump_count == 0
$game_map.update_fow_grid
$scene.spriteset.update_event_transparency if $game_map.fow_dynamic
$scene.spriteset.update_fow_tilemap
end
end
#--------------------------------------------------------------------------
# * Update frame (move)
#--------------------------------------------------------------------------
def update_move
# We check if the character is moving and is not jumping
if moving? && !jumping?
# Update fog of war only if position has changed, with a small delay
if $game_map.fow && (@x != @last_x || @y != @last_y)
$game_map.update_fow_grid if $game_map.fow_dynamic || $game_map.fow_static
$scene.spriteset.update_event_transparency if $game_map.fow_dynamic
$scene.spriteset.update_fow_tilemap
end
end
# Inherit original method statements from the Game_Character superclass
super
# Update last position after moving
@last_x, @last_y = @x, @y
end
end
This codes will not work with your script but help with optimization if You try adjust it.
If You want i can send You my script on pw for tests and analysis.