Modificação no Weather Ex do Moghunter [VX Ace]

4 Respostas   816 Visualizações

0 Membros e 1 Visitante estão vendo este tópico.

Geraldo de Rívia

  • Mito
  • *
  • Posts: 4452
  • Ouros: 3887
  • O vento está sibilando.
  • Medalhas Vencedor do Protótipo Premiado Participantes do Maps Together 2
Tópico criado em: 24/01/2015 às 22:13 - Última modificação por King Gerar em 26/01/2015 às 09:40

Bom... eu tentei, tentei, e tentei, mas tudo que consegui foi perder minha tarde de sábado.

O script que queria a mudança é esse (Weather Ex do Moghunter). Particularmente no
efeito "wind", em que as partículas caem da parte superior esquerda em direção a lateral
direita da tela. Os outros nem vou usar.

O que eu queria é que as partículas "nascessem" na parte inferior da tela, se possível antes
da metade horizontal e subissem em direção ao canto direito da tela, porém, desaparecendo
gradualmente mais ou menos na metade da tela. Para ilustrar, ficaria algo tipo as partículas
da imagem abaixo, em spoiler:


Imagem
[close]

Ou, se isso for muito complicado, agradeço se alguém quiser me ensinar como faz um script
desse que peço, só com esse efeito mesmo x.x
Desde já agradeço!
  :o:):

Lycanimus

Resposta 1: 25/01/2015 às 00:30 - Última modificação por Lycanimus em 25/01/2015 às 01:06

King, eu fiz uma alteração, vê se é isso que você queria, e aliás ótimo design dessa imagem que postou.  :ok:


Vídeo do efeito:

Código: [Selecionar]
#==============================================================================
# +++ MOG - Weather EX (v0.8b) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de clima com efeitos animados.
#==============================================================================
# As imagens usadas pelo sistema do clima devem ser gravadas na pasta
#
# GRAPHICS/WEATHER/
#
#==============================================================================
# UTILIZAÇÃO
#
# Use o comando abaixo através da função chamar script.*(Evento)
#
# weather(TYPE, POWER, IMAGE_FILE)
#
# TYPE - Tipo de clima. (de 0 a 6)
# POWER - Quantidade de partículas na tela. (de 1 a 10)
# IMAGE_FILE - Nome da imagem.
#
# Exemplo (Eg)
#
# weather(0, 5, "Leaf")
#
#==============================================================================
# Para parar o clima use o comando abaixo.
#
# weather_stop
#
#==============================================================================
# Tipos de Clima.
#
# O sistema vem com 7 climas pré-configurados, que podem ser testados na demo
# que vem com esse script.
#
# 0 - (Rain) 
# 1 - (Wind)
# 2 - (Fog) 
# 3 - (Light)
# 4 - (Snow)
# 5 - (Spark)
# 6 - (Random)
#
#==============================================================================
# NOTA
#
# Evite de usar imagens muito pesadas ou de tamanho grande, caso for usar
# diminua o poder do clima para evitar lag.
#
#==============================================================================
module MOG_WEATHER_EX
  #Prioridade do clima na tela.
  WEATHER_SCREEN_Z = 100 
  #Definição da eficiência do poder do clima.
  #NOTA -  Um valor muito alto pode causar lag, dependendo do tipo de clima e
  #        imagem usada.
  WEATHER_POWER_EFIC = 5
end

