ShinNessTen

Valedictorian of Wonderland
Veteran
Joined
May 25, 2015
Messages
94
Reaction score
166
First Language
German
Primarily Uses
RMVX
Is it possible to add a force action Event into this little snippet?View attachment 156112
It's a Retry Battle script and under the #Setup battle I would like to immediently force an Enemy to use a specific Skill in the Database upon loading the battle.

Here's the current Battle Retry script I'm using:
I suppose I should also clarify why I even want one to begin with.
I am aiming to fix this scripts issues where upon loading the battle it would start the battle with turn 0.
As you can see in the code I tried to add the $game_troop.turn_count = 0 but to no avail. I believe it just simply doesn't work with another script I'm using, Tankentai, more specifically the ATB addon.
It would most likely be a tremendous amount of effort fixing this(at least I assume so) so having just force an empty action is a good enough alternative.
 

ShinNessTen

Valedictorian of Wonderland
Veteran
Joined
May 25, 2015
Messages
94
Reaction score
166
First Language
German
Primarily Uses
RMVX
bumping this
 

ShinNessTen

Valedictorian of Wonderland
Veteran
Joined
May 25, 2015
Messages
94
Reaction score
166
First Language
German
Primarily Uses
RMVX
bumping again
 

ShinNessTen

Valedictorian of Wonderland
Veteran
Joined
May 25, 2015
Messages
94
Reaction score
166
First Language
German
Primarily Uses
RMVX

ShinNessTen

Valedictorian of Wonderland
Veteran
Joined
May 25, 2015
Messages
94
Reaction score
166
First Language
German
Primarily Uses
RMVX

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
356
Reaction score
101
First Language
English
Primarily Uses
RMXP
What about this revised version of the script?

Code:
#===============================================================
# ● [VX] ◦ Battle Retry ◦ □
# * Enable player to retry the battle after losing *
# ** Note: Read the setup part before using this script **
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# * Modified by Kyonides Arkanthes
# ◦ Released on: 19/08/2021
# ◦ Version: 1.1
#--------------------------------------------------------------
# ◦ Update:
#--------------------------------------------------------------
# □ Version 1.1 (19/08/2021)
# - Created the BattleRetry module
# - Added enemy's first move before the start of first turn - Retry Mode Only!
#
# □ Version 1.0 (29/02/2009)
# - Set switch ID to enable/disable battle retry during the game
# - Editable command's text, command's window width and Y-coordinate
# - You can choose to record party actors stat (HP/MP/States) before battle
#
#--------------------------------------------------------------
# ◦ Compatibility:
#--------------------------------------------------------------
#
# □ This script will alias 5 method(s):
# Scene_Gameover#perform_transition
# Scene_Gameover#terminate
# Scene_Gameover#update
# Scene_Battle#process_battle_start
# Scene_Battle#battle_end
# Game_Interpreter#command_301
#
# □ This script should work with most scripts, except for some modifications
# of Scene_Gameover
#
#--------------------------------------------------------------
# ◦ Installation:
#--------------------------------------------------------------
# 1) This script should be placed JUST BEFORE ▼ Main Process.
#
# □ Like this:
# ▼ Materials
# ...
# ...
# * Battle Retry
# ▼ Main Process
# Main
#
# 2) Setup this script in Setup Part below.
#--------------------------------------------------------------
# ◦ How to use:
#--------------------------------------------------------------
# □ Place this script and setup in the setup part.
# □ Set a troop's battle condition to the FIRST_MOVE_SWITCH_ID switch
#=================================================================
# * Setup * #
module BattleRetry
  ACTIVATION_SUCCESS_RATE = 100 # 0% through 100%
  ENABLE_SWITCH_ID = 70 # Enable Battle Retry only if this switch ID is ON
  FIRST_MOVE_SWITCH_ID = 71
# Use this switch as troop battle condition to allow enemies to hit you at the
# very beginning of the battle, even before you can even see your stats!
 
  COMMANDS = ['Retry!', 'Give Up...']
# Text on command window asking for Battle Retry
# E.g. ['Go back to battle', 'Exit to title screen']
 
  WINDOW_Y = 288 # Command window's Y-coordinate (Top: 0, Bottom: 416)
 
  WINDOW_WIDTH = 200 # Command windows' width
 
  RECORD_PARTY_STAT = true
