Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Last Fighter XP

Last Fighter XP
(Standard Battle System) Version: 1.0.0
By: Kyonides-Arkanthos
alias Kyonides, Shadowball

Introduction

Simple Plug 'n' Play script.

One of your heroes won't fight against the enemies unless all other heroes are dead already.

Features

Read my comments included in the script...

Screenshots

There's no way you may notice how it works unless you play a demo...

Demo

Pending...

Script

[rgss]<span style="color:#000080; font-style:italic;">=begin
<span style="color:#000080; font-style:italic;">  Last Fighter XP
<span style="color:#000080; font-style:italic;">  (Standard Battle System Version)
<span style="color:#000080; font-style:italic;">  by Kyonides-Arkanthos alias Kyonides, Shadowball
<span style="color:#000080; font-style:italic;">  v 1.0.0 - 02.10.2010 (BETA 3)
<span style="color:#000080; font-style:italic;">  v 1.0.0 - 02.08.2010 (BETA 2)
<span style="color:#000080; font-style:italic;">  v 1.0.0 - 02.07.2010 (BETA 1)
 
<span style="color:#000080; font-style:italic;">  A Game_Party & Scene_Battle Mod
 
<span style="color:#000080; font-style:italic;">  Plug n Play
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  FEATURES (6)
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  1. The Last Fighter won't fight against their enemies unless all other
<span style="color:#000080; font-style:italic;">  Party Members are officially DEAD.
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  2. You can change who the Last Fighter should be here in the Script Editor or
<span style="color:#000080; font-style:italic;">  from an event by calling the script like this:
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  LastActor.new = 2
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  You may choose a number (-1 to 3), -1 means all Party Members should fight.
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  3. The Last Fighter will defend himself / herself if you want him/her to do so
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  # He or She will be guarding...
<span style="color:#000080; font-style:italic;">  ID = [0, true]
<span style="color:#000080; font-style:italic;">  # or
<span style="color:#000080; font-style:italic;">  LastActor.guard = true
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  # He or She won't be guarding...
<span style="color:#000080; font-style:italic;">  ID = [0, nil]  
<span style="color:#000080; font-style:italic;">  # or
<span style="color:#000080; font-style:italic;">  LastActor.guard = nil
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  4. Now the Actor Command Window will show a unique customized Skills term for
<span style="color:#000080; font-style:italic;">     every single party member.
<span style="color:#000080; font-style:italic;">     
<span style="color:#000080; font-style:italic;">     Just edit the ClassID Hash as you wish.
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">     It comes with the 8 basic Hero classes, but you can edit it at will
<span style="color:#000080; font-style:italic;">     depending on how many Hero Classes do you created in the Classes Tab
<span style="color:#000080; font-style:italic;">     in the Database Window.
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  "1 Turn Only" Features :
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  5. AutoFight : All fighters deal physical damage semi-automatically
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  6. AutoSkill : All fighters use a randomly selected skill if possible.
<span style="color:#000080; font-style:italic;">  Otherwise they'll just deal physical damage to the enemy
<span style="color:#000080; font-style:italic;">=end
module LastActor
  # EDIT THIS VALUE, it must be an Integer (-1 to 3)
  # -1 means All Party Members Will Fight
  # true - PM will protect himself or herself just in case s/he is attacked
  # nil  - Party Member will not protect himself
  ID = [3, true]
 
  Tecnicas = 'Tecnicas'
 
  ClassID = {
    1 => Tecnicas,    2 => Tecnicas,     3 => Tecnicas,
    4 => 'Artimañas', 5 => Tecnicas,     6 => Tecnicas,
    7 => 'Magias',    8 => 'Hechicerias'
  }
 
  def self.new=(index);   ID[0] = index end
 
  def self.guard=(state); ID[1] = state end
end
 
class Game_Party
  attr_reader :eek:thers
  alias :kyon_lastman_gm_py_ssm :setup_starting_members
  def setup_starting_members
    @others = [] # Array of all party members but the last standing man
    kyon_lastman_gm_py_ssm
    for actor in @actors
      @others.push actor if actor != @actors[LastActor::ID[0]]
    end
  end
 
  def last_actor; @actors.size-1 end
 
  def others_dead?
    if $game_party.others.size == 0
      return false # If number of other party members is 0
    end
    for actor in @others
      if actor.hp > 0
        return false # If an actor is in the party with 0 or more HP
      end
    end
    return true # All other members are dead
  end
end
 
class Window_Command
  attr_accessor :commands
  # This method replaces the generic Skills command name with a customized one
  # You may replace it by calling the script like this...
  #   @actor_command_window.commands[1] = 'Spells'
end
 
class Window_PartyCommand < Window_Selectable
  def initialize
    x = 320 - (520 / 2)
    super(x, 0, 520, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    @commands = ['Fight', 'AutoFight', 'AutoSkill','Escape']
    @item_max = @commands.size
    @column_max = @commands.size
    [0,1,2].each {|index| draw_item(index, normal_color)}
    draw_item(3, $game_temp.battle_can_escape ? normal_color : disabled_color)
    self.active = false
    self.visible = false
    self.index = 0
  end
 
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(index * 120 + 4, 0, 116 - 10, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], 1)
  end
 
  def update_cursor_rect
    self.cursor_rect.set(index * 120, 0, 128, 32)
  end
end
 
