Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Ronivan on February 07, 2015, 12:48:35 pm

Title: Weather Effect and Custom Resolution Problem
Post by: Ronivan on February 07, 2015, 12:48:35 pm
I'm in need of help with ForeverZer0 Custom Resolution. The script work as it should, exept for one problem, it don't change the resolution of weather effects.
I've tryed both types of weather effect, the RPG Maker XP custom weather and weather effects by scripts, both don't feet the new resolution of screen, the weather
just stays at the standard resolution of 640x480 of the upper left side of the screen. Anyone have solve this problem? I need help to solve this.
Title: Re: Weather Effect and Custom Resolution Problem
Post by: KK20 on February 07, 2015, 01:14:35 pm
Took this code from my XP Ace Tilemap (http://forum.chaos-project.com/index.php/topic,14638.0.html).

#===============================================================================
# ** RPG::Weather
#===============================================================================
class RPG::Weather
   
  alias add_more_weather_sprites initialize
  def initialize(vp = nil)
    add_more_weather_sprites(vp)
    total_sprites = SCREEN[0] * SCREEN[1] / 7680
    if total_sprites > 40
      for i in 1..(total_sprites - 40)
        sprite = Sprite.new(vp)
        sprite.z = 1000
        sprite.visible = false
        sprite.opacity = 0
        @sprites.push(sprite)
      end
    end
  end
 
  def type=(type)
    return if @type == type
    @type = type
    case @type
    when 1
      bitmap = @rain_bitmap
    when 2
      bitmap = @storm_bitmap
    when 3
      bitmap = @snow_bitmap
    else
      bitmap = nil
    end
    for i in 1..@sprites.size
      sprite = @sprites[i]
      if sprite != nil
        sprite.visible = (i <= @max)
        sprite.bitmap = bitmap
      end
    end
  end
 
  def max=(max)
    return if @max == max;
    @max = [[max, 0].max, @sprites.size].min
    for i in 1..@sprites.size
      sprite = @sprites[i]
      if sprite != nil
        sprite.visible = (i <= @max)
      end
    end
  end
 
  def update
    return if @type == 0
    for i in 1..@max
      sprite = @sprites[i]
      if sprite == nil
        break
      end
      if @type == 1
        sprite.x -= 2
        sprite.y += 16
        sprite.opacity -= 8
      end
      if @type == 2
        sprite.x -= 8
        sprite.y += 16
        sprite.opacity -= 12
      end
      if @type == 3
        sprite.x -= 2
        sprite.y += 8
        sprite.opacity -= 8
      end
      x = sprite.x - @ox
      y = sprite.y - @oy
      if sprite.opacity < 64
        sprite.x = rand(SCREEN[0] + 100) - 100 + @ox
        sprite.y = rand(SCREEN[0] + 200) - 200 + @oy
        sprite.opacity = 160 + rand(96)
      end
    end
  end
 
end
#===============================================================================
# ** Game_Screen
#===============================================================================
class Game_Screen
  #--------------------------------------------------------------------------
  # * Set Weather
  #     type : type
  #     power : strength
  #     duration : time
  #--------------------------------------------------------------------------

  def weather(type, power, duration)
    @weather_type_target = type
    if @weather_type_target != 0
      @weather_type = @weather_type_target
    end
    if @weather_type_target == 0
      @weather_max_target = 0.0
    else
      num = SCREEN[0] * SCREEN[1] / 76800.0
      @weather_max_target = (power + 1) * num
    end
    @weather_duration = duration
    if @weather_duration == 0
      @weather_type = @weather_type_target
      @weather_max = @weather_max_target
    end
  end
end
Title: Re: Weather Effect and Custom Resolution Problem
Post by: Ronivan on February 07, 2015, 01:39:25 pm
Thank you again KK20, it worked perfectly. All resolutions that I try now, the weather fits on the screen.
My thanks!