查看: 2516|回复: 1

[已经解决] MOG的这几个脚本的用法

[复制链接]
梦石
0
星屑
61
在线时间
251 小时
注册时间
2015-5-14
回帖
430
发表于 2015-11-19 21:04:26 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
看不懂MOG脚本里的文字,麻烦大神告知一下用法及作用

这是第一个
[pre lang="ruby"]#==============================================================================
# +++ MOG - Transition EX (V1.4) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# - Adiciona efeitos nas transições de batalha.
#==============================================================================
# Para definir o efeito de transição use o código abaixo.
#
# transition_ex(X)
#
# X - (Effect)
#
# 0 - Zoom IN
# 1 - Zoom OUT
# 2 - Angle
# 3 - Wave
# 4 - Shake
# 5 - Screen Slice
# 6 - Random
# 7 - Nothing (Default Rpg Maker Transition)
#
#==============================================================================
# - DEFAULT TRANSITION NAME
#==============================================================================
# Se deseja mudar o tipo de transiçâo padrão, use o código abaixo.
#
# transition_name("TRANSITION_NAME")
#
# Ex
#
# transition_name("BattleStart_4")
# transition_speed(160)

#==============================================================================

#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 1.4 - Melhoria na codificação.
#==============================================================================
module MOG_TRANSITION_EX


end

$imported = {} if $imported.nil?
$imported[:mog_transition_ex] = true

#===============================================================================
# ■ Game System
#===============================================================================
class Game_System
  
  attr_accessor :transition_ex
  attr_accessor :transition_name
  attr_accessor :transition_speed
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------   
  alias mog_transiton_ex_initialize initialize
  def initialize
      @transition_ex = 0
      @transition_name = "BattleStart"
      @transition_speed = 60
      mog_transiton_ex_initialize
  end
   
end

#==============================================================================
# ■ Game Interpreter
#==============================================================================
class Game_Interpreter

  #--------------------------------------------------------------------------
  # ● Transition EX
  #--------------------------------------------------------------------------        
  def transition_ex(type = 0)
      $game_system.transition_ex = type
  end  
  
  #--------------------------------------------------------------------------
  # ● Transition Name
  #--------------------------------------------------------------------------      
  def transition_name(name = "")
      $game_system.transition_name = name
  end  
  
  #--------------------------------------------------------------------------
  # ● Transition Speed
  #--------------------------------------------------------------------------        
  def transition_speed(speed = 60)
      $game_system.transition_speed = speed
  end  
  
end

#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
  
  @background_transition = nil
  
  #--------------------------------------------------------------------------
  # ● Call
  #--------------------------------------------------------------------------  
  alias mog_transition_ex_call call
  def call(scene_class)
      snapshot_for_transition
      mog_transition_ex_call(scene_class)   
  end
  
  #--------------------------------------------------------------------------
  # ● Snapshot For Transition
  #--------------------------------------------------------------------------
  def snapshot_for_transition
      @background_transition.dispose if @background_transition
      @background_transition = Graphics.snap_to_bitmap
  end
  
  #--------------------------------------------------------------------------
  # ● Background Transition
  #--------------------------------------------------------------------------
  def background_transition
      @background_transition
  end
  
end

#===============================================================================
# ■ Module Transition
#===============================================================================
module Module_Transition_EX
  include MOG_TRANSITION_EX

  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------        
  def initialize
      super rescue nil
      execute_transition_ex
  end  
  
  #--------------------------------------------------------------------------
  # ● Terminate
  #--------------------------------------------------------------------------        
  def terminate
      super rescue nil
      dispose_transition_ex
  end
  
  #--------------------------------------------------------------------------
  # ● Create Black Background
  #--------------------------------------------------------------------------      
  def create_blackbackground
      return if @blackbackground != nil
      @blackbackground = Sprite.new
      @blackbackground.bitmap = Bitmap.new(Graphics.width,Graphics.height)
      @blackbackground.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0,0,0))
      @blackbackground.z = 5000
  end
  
  #--------------------------------------------------------------------------
  # ● Execute Transition EX
  #--------------------------------------------------------------------------   
  def execute_transition_ex
      return if @transtion_ex
      return if !$game_system.transition_ex.between?(0,6)
      @transition_ex = true
      dispose_transition_ex
      create_blackbackground
      @transition = []
      case $game_system.transition_ex   
        when 0
           @transition_time = 90
        else  
           @transition_time = 120
      end
      @transition.push(Sprite_Transition.new($game_system.transition_ex,@transition_time))
  end
  
#--------------------------------------------------------------------------
# ● Dispose Transition EX
#--------------------------------------------------------------------------
def dispose_transition_ex
     return if @transition == nil
     @transition.each {|sprite| sprite.dispose }
     @blackbackground.bitmap.dispose
     @blackbackground.dispose
     @transition_time = 0
     @transition = nil
end  
  
#--------------------------------------------------------------------------
# ● Update Transition EX
#--------------------------------------------------------------------------
def update_transition_ex
     return if @transition == nil
     time = @transition_time
     for i in 0...@transition_time
           @transition.each {|sprite| sprite.update }
           @blackbackground.opacity -= 10 if time <= 26
           Graphics.update
           time -= 1
     end
     dispose_transition_ex
