-40%
Le deal à ne pas rater :
-40% sur le Pack Gaming Mario PDP Manette filaire + Casque filaire ...
29.99 € 49.99 €
Voir le deal

Aller en bas
Kingdommangas
Kingdommangas
Membre

Nombre de messages : 1401
Localisation : Ma tête
Distinction : Débrouillarde notoire é_è [Mist']
Ou celle qui partageait plus vite que son ombre [Gel']
Poisson 2017 [Amal]
Grâce à elle, tout le forum appelle Yamashi "Mamashi" [Yama]
Entraide d'Or
Règne dans l'ombre de la commu'
Youtubeuse beauté reconvertie dans le gaming [Amal']
Date d'inscription : 05/05/2015
https://www.youtube.com/channel/UCqGFuGrzm7jim1o5QJ4lKvg

Avoir sa revanche en cas de défaite.   Empty Avoir sa revanche en cas de défaite.

Mer 8 Juin 2016 - 19:43
Alors voici un script qui permet de retanter sa chance après avoir été vaincu en combats.

Code:
=begin
      RGSS3
     
      ★ バトルリトライ ★
     
      戦闘敗北時に、リトライするかの選択を可能にします。
     
      ver1.00

      Last Update : 2012/02/06
      02/06 : 新規
     
      ろかん   http://kaisou-ryouiki.sakura.ne.jp/
=end

#===========================================
#  設定箇所
#===========================================
module Rokan
module Retry_Battle
    # Interrupteur a actionner pour l'utilisation
    RETRY_ENABLE_SWITCH = 10
    # コマンドに表示する文字列
    RETRY_COMMAND = "Revanche"
    GIVEUP_COMMAND = "Abandonner"
end
end
#===========================================
#  ここまで
#===========================================

$rsi ||= {}
$rsi["バトルリトライ"] = true

class << BattleManager
  #--------------------------------------------------------------------------
  # ● インクルード Rokan::Retry_Battle
  #--------------------------------------------------------------------------
  include Rokan::Retry_Battle
  #--------------------------------------------------------------------------
  # ● セットアップ
  #--------------------------------------------------------------------------
  alias _retry_battle_setup setup
  def setup(troop_id, can_escape = true, can_lose = false)
    _retry_battle_setup(troop_id, can_escape, can_lose)
    setup_retry_data
  end
  #--------------------------------------------------------------------------
  # ● オブジェクトをディープコピーして返す
  #--------------------------------------------------------------------------
  def deep_cp(obj)
    Marshal.load(Marshal.dump(obj))
  end
  #--------------------------------------------------------------------------
  # ● リトライ用にデータを保持する
  #--------------------------------------------------------------------------
  def backup_retry_data
    @retry_data = []
    @retry_data << deep_cp($game_switches)
    @retry_data << deep_cp($game_variables)
    @retry_data << deep_cp($game_actors)
    @retry_data << deep_cp($game_party)
    @retry_data << deep_cp($game_troop)
  end
  #--------------------------------------------------------------------------
  # ● リトライ用データを読み込む
  #--------------------------------------------------------------------------
  def restore_retry_data
    $game_switches = deep_cp(@retry_data[0])
    $game_variables = deep_cp(@retry_data[1])
    $game_actors = deep_cp(@retry_data[2])
    $game_party = deep_cp(@retry_data[3])
    $game_troop = deep_cp(@retry_data[4])
  end
  #--------------------------------------------------------------------------
  # ● リトライの為の準備を行う
  #--------------------------------------------------------------------------
  def setup_retry_data
    backup_retry_data
  end
  #--------------------------------------------------------------------------
  # ● リトライの是非の選択開始
  #--------------------------------------------------------------------------
  def start_retry_selection
    SceneManager.scene.start_retry_selection
  end
  #--------------------------------------------------------------------------
  # ● リトライの処理
  #--------------------------------------------------------------------------
  def process_retry
    Graphics.update
    Graphics.freeze
    restore_retry_data
    SceneManager.goto(Scene_Battle)
    BattleManager.play_battle_bgm
    Sound.play_battle_start
  end
  #--------------------------------------------------------------------------
  # ● 敗北の処理
  #--------------------------------------------------------------------------
  alias _retry_battle_process_defeat process_defeat
  def process_defeat
    if $game_switches[RETRY_ENABLE_SWITCH]
      start_retry_selection
    else
      _retry_battle_process_defeat
    end
  end
end

class Game_Screen
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_writer  :brightness              # 明るさ
end

class Retry_Window < Window_Command
  #--------------------------------------------------------------------------
  # ● インクルード Rokan::Retry_Battle
  #--------------------------------------------------------------------------
  include Rokan::Retry_Battle
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    update_placement
    select_symbol(:reset_battle)
    self.openness = 0
    self.active = false
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ位置の更新
  #--------------------------------------------------------------------------
  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height - height) / 2
  end
  #--------------------------------------------------------------------------
  # ● コマンドリストの作成
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(RETRY_COMMAND, :retry)
    add_command(GIVEUP_COMMAND, :giveup)
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウのアクティブ化
  #--------------------------------------------------------------------------
  def activate
    open
    super
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウの非アクティブ化
  #--------------------------------------------------------------------------
  def deactivate
    close
    super
  end
end

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  alias _retry_battle_start start
  def start
    _retry_battle_start
    create_command_window
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  alias _retry_battle_terminate terminate
  def terminate
    _retry_battle_terminate
    @command_window.dispose
    perform_battle_transition if SceneManager.scene_is?(Scene_Battle)
  end
  #--------------------------------------------------------------------------
  # ● 確認コマンドウィンドウの作成
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Retry_Window.new
    @command_window.set_handler(:retry, method(:reset_battle))
    @command_window.set_handler(:giveup, method(:giveup_battle))
  end
  #--------------------------------------------------------------------------
  # ● リトライの是非の選択開始
  #--------------------------------------------------------------------------
  def start_retry_selection
    @command_window.activate
    bgm = RPG::BGM.last
    bgm.volume -= 20
    bgm.play
    update_basic until @command_window.open?
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias _retry_battle_update update
  def update
    if @command_window.active
      super
    else
      _retry_battle_update
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新(基本)
  #--------------------------------------------------------------------------
  alias _retry_battle_update_basic update_basic
  def update_basic
    if @command_window && @command_window.active
      $game_troop.screen.brightness = [$game_troop.screen.brightness - 8, 160].max
    end
    _retry_battle_update_basic
  end
  #--------------------------------------------------------------------------
  # ● 戦闘をあきらめる
  #--------------------------------------------------------------------------
  def giveup_battle
    @command_window.deactivate
    BattleManager._retry_battle_process_defeat
  end
  #--------------------------------------------------------------------------
  # ● 戦闘のリセット
  #--------------------------------------------------------------------------
  def reset_battle
    @command_window.deactivate
    update_basic until @command_window.close?
    BattleManager.process_retry
  end
  #--------------------------------------------------------------------------
  # ● 戦闘前トランジション実行
  #--------------------------------------------------------------------------
  def perform_battle_transition
    Graphics.transition(60, "Graphics/System/BattleStart", 100)
    Graphics.freeze
  end
end

Pour l'utilisation c'est simple.

Il suffit d'activer un interrupteur pour autoriser le joueur à renter sa chance en combats.

à la ligne 22, on peut modifier l’interrupteur qui autorise un nouveau combats.
Code:
  RETRY_ENABLE_SWITCH = 10

Juste en dessous il y a les mots qui apparaitrons à l'écran, ils sont modifiable à condition de bien rester entre les accolades.
Code:
RETRY_COMMAND = "Revanche"
    GIVEUP_COMMAND = "Abandonner"

C'est tout, un screen.
Avoir sa revanche en cas de défaite.   Combat10
Pour la source c'est encore et toujours http://kaisou-ryouiki.sakura.ne.jp/.
Coco'
Coco'
Staffeux retraité

Nombre de messages : 6578
Age : 30
Localisation : Nord/Douai
Distinction : EL DICTATOR COCO'
Coco-Dieu en puissance

Avoir sa revanche en cas de défaite.   Magikarpe Grand gourou suppléant de la secte des MAGIKARP
Leader charismatique des 2beStaffieux

N°1 du forum
Président, vice-présidents et membres honoraires de la cour suprême du forum
Président de l'association des grosses distinctions CMB
Date d'inscription : 02/07/2008
http://www.rpgmakervx-fr.com

Avoir sa revanche en cas de défaite.   Empty Re: Avoir sa revanche en cas de défaite.

Jeu 9 Juin 2016 - 0:46
Sympathique ça ! Ça peut avoir pas mal d'utilité !

Merci du partage !
Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum