WR Heart rpg
Vuoi reagire a questo messaggio? Crea un account in pochi clic o accedi per continuare.

Battle Retry

Andare in basso

Iconxp Battle Retry

Messaggio Da JillChelsea il Mer Ago 22, 2012 8:40 pm

- Nome: Battle Retry
- Versione: 6.0
- Autore: sandgolem

Descrizione
Semplice script che permette di riprovare una battaglia invece di ricominciare dall'ultimo savepoint.
(Questo farà la gioia di un sacco di giocatori smemorati - me compresa XD)

Istruzioni
Inserire lo script sopra Main e sotto gli altri script.

Script
Codice:
======================================================================
# ** SG Battle Retry
#==========================================================================
# by sandgolem
# Version 6
# January 15th, 2008
#==========================================================================

module SG
  BattleRetryCommands = ['Retry Battle','Title Screen']
  BattleRetryDisableSwitch = 14
end

#==========================================================================
#
# To check for updates or find more scripts, visit:
#      http://www.gamebaker.com/rmxp/scripts/
# Our RMVX scripts: http://www.gamebaker.com/rmvx/scripts/
#
# Instructions: http://www.gamebaker.com/rmxp/scripts/e/battle-retry.php
# Discussion/Help: http://forums.gamebaker.com/showthread.php?t=8
#
#==========================================================================

if Object.const_defined?('SDK')
  SDK.log('SG Battle Retry', 'sandgolem', 6, '15.01.08')
  @sg_battleretry_disabled = true if !SDK.enabled?('SG Battle Retry')
end

if !@sg_battleretry_disabled
#--------------------------------------------------------------------------

class Interpreter
  alias_method :sg_battleretry_interp601, :command_601
  def command_601
    if $sg_retrywon
      @branch[@list[@index].indent] = 0
      $sg_retrywon = nil
    end
    return sg_battleretry_interp601
  end
 
  alias_method :sg_battleretry_interp602, :command_602
  def command_602
    if $game_temp.battle_can_escape && $sg_retryescaped
      @branch[@list[@index].indent] = 1
      $sg_retryescaped = nil
    end
    return sg_battleretry_interp602
  end
end

# class Game_System; attr_accessor :playing_bgm; end
class Game_Temp; attr_accessor :battle_music_playing; end

class Scene_Map
  alias_method :sg_battleretry_callbattle, :call_battle
  def call_battle
    sg_battleretry_callbattle
    $game_temp.battle_music_playing = $game_system.playing_bgm.clone
  end
end

class Scene_Save < Scene_File 
  def sg_write_retrysave_data
    file = File.open('Data/retry.sg', 'wb')
    write_save_data(file)
    file.close
  end
end

class Scene_Load < Scene_File 
  def sg_read_retrysave_data
    file = File.open('Data/retry.sg', 'rb')
    read_save_data(file)
    file.close
  end
end

class Scene_Battle
  alias_method :sg_battleretry_main, :main
  def main
    $sg_retryescaped = nil
    $sg_retrywon = nil
    if !$game_switches[SG::BattleRetryDisableSwitch]
      if !$sg_battleretry_inbattle && !$game_temp.battle_can_lose
        $sg_battleretry_inbattle = $game_temp
        sg_scene_save_temp = Scene_Save.new
        sg_scene_save_temp.sg_write_retrysave_data
      end
    end
    sg_battleretry_main
    if !$scene.is_a?(Scene_Gameover)
      File.delete('Data/retry.sg') if FileTest.exist?('Data/retry.sg')
      $sg_battleretry_inbattle = nil
    end
  end
 
  alias_method :sg_battleretry_battleend, :battle_end
  def battle_end(result)
    $sg_retrywon = true if result == 0
    $sg_retryescaped = true if result == 1
    sg_battleretry_battleend(result)
  end
end

class Scene_Gameover
  alias_method :sg_battleretry_gameovermain, :main
  def main
    if $sg_battleretry_inbattle
      @sprite = Sprite.new
      @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
      $game_system.bgm_stop
      $game_system.me_play($data_system.gameover_me)
      Graphics.transition(90)
      @command_window = Window_Command.new(192,SG::BattleRetryCommands)
      @command_window.back_opacity = 160
      @command_window.x = 320 - @command_window.width / 2
      @command_window.y = 288
      loop do
        Graphics.update
        Input.update
        sg_retry_update
        if $scene != self
          break
        end
      end
      @command_window.dispose
      Graphics.freeze
      @sprite.bitmap.dispose
      @sprite.dispose
      Graphics.transition(30)
      Graphics.freeze
    else
      sg_battleretry_gameovermain
    end
  end
 
  def sg_retry_update
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        sg_scene_save_temp = Scene_Load.new
        sg_scene_save_temp.sg_read_retrysave_data
        $game_temp = $sg_battleretry_inbattle
        $game_temp.gameover = nil
        $game_system.bgm_play($game_temp.battle_music_playing)
        $scene = Scene_Battle.new
      when 1
        File.delete('Data/retry.sg') if FileTest.exist?('Data/retry.sg')
        $sg_battleretry_inbattle = nil
        $scene = Scene_Title.new
      end
    end
  end
end

#--------------------------------------------------------------------------
end

#==========================================================================
# End of file! You can find more of my scripts at http://www.rpgrevolution.com
#==========================================================================

Se usate lo script, creditate l'autore.
JillChelsea
JillChelsea

Data d'iscrizione : 15.07.11
Età : 22
Località : Sessa Aurunca (CE)

Torna in alto Andare in basso

Torna in alto

- Argomenti simili

 
Permessi in questa sezione del forum:
Non puoi rispondere agli argomenti in questo forum.