end

end

#===============================================================================
# ■ Sprite Transition
#===============================================================================
class Sprite_Transition   
  include MOG_TRANSITION_EX
  
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------     
  def initialize(type = 0,duration = 90)
      @type = $game_system.transition_ex > 5 ? rand(5) : type
      @range = 0
      @speed = 0  
      @power = 0
      @image = SceneManager.background_transition
      @image = Cache.system("") if @image == nil
      @transition = Sprite.new      
      @transition.x = 0
      @transition.y = 0
      @transition.z = 99999
      @screen_size = [Graphics.width ,Graphics.height]
      @center = [@screen_size[0]/ 2, @screen_size[1] / 2]
      @transition.x = @center[0]
      @transition.y = @center[1]
      @transition.ox = @center[0]
      @transition.oy = @center[1]
      case @type
         when 5
            @transition.bitmap = Bitmap.new(@screen_size[0], @screen_size[1])         
            @transition.bitmap.stretch_blt(@transition.bitmap.rect, @image, @image.rect)                     
            @cw = @transition.bitmap.width
            @ch = @transition.bitmap.height / 2            
            src_rect = Rect.new(0, 0,@screen_size[0], @screen_size[1] )
            @transition.bitmap.blt(0, 0, @image, src_rect)                 
         else
            @transition.bitmap = Bitmap.new(@screen_size[0], @screen_size[1])         
            @transition.bitmap.stretch_blt(@transition.bitmap.rect, @image, @image.rect)                       
      end         
      @effect_time = [duration, duration]   
  end  
  
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------     
  def dispose
      @image.dispose
      @transition.bitmap.dispose
      @transition.dispose
  end  
  
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------   
  def update
      @effect_time[0] -= 1 if @effect_time[0] > 0
      case @type
         when 1 # Zoom IN / OUT # --------------------
               if  @effect_time[0].between?(@effect_time[1] - 20, @effect_time[1])
                   @transition.zoom_x += 0.07
                   @transition.zoom_y += 0.07
               else   
                   @transition.zoom_x -= 0.03
                   @transition.zoom_y -= 0.03
                   @transition.opacity -= 3
               end  
        when 2 # Angle # --------------------
                @transition.zoom_x += 0.01
                @transition.zoom_y -= 0.02
                @transition.opacity -= 2
                @transition.angle += 5
        when 3 # Wave
            if  @effect_time[0] == @effect_time[1] - 1
                @range = 250
                @speed = 500            
                @transition.wave_length = 544
            end
            @power += 1
            @transition.wave_amp = @power * 2
            @transition.wave_speed = @power * 7         
            @transition.opacity -= 2
            @transition.zoom_x += 0.01
            @transition.zoom_y += 0.01            
            @transition.update
        when 4 # Shake
            if  @effect_time[0].between?(@effect_time[1] - 10, @effect_time[1]) or
                @effect_time[0].between?(@effect_time[1] - 30, @effect_time[1] - 20) or
                @effect_time[0].between?(@effect_time[1] - 50, @effect_time[1] - 40) or
                @effect_time[0].between?(@effect_time[1] - 70, @effect_time[1] - 60) or
                @effect_time[0].between?(@effect_time[1] - 90, @effect_time[1] - 80)
                @transition.zoom_x += 0.1
                @transition.zoom_y += 0.1               
            else   
                @transition.zoom_x -= 0.1
                @transition.zoom_y -= 0.1
             end
        when 5 #Slice
           @transition.bitmap.clear
           @speed += 6           
           src_rect = Rect.new(0, 0,@cw, @ch )
           @transition.bitmap.blt(@speed, 0, @image, src_rect)            
           src_rect = Rect.new(0, @ch,@cw, @ch )
           @transition.bitmap.blt(-@speed, @ch, @image, src_rect)           
           @transition.opacity -= 3
           @transition.zoom_x += 0.005
           @transition.zoom_y += 0.005        
         else # Zoom IN # --------------------
              @transition.zoom_x += 0.05
              @transition.zoom_y += 0.05         
              @transition.opacity -= 3      
      end     
    end  
        
end

#===============================================================================
# ■ Scene Map
#===============================================================================
class Scene_Map < Scene_Base
  
#--------------------------------------------------------------------------
# ● Perform Battle Transition
#--------------------------------------------------------------------------      
def perform_battle_transition
     if $game_system.transition_ex.between?(0,6)      
        Graphics.transition(0)
      else
        Graphics.transition($game_system.transition_speed, "Graphics/System/" + $game_system.transition_name, 100)
     end
     Graphics.freeze     
end
   
end

#===============================================================================
# ■ Scene Battle
#===============================================================================
class Scene_Battle < Scene_Base
  include Module_Transition_EX
  