#==============================================================================
# ■ Spriteset Map
#==============================================================================
class Spriteset_Map
 
 #--------------------------------------------------------------------------
 # ● Initialize
 #--------------------------------------------------------------------------                   
  alias mog_weather_ex_initialize initialize
  def initialize         
      mog_weather_ex_initialize
      create_weather_ex
  end

 #--------------------------------------------------------------------------
 # ● Dispose
 #--------------------------------------------------------------------------                   
  alias mog_weather_ex_dispose dispose
  def dispose
      mog_weather_ex_dispose
      dispose_weather_ex
  end 

 #--------------------------------------------------------------------------
 # ● Update
 #--------------------------------------------------------------------------                   
  alias mog_weather_ex_update update
  def update
      mog_weather_ex_update
      update_weather_ex
  end 
 
 #--------------------------------------------------------------------------
 # ● Create Weather EX
 #--------------------------------------------------------------------------                   
  def create_weather_ex
      create_weather_viewport
      create_weather_sprite     
  end
 
 #--------------------------------------------------------------------------
 # ● Dispose Wheater EX
 #--------------------------------------------------------------------------                     
  def dispose_weather_ex
      dispose_weather_ex_sprite
      dispose_weather_ex_viewport
  end 
 
 #--------------------------------------------------------------------------
 # ● Create Weather Viewport
 #--------------------------------------------------------------------------                     
  def create_weather_viewport
      @viewport_weather_ex = Viewport.new(-32, -32, 576, 448)
      @viewport_weather_ex.z = MOG_WEATHER_EX::WEATHER_SCREEN_Z
      @viewport_weather_ex.ox = ($game_map.display_x * 32)
      @viewport_weather_ex.oy = ($game_map.display_y * 32)     
  end 

 #--------------------------------------------------------------------------
 # ● Create Weather Sprite
 #--------------------------------------------------------------------------                       
  def create_weather_sprite
      @old_weather = $game_system.weather
      return if $game_system.weather == [] or $game_system.weather[0] == -1
      @weather_ex = []
      index = 0
      power_efic = MOG_WEATHER_EX::WEATHER_POWER_EFIC
      power_efic = 1 if power_efic < 1
      power = [[$game_system.weather[1] * power_efic, power_efic].max, 999].min
      for i in 0...power
          @weather_ex.push(Weather_EX.new(@viewport_weather_ex,$game_system.weather[0],$game_system.weather[2],index, @viewport_weather_ex.ox, @viewport_weather_ex.oy))
          index += 1
      end           
  end

 #--------------------------------------------------------------------------
 # ● Dispose Weather EX Viewport
 #--------------------------------------------------------------------------                       
  def dispose_weather_ex_viewport
      @viewport_weather_ex.dispose
      @viewport_weather_ex = nil
  end 
 
 #--------------------------------------------------------------------------
 # ● Dispose Weather EX
 #--------------------------------------------------------------------------                   
  def dispose_weather_ex_sprite
      return if @weather_ex == nil
      index = 0
      for i in @weather_ex
          $game_temp.weather_ex_set[index] = [] if $game_temp.weather_ex_set[index] == nil
          $game_temp.weather_ex_set[index].push(i.x,i.y,i.opacity,i.angle,i.zoom_x)
          i.dispose
          index += 1
      end 
      @weather_ex.clear
      @weather_ex = nil
  end
 
 #--------------------------------------------------------------------------
 # ● Dispose Refresh
 #--------------------------------------------------------------------------                   
  def dispose_refresh
      $game_temp.weather_ex_set.clear
      return if @weather_ex == nil
      @weather_ex.each {|sprite| sprite.dispose}
      @weather_ex.clear
      @weather_ex = nil
  end 
 
 #--------------------------------------------------------------------------
 # ● Update Weather EX
 #--------------------------------------------------------------------------                   
  def update_weather_ex
      refresh_weather_ex
      update_weather_ex_viewport
      return if @weather_ex == nil
      @weather_ex.each {|sprite| sprite.update(@viewport_weather_ex.ox,@viewport_weather_ex.oy)}
  end
 
 #--------------------------------------------------------------------------
 # ● Update Weather Ex Viewport
 #--------------------------------------------------------------------------                     
  def update_weather_ex_viewport
      return if @viewport_weather_ex == nil
      @viewport_weather_ex.ox = ($game_map.display_x * 32)
      @viewport_weather_ex.oy = ($game_map.display_y * 32)
  end
 
 #--------------------------------------------------------------------------
 # ● Refresh Weather EX
 #--------------------------------------------------------------------------                     
  def refresh_weather_ex
      return if @old_weather == nil
      return if @old_weather == $game_system.weather
      dispose_refresh
      create_weather_sprite
  end 
end 


#==============================================================================
# ■ Cache
#==============================================================================
module Cache
 
  #--------------------------------------------------------------------------
  # ● Weather
  #--------------------------------------------------------------------------
  def self.weather(filename)
      load_bitmap("Graphics/Weather/", filename)
  end
 
end

#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_System
 
  attr_accessor :weather
 
  #--------------------------------------------------------------------------
  # ● Initialize
  #-------------------------------------------------------------------------- 
  alias weather_ex_initialize initialize 
  def initialize
      @weather = []
      weather_ex_initialize
  end 
 
end 

#==============================================================================
# ■ Game Interpreter
#==============================================================================
class Game_Interpreter
 
  #--------------------------------------------------------------------------
  # ● Weather
  #--------------------------------------------------------------------------   
  def weather(type = -1, power = 0, image = "")
      $game_system.weather.clear
      $game_system.weather = [type,power,image]
  end
 
  #--------------------------------------------------------------------------
  # ● Weather Stop
  #--------------------------------------------------------------------------     
  def weather_stop
      $game_system.weather.clear
      $game_system.weather = [-1,0,""]
  end
 
end 

#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp

  attr_accessor :weather_ex_set
 
  #--------------------------------------------------------------------------
  # ● Initialize
  #-------------------------------------------------------------------------- 
  alias mog_weather_ex_initialize initialize
  def initialize
      @weather_ex_set = []
      mog_weather_ex_initialize
  end 
 