# Record party members' HP/MP/status before going to battle? (true/false)
# - If this set to true, if Ralph has HP 30 before battle and got poisoned.
# When player retry the battle, Ralph will still has HP 30 and poisoned.
# - If this set to false, all the members will get full HP/MP and no bad status
# after retry the battle.
#
# * End of Setup * #
  def self.active?
    $game_switches[FIRST_MOVE_SWITCH_ID] and rand(100) < ACTIVATION_SUCCESS_RATE
  end
end

class Scene_Gameover < Scene_Base
  alias wora_batretry_scego_pertran perform_transition
  alias wora_batretry_scego_term terminate
  alias wora_batretry_scego_upd update
  def update(*args)
    return wora_batretry_scego_upd(*args) unless $game_temp.battle_retry?
    super
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0 # Battle Retry
        # If recorded party stat, load recorded data
        unless $game_temp.last_troop_actor.nil?
          actors = $game_temp.last_troop_actor
          actors.each_key do |id|
            data = actors[id]
            $game_actors[id].hp = data[0]
            $game_actors[id].mp = data[1]
            $game_actors[id].real_states = data[2]
          end
        else # If not, recover party members
          $game_party.members.each {|actor| actor.recover_all }
        end
        # Setup battle
        $game_switches[BattleRetry::FIRST_MOVE_SWITCH_ID] = true
        last_troop = $game_temp.last_troop_id
        $game_troop.setup(last_troop[0])
        $game_troop.can_escape = last_troop[1]
        $game_troop.can_lose = false
        $game_temp.next_scene = "battle"
        $scene = Scene_Battle.new
      when 1 # Go to Title Screen
        RPG::BGM.fade(100)
        $scene = Scene_Title.new
        Graphics.fadeout(30)
      end
    end
  end

  def perform_transition(*args)
    if $game_temp.battle_retry?
      # Add command window if need battle retry
      commands = BattleRetry::COMMANDS
      @command_window = Window_Command.new(BattleRetry::WINDOW_WIDTH, commands)
      # Show battle retry window in the middle
      @command_window.x = (Graphics.width - @command_window.width) / 2
      @command_window.y = BattleRetry::WINDOW_Y
      @command_window.openness = 0
      @command_window.open
      # Perform transition
      wora_batretry_scego_pertran(*args)
      # Open command window
      until @command_window.openness == 255
        @command_window.update
        Graphics.update
      end
      @command_window.active = true
    else # Normal Gameover scene
      wora_batretry_scego_pertran(*args)
    end
  end

  def terminate(*args)
    @command_window.dispose unless @command_window.nil?
    wora_batretry_scego_term(*args)
  end
end
 
class Scene_Battle < Scene_Base
  alias :kyon_batretry_scn_bat_pro_bat_st :process_battle_start
  alias wora_batretry_scebat_batend battle_end
  def process_battle_start
    kyon_batretry_scn_bat_pro_bat_st
    start_main if BattleRetry.active?
  end

  def battle_end(*args)
    unless (args[0] == 2 and !$game_troop.can_lose)
      # Remove last troop data if won battle
      $game_temp.last_troop_id = nil
      $game_temp.last_troop_actor = nil
      $game_switches[BattleRetry::FIRST_MOVE_SWITCH_ID] = false
    end
    wora_batretry_scebat_batend(*args)
  end
end
 
class Game_Temp
  attr_accessor :last_troop_id, :last_troop_actor
  def battle_retry?
   ($game_switches[BattleRetry::ENABLE_SWITCH_ID] and !@last_troop_id.nil?)
  end
end
 
class Game_Interpreter
  alias wora_batretry_gamint_com301 command_301
  def command_301(*args)
    # If enable to record party stat before battle..
    if BattleRetry::RECORD_PARTY_STAT
      $game_temp.last_troop_actor = {}
      $game_party.members.each do |a|
        $game_temp.last_troop_actor[a.id] = [a.hp, a.mp, a.real_states]
      end
    end
    # Store last troop ID in Game_System
    troop_id = @params[0] == 0 ? @params[1] : $game_variables[@params[1]]
    $game_temp.last_troop_id = [troop_id, @params[2]] if !$game_temp.in_battle
    wora_batretry_gamint_com301(*args)
  end
end
 
class Game_Battler
  def real_states() @states.clone end
  def real_states=(states_id_array) @states = states_id_array end
end
 

ShinNessTen

Valedictorian of Wonderland
Veteran
Joined
May 25, 2015
Messages
94
Reaction score
166
First Language
German
Primarily Uses
RMVX
What about this revised version of the script?