#--------------------------------------------------------------------------
# ● Perform Transition
#--------------------------------------------------------------------------      
def perform_transition
     if $game_system.transition_ex.between?(0,6)
        Graphics.transition(0)
        update_transition_ex
     else        
        Graphics.transition($game_system.transition_speed, "Graphics/System/" + $game_system.transition_name, 100)
     end
     Graphics.update
end
  
end
[/pre]
这是第二个好(像是用在让战斗背景特殊变更的):
[pre lang="ruby"]#==============================================================================
# +++ MOG - Battleback EX (v2.3) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Adiciona efeitos animados nos battlebacks e camadas infinitas.
#==============================================================================
# ● UTILIZAÇÃO
#==============================================================================
# Use os códigos abaixo através do comando chamar script.
# NOTA - Os códigos podem ser usados no meio da  batalha.
#
# bb(LAYER_ID ,EFFECT ,POWER A, POWER B , BLENDY_TYPE , SCREEN_Z, FADE_SPEED )
#
# TYPE = 0...4
#
# 0 = Efeito slide
# 1 = Efeito wave
# 2 = Normal
# 3 = Battleback animado por frames.
# 4 = Perspective (Battle Camera)
#
# POWER 1  
#
# Velocidade de deslize na horizontal no efeito SLIDE.
# Area de distorção no efeito WAVE. (de 0 a 20)
#
# POWER 2
#
# Velocidade de deslize na vertical no efeito SLIDE.
# Velocidade de distorção do efeito WAVE.
# Velocidade de animação no efeito 2.
#
# BLENDY_TYPE  (Opcional)
# Efeito de blendy de 0 a 2
#
# SCREEN_Z (Opcional)
# Posição Z da camada. (Valores acima de 100 ficam acima dos battlers)
#
# FADE_SPEED Opcional (Opcional)
# Velocidade de Fade. (0 = Desativar)
#
#
# Exemplo.
#
# bb(1,1,20,20)
#
#==============================================================================
# ● Cancelar o Efeito.
#==============================================================================
# Para cancelar o efeito use o código abaixo.
#
# bb_clear
#
#==============================================================================
# Efeito de animação por frames. (Efeito tipo 3)
#==============================================================================
# Para ativar o efeito de animação por frames é necessário ter e nomear os
# arquivos da seguinte forma.
#
# Picture_Name.png  (A imagem que deve ser escolhida no comando do evento.)
# Picture_Name0.png
# Picture_Name1.png
# Picture_Name2.png
# Picture_Name3.png
# Picture_Name4.png
# ...
#==============================================================================
# DEFININDO MULTIPLAS CAMADAS (Acima de 2 camadas - Padrão)
#==============================================================================
# Para ativar camadas extras utilize o código abaixo.
#
# bb_name(LAYER_ID ,FILE_NAME)
#
# LAYER_ID   = ID da Camada
# FILE_NAME  = Nome do arquivo
#
# Exemplo
#
#
# bb_name(1,"BlueSky")
# bb_name(2,"Fog_03")
# bb_name(3,"Grassland_01B")
# bb_name(4,"Fog_02")
# ...
#
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 2.3 - Adição do modo perspective.
# v 2.2 - Compatibilidade com MOG Battle Camera.
# v 2.1 - Melhoria no sistema de bitmap.
# v 2.0 - Função do Battleback Animado por frames.
#==============================================================================
module MOG_BATTLEBACK_EX
  # Definição da posição Z do Battleback (Apenas para ajustes de compatibilidade)
  # É possível modificar o valor no meio do jogo usando o código abaixo.
  #
  # bb_screen_z(X)
  #
  SCREEN_Z = 0
end

$imported = {} if $imported.nil?
$imported[:mog_battleback_ex] = true

#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
   
  attr_accessor :bb_fade_duration
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------            
  alias mog_bb_ex_initialize_temp initialize
  def initialize
      @bb_fade_duration = [0 , true]
      mog_bb_ex_initialize_temp
  end  
  
end  
#==============================================================================
# ■ Game System
#==============================================================================
class Game_System
  
  attr_accessor :bb_data
  attr_accessor :bb_name
  attr_accessor :bb_screen_z
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------           
  alias mog_bb_ex_initialize initialize
  def initialize
      @bb_data = [] ; @bb_name = [] ; @bb_screen_z = MOG_BATTLEBACK_EX::SCREEN_Z
      mog_bb_ex_initialize
  end  
  
end