end

#==============================================================================
# ■ Weather_EX
#==============================================================================
class Weather_EX < Sprite
 
  #--------------------------------------------------------------------------
  # ● Initialize
  #-------------------------------------------------------------------------- 
  def initialize(viewport = nil ,type = 0, image_name = "",index = 0,nx,ny)
      super(viewport)
      self.bitmap = Cache.weather(image_name.to_s)
      self.opacity = 0
      @cw = self.bitmap.width
      @ch = self.bitmap.height
      @angle_speed = 0
      @x_speed = 0
      @y_speed = 0
      @zoom_speed = 0
      @opacity_speed = 0
      @type = type
      @index = index
      @old_nx = nx
      @old_ny = ny
      type_setup(nx,ny)
  end
 
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------   
  def dispose
      self.bitmap.dispose
      self.bitmap = nil
  end
 
  #--------------------------------------------------------------------------
  # ● Pre Values
  #--------------------------------------------------------------------------   
  def pre_values(index)
      return if  $game_temp.weather_ex_set[index] == nil
      self.x = $game_temp.weather_ex_set[index][0]
      self.y = $game_temp.weather_ex_set[index][1]
      self.opacity = $game_temp.weather_ex_set[index][2]
      self.angle = $game_temp.weather_ex_set[index][3]
      self.zoom_x = $game_temp.weather_ex_set[index][4]
      self.zoom_y = $game_temp.weather_ex_set[index][4]
      $game_temp.weather_ex_set[index].clear
      $game_temp.weather_ex_set[index] = nil
  end 
 
  #--------------------------------------------------------------------------
  # ● Type Setup
  #--------------------------------------------------------------------------     
  def type_setup(nx = 0, ny = 0)
      @cw2 = [(672 + @cw) + nx, -(96 + @cw) + nx]
      @ch2 = [(576 + @ch) + ny, -(96 + @ch) + ny]
      check_weather_type
      pre_values(@index)   
  end
 
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------   
  def update(nx = 0, ny = 0)     
      self.x += @x_speed
      self.y += @y_speed
      self.opacity += @opacity_speed
      self.angle += @angle_speed
      self.zoom_x += @zoom_speed
      self.zoom_y += @zoom_speed
      check_loop_map(nx,ny)
      type_setup(nx,ny) if can_reset_setup?
  end 

  #--------------------------------------------------------------------------
  # ● Check Loop Map
  #--------------------------------------------------------------------------       
  def check_loop_map(nx,ny)
      if (@old_nx - nx).abs > 32
         @cw2 = [(672 + @cw) + nx, -(96 + @cw) + nx]
         self.x += nx
         self.x -= @old_nx if nx == 0
      end   
      if (@old_ny - ny).abs > 32
         @ch2 = [(576 + @ch) + ny, -(96 + @ch) + ny]
         self.y += ny
         self.y -= @old_ny if ny == 0
      end         
      @old_nx = nx
      @old_ny = ny   
  end 
   
  #--------------------------------------------------------------------------
  # ● Can Reset Setup
  #--------------------------------------------------------------------------     
  def can_reset_setup?
      return true if self.x > @cw2[0] or self.x <  @cw2[1]
      return true if self.y > @ch2[0]  or self.y < @ch2[1]
      return true if self.opacity == 0
      return true if self.zoom_x > 2.0 or self.zoom_x < 0.5
      return false
  end
 
 #--------------------------------------------------------------------------
 # ● Check Weather Type
 #--------------------------------------------------------------------------                         
 def check_weather_type
     case @type
         when 0;   rain
         when 1;   wind   
         when 2;   fog
         when 3;   light
         when 4;   snow
         when 5;   spark
         when 6;   random                 
      end
 end
   
 #--------------------------------------------------------------------------
 # ● Snow
 #--------------------------------------------------------------------------                         
 def snow
     self.angle = rand(360)
     self.x = rand(@cw2[0])
     self.y = rand(@ch2[0])
     self.opacity = 1
     self.zoom_x = (rand(100) + 50) / 100.0
     self.zoom_y = self.zoom_x
     @y_speed = [[rand(5), 1].max, 5].min
     @opacity_speed = 5
     @angle_speed = rand(3)
 end   
 
 #--------------------------------------------------------------------------
 # ● Spark
 #--------------------------------------------------------------------------                           
 def spark
     self.angle = rand(360)
     self.x = rand(@cw2[0])
     self.y = rand(@ch2[0])
     self.opacity = 1
     self.zoom_x = (rand(100) + 100) / 100.0
     self.zoom_y = self.zoom_x
     self.blend_type = 1     
     @opacity_speed = 10
     @zoom_speed = -0.01
 end
 
 #--------------------------------------------------------------------------
 # ● Rain
 #--------------------------------------------------------------------------                         
 def rain
     self.x = rand(@cw2[0])       
     if @start == nil
        self.y = rand(@ch2[0])
        @start = true
     else
        self.y = @ch2[1]       
     end   
     self.opacity = 1
     self.zoom_y = (rand(50) + 100) / 100.0
     self.zoom_x = (rand(25) + 100) / 100.0
     @y_speed = [[rand(10) + 10, 10].max, 20].min
     @opacity_speed = 10
 end   
 
 #--------------------------------------------------------------------------
 # ● Fog
 #--------------------------------------------------------------------------                           
 def fog
     rand_angle = rand(2)
     self.angle = rand_angle == 1 ? 180 : 0
     self.x = rand(@cw2[0])
     self.y = rand(@ch2[0])
     self.opacity = 1
     self.zoom_x = (rand(100) + 50) / 100.0
     self.zoom_y = self.zoom_x
     @x_speed = [[rand(10), 1].max, 10].min
     @opacity_speed = 10
 end
 
 #--------------------------------------------------------------------------
 # ● Light
 #--------------------------------------------------------------------------                           
 def light
     self.angle = rand(360)
     self.x = rand(@cw2[0])
     self.y = rand(@ch2[0])
     self.opacity = 1
     self.zoom_x = (rand(100) + 50) / 100.0
     self.zoom_y = self.zoom_x
     self.blend_type = 1
     @angle_speed = [[rand(3), 1].max, 3].min
     @y_speed = -[[rand(10), 1].max, 10].min
     @opacity_speed = 2
 end
 
 #--------------------------------------------------------------------------
 # ● Wind
 #--------------------------------------------------------------------------                         
 def wind
     self.angle = rand(300)
     self.x = 00
     self.y = 570
     self.opacity = 1
     self.zoom_x = (rand(100) +100) / 100.0
     self.zoom_y = self.zoom_x
     self.blend_type = 1
     @x_speed = [[rand(10), 1].max, 10].min
     @y_speed = -[[rand(4), 1].max, 10].min
     @opacity_speed = 20
     @zoom_speed = -0.01
 end   
     
 #--------------------------------------------------------------------------
 # ● Random
 #--------------------------------------------------------------------------                         
 def random
     self.angle = rand(360)
     self.x = rand(@cw2[0])
     self.y = rand(@ch2[0])
     self.opacity = 1
     self.zoom_x = (rand(100) + 50) / 100.0
     self.zoom_y = self.zoom_x
     x_s = [[rand(10), 1].max, 10].min
     y_s = [[rand(10), 1].max, 10].min
     rand_x = rand(2)
     rand_y = rand(2)
     @x_speed = rand_x == 1 ? x_s : -x_s
     @y_speed = rand_y == 1 ? y_s : -y_s     
     @opacity_speed = 10
 end   
 
