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
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...
(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
script
Spoiler
- =begin
- Last Fighter XP
- (Standard Battle System Version)
- by Kyonides-Arkanthos alias Kyonides, Shadowball
- v 1.0.0 - 02.10.2010 (BETA 3)
- v 1.0.0 - 02.08.2010 (BETA 2)
- v 1.0.0 - 02.07.2010 (BETA 1)
- A Game_Party & Scene_Battle Mod
- Plug n Play
- FEATURES (6)
- 1. The Last Fighter won't fight against their enemies unless all other
- Party Members are officially DEAD.
- 2. You can change who the Last Fighter should be here in the Script Editor or
- from an event by calling the script like this:
- LastActor.new = 2
- You may choose a number (-1 to 3), -1 means all Party Members should fight.
- 3. The Last Fighter will defend himself / herself if you want him/her to do so
- # He or She will be guarding...
- ID = [0, true]
- # or
- LastActor.guard = true
- # He or She won't be guarding...
- ID = [0, nil]
- # or
- LastActor.guard = nil
- 4. Now the Actor Command Window will show a unique customized Skills term for
- every single party member.
- Just edit the ClassID Hash as you wish.
- It comes with the 8 basic Hero classes, but you can edit it at will
- depending on how many Hero Classes do you created in the Classes Tab
- in the Database Window.
- "1 Turn Only" Features :
- 5. AutoFight : All fighters deal physical damage semi-automatically
- 6. AutoSkill : All fighters use a randomly selected skill if possible.
- Otherwise they'll just deal physical damage to the enemy
- =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 :others
- 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
Expand to see the code.
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...