#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------   
  alias mog_bb_ex_initialize initialize
  def initialize
      $game_temp.bb_fade_duration = [0,false] ; @back_sprite_ex = []
      @bba_bitmap = [] ; @bba_frames = [] ; @bb_data = []
      mog_bb_ex_initialize
      create_battleback_ex
      update
  end  

  #--------------------------------------------------------------------------
  # ● Create Battkeback EX
  #--------------------------------------------------------------------------   
  def create_battleback_ex
      $game_system.bb_name.each_with_index do |bb, index|
      create_bbex_sprite(bb, index) if bb != nil and !bb.empty?
      end      
  end

  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------   
  alias mog_bb_exm_dispose dispose
  def dispose
      dispose_battleback_ex
      mog_bb_exm_dispose
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose Batleback1
  #--------------------------------------------------------------------------   
  alias mog_bb_ex_dispose_battleback1 dispose_battleback1
  def dispose_battleback1
      mog_bb_ex_dispose_battleback1
      dispose_battleback_ex ; dispose_sprites_a(0)
  end

  #--------------------------------------------------------------------------
  # ● Dispose Batleback2
  #--------------------------------------------------------------------------   
  alias mog_bb_ex_dispose_battleback2 dispose_battleback2
  def dispose_battleback2
      mog_bb_ex_dispose_battleback2
      dispose_sprites_a(1)
  end  

  #--------------------------------------------------------------------------
  # ● Dispose Battleback
  #--------------------------------------------------------------------------   
  def dispose_battleback_ex
      return if @back_sprite_ex == nil
      @back_sprite_ex.compact.each_with_index {|sprite,index|
      sprite.bitmap.dispose rescue nil ; sprite.dispose; dispose_sprites_a(index)}  
  end  

  #--------------------------------------------------------------------------
  # ● Disposes Sprites A
  #--------------------------------------------------------------------------         
  def dispose_sprites_a(type)
      @bba_bitmap[type].each {|sprite| sprite.dispose } if @bba_bitmap[type]
      @bba_bitmap[type] = nil
  end  

  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------  
  alias mog_bb_ex_update update
  def update
      update_battleback_transition
      mog_bb_ex_update
  end

  #--------------------------------------------------------------------------
  # ● Update Battleback Transition
  #--------------------------------------------------------------------------        
  def update_battleback_transition
      @back_sprite_ex.each_with_index {|sprite,index| update_battleback_ex(index,@back1_sprite.opacity) }
      return if $game_temp.bb_fade_duration[0] == 0
      if $game_temp.bb_fade_duration[1]
         $game_temp.bb_fade_duration = [0 , false] ; refresh_bb_ex
         @back1_sprite.opacity = 255 if @back1_sprite != nil
      end  
      $game_temp.bb_fade_duration[0] -= 1
      case $game_temp.bb_fade_duration[0]
           when 129..300
              @back1_sprite.opacity -= 2 if @back1_sprite != nil
           when 1..128
              if $game_temp.bb_fade_duration[0] == 128
                 refresh_bb_ex
                 @back1_sprite.opacity = 0 if @back1_sprite != nil
              end   
              @back1_sprite.opacity += 2 if @back1_sprite != nil
           else   
              @back1_sprite.opacity = 255 if @back1_sprite != nil
      end      
      @back2_sprite.opacity = @back1_sprite.opacity if @back2_sprite != nil
  end  
  
  #--------------------------------------------------------------------------
  # ● Refresh Battleback EX
  #--------------------------------------------------------------------------         
  def refresh_bb_ex  
      dispose_battleback1 ; dispose_battleback2 ; dispose_battleback_ex
      create_battleback1 ; create_battleback2 ; create_battleback_ex
  end   
  
  #--------------------------------------------------------------------------
  # ● Create_Battleback1
  #--------------------------------------------------------------------------
  def create_battleback1
      dispose_sprites_a(0) ; @bb_data[0] = [] if @bb_data[0] == nil
      $game_system.bb_data[0] = [] if $game_system.bb_data[0] == nil
      if !$game_system.bb_data[0].empty? ; create_bb1_ex ; return ; end
      c_normal_sprite(0)  
  end

  #--------------------------------------------------------------------------
  # ● Create_battleback2
  #--------------------------------------------------------------------------
  def create_battleback2
      dispose_sprites_a(1) ; @bb_data[1] = [] if @bb_data[1] == nil
      $game_system.bb_data[1] = [] if $game_system.bb_data[1] == nil
      if !$game_system.bb_data[1].empty? ; create_bb2_ex ; return ; end
      c_normal_sprite(1)   
  end

  #--------------------------------------------------------------------------
  # ● Dispose BB EX
  #--------------------------------------------------------------------------   
  def dispose_bb_ex(type)
      sprite = set_current_battleback(type)
      return if sprite == nil
      sprite.bitmap.dispose rescue nil ; sprite.dispose ; sprite = nil
      dispose_sprites_a(type)
  end     
   
  #--------------------------------------------------------------------------
  # ● Set Current Battleback
  #--------------------------------------------------------------------------   
  def set_current_battleback(type)
      return @back1_sprite if type == 0
      return @back2_sprite if type == 1
      return @back_sprite_ex[type] if type >= 2   
  end
  
  #--------------------------------------------------------------------------
  # ● Set Current BB Name
  #--------------------------------------------------------------------------   
  def set_current_bb_name(type)
      return battleback1_name if type == 0
      return battleback2_name if type == 1
      return $game_system.bb_name[type] if type >= 2
  end
  
  #--------------------------------------------------------------------------
  # ● Set Current Bitmap
  #--------------------------------------------------------------------------   
  def set_current_bitmap(type)
      return battleback1_bitmap if type == 0
      return battleback2_bitmap if type == 1
      if type >= 2
         if @back_sprite_ex[type].bitmap == nil
            return Cache.battleback2($game_system.bb_name[type])
         else   
            return @back_sprite_ex[type].bitmap
         end  
      end
  end      
  
  #--------------------------------------------------------------------------
  # ● Create BB 1 EX
  #--------------------------------------------------------------------------  
  def create_bb1_ex
      clear_base_bb_ex(0)
      if set_current_bb_name(0) == nil ; c_normal_sprite(0) ; return ; end
      @bb_data1_oxy = [0,0]  
      case $game_system.bb_data[0][0]
          when 0
            @back1_sprite = Plane.new(@viewport1)
            @back1_sprite.bitmap = battleback1_bitmap  
            stretch_battleback(@back1_sprite) if $imported[:mog_battle_camera]
          when 1  
            @back1_sprite = Sprite.new(@viewport1) ; set_bb_wave(0)
            center_sprite_wave(@back1_sprite,0)
          when 2               
            @back1_sprite = Sprite.new(@viewport1)
            set_animated_bb(0,@back1_sprite, battleback1_bitmap,$game_system.bb_data[0][1])            
            center_sprite(@back1_sprite)
          else ; c_normal_sprite(0)
      end
      @bb_data[0] = $game_system.bb_data[0] ; set_data_misc(0)
      @back1_sprite.z = $game_system.bb_screen_z + @bb_data[0][4]
      @back1_sprite.blend_type = @bb_data[0][3]
      if $imported[:mog_battle_camera]
         @bb_data1_oxy[0] = (@back1_sprite.bitmap.width - Graphics.width) / 2
         @bb_data1_oxy[1] = (@back1_sprite.bitmap.width - Graphics.width) / 2
      end   
  end
  
  #--------------------------------------------------------------------------
  # ● Create BB 2 EX
  #--------------------------------------------------------------------------   
  def create_bb2_ex
      clear_base_bb_ex(1)     
      if set_current_bb_name(1) == nil ; c_normal_sprite(1) ; return ; end   
      @bb_data2_oxy = [0,0]      
      case $game_system.bb_data[1][0]
          when 0
            @back2_sprite = Plane.new(@viewport1)
            @back2_sprite.bitmap = battleback2_bitmap
            stretch_battleback(@back2_sprite) if $imported[:mog_battle_camera]
          when 1  
            @back2_sprite = Sprite.new(@viewport1) ; set_bb_wave(1)
            center_sprite_wave(@back2_sprite,1)
          when 2   
            @back2_sprite = Sprite.new(@viewport1)
            set_animated_bb(1,@back2_sprite,battleback2_bitmap,$game_system.bb_data[1][1])
            center_sprite(@back2_sprite)
          else ; c_normal_sprite(1)
          end     
      @bb_data[1] = $game_system.bb_data[1] ; set_data_misc(1)
      @back2_sprite.z = 1 + $game_system.bb_screen_z  + @bb_data[1][4]
      @back2_sprite.blend_type = @bb_data[1][3]
      if $imported[:mog_battle_camera]
         @bb_data2_oxy[0] = (@back2_sprite.bitmap.width - Graphics.width) / 2
         @bb_data2_oxy[1] = (@back2_sprite.bitmap.height - Graphics.width) / 2
      end   
  end
   
  #--------------------------------------------------------------------------
  # ● Create BB EX Sprite
  #--------------------------------------------------------------------------   
  def create_bbex_sprite(bb, index)
      @bb_data_oxy = [] if @bb_data_oxy == nil
      @bb_data[index] = [] if @bb_data[index] == nil
      @bb_data_oxy[index] = [0,0]
      $game_system.bb_data[index] = [] if $game_system.bb_data[index] == nil   
      clear_base_bb_ex(index)         
      case $game_system.bb_data[index][0]
          when 0
            @back_sprite_ex[index] = Plane.new(@viewport1)
            @back_sprite_ex[index].bitmap = Cache.battleback2($game_system.bb_name[index])      
            stretch_battleback(@back_sprite_ex[index]) if $imported[:mog_battle_camera]
          when 1  
            @back_sprite_ex[index] = Sprite.new(@viewport1)
            @back_sprite_ex[index].bitmap = Cache.battleback2($game_system.bb_name[index])  
            set_bb_wave(index) ; center_sprite_wave(@back_sprite_ex[index],index)
          when 2   
            @back_sprite_ex[index] = Sprite.new(@viewport1)
            set_animated_bb(index,@back_sprite_ex[index],set_current_battleback(index),$game_system.bb_data[index][1])
            center_sprite(@back_sprite_ex[index])
          else
            @back_sprite_ex[index] = Sprite.new(@viewport1)
            set_bitmap_background(@back_sprite_ex[index],index)
       end     
      @bb_data[index] = $game_system.bb_data[index] ; set_data_misc(index)
      @back_sprite_ex[index].z = index + $game_system.bb_screen_z + @bb_data[index][4]
      @back_sprite_ex[index].blend_type = @bb_data[index][3]
      if $imported[:mog_battle_camera]
         @bb_data_oxy[index][0] = (@back_sprite_ex[index].bitmap.width - Graphics.width) / 2
         @bb_data_oxy[index][1] = (@back_sprite_ex[index].bitmap.height - Graphics.height) / 2
      end   
  end   

  #--------------------------------------------------------------------------
  # * Move Sprite to Screen Center
  #--------------------------------------------------------------------------
  def center_sprite_wave(sprite,index)
    sprite.ox = sprite.bitmap.width / 2
    sprite.oy = sprite.bitmap.height / 2
    sprite.x = Graphics.width / 2
    sprite.y = Graphics.height / 2
  end  
  
  #--------------------------------------------------------------------------
  # ● Set Data Misc
  #--------------------------------------------------------------------------   
  def set_data_misc(index)
      @bb_data[index][5] = 0
      @bb_data[index][6] = 0     
      opm =  @bb_data[index][10] > 0 ? @bb_data[index][10] : 1
      @bb_data[index][7] = 255 / opm
      @bb_data[index][8] = 0
      @bb_data[index][9] = 255  
  end
      
  #--------------------------------------------------------------------------
  # ● C Normal Sprite
  #--------------------------------------------------------------------------  
  def c_normal_sprite(type)
      @back1_sprite = Sprite.new(@viewport1) if type == 0
      @back2_sprite = Sprite.new(@viewport1) if type == 1
      sprite = type == 0 ? @back1_sprite : @back2_sprite
      set_bitmap_background(sprite,type)
  end      
  
  #--------------------------------------------------------------------------
  # ● Set Bitmap Background
  #--------------------------------------------------------------------------  
  def set_bitmap_background(sprite,type)
      sprite_bitmap = set_current_bitmap(type)
      bw = sprite_bitmap.width < Graphics.width ? Graphics.width : sprite_bitmap.width
      bh = sprite_bitmap.height < Graphics.height ? Graphics.height : sprite_bitmap.height
      sprite.bitmap = Bitmap.new(bw,bh)
      sprite.bitmap.stretch_blt(sprite.bitmap.rect, sprite_bitmap, sprite_bitmap.rect)
      sprite.z = type ; center_sprite(sprite)
  end   
      
  #--------------------------------------------------------------------------
  # ● Clear Base BB EX
  #--------------------------------------------------------------------------   
  def clear_base_bb_ex(type)
      if $game_system.bb_data[type] == nil or $game_system.bb_data[type].empty?
         $game_system.bb_data[type] = [0,0,0,0,0,0,0,0,0,0,0]
      end   
      dispose_sprites_a(type)
      return if $game_system.bb_data[type] == nil or $game_system.bb_data[type].empty?
      $game_system.bb_data[type][0] = 0 if $game_system.bb_data[type][0] > 3
      $game_system.bb_data[type][1] = 0 if $game_system.bb_data[type][1] == nil
      $game_system.bb_data[type][2] = 0 if$game_system.bb_data[type][2] == nil   
  end
  
  #--------------------------------------------------------------------------
  # ● Set bb Wave
  #--------------------------------------------------------------------------   
  def set_bb_wave(type)
      bb_data = $game_system.bb_data[type]
      if $imported[:mog_battle_camera]
         range = range = (bb_data[1] + 1) * 5 ; range = 500 if range > 500
         rxy = [Graphics.width * camera_range / 100,Graphics.height * camera_range / 100]
      else
         range = (bb_data[1] + 1) * 5 ; range = 500 if range > 500
         rxy = [0,0]
      end
      speed = (bb_data[2] + 1) * 100 ; speed = 1000 if speed > 1000
      sprite = set_current_battleback(type)
      sprite_bitmap = set_current_bitmap(type)
      sprite.x = -range
      sprite.wave_amp = range
      sprite.wave_length = Graphics.width
      sprite.wave_speed = speed        
      sprite.bitmap = Bitmap.new(Graphics.width + rxy[0] + (range * 2),Graphics.height + rxy[1])
      sprite.bitmap.stretch_blt(sprite.bitmap.rect, sprite_bitmap, sprite_bitmap.rect)
  end  
  
  #--------------------------------------------------------------------------
  # ● Set Animated BB
  #--------------------------------------------------------------------------   
  def set_animated_bb(type,sprite,sprite_bitmap,speed)
      @bba_bitmap[type] = [] ; @bba_frames[type] = [0,0,speed]
      for index in 0..999
        if type == 0
           @bba_bitmap[type].push(Cache.battleback1(set_current_bb_name(type) + index.to_s)) rescue nil
         else
           @bba_bitmap[type].push(Cache.battleback2(set_current_bb_name(type) + index.to_s)) rescue nil
        end
        break if @bba_bitmap[type][index] == nil
      end
      if @bba_bitmap[type].size <= 1
         @bba_bitmap[type] = nil ; @bba_frames[type] = nil
         sprite.bitmap = set_current_bitmap(type) ; return
      end   
      refresh_bb_anime(type,sprite)  
  end
  
  #--------------------------------------------------------------------------
  # ● Update Background An
  #--------------------------------------------------------------------------   
  def update_background_an(type,sprite)
      return if @bba_frames[type] == nil
      @bba_frames[type][1] += 1
      refresh_bb_anime(type,sprite) if @bba_frames[type][1] >= @bba_frames[type][2]
  end
  
  #--------------------------------------------------------------------------
  # ● Refresh BB anime
  #--------------------------------------------------------------------------   
  def refresh_bb_anime(type,sprite)
      sprite.bitmap = @bba_bitmap[type][@bba_frames[type][0]]
      @bba_frames[type][0] += 1 ; @bba_frames[type][1] = 0
      @bba_frames[type][0] = 0 if @bba_frames[type][0] >= @bba_bitmap[type].size
  end

  #--------------------------------------------------------------------------
  # ● Update BB Scroll
  #--------------------------------------------------------------------------
  def update_bb_scroll(index)
      @bb_data[index][5] += @bb_data[index][1]
      @bb_data[index][6] += @bb_data[index][2]
      @bb_data[index][5] = 0 if @bb_data[index][5] >= 99999999
      @bb_data[index][6] = 0 if @bb_data[index][6] >= 99999999
  end  

  #--------------------------------------------------------------------------
  # ● Update Opacity EX
  #--------------------------------------------------------------------------
  def update_bb_opacity(index,sprite)
      @bb_data[index][6] += 1
      return if @bb_data[index][6] < @bb_data[index][5]
      @bb_data[index][6] = 0 ; @bb_data[index][8] += 1
      case @bb_data[index][8]
        when 0..@bb_data[index][10]
           @bb_data[index][9] -= @bb_data[index][7]
        when @bb_data[index][10]..(-1 + @bb_data[index][10] * 2)
           @bb_data[index][9] += @bb_data[index][7]
        else
           @bb_data[index][9] = 255 ; @bb_data[index][8] = 0
      end
      sprite.opacity = @bb_data[index][9]
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Battleback1
  #--------------------------------------------------------------------------
  def update_battleback1
      if !@bb_data[0].empty?
          case @bb_data[0][0]
             when 0
               update_bb_scroll(0)
               @back1_sprite.ox = @bb_data[0][5] + @bb_data1_oxy[0]
               @back1_sprite.oy = @bb_data[0][6] + @bb_data1_oxy[1]
             when 2 ; update_background_an(0,@back1_sprite)
             when 3 ; bb_camera_effect(@back1_sprite,0)
             else ; @back1_sprite.update
          end
          return
      end   
      @back1_sprite.update
  end

  #--------------------------------------------------------------------------
  # ● Update Battleback2
  #--------------------------------------------------------------------------
  def update_battleback2
      if !@bb_data[1].empty?
         case @bb_data[1][0]
             when 0
                update_bb_scroll(1)
                @back2_sprite.ox = @bb_data[1][5] + @bb_data2_oxy[0]
                @back2_sprite.oy = @bb_data[1][6] + @bb_data1_oxy[1]
             when 2 ; update_background_an(1,@back2_sprite)
             when 3 ; bb_camera_effect(@back2_sprite,1)
             else ; @back2_sprite.update
         end
         return   
      end      
      @back2_sprite.update
  end
  
  #--------------------------------------------------------------------------
  # ● Update Battleback EX
  #--------------------------------------------------------------------------
  def update_battleback_ex(index,opacity)
      return if @back_sprite_ex[index].nil? or @back_sprite_ex[index].disposed?
      if @bb_data[index][10] > 0 and $game_temp.bb_fade_duration[0] == 0
         update_bb_opacity(index,@back_sprite_ex[index])
      else
         @back_sprite_ex[index].opacity = opacity if opacity != nil
      end
      if !@bb_data[index].empty?
          case @bb_data[index][0]
             when 0
               update_bb_scroll(index)
               @back_sprite_ex[index].ox = @bb_data[index][5] + @bb_data_oxy[index][0]
               @back_sprite_ex[index].oy = @bb_data[index][6] + @bb_data_oxy[index][1]
             when 2 ; update_background_an(index,@back_sprite_ex[index])  
             when 3 ; bb_camera_effect(@back_sprite_ex[index],index)
             else ; @back_sprite_ex[index].update
          end
          return
      end   
      @back_sprite_ex[index].update      
  end  
  
  #--------------------------------------------------------------------------
  # ● BB Camera Effect
  #--------------------------------------------------------------------------
  def bb_camera_effect(sprite,index)
      bx = [[@bb_data[index][1], 100].min, -100].max
      by = [[@bb_data[index][2], 100].min, -100].max
      vx = @viewport1.ox * bx / 100
      vy = @viewport1.oy * by / 100
      sprite.ox = (sprite.bitmap.width / 2) -@viewport1.ox + vx
      sprite.oy = (sprite.bitmap.height / 2) -@viewport1.oy  + vy
  end
  