Code:
#===============================================================
# ● [VX] ◦ Battle Retry ◦ □
# * Enable player to retry the battle after losing *
# ** Note: Read the setup part before using this script **
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# * Modified by Kyonides Arkanthes
# ◦ Released on: 19/08/2021
# ◦ Version: 1.1
#--------------------------------------------------------------
# ◦ Update:
#--------------------------------------------------------------
# □ Version 1.1 (19/08/2021)
# - Created the BattleRetry module
# - Added enemy's first move before the start of first turn - Retry Mode Only!
#
# □ Version 1.0 (29/02/2009)
# - Set switch ID to enable/disable battle retry during the game
# - Editable command's text, command's window width and Y-coordinate
# - You can choose to record party actors stat (HP/MP/States) before battle
#
#--------------------------------------------------------------
# ◦ Compatibility:
#--------------------------------------------------------------
#
# □ This script will alias 5 method(s):
# Scene_Gameover#perform_transition
# Scene_Gameover#terminate
# Scene_Gameover#update
# Scene_Battle#process_battle_start
# Scene_Battle#battle_end
# Game_Interpreter#command_301
#
# □ This script should work with most scripts, except for some modifications
# of Scene_Gameover
#
#--------------------------------------------------------------
# ◦ Installation:
#--------------------------------------------------------------
# 1) This script should be placed JUST BEFORE ▼ Main Process.
#
# □ Like this:
# ▼ Materials
# ...
# ...
# * Battle Retry
# ▼ Main Process
# Main
#
# 2) Setup this script in Setup Part below.
#--------------------------------------------------------------
# ◦ How to use:
#--------------------------------------------------------------
# □ Place this script and setup in the setup part.
# □ Set a troop's battle condition to the FIRST_MOVE_SWITCH_ID switch
#=================================================================
# * Setup * #
module BattleRetry
  ACTIVATION_SUCCESS_RATE = 100 # 0% through 100%
  ENABLE_SWITCH_ID = 70 # Enable Battle Retry only if this switch ID is ON
  FIRST_MOVE_SWITCH_ID = 71
# Use this switch as troop battle condition to allow enemies to hit you at the
# very beginning of the battle, even before you can even see your stats!
 
  COMMANDS = ['Retry!', 'Give Up...']
# Text on command window asking for Battle Retry
# E.g. ['Go back to battle', 'Exit to title screen']
 
  WINDOW_Y = 288 # Command window's Y-coordinate (Top: 0, Bottom: 416)
 
  WINDOW_WIDTH = 200 # Command windows' width
 
  RECORD_PARTY_STAT = true
# Record party members' HP/MP/status before going to battle? (true/false)
# - If this set to true, if Ralph has HP 30 before battle and got poisoned.
# When player retry the battle, Ralph will still has HP 30 and poisoned.
# - If this set to false, all the members will get full HP/MP and no bad status
# after retry the battle.
#
# * End of Setup * #
  def self.active?
    $game_switches[FIRST_MOVE_SWITCH_ID] and rand(100) < ACTIVATION_SUCCESS_RATE
  end
end

class Scene_Gameover < Scene_Base
  alias wora_batretry_scego_pertran perform_transition
  alias wora_batretry_scego_term terminate
  alias wora_batretry_scego_upd update
  def update(*args)
    return wora_batretry_scego_upd(*args) unless $game_temp.battle_retry?
    super
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0 # Battle Retry
        # If recorded party stat, load recorded data
        unless $game_temp.last_troop_actor.nil?
          actors = $game_temp.last_troop_actor
          actors.each_key do |id|
            data = actors[id]
            $game_actors[id].hp = data[0]
            $game_actors[id].mp = data[1]
            $game_actors[id].real_states = data[2]
          end
        else # If not, recover party members
          $game_party.members.each {|actor| actor.recover_all }
        end
        # Setup battle
        $game_switches[BattleRetry::FIRST_MOVE_SWITCH_ID] = true
        last_troop = $game_temp.last_troop_id
        $game_troop.setup(last_troop[0])
        $game_troop.can_escape = last_troop[1]
        $game_troop.can_lose = false
        $game_temp.next_scene = "battle"
        $scene = Scene_Battle.new
      when 1 # Go to Title Screen
        RPG::BGM.fade(100)
        $scene = Scene_Title.new
        Graphics.fadeout(30)
      end
    end
  end

  def perform_transition(*args)
    if $game_temp.battle_retry?
      # Add command window if need battle retry
      commands = BattleRetry::COMMANDS
      @command_window = Window_Command.new(BattleRetry::WINDOW_WIDTH, commands)
      # Show battle retry window in the middle
      @command_window.x = (Graphics.width - @command_window.width) / 2
      @command_window.y = BattleRetry::WINDOW_Y
      @command_window.openness = 0
      @command_window.open
      # Perform transition
      wora_batretry_scego_pertran(*args)
      # Open command window
      until @command_window.openness == 255
        @command_window.update
        Graphics.update
      end
      @command_window.active = true
    else # Normal Gameover scene
      wora_batretry_scego_pertran(*args)
    end
  end

  def terminate(*args)
    @command_window.dispose unless @command_window.nil?
    wora_batretry_scego_term(*args)
  end
