Scripts Incompatible with Luna Engine - Moghunter

● ARCHIVED · READ-ONLY
Started by Revanne 4 posts View original ↗
  1. I have a incompatibility between a script of Moghunter (for animated title) and Lunatic Background (him again ^^)


    Error appear when i load a game with "continue"... a conflict with the scene_load ?





    Moghunter's script (Ayesha Title Screen)

    Spoiler
    if true


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


    # +++ MOG - Ayesha Title Screen (v1.5) +++


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


    # By Moghunter 


    # http://www.atelier-rgss.com/


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


    # Tela de título animada com o tema da Ayesha, para os fans da série Atelier.


    # Naturalmente é possível customizar qualquer tipo de personagem.


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


    module MOG_AYESHA_TITLE_SCRREN


      #Definição da velocidade de deslize da imagem de fundo.


      BACKGROUND_SCROLL_SPEED = [-1,0]


      #Definição da quantidade de partículas.


      NUMBER_OF_PARTICLES = 10


      #Definição da posição do personagem.


      CHARACTER_POSITION = [0,0]


      #Definição da posição do comando.


      COMMAND_POSITION = [20,435]


      #Espaço entre os comandos


      COMMAND_SPACE = [100,-47]


      #Ativar efeito aura na imagem do personagem.


      CHARACTER_AURA_EFFECT = true


      #Ativar Logo.


      LOGO = true


      #Definição da duração do logo.


      LOGO_DURATION = 2


      #Definição do tempo de transição.


      TRASITION_DURATION = 10


      #Parar BGM após iniciar o jogo.


      NEWGAME_STOP_BGM = true


    end


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


    # Version History.


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


    # 1.5 - Melhoria no sistema de comandos.


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


    $imported = {} if $imported.nil?


    $imported[:mog_ayesha_title_screen] = true


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


    # ■ Scene Title


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


    class Scene_Title


      include MOG_AYESHA_TITLE_SCRREN


      #--------------------------------------------------------------------------


      # ● Main


      #--------------------------------------------------------------------------        


      def main      


          execute_logo if LOGO


          Graphics.update


          Graphics.freeze


          execute_setup


          execute_loop


          dispose


      end  


      #--------------------------------------------------------------------------


      # ● Execute Setup


      #--------------------------------------------------------------------------        


      def execute_setup


          @phase = 0


          @active = false


          @continue_enabled = DataManager.save_file_exists?


          @com_index = @continue_enabled ? 1 : 0


          @com_index_old = @com_index


          @com_index_max = 2


          create_sprites


      end


      #--------------------------------------------------------------------------


      # ● Execute Lopp


      #--------------------------------------------------------------------------        


      def execute_loop


           Graphics.update


           Graphics.transition(TRASITION_DURATION)


           play_title_music


           loop do


              Input.update


              update


              Graphics.update


              break if SceneManager.scene != self


           end


       end


    end


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


    # ■ Scene Title


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


    class Scene_Title


      #--------------------------------------------------------------------------


      # ● Execute Logo


      #--------------------------------------------------------------------------    


      def execute_logo


          Graphics.transition


          create_logo 


          loop do


             Input.update


             update_logo


             Graphics.update


             break if !@logo_phase


          end


          dispose_logo


      end


      #--------------------------------------------------------------------------


      # ● Create Logo


      #--------------------------------------------------------------------------      


      def create_logo


          @logo = Sprite.new


          @logo.z = 100


          @logo.opacity = 0


          @logo_duration = [0,60 * LOGO_DURATION]


          @logo.bitmap = Cache.title1("Logo") rescue nil


          @logo_phase = @logo.bitmap != nil ? true : false      


      end


      #--------------------------------------------------------------------------


      # ● Dispose Logo


      #--------------------------------------------------------------------------       


      def dispose_logo      


          Graphics.freeze


          @logo.bitmap.dispose if @logo.bitmap != nil


          @logo.dispose


      end


      #--------------------------------------------------------------------------


      # ● Update Logo


      #--------------------------------------------------------------------------      


      def update_logo  


          return if !@logo_phase


          update_logo_command


          if @logo_duration[0] == 0


             @logo.opacity += 5


             @logo_duration[0] = 1 if @logo.opacity >= 255


           elsif @logo_duration[0] == 1


             @logo_duration[1] -= 1


             @logo_duration[0] = 2 if @logo_duration[1] <= 0


           else  


             @logo.opacity -= 5


             @logo_phase = false if @logo.opacity <= 0


           end


      end


      #--------------------------------------------------------------------------


      # ● Update Logo Command


      #--------------------------------------------------------------------------      


      def update_logo_command


          return if @logo_duration[0] == 2


          if Input.trigger?:)C) or Input.trigger?:) B)


             @logo_duration = [2,0]


          end


      end


    end


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


    # ■ Scene Title


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


    class Scene_Title


      #--------------------------------------------------------------------------


      # ● Create Sprites


      #--------------------------------------------------------------------------          


      def create_sprites     


          create_background


          create_fog


          create_commands


          create_particles


          create_character


          create_layout


      end


      #--------------------------------------------------------------------------


      # ● Create Fog


      #--------------------------------------------------------------------------            


      def create_fog


          @fog = []


          @fog_speed = [0,0,0]


          for index in 0...2


             @fog.push(Plane.new)


             @fog[index].bitmap = Cache.title1("Fog" + index.to_s)


             @fog[index].blend_type = 0


             @fog[index].opacity = 0


             if index == 0


                @fog[index].z = 4


                @fog_speed[index] = 2


             else


                @fog[index].z = 1


                @fog_speed[index] = 1


             end   


          end


      end


      #--------------------------------------------------------------------------


      # ● Create Background


      #--------------------------------------------------------------------------            


      def create_background


          @background = Plane.new


          @background.bitmap = Cache.title1("Background")


          @background_scroll = [background_SCROLL_SPEED[0],BACKGROUND_SCROLL_SPEED[1],0]


          @background.z = 0


          @background.opacity = 0


      end


      #--------------------------------------------------------------------------


      # ● Create Layout


      #--------------------------------------------------------------------------              


      def create_layout


          @layout = Sprite.new


          @layout.bitmap = Cache.title1("Layout")


          @layout.z = 20


          @layout.opacity = 0


      end


      #--------------------------------------------------------------------------


      # ● Create Commands


      #--------------------------------------------------------------------------                


      def create_commands


          @com = []


          for index in 0...3


              @com.push(Title_Commands.new(nil,index))


          end 


      end


      #--------------------------------------------------------------------------


      # ● Create Particles


      #--------------------------------------------------------------------------  


      def create_particles


          @particles_sprite =[]


          for i in 0...NUMBER_OF_PARTICLES


              @particles_sprite.push(Particles_Title.new(nil))


          end


      end   


      #--------------------------------------------------------------------------


      # ● Create Character


      #--------------------------------------------------------------------------    


      def create_character


          @character = Sprite.new


          @character.bitmap = Cache.title1("Character")


          @character.ox = @character.bitmap.width / 2


          @character.oy = @character.bitmap.height / 2


          @character.x = CHARACTER_POSITION[0] + @character.ox


          @character.y = CHARACTER_POSITION[1] + @character.oy


          @character.z = 3


          @character.opacity = 0


      end


    end


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


    # ■ Particles Title


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


    class Particles_Title < Sprite


      include MOG_AYESHA_TITLE_SCRREN


     #--------------------------------------------------------------------------


     # ● Initialize


     #--------------------------------------------------------------------------             


      def initialize(viewport = nil)


          super(viewport)


          @speed_x = 0


          @speed_y = 0


          @speed_a = 0


          @speed_o = 0


          self.bitmap = Cache.title1("Particles")


          self.z = 4


          @cx_size = Graphics.width + self.bitmap.width + (self.bitmap.width / 2)


          @cy_size = self.bitmap.height + (self.bitmap.height / 2)


          @cy_limit = -(@cy_size * 3)


          reset_setting(true)


      end  


     #--------------------------------------------------------------------------


     # ● Reset Setting


     #--------------------------------------------------------------------------               


      def reset_setting(initial = false)


          zoom = (50 + rand(100)) / 100.1


          self.zoom_x = zoom


          self.zoom_y = zoom


          self.x = rand(Graphics.width)


          self.y = initial == true ? rand(480) : (Graphics.height + @cy_size)


          self.opacity = 0


          z = rand(2)


          if z == 1


             self.z = 5


          else


             self.z = 1


          end


          @speed_y = -(1 + rand(3))


          @speed_x = (1 + rand(2))


          @speed_a = (1 + rand(4))


          @speed_o = (2 + rand(8))


      end


     #--------------------------------------------------------------------------


     # ● Dispose


     #--------------------------------------------------------------------------               


      def dispose


          super


          self.bitmap.dispose if self.bitmap != nil


      end  


     #--------------------------------------------------------------------------


     # ● Update


     #--------------------------------------------------------------------------               


      def update


          super


          self.x += @speed_x 


          self.y += @speed_y


          self.angle += @speed_a


          self.opacity += 5


          reset_setting if can_reset_setting?


      end  


     #--------------------------------------------------------------------------


     # ● Can Reset Setting


     #--------------------------------------------------------------------------                 


      def can_reset_setting?


          return true if self.y < -@cy_size


          return true if self.x > @cx_size


          return false


      end  


    end


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


    # ■ Title Commands


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


    class Title_Commands < Sprite


      include MOG_AYESHA_TITLE_SCRREN


      #--------------------------------------------------------------------------


      # ● Initialize


      #--------------------------------------------------------------------------  


      def initialize(viewport = nil,index)


          super(viewport)


          @index = index


          @float = [0,0,0]


          @image = Cache.title1("Command" + index.to_s)


          @image_cw = @image.width


          @image_ch = (@image.height / 2)


          @active = 1


          @active_old = @active


          self.bitmap = Bitmap.new(@image_cw,@image_ch)


          self.ox = self.bitmap.width / 2


          self.oy = self.bitmap.height / 2 


          @org_pos = [COMMAND_POSITION[0] + self.ox + (COMMAND_SPACE[0] * index),


            COMMAND_POSITION[1] + self.oy + (self.bitmap.height + COMMAND_SPACE[1]) * index,


            self.ox - 24]


          @org_pos[0] += 0


          @org_pos[1] += -20


          self.x = -32 + @org_pos[0] - self.bitmap.width - (self.bitmap.width * index)


          self.y = @org_pos[1]


          self.z = 25


          @next_pos = [@org_pos[0],@org_pos[1]]


          refresh_command


      end


      #--------------------------------------------------------------------------


      # ● Refresh Command


      #--------------------------------------------------------------------------  


      def refresh_command


          @active_old = @active


          self.bitmap.clear


          b_rect = Rect.new(0,@image_ch * @active,@image_cw,@image_ch)


          self.bitmap.blt(0,0,@image,b_rect)


      end


      #--------------------------------------------------------------------------


      # ● Dispose


      #--------------------------------------------------------------------------  


      def dispose_sprites


          self.bitmap.dispose


          @image.dispose


      end


      #--------------------------------------------------------------------------


      # ● Update


      #--------------------------------------------------------------------------              


      def update_sprites(index,active)


          if index == @index


             self.opacity += 10 


             @active = 0


          else


             self.opacity -= 15 if self.opacity > 150


             @float = [0,0,0]


             @active = 1


          end  


          refresh_command if @active_old != @active


          update_slide(0,@next_pos[0])


          update_slide(1,@org_pos[1] + @float[0])


      end


     #--------------------------------------------------------------------------


     # ● Update Slide


     #--------------------------------------------------------------------------                       


      def update_slide(type,np)


          cp = type == 0 ? self.x : self.y


          sp = 3 + ((cp - np).abs / 10)


          if cp > np 


             cp -= sp


             cp = np if cp < np


          elsif cp < np 


             cp += sp


             cp = np if cp > np


          end     


          self.x = cp if type == 0


          self.y = cp if type == 1


      end     


    end


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


    # ■ Scene Title


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


    class Scene_Title


      #--------------------------------------------------------------------------


      # ● Dispose


      #--------------------------------------------------------------------------          


      def dispose


          Graphics.freeze


          dispose_background


          dispose_particles


          dispose_character


          dispose_layout


          dispose_fog


          dispose_commands


      end


      #--------------------------------------------------------------------------


      # ● Dispose Background


      #--------------------------------------------------------------------------            


      def dispose_background


          @background.bitmap.dispose


          @background.dispose    


      end


      #--------------------------------------------------------------------------


      # ● Dispose Layout


      #--------------------------------------------------------------------------              


      def dispose_layout  


          @layout.bitmap.dispose


          @layout.dispose


      end  


      #--------------------------------------------------------------------------


      # ● Dispose Commands


      #--------------------------------------------------------------------------                


      def dispose_commands


          @com.each {|sprite| sprite.dispose_sprites }


      end  


      #--------------------------------------------------------------------------


      # ● Dispose Commands


      #--------------------------------------------------------------------------                


      def dispose_fog


          @fog.each {|sprite| sprite.bitmap.dispose }


          @fog.each {|sprite| sprite.dispose }


      end    


     #--------------------------------------------------------------------------


     # ● Dispose Particles


     #--------------------------------------------------------------------------    


     def dispose_particles


         @particles_sprite.each {|sprite| sprite.dispose }


     end    


      #--------------------------------------------------------------------------


      # ● Dispose Character


      #--------------------------------------------------------------------------    


      def dispose_character


          @character.bitmap.dispose


          @character.dispose


     end    


    end


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


    # ■ Scene Title


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


    class Scene_Title


      #--------------------------------------------------------------------------


      # ● Update Sprites


      #--------------------------------------------------------------------------          


      def update_sprites


          update_background    


          update_particles


          update_character


          update_commands


          update_fog


      end


      #--------------------------------------------------------------------------


      # ● Update Fog


      #--------------------------------------------------------------------------            


      def update_fog


          @fog_speed[2] += 1


          return if @fog_speed[2] < 3


          @fog_speed[2] = 0


          for index in 0...2


              @fog[index].opacity += 5


              @fog[index].ox += @fog_speed[index]


          end


      end


      #--------------------------------------------------------------------------


      # ● Update Background


      #--------------------------------------------------------------------------            


      def update_background


          @layout.opacity += 5


          @background.opacity += 5


          @background_scroll[2] += 1


          return if @background_scroll[2] < 4


          @background_scroll[2] = 0


          @background.ox += @background_scroll[0]


          @background.oy += @background_scroll[1]


      end  


      #--------------------------------------------------------------------------


      # ● Update Commands


      #--------------------------------------------------------------------------                


      def update_commands


          @com.each {|sprite| sprite.update_sprites(@com_index,@active)}


      end      


      #--------------------------------------------------------------------------


      # ● Update Particles


      #--------------------------------------------------------------------------  


      def update_particles


          return if @particles_sprite == nil


          @particles_sprite.each {|sprite| sprite.update }


      end  


      #--------------------------------------------------------------------------


      # ● Update Character


      #--------------------------------------------------------------------------    


      def update_character


          @character.opacity += 5


      end


    end


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


    # ■ Scene Title


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


    class Scene_Title


      #--------------------------------------------------------------------------


      # ● Update


      #--------------------------------------------------------------------------          


      def update


          update_command


          update_sprites


      end


      #--------------------------------------------------------------------------


      # ● Update Command


      #--------------------------------------------------------------------------          


      def update_command


          update_key


          refresh_index if @com_index_old != @com_index


      end


      #--------------------------------------------------------------------------


      # ● Update Key


      #--------------------------------------------------------------------------            


      def update_key


          if Input.trigger?:)DOWN) or Input.trigger?:)RIGHT)


             add_index(1) 


          elsif Input.trigger?:)UP) or Input.trigger?:)LEFT)


             add_index(-1)


          elsif Input.trigger?:)C)  


             select_command


          end  


      end


      #--------------------------------------------------------------------------


      # ● Select Command


      #--------------------------------------------------------------------------              


      def select_command


          case @com_index


             when 0; command_new_game


             when 1; command_continue


             when 2; command_shutdown  


          end


      end


      #--------------------------------------------------------------------------


      # ● Add Index


      #--------------------------------------------------------------------------              


      def add_index(value = 0)


          @com_index += value


          if !@continue_enabled and @com_index == 1


              @com_index = 2 if value == 1


              @com_index = 0 if value == -1


          end    


          @com_index = 0 if @com_index > @com_index_max


          @com_index = @com_index_max if @com_index < 0


      end


      #--------------------------------------------------------------------------


      # ● Refresh Index


      #--------------------------------------------------------------------------            


      def refresh_index


          @com_index_old = @com_index


          Sound.play_cursor


      end


      #--------------------------------------------------------------------------


      # ● Command New Game


      #--------------------------------------------------------------------------            


      def command_new_game    


          Sound.play_ok


          DataManager.setup_new_game


          fadeout_all


          $game_map.autoplay


          SceneManager.goto(Scene_Map)      


      end  


      #--------------------------------------------------------------------------


      # ● Command Continue


      #--------------------------------------------------------------------------            


      def command_continue


          if !@continue_enabled


             Sound.play_cancel


             return


          else   


             Sound.play_ok


          end  


          SceneManager.call(Scene_Load)


      end    


      #--------------------------------------------------------------------------


      # ● Command Shutdown


      #--------------------------------------------------------------------------            


      def command_shutdown


          Sound.play_ok


          fadeout_all


          SceneManager.exit    


      end


      #--------------------------------------------------------------------------


      # ● play_title_music


      #--------------------------------------------------------------------------


      def play_title_music


          $data_system.title_bgm.play


          RPG::BGS.stop


          RPG::ME.stop


      end  


      #--------------------------------------------------------------------------


      # ● Fadeout_all


      #--------------------------------------------------------------------------


      def fadeout_all(time = 1000)


          RPG::BGM.fade(time) if NEWGAME_STOP_BGM


          RPG::BGS.fade(time)


          RPG::ME.fade(time)


          Graphics.fadeout(time * Graphics.frame_rate / 1000)


          RPG::BGM.stop if NEWGAME_STOP_BGM


          RPG::BGS.stop


          RPG::ME.stop


      end  


    end


    end
  2. Hey Revanne, the reason there's incompatibility is that Lunatic backgrounds directly affect the Title Screen as well. You'd have to either disable Lunatic Backgrounds and settle with Lunatic Configurations to do some background magic or remove the Ayesha title screen.


    .......Or we'd have to implement it the same features ourselves, brb checking.
  3. I don't understand everything... it's possible to modulate Lunatic Background for a compatibility with scene_load ?
  4. Lunatic backgrounds and Moghunter both overwrite Scene_Title in some way that they're clashing. That's why they're incompatible.


    It's not that Lunatic Backgrounds is incompatible with Scene_Load, otherwise you can't use Luna Engine's Save config if it breaks there.