Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RESOLVED] Fogs during battles?

Wowowow~

I just noticed something that is pretty silly, but fogs don't carry over into battles. o_O I wonder why RMXP did this...

Anyway, is there a fix for this? A script perhaps? I looked for one but couldn't find it.~

Thanks! ^^
 

Zeriab

Sponsor

A script for getting fogs into battles?
It sounds more like a request than a support question.

A request for getting a script which carries fogs over into battles.
Do you also want the Change Map Settings, Change Fog Color Tone and Change Fog Opacity event commands to work in battles?

*hugs*
- Zeriab
 
Code:
#==============================================================================
# ** Fog in Battle
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-07-26
#==============================================================================

#==============================================================================
# ** Spriteset_Battle
#==============================================================================

class Spriteset_Battle
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_battlefogs_ssbtl_init, :initialize
  alias_method :seph_battlefogs_ssbtl_disp, :dispose
  alias_method :seph_battlefogs_ssbtl_updt, :update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Original Initialization
    seph_battlefogs_ssbtl_init
    # Create Fog
    @fog = Plane.new(@viewport1)
    @fog.z = 1
    update_fog
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    # Original Initialization
    seph_battlefogs_ssbtl_disp
    # Dispose of fog plane
    @fog.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update: Fog
  #--------------------------------------------------------------------------
  def update_fog
    # If fog is different than current fog
    return if @fog == nil
    if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
      @fog_name = $game_map.fog_name
      @fog_hue = $game_map.fog_hue
      if @fog.bitmap != nil
        @fog.bitmap.dispose
        @fog.bitmap = nil
      end
      if @fog_name != ""
        @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
      end
      Graphics.frame_reset
    end
    # Update fog plane
    @fog.zoom_x = $game_map.fog_zoom / 100.0
    @fog.zoom_y = $game_map.fog_zoom / 100.0
    @fog.opacity = $game_map.fog_opacity
    @fog.blend_type = $game_map.fog_blend_type
    @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
    @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
    @fog.tone = $game_map.fog_tone
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original Update
    seph_battlefogs_ssbtl_updt
    # Update Fog
    update_fog
  end
end
 
^

Wait, since when are you mod? o_o

And yea, perhaps it should go in here. I just always felt that this forum was more for requests like battle systems and menu systems. :3

The commands don't have to work. It's just so that the fog from the map carries over into the battle, or else it's really strange. ^_^

@Seph: My Gosh, Seph, you're like my personal script angel. O_O *tests it*

Edit: Whee, it works~!!! =D The fog is supposed to stop, right?
 

Zeriab

Sponsor

I think I became mod a few weeks back although I don't remember exactly when.
I understand your feeling about what probably is a small script.
Good luck with your project.

*hugs*
- Zeriab
 
@Seph: Well, the movement. ^^ On the map the fog moves x = 2, y = 1, but in the battle it stops moving. =) Perhaps it's conflicting with an other script I'm using that rewrites one of the methods? As I'm using the RTAB. :3 But other than that it doesnt move in the battle, it works great.

@Zeriab: Yea you just told me on MSN. ^^ And thanks. =D *hug*

[Edit:] Well this is interesting. If there is no fog, @fog != nil. So it then freezes. X_x E.g. in test play.
 
I see what's going on. Update the script with this:

Code:
#==============================================================================
# ** Fog in Battle
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-07-26
#==============================================================================

#==============================================================================
# ** Spriteset_Battle
#==============================================================================

class Spriteset_Battle
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_battlefogs_ssbtl_init, :initialize
  alias_method :seph_battlefogs_ssbtl_disp, :dispose
  alias_method :seph_battlefogs_ssbtl_updt, :update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Original Initialization
    seph_battlefogs_ssbtl_init
    # Create Fog
    @fog = Plane.new(@viewport1)
    @fog.z = 1
    update_fog
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    # Original Initialization
    seph_battlefogs_ssbtl_disp
    # Dispose of fog plane
    @fog.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update: Fog
  #--------------------------------------------------------------------------
  def update_fog
    # Return if nil fog
    return if @fog == nil
    # Update fog in $game_map
    $game_map.update_fog_scroll
    $game_map.update_fog_color
    $game_map.update_fog
    # If fog is different than current fog
    if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
      @fog_name = $game_map.fog_name
      @fog_hue = $game_map.fog_hue
      if @fog.bitmap != nil
        @fog.bitmap.dispose
        @fog.bitmap = nil
      end
      if @fog_name != ""
        @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
      end
      Graphics.frame_reset
    end
    # Update fog plane
    @fog.zoom_x = $game_map.fog_zoom / 100.0
    @fog.zoom_y = $game_map.fog_zoom / 100.0
    @fog.opacity = $game_map.fog_opacity
    @fog.blend_type = $game_map.fog_blend_type
    @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
    @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
    @fog.tone = $game_map.fog_tone
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original Update
    seph_battlefogs_ssbtl_updt
    # Update Fog
    update_fog
  end
end

if !Object.const_defined?(:SDK)

#==============================================================================
# ** Game_Map
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Update Fog Scroll
  #--------------------------------------------------------------------------
  def update_fog_scroll
    # Manage fog scrolling
    @fog_ox -= @fog_sx / 8.0
    @fog_oy -= @fog_sy / 8.0
  end
  #--------------------------------------------------------------------------
  # * Update Fog Color
  #--------------------------------------------------------------------------
  def update_fog_color
    # Manage change in fog color tone
    if @fog_tone_duration >= 1
      d = @fog_tone_duration
      target = @fog_tone_target
      @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
      @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
      @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
      @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
      @fog_tone_duration -= 1
    end
  end
  #--------------------------------------------------------------------------
  # * Update Fog
  #--------------------------------------------------------------------------
  def update_fog
    # Manage change in fog opacity level
    if @fog_opacity_duration >= 1
      d = @fog_opacity_duration
      @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
      @fog_opacity_duration -= 1
    end
  end
end

end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top