end

$mog_rgss3_weather_ex = true
Fazer mapas é uma arte, faça como se fosse o seu último.




Geraldo de Rívia

  • Mito
  • *
  • Posts: 4452
  • Ouros: 3887
  • O vento está sibilando.
  • Medalhas Vencedor do Protótipo Premiado Participantes do Maps Together 2
Resposta 2: 25/01/2015 às 08:58

Hum, é quase isso, mas tu já conseguiu algo que eu não conseguia nem a pau uehaue
Tipo, o que tu pôs ta meio que "lançando" as partículas, não ficou fluída como é a de
vento naturalmente. Mas vou tentar aqui, talvez a partir da mudança que tu fez eu
ja consiga chegar mais perto.
Brigadão Lyca!
  :ok:

Lycanimus

Resposta 3: 25/01/2015 às 19:37

Tranquilo King, vou ver se consigo deixa-la mais fluida, ai qualquer coisa eu posto aqui, abraços
Fazer mapas é uma arte, faça como se fosse o seu último.




Geraldo de Rívia

  • Mito
  • *
  • Posts: 4452
  • Ouros: 3887
  • O vento está sibilando.
  • Medalhas Vencedor do Protótipo Premiado Participantes do Maps Together 2
Resposta 4: 26/01/2015 às 09:40

Ahhh, agora que fui mexer aqui. Na verdade nem usei o wind mais, consegui
deixar o light mais próximo do que eu queria. E fuçando o que tu fez, vi que
o script que tu tem é diferente do que vem na Daster Demo do Mog.
Acho que já tá bom como ficou, e brigadão mesmo, Lyca:beijo:

Ah, e valeu pelo elogio à logo. Não tinha visto antes x.x