end

#==============================================================================
# ■ Game Interpreter
#==============================================================================
class Game_Interpreter

  #--------------------------------------------------------------------------
  # ● BB
  #--------------------------------------------------------------------------      
  def bb(id ,type = 0 , power = 0 , power2 = 0, blend_type = 0, screen_z = 0,a_fade = 0)
      return if id <= 0
      id -= 1 if [1,2].include?(id)
      $game_system.bb_data[id] = [] if $game_system.bb_data[id] == nil
      if (type == nil or type < 0) ; $game_system.bb_data[id].clear
      else ; $game_system.bb_data[id] = [type, power, power2,blend_type, screen_z,
                                         0,0,0,0,0,a_fade]
      end   
      $game_temp.bb_fade_duration[0] = 256 if SceneManager.scene_is?(Scene_Battle)
  end

  #--------------------------------------------------------------------------
  # ● BB Name
  #--------------------------------------------------------------------------      
  def bb_name(id,name = "")
      if name == nil ; $game_system.bb_name[id].clear rescue nil ; return ; end   
      return if id <= 0
      if [1,2].include?(id)
         $game_map.change_battleback_name(id,name) ; return
      end
      $game_system.bb_name[id] = name
  end
  
  #--------------------------------------------------------------------------
  # ● BB Clear
  #--------------------------------------------------------------------------      
  def bb_clear
      $game_system.bb_data.clear
      $game_system.bb_name.clear
  end
  
  #--------------------------------------------------------------------------
  # ● BB Screen Z
  #--------------------------------------------------------------------------      
  def bb_screen_z(value)
      $game_system.bb_screen_z = value
  end  
  