class Scene_Battle
  def update_phase2
    if Input.trigger?(Input::C)
      # Branch by party command window cursor position
      case @party_command_window.index
      # Fight, AutoFight, AutoSkill - Heroes deal physical damage only (1 turn)
      when 0, 1, 2
        $game_system.se_play($data_system.decision_se) # Play decision SE
        start_phase3 # Start actor command phase
      when 3 # Escape
        if $game_temp.battle_can_escape == false # If it's impossible to escape
          $game_system.se_play($data_system.buzzer_se) # Play buzzer SE
          return
        end
        $game_system.se_play($data_system.decision_se) # Play decision SE
        update_phase2_escape # Escape processing
      end
      return
    end
  end
 
  def start_phase3
    @phase = 3 # Shift to phase 3
    @actor_index = -1 # Set actor as unselectable
    @active_battler = nil
    # Go to command input for next actor if player selected Fight command
    # otherwise all actors will deal physical damage only or use a skill instead
    case @party_command_window.index
    when 0;  phase3_next_actor
    when 1;  phase3_all_actors:)fight)
    when 2;  phase3_all_actors:)skill)
    end
  end
 
  def phase3_all_actors(attack_or_skill) # AutoFight method call
    all_active_battlers(attack_or_skill)
    @party_command_window.active = false
    @party_command_window.visible = false
  end
 
  def phase3_next_actor # Normal Fight method call
    all_active_battlers:)actor_command)
    phase3_setup_command_window
  end
 
  def all_active_battlers(index)
    begin
      if index == :actor_command and @active_battler != nil
        @active_battler.blink = false # Actor blink effect OFF
      end
      # If index is equal to last man standing and that actor is the last one
      # in the list and other party members are alive, let them fight!
      if (@actor_index == LastActor::ID[0]-1 and
        LastActor::ID[0] == $game_party.last_actor and
        !$game_party.others_dead? and LastActor::ID[1].nil?) or
        @actor_index == $game_party.last_actor # If last actor
        start_phase4 # Start main phase
        return
      end
      # Advance actor index
      @actor_index += 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true if index == :actor_command
      if index != :actor_command
        # AutoFight: All active members should fight
        if index == :fight
          @active_battler.current_action.kind = 0
          action = @actor_index != LastActor::ID[0] ? 0 : 1
          @active_battler.current_action.basic = action
        # AutoSkill: all members should use a skill
        elsif index == :skill
          autoselect_skill # Check if battler can use any skill
        end
        index = rand($game_troop.enemies.size)
        @active_battler.current_action.target_index = index
      end
    end until @active_battler.inputable?
  end
 
  alias :kyon_lastman_battle_up_ph3 :update_phase3
  def update_phase3
    phase3_all_actors:)fight) if @party_command_window.index == 1
    phase3_all_actors:)skill) if @party_command_window.index == 2
    kyon_lastman_battle_up_ph3
  end
 
  def autoselect_skill
    for skill in @active_battler.skills
      next if !@active_battler.skill_can_use? skill
      @skill_id = skill
      break
    end
    @active_battler.current_action.kind  = !@skill_id.nil? ? 1 : 0
    @active_battler.current_action.basic = 0 if @skill_id.nil?
    @active_battler.current_action.skill_id = @skill_id if !@skill_id.nil?
  end
  # This method replaces the generic Skills command name with a customized one
  alias :kyon_lastman_battle_ph3_scw :phase3_setup_command_window
  def phase3_setup_command_window
    class_id = $game_party.actors[@actor_index].class_id
    @actor_command_window.commands[1] = LastActor::ClassID[class_id]
    @actor_command_window.refresh
    kyon_lastman_battle_ph3_scw
  end
end
[/rgss]

Instructions

Plug 'n' Play script

Edit the ID constant inside LastActor module to select which hero will rest during battles unless all other heroes are dead already.

Accepted party members index values: -1 to 3.

-1 means All Party Members should fight against the enemies.

You can change it at any time from a script call, e.g.

LastActor.new = 1

Here's another way to explain what this script does...

The index is the $game_party.actors index (0 to 3), but if you want all party members to fight against the enemies, then choose -1 to make sure no one is taking a nap while the enemies are attacking you, this (-1) would be the XP's Standard Battle System normal behavior.

If you choose a specific actor not to attack or use any skill, let's say you've chosen Aluxes (the party leader at the party's position number 1), then Aluxes won't do anything unless all other party members are dead.

There are other features, so don't forget to read my comments or just test my script in any of your projects.

FAQ

None yet.

Compatibility

For XP's Standard Battle System...

Credits and Thanks

This was requested by Desbrina, but I'm not sure if he needed any other feature, too.

Author's Notes

None.

Terms and Conditions

Not intended for Commercial Use and you should include my name in your project's credits. If you want to post this script in any other forum, then send me an email or pm first so I can take a decision...
 
yo, this is approved, but would you please add a demo and some more explanation as soon as possible?
just posting a script is a bit bare.. other people would like to use it too, but they have to know what it's for..
 

Jason

Awesome Bro

I assume the index is the actor index... for example;

Index 0 = First in party
Index 1 = Second in party

etc. etc.

Or it's the actor in the database, so you can decide when adding them to the party.
 
EDIT: The first post was updated again!

The index is the $game_party.actors index (0 to 3), but if you want all party members to fight against the enemies, then choose -1 to make sure no one is taking a nap while the enemies are attacking you, this (-1) would be the XP's Standard Battle System normal behavior.

If you choose a specific actor not to attack or use any skill, let's say you've chosen Aluxes (the party leader at the party's position number 1), then Aluxes won't do anything unless all other party members are dead.

You might think that behavior is weird, but that's what Desbrina was asking for on Script Requests subforum.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top