end
 
class Scene_Battle < Scene_Base
  alias :kyon_batretry_scn_bat_pro_bat_st :process_battle_start
  alias wora_batretry_scebat_batend battle_end
  def process_battle_start
    kyon_batretry_scn_bat_pro_bat_st
    start_main if BattleRetry.active?
  end

  def battle_end(*args)
    unless (args[0] == 2 and !$game_troop.can_lose)
      # Remove last troop data if won battle
      $game_temp.last_troop_id = nil
      $game_temp.last_troop_actor = nil
      $game_switches[BattleRetry::FIRST_MOVE_SWITCH_ID] = false
    end
    wora_batretry_scebat_batend(*args)
  end
end
 
class Game_Temp
  attr_accessor :last_troop_id, :last_troop_actor
  def battle_retry?
   ($game_switches[BattleRetry::ENABLE_SWITCH_ID] and !@last_troop_id.nil?)
  end
end
 
class Game_Interpreter
  alias wora_batretry_gamint_com301 command_301
  def command_301(*args)
    # If enable to record party stat before battle..
    if BattleRetry::RECORD_PARTY_STAT
      $game_temp.last_troop_actor = {}
      $game_party.members.each do |a|
        $game_temp.last_troop_actor[a.id] = [a.hp, a.mp, a.real_states]
      end
    end
    # Store last troop ID in Game_System
    troop_id = @params[0] == 0 ? @params[1] : $game_variables[@params[1]]
    $game_temp.last_troop_id = [troop_id, @params[2]] if !$game_temp.in_battle
    wora_batretry_gamint_com301(*args)
  end
end
 
class Game_Battler
  def real_states() @states.clone end
  def real_states=(states_id_array) @states = states_id_array end
end
Unfortunately it didn't work.
I'm not sure how the First_Move_Switch was meant to be used, but I assume it would have made it so that the enemy would've immediently attacked me with something random.

I went ahead and made a little Project with all my scripts so that the process goes by quicker:
In there you can fight a boss and just get beaten. I set up all the necessary switches for the retry script as well. The script itself is also located all the way at the bottom in the editor. (And I assume you have the VX RTP installed)

My goal is to have these little icons show up right after you retry battle:
Screenshot_1.png
They are the clear indicator that will show you that the turn thing has been fixed.
As it stands, they only appear after a single action (from enemy or ally) and I want them to show up immediently after pressing retry battle.
 

Latest Threads

Latest Posts

Latest Profile Posts

Another comic with Backstage Malak...
If you want to ask him anything, you can ask on my DeviantArt page! I'm not sure if you're allowed to do it here.
Forum tip of the day ...
If you get a temporary suspension for being a jerk to people who are trying to help you, and arguing with mods and admins, don't go making new accounts. Chances are, if you p**s us off enough to suspend you for a week, we're not going to hesitate giving you a permanent ban when you give us a reason.
E_6fAErVkAQILXu.png
I'm so close to releasing my game on steam! :blush::blush::blush:
Us:
"This game is awesome! I wish there are more games like this in the future."
Also us:
"I hate how games stopped being original and start copying other successful games."
Should've done this a few days ago but...
PRI_200136808.jpg
Rest in Peace, Sir Clive Sinclair
1940 - 2021
Entrepreneur, Technologist, Father of the Modern British Computing Industry, and protagonist of Legend of ZUN.

Without you, England's games and tech industry wouldn't be where it is.

Forum statistics

Threads
115,291
Messages
1,088,680
Members
149,920
Latest member
mulinho
Top