end  

#==============================================================================
# ■ Game Map
#==============================================================================
class Game_Map
  
  #--------------------------------------------------------------------------
  # * Change Battle Background
  #--------------------------------------------------------------------------
  def change_battleback_name(type,battleback_name)
      @battleback1_name = battleback_name if type == 1
      @battleback2_name = battleback_name if type == 2
      $game_temp.bb_fade_duration = [256, false] if SceneManager.scene_is?(Scene_Battle)
  end  
  
  #--------------------------------------------------------------------------
  # ● Change_Battleback
  #--------------------------------------------------------------------------  
   alias mog_bbex_change_battleback change_battleback
   def change_battleback(battleback1_name, battleback2_name)
       mog_bbex_change_battleback(battleback1_name, battleback2_name)
       $game_temp.bb_fade_duration = [256, false] if SceneManager.scene_is?(Scene_Battle)
   end

end[/pre]
梦石
0
星屑
1736
在线时间
761 小时
注册时间
2013-9-23
回帖
180

开拓者

发表于 2015-11-20 12:20:09 | 显示全部楼层
第一个是进入战斗前转换场景时的效果
游戏时使用脚本  $game_system.transition_ex = X 更改
改了之后对明雷和暗雷遇敌都有效,改一次后会一直生效,不用每次战斗都改。
X 是特效种类
0 = 逐渐放大至消散
1 = 先放大后再缩小
2 = 画面定格后旋转
3 = 横向扭曲的波纹效果
4 = 反复放大缩小抖动数次的再缩小
5 = 画面分成上下两部分后左右分开
6 = 每次战斗转场都会随机选取上述一种效果
7 = VA默认效果

第2个是美化战斗背景的
可以在战斗中更改,也可以在战斗前改。
这个脚本我也没太深入研究过,脚本的一部分功能对素材要求很高。
注解部分是葡萄牙语,以下是机翻+个人理解。
脚本:bb(A, B, C1, C2, D, E, F)
其中.....
A是图层ID
B是图层特效,0=幻灯片效果;1是波浪效果;2是帧数动画(需要大量素材)
C1:幻灯片效果时是横向移动的速度;波纹效果时是幅度
C2:幻灯片效果时是纵向移动的速度;波纹效果时是速度;帧数动画时是每一帧播放的速度
D是合成方式,0=正常;1=加法‘2=减法
E是优先级,可以不填。
F渐变速度,可以不填。
关于帧数动画.....
就是动画的每一帧都是一张图片,N张图片串起来就形成了动画的效果。
图片命名的格式比如:
Picture_Name.png  (必备 图像可与动画的第1帧相同 仅作为标记使用在代码中)
Picture_Name0.png (此为动画的第1帧 以下类推 每帧都是单张的图像)
Picture_Name1.png
Picture_Name2.png
Picture_Name3.png
……
因为VA默认的战斗背景图是两层,如果图层大于两层就要使用下面的脚本。
bb_name(图层ID,图片名)
例如
bb_name(1,"BlueSky")
bb_name(2,"Fog_03")
bb_name(3,"Grassland_01B")
bb(2,0,1,0)
bb_name(4,"Fog_02")
bb(1,1,20,10)
……
这个只看注解估计很难看懂,你可以参照范例里与【八云紫】战斗的战斗事件。
另外,一般情况下用不到多图层,除非你要把战斗背景变得超级华丽。
比如在树林中战斗时,
树木分为远中近3层,每层树木之间还要有流动速度不同的雾气,
最近处的地面上有草被风吹动,最远处的天空还要有云流动等等……(─.─|||

评分

参与人数 2星屑 +10 梦石 +1 收起 理由
VIPArcher + 1 认可答案
wangyanzhe6 + 10

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部