Basically, I'm trying to combine Yanfly's Input Combo script (popularized by LISA) with Archeia's Luna engine script that introduces combat mechanics lifted from SMT Nocturne.
I have this one character - Walter - who's supposed to have this combo where he can use an attack that hurts himself three times, whereupon he just straight up dies, but his self-sacrifice gives the other remaining party members 4 extra turns to work with (the latter mechanic belonging to Archeia's PTB script)
Video below:
You can see Walter using the combo, and the 4 turns registering, but as soon as his own turn is over, they disappear.
All relevant code below:
Thank you in advance for any guidance, input, help, or general direction!
I have this one character - Walter - who's supposed to have this combo where he can use an attack that hurts himself three times, whereupon he just straight up dies, but his self-sacrifice gives the other remaining party members 4 extra turns to work with (the latter mechanic belonging to Archeia's PTB script)
Video below:
You can see Walter using the combo, and the 4 turns registering, but as soon as his own turn is over, they disappear.
All relevant code below:
Code:
#==============================================================================
#
# ▼ Yanfly Engine Ace - Input Combo Skills v1.01
# -- Last Updated: 2011.12.26
# -- Level: Hard
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-InputComboSkills"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2014.08.29 - Bug Fix: Battle doesn't end if all side is dead and you still have
# to input commands.
# 2011.12.26 - Bug Fix: Crash when no action is performed.
# 2011.12.22 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script enables the usage of Input Combo Skills. When an Input Combo
# Skill is activated by an actor, a list of the potential input attacks appears
# on the side of the screen. The player then presses the various buttons listed
# in the window and attacks will occur in a combo fashion. If a particular
# attack combination is met, a special attack will occur.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skill notebox in the database.
# -----------------------------------------------------------------------------
# <combo skill L: x>
# <combo skill R: x>
# <combo skill X: x>
# <combo skill Y: x>
# <combo skill Z: x>
# Makes the skill with these notetags to become potentially comboable. Replace
# x with the ID of the skill you want the button to cause the skill to combo.
# The combo skill will be usable even if the user has not learned the skill.
# However, if the user is unable to use the skill due to a lack of resources,
# then the skill will be greyed out. The skill can be inputted, but if the user
# lacks the resources, it will not perform and the skill combo will break.
#
# <combo max: x>
# Sets the maximum number of inputs the player can use for this skill. If this
# tag is not present, it will use the default number of maximum inputs that's
# pre-defined by the module.
#
# <combo special string: x>
# If the player inputs a sequence that matches the string (any combination of
# L, R, X, Y, Z), then the special skill x will be performed. If a combination
# is met, then the combo chain will end prematurely even if there are more
# inputs left. If the user does not know skill x, then the special combo skill
# x will not be performed.
#
# <combo only>
# This makes a skill only usable in a combo and cannot be directly used from a
# skill menu. This effect does not affect monsters. Combo skills will still be
# unusable if the user does not meet the skill's other requirements (such as a
# lack of MP or TP).
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# While this script doesn't interfere with Active Chain Skills, it will most
# likely be unable to used in conjunction with Active Chain Skills. I will not
# provide support for any errors that may occur from this, nor will I be
# responsible for any damage doing this may cause your game.
#
#==============================================================================
module YEA
module INPUT_COMBO
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Combo Skill Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust the sound effect played when a skill is selected,
# what the minimum time windows are.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This will be the sound effect played whenever an active combo skill has
# been selected for comboing.
INPUT_COMBO_SOUND = RPG::SE.new("Skill2", 80, 100)
# This will be the sound effect played when an input combo matches and
# activates a specialized combo.
ACHIEVED_COMBO_SOUND = RPG::SE.new("Skill3", 90, 100)
# How many frames minimum for combo allowance. Sometimes the battlelog
# window will move too fast for the player to be able to combo. This sets
# a minimum timer for how long the combo window will stay open.
MINIMUM_TIME = 90
# This is the bonus number of frames of leeway that the player gets for
# a larger input sequence. This is because the battlelog window may move
# too fast for the player to be able to combo. This adds to the minimum
# timer for how long the combo window will stay open.
TIME_PER_INPUT = 30
# This sets the default number of inputs that a combo skill can have at
# maximum. If you wish to exceed this amount or to have lower than this
# amount, use a notetag to change the skill's max combo amount.
DEFAULT_MAX_INPUT = 5
# This will be the "Window" colour used for a special skill in the display.
SPECIAL_SKILL_COLOUR = 17
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Combo Skill Text -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This section adjusts the text that appears for the combo skills. Adjust
# the text to appear as you see fit. Note that the vocab other than the
# title can use text codes.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COMBO_TITLE = "Input Combo Attacks"
TITLE_SIZE = 20
L_SKILL_ON = "\eC[17]Q\eC[0]: "
L_SKILL_OFF = "\eC[7]Q: "
R_SKILL_ON = "\eC[17]W\eC[0]: "
R_SKILL_OFF = "\eC[7]W: "
X_SKILL_ON = "\eC[17]A\eC[0]: "
X_SKILL_OFF = "\eC[7]A: "
Y_SKILL_ON = "\eC[17]S\eC[0]: "
Y_SKILL_OFF = "\eC[7]S: "
Z_SKILL_ON = "\eC[17]D\eC[0]: "
Z_SKILL_OFF = "\eC[7]D: "
end # INPUT_COMBO
end # YEA
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module SKILL
COMBO_MAX = /<(?:COMBO_MAX|combo max):[ ](\d+)>/i
COMBO_ONLY = /<(?:COMBO_ONLY|combo only)>/i
COMBO_SKILL = /<(?:COMBO_SKILL|combo skill)[ ]([LRXYZ]):[ ](\d+)>/i
COMBO_SPECIAL = /<(?:COMBO_SPECIAL|combo special)[ ](.*):[ ](\d+)>/i
end # SKILL
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_ics load_database; end
def self.load_database
load_database_ics
load_notetags_ics
end
#--------------------------------------------------------------------------
# new method: load_notetags_ics
#--------------------------------------------------------------------------
def self.load_notetags_ics
for skill in $data_skills
next if skill.nil?
skill.load_notetags_ics
end
end
end # DataManager
#==============================================================================
# ■ RPG::Skill
#==============================================================================
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :combo_only
attr_accessor :combo_skill
attr_accessor :combo_max
attr_accessor :combo_special
#--------------------------------------------------------------------------
# common cache: load_notetags_ics
#--------------------------------------------------------------------------
def load_notetags_ics
@combo_only = false
@combo_skill = {}
@combo_special = {}
@combo_max = YEA::INPUT_COMBO::DEFAULT_MAX_INPUT
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::SKILL::COMBO_ONLY
@combo_only = true
when YEA::REGEXP::SKILL::COMBO_SKILL
case $1.upcase
when "L"; @combo_skill[:L] = $2.to_i
when "R"; @combo_skill[:R] = $2.to_i
when "X"; @combo_skill[:X] = $2.to_i
when "Y"; @combo_skill[:Y] = $2.to_i
when "Z"; @combo_skill[:Z] = $2.to_i
else; next
end
when YEA::REGEXP::SKILL::COMBO_MAX
@combo_max = $1.to_i
when YEA::REGEXP::SKILL::COMBO_SPECIAL
@combo_special[$1.to_s.upcase] = $2.to_i
#---
end
} # self.note.split
#---
end
end # RPG::UsableItem
#==============================================================================
# ■ Game_Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# new method: set_input_combo_skill
#--------------------------------------------------------------------------
def set_input_combo_skill(skill_id)
set_skill(skill_id)
@target_index = subject.current_action.target_index
@input_combo_skill = true
end
#--------------------------------------------------------------------------
# alias method: valid?
#--------------------------------------------------------------------------
alias game_action_valid_ics valid?
def valid?
subject.enable_input_combo(true) if @input_combo_skill
result = game_action_valid_ics
subject.enable_input_combo(false) if @input_combo_skill
return result
end
end # Game_Action
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: skill_conditions_met?
#--------------------------------------------------------------------------
alias game_battlerbase_skill_conditions_met_ics skill_conditions_met?
def skill_conditions_met?(skill)
return false if combo_skill_restriction?(skill)
return game_battlerbase_skill_conditions_met_ics(skill)
end
#--------------------------------------------------------------------------
# new method: combo_skill_restriction?
#--------------------------------------------------------------------------
def combo_skill_restriction?(skill)
return false unless actor?
return false unless $game_party.in_battle
return false unless skill.combo_only
return !@input_combo_enabled
end
#--------------------------------------------------------------------------
# alias method: hp=
#--------------------------------------------------------------------------
alias game_battlerbase_hpequals_ics hp=
def hp=(value)
game_battlerbase_hpequals_ics(value)
return unless SceneManager.scene_is?(Scene_Battle)
return unless actor?
return if value == 0
SceneManager.scene.refresh_input_combo_skill_window(self)
end
#--------------------------------------------------------------------------
# alias method: mp=
#--------------------------------------------------------------------------
alias game_battlerbase_mpequals_ics mp=
def mp=(value)
game_battlerbase_mpequals_ics(value)
return unless SceneManager.scene_is?(Scene_Battle)
return unless actor?
return if value == 0
SceneManager.scene.refresh_input_combo_skill_window(self)
end
#--------------------------------------------------------------------------
# alias method: tp=
#--------------------------------------------------------------------------
alias game_battlerbase_tpequals_ics tp=
def tp=(value)
game_battlerbase_tpequals_ics(value)
return unless SceneManager.scene_is?(Scene_Battle)
return unless actor?
return if value == 0
SceneManager.scene.refresh_input_combo_skill_window(self)
end
end # Game_BattlerBase
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: on_battle_start
#--------------------------------------------------------------------------
alias game_battler_on_battle_start_ics on_battle_start
def on_battle_start
game_battler_on_battle_start_ics
@input_combo_enabled = false
end
#--------------------------------------------------------------------------
# alias method: on_battle_end
#--------------------------------------------------------------------------
alias game_battler_on_battle_end_ics on_battle_end
def on_battle_end
game_battler_on_battle_end_ics
@input_combo_enabled = false
end
#--------------------------------------------------------------------------
# new method: enable_input_combo
#--------------------------------------------------------------------------
def enable_input_combo(active)
return unless actor?
@input_combo_enabled = active
end
end # Game_Battler
#==============================================================================
# ■ Window_ComboSkillList
#==============================================================================
class Window_ComboSkillList < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
dw = [Graphics.width/2, 320].max
super(-standard_padding, 0, dw, fitting_height(7))
self.z = 200
self.opacity = 0
hide
end
#--------------------------------------------------------------------------
# reveal
#--------------------------------------------------------------------------
def reveal(battler, skill)
@battler = battler
@skill = skill
@combo_skills = []
for key in skill.combo_skill
next if key[1].nil?
next if $data_skills[key[1]].nil?
@combo_skills.push($data_skills[key[1]])
end
return if @combo_skills == []
self.y = Graphics.height - fitting_height(4)
self.y -= fitting_height(@combo_skills.size + 2)
show
activate
refresh
end
#--------------------------------------------------------------------------
# refresh_check
#--------------------------------------------------------------------------
def refresh_check(battler)
return if @battler != battler
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_background_colour
draw_horz_line(0)
draw_combo_title
draw_horz_line(@combo_skills.size * line_height)
draw_combo_skills
end
#--------------------------------------------------------------------------
# draw_background_colour
#--------------------------------------------------------------------------
def draw_background_colour
dh = line_height * (@combo_skills.size + 2)
rect = Rect.new(0, 0, contents.width, dh)
back_colour1 = Color.new(0, 0, 0, 192)
back_colour2 = Color.new(0, 0, 0, 0)
contents.gradient_fill_rect(rect, back_colour1, back_colour2)
end
#--------------------------------------------------------------------------
# draw_horz_line
#--------------------------------------------------------------------------
def draw_horz_line(dy)
line_y = dy + line_height - 2
line_colour = normal_color
line_colour.alpha = 48
contents.fill_rect(0, line_y, contents.width, 2, line_colour)
end
#--------------------------------------------------------------------------
# draw_combo_title
#--------------------------------------------------------------------------
def draw_combo_title
reset_font_settings
text = YEA::INPUT_COMBO::COMBO_TITLE
contents.font.size = YEA::INPUT_COMBO::TITLE_SIZE
contents.font.bold = true
contents.font.italic = true
draw_text(12, 0, contents.width - 12, line_height, text)
reset_font_settings
end
#--------------------------------------------------------------------------
# draw_combo_skills
#--------------------------------------------------------------------------
def draw_combo_skills
button_array = [:L, :R, :X, :Y, :Z]
dx = 24
dy = line_height
for button in button_array
next if @skill.combo_skill[button].nil?
combo_skill = $data_skills[@skill.combo_skill[button]]
text = text_setting(button, combo_skill)
text += sprintf("\eI[%d]", combo_skill.icon_index)
text += combo_skill.name
draw_text_ex(dx, dy, text)
dy += line_height
end
end
#--------------------------------------------------------------------------
# text_setting
#--------------------------------------------------------------------------
def text_setting(button, skill)
text = ""
case button
when :L
if @battler.usable?(skill)
text = YEA::INPUT_COMBO::L_SKILL_ON
else
text = YEA::INPUT_COMBO::L_SKILL_OFF
end
when :R
if @battler.usable?(skill)
text = YEA::INPUT_COMBO::R_SKILL_ON
else
text = YEA::INPUT_COMBO::R_SKILL_OFF
end
when :X
if @battler.usable?(skill)
text = YEA::INPUT_COMBO::X_SKILL_ON
else
text = YEA::INPUT_COMBO::X_SKILL_OFF
end
when :Y
if @battler.usable?(skill)
text = YEA::INPUT_COMBO::Y_SKILL_ON
else
text = YEA::INPUT_COMBO::Y_SKILL_OFF
end
when :Z
if @battler.usable?(skill)
text = YEA::INPUT_COMBO::Z_SKILL_ON
else
text = YEA::INPUT_COMBO::Z_SKILL_OFF
end
end
return text
end
end # Window_ComboSkillList
#==============================================================================
# ■ Window_ComboInfo
#==============================================================================
class Window_ComboInfo < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, fitting_height(1))
self.y = Graphics.height - fitting_height(4) - fitting_height(1)
self.opacity = 0
self.z = 200
@combos = []
@special = nil
hide
end
#--------------------------------------------------------------------------
# reveal
#--------------------------------------------------------------------------
def reveal
@combos = []
@special = nil
refresh
show
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
dx = draw_combo_icons
draw_special(dx)
end
#--------------------------------------------------------------------------
# add_combo
#--------------------------------------------------------------------------
def add_combo(icon, special = nil)
@combos.push(icon)
@special = special
refresh
end
#--------------------------------------------------------------------------
# draw_combo_icons
#--------------------------------------------------------------------------
def draw_combo_icons
dx = 0
for icon in @combos
draw_icon(icon, dx, 0)
dx += 24
end
return dx
end
#--------------------------------------------------------------------------
# draw_special
#--------------------------------------------------------------------------
def draw_special(dx)
return if @special.nil?
draw_icon(@special.icon_index, dx + 12, 0)
colour = text_color(YEA::INPUT_COMBO::SPECIAL_SKILL_COLOUR)
change_color(colour)
draw_text(dx + 36, 0, contents.width, line_height, @special.name)
end
end # Window_ComboInfo
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: create_all_windows
#--------------------------------------------------------------------------
alias scene_battle_create_all_windows_ics create_all_windows
def create_all_windows
scene_battle_create_all_windows_ics
create_combo_skill_window
end
#--------------------------------------------------------------------------
# new method: create_combo_skill_window
#--------------------------------------------------------------------------
def create_combo_skill_window
@input_combo_skill_window = Window_ComboSkillList.new
@input_combo_info_window = Window_ComboInfo.new
@input_combo_skill_counter = 0
end
#--------------------------------------------------------------------------
# alias method: use_item
#--------------------------------------------------------------------------
alias scene_battle_use_item_ics use_item
def use_item
@subject.enable_input_combo(true)
item = @subject.current_action.item
combo_skill_list_appear(true, item)
start_input_combo_skill_counter(item)
scene_battle_use_item_ics
loop do
break if break_input_combo?(item)
update_basic
update_combo_skill_queue
end
combo_skill_list_appear(false, item)
@subject.enable_input_combo(false)
end
#--------------------------------------------------------------------------
# new method: combo_skill_list_appear
#--------------------------------------------------------------------------
def combo_skill_list_appear(visible, skill)
return if @subject.nil?
return unless @subject.actor?
return unless skill.is_a?(RPG::Skill)
return if visible && @input_combo_skill_window.visible
if visible
@break_combo = false
@current_combo_skill = skill
@total_combo_skills = 0
@combo_skill_queue = []
@combo_skill_string = ""
@input_combo_skill_window.reveal(@subject, skill)
@input_combo_info_window.reveal
else
@input_combo_skill_window.hide
@input_combo_info_window.hide
return if @subject.current_action.nil?
@subject.current_action.set_skill(@current_combo_skill.id)
end
end
#--------------------------------------------------------------------------
# new method: refresh_input_combo_skill_window
#--------------------------------------------------------------------------
def refresh_input_combo_skill_window(battler)
return unless @input_combo_skill_window.visible
@input_combo_skill_window.refresh_check(battler)
end
#--------------------------------------------------------------------------
# new method: start_input_combo_skill_counter
#--------------------------------------------------------------------------
def start_input_combo_skill_counter(skill)
return unless @input_combo_skill_window.visible
@input_combo_skill_counter = YEA::INPUT_COMBO::MINIMUM_TIME
bonus_time = skill.combo_max * YEA::INPUT_COMBO::TIME_PER_INPUT
@input_combo_skill_counter += bonus_time
end
#--------------------------------------------------------------------------
# new method: break_input_combo?
#--------------------------------------------------------------------------
def break_input_combo?(item)
# This part is added in this fix to break input combo if at least 1 side is all dead
return true if $game_party.all_dead? || $game_troop.all_dead?
#
return true if @break_combo
return true if @current_combo_skill.nil?
return true if @current_combo_skill.combo_skill == {}
return false if @combo_skill_queue != []
return true if @total_combo_skills == @current_combo_skill.combo_max
return @input_combo_skill_counter <= 0
end
#--------------------------------------------------------------------------
# new method: update_combo_skill_queue
#--------------------------------------------------------------------------
def update_combo_skill_queue
return if @combo_skill_queue == []
action = @combo_skill_queue.shift
if [email protected]?(action)
@break_combo = true
return
end
@subject.current_action.set_input_combo_skill(action.id)
@log_window.clear
execute_action
end
#--------------------------------------------------------------------------
# alias method: update_basic
#--------------------------------------------------------------------------
alias scene_battle_update_basic_ics update_basic
def update_basic
scene_battle_update_basic_ics
update_input_combo_skill_counter
update_input_combo_skill_select
end
#--------------------------------------------------------------------------
# new method: update_input_combo_skill_counter
#--------------------------------------------------------------------------
def update_input_combo_skill_counter
return if @input_combo_skill_counter == 0
@input_combo_skill_counter -= 1
end
#--------------------------------------------------------------------------
# new method: update_input_combo_skill_select
#--------------------------------------------------------------------------
def update_input_combo_skill_select
return unless @input_combo_skill_window.visible
return if @total_combo_skills >= @current_combo_skill.combo_max
if Input.trigger?(:L)
check_input_combo_skill(:L)
elsif Input.trigger?(:R)
check_input_combo_skill(:R)
elsif Input.trigger?(:X)
check_input_combo_skill(:X)
elsif Input.trigger?(:Y)
check_input_combo_skill(:Y)
elsif Input.trigger?(:Z)
check_input_combo_skill(:Z)
end
end
#--------------------------------------------------------------------------
# new method: check_input_combo_skill
#--------------------------------------------------------------------------
def check_input_combo_skill(button)
skill_id = @current_combo_skill.combo_skill[button]
return if skill_id.nil?
return if $data_skills[skill_id].nil?
case button
when :L; @combo_skill_string += "L"
when :R; @combo_skill_string += "R"
when :X; @combo_skill_string += "X"
when :Y; @combo_skill_string += "Y"
when :Z; @combo_skill_string += "Z"
end
if special_input_combo?
icon = $data_skills[skill_id].icon_index
@combo_skill_queue.push($data_skills[skill_id])
skill_id = @current_combo_skill.combo_special[@combo_skill_string]
combo_skill = $data_skills[skill_id]
@input_combo_info_window.add_combo(icon, combo_skill)
YEA::INPUT_COMBO::ACHIEVED_COMBO_SOUND.play
@total_combo_skills = @current_combo_skill.combo_max
else
YEA::INPUT_COMBO::INPUT_COMBO_SOUND.play
combo_skill = $data_skills[skill_id]
@input_combo_info_window.add_combo(combo_skill.icon_index)
@total_combo_skills += 1
end
@combo_skill_queue.push(combo_skill)
return unless @total_combo_skills == @current_combo_skill.combo_max
@input_combo_skill_counter = 0
end
#--------------------------------------------------------------------------
# new method: special_input_combo?
#--------------------------------------------------------------------------
def special_input_combo?
combo_hash = @current_combo_skill.combo_special
return false unless combo_hash.include?(@combo_skill_string)
skill = $data_skills[combo_hash[@combo_skill_string]]
return @subject.skills.include?(skill)
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
Code:
#==============================================================================
#
# ▼ Luna Engine - Press Turn Battle Add-on
# -- Script: Press Turn Gauge
# -- Last Updated: 2012.07.09
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YES-PTBNGauge"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.09 - Started and Finished Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides a visual for Press Turn of PTB.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below YES - Battle PTB but above ▼ Main. Remember to save.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
# This script only works with YES - Battle PTB.
#
#==============================================================================
module YES
module PTBN
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Turn Gauge Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings are adjusted for the Turn Gauge of PTB.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TURN_GAUGE = { # Start.
:x => 40,
:y => 12,
} # End.
end # PTB
end # YES
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ■ Cache
#==============================================================================
module Cache
#--------------------------------------------------------------------------
# new method: ptb
#--------------------------------------------------------------------------
def self.ptb(filename)
begin
load_bitmap("Graphics/PTB/", filename)
end
end
end # Cache
#==============================================================================
# ■ YES::PTB
#==============================================================================
module YES
module PTB
SPRITE_WIDTH = Cache.ptb("PartyPTB").width
SPRITE_HEIGHT = Cache.ptb("TroopPTB").height
RECT = Rect.new(0, 0, SPRITE_WIDTH, SPRITE_HEIGHT)
end
end
#==============================================================================
# ■ Sprite_PTBN
#==============================================================================
class Sprite_PTBN < Sprite
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(index, party)
super(nil)
@index = index
@party = party
@count = 0
self.opacity = 255
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
bitmap_name = @party ? "PartyPTB" : "TroopPTB"
self.bitmap = Cache.ptb(bitmap_name)
#---
self.x = YES::PTBN::TURN_GAUGE[:x]
self.y = YES::PTBN::TURN_GAUGE[:y]
self.x += (BattleControl.ptbn_actions.size - @index - 1) * YES::PTB::SPRITE_WIDTH
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
return if disposed?
super
self.opacity -= 24 if @disposing
self.dispose if self.opacity <= 0
return if @disposing
if BattleControl.ptbn_actions[@index] == 0
@disposing = true
elsif BattleControl.ptbn_actions[@index] == 2
@count -= 1
if @count <= 0;self.flash(Color.new(255,255,255), 24); @count = 48; end
end
end
#--------------------------------------------------------------------------
# disposing
#--------------------------------------------------------------------------
def disposing
@disposing = true
end
end # Sprite_PTBN
#==============================================================================
# ■ Sprite_PTBN
#==============================================================================
class Spriteset_PTBN
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
@sprites ||= []
#---
@sprites.each { |sprite| sprite.disposing }
#---
party = BattleControl.ptbn_order == :party ? true : false
BattleControl.ptbn_actions.each_index { |index|
sprite = Sprite_PTBN.new(index, party)
@sprites.push(sprite)
}
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
@sprites.each { |sprite| sprite.update if sprite }
end
#--------------------------------------------------------------------------
# dispose
#--------------------------------------------------------------------------
def dispose
@sprites.each { |sprite| sprite.dispose if sprite }
end
#--------------------------------------------------------------------------
# disposing
#--------------------------------------------------------------------------
def disposing
@sprites.each { |sprite| sprite.opacity -= 24 if sprite && !sprite.disposed? }
end
end # Spriteset_PTBN
#==============================================================================
# ■ Window_BattleStatusPTBN
#==============================================================================
class Window_BattleStatusPTBN < Window_BattleStatus
#--------------------------------------------------------------------------
# draw_actor_ptbn
#--------------------------------------------------------------------------
def draw_actor_ptbn(actor, x, y, width = 112)
return unless BattleControl.ptbn_order == :party
change_color(Color.new(255,160,160))
draw_text(x, y, width, line_height, BattleControl.ptbn_index(actor), 2)
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
return unless BattleManager.in_turn?
return if index.nil?
clear_item(index)
actor = $imported["YEA-BattleEngine"] ? battle_members[index] : $game_party.battle_members[index]
rect = item_rect(index)
return if actor.nil?
width = $imported["YEA-BattleEngine"] ? rect.width-8 : 100
draw_actor_ptbn(actor, rect.x, rect.y, width)
end
end # Window_BattleStatus
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: create_all_windows
#--------------------------------------------------------------------------
alias ptbn_create_all_windows create_all_windows
def create_all_windows
create_ptbn_order_gauge
ptbn_create_all_windows
create_ptbn_status_window
end
#--------------------------------------------------------------------------
# new method: create_ptbn_order_gauge
#--------------------------------------------------------------------------
def create_ptbn_order_gauge
return unless BattleControl.battle_type == :ptbn
@ptbn_turn_gauge = Spriteset_PTBN.new
@ptbn_turn_gauge.refresh
end
#--------------------------------------------------------------------------
# new method: create_ptbn_status_window
#--------------------------------------------------------------------------
def create_ptbn_status_window
return unless BattleControl.battle_type == :ptbn
@ptbn_status_window = Window_BattleStatusPTBN.new
@ptbn_status_window.opacity = 0
@ptbn_status_window.viewport = @info_viewport
end
#--------------------------------------------------------------------------
# alias method: update_basic
#--------------------------------------------------------------------------
alias ptbn_update_basic update_basic
def update_basic
ptbn_update_basic
return unless BattleControl.battle_type == :ptbn
if $game_party.all_dead? || $game_troop.all_dead?
@ptbn_turn_gauge.disposing
end
@ptbn_turn_gauge.update
@ptbn_status_window.x = @status_window.x
@ptbn_status_window.y = @status_window.y
@ptbn_status_window.open if @status_window.open?
@ptbn_status_window.close if @status_window.close?
end
#--------------------------------------------------------------------------
# alias method: dispose_spriteset
#--------------------------------------------------------------------------
alias ptbn_dispose_spriteset dispose_spriteset
def dispose_spriteset
ptbn_dispose_spriteset
return unless BattleControl.battle_type == :ptbn
@ptbn_turn_gauge.dispose
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
Code:
#==============================================================================
#
# ▼ Luna Engine - Battle Mechanism
# -- Type: Press Turn Battle (SMT: Nocturne)
# -- Last Updated: 04/01/2015
# -- Level: Normal
# -- Requires: n/a
# -- Made by: Yami
# -- Edited by: Archeia and Fomar0153
#==============================================================================
$imported = {} if $imported.nil?
$imported["YES-BattlePTBN"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2015.01.04 - Fixed if paralyzed, that character still has a turn.
# Added new turn functions.
# 2012.11.01 - Bugfix for a major crash.
# 2012.08.02 - Bugfix for Magic Reflection.
# 2012.07.30 - Bugfix for Large Party.
# 2012.07.09 - Started Script.
# 2012.07.07 - Started Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides battle mechanism Press Turn Battle (PTB). This PTB based
# from Shin Megami Tensei: Nocturne battle.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# To change Battle Mechanism to PTB, use have to change DEFAULT_BATTLE_TYPE
# in Battle Control to :ptbn or use script call ingame:
# BattleControl.change_btype(:ptbn)
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
# This script may not be compatible with other battle scripts. It is highly
# recommended putting this script above all other battle scripts, except YEA -
# Ace Battle Engine and other scripts that Author recommends putting above this.
#
#==============================================================================
module YES
module PTBN
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Mechanism Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings are adjusted for the threshold mechanism which related
# to battlers' actions and turn counting.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The Pass skill must set to use on The User
# For half turn skill, use <ptb half>
# For instant skill, use with Yanfly's instant cast
# For Beast Eye: <ptb gain: n>
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
MECHANISM_SETTINGS = { # Start.
:default_ptb => 1, # Turns per battler by default.
#---
:lose_evade => 0,
:lose_miss => 0,
:lose_strong => 0,
:lose_immunity => 1,
:lose_absorb => 99,
:lose_reflect => 99,
} # End.
end # PTBN
end # YES
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ■ Regular Expression
#==============================================================================
module YES
module REGEXP
module BATTLER
PTB_ACTIONS = /<(?:PTB_ACTIONS|ptb actions):[ ](\d+)?>/i
PTB_PASS = /<(?:PTB_PASS|ptb pass)>/i
PTB_HALF = /<(?:PTB_PASS|ptb half)>/i
PTB_INSTANT = /<(?:PTB_INSTANT|ptb instant)>/i
PTB_GAIN = /<(?:PTB_GAIN|ptb gain):[ ](\d+)>/i
end # BATTLER
end # REGEXP
end # YES
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_battleptbn load_database; end
def self.load_database
load_database_battleptbn
load_notetags_battleptbn
end
#--------------------------------------------------------------------------
# new method: load_notetags_battleptbn
#--------------------------------------------------------------------------
def self.load_notetags_battleptbn
groups = [$data_actors, $data_enemies, $data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_battleptbn
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :ptbn_actions
attr_accessor :ptbn_pass
attr_accessor :ptbn_half
attr_accessor :ptbn_instant
attr_accessor :ptbn_gain
#--------------------------------------------------------------------------
# common cache: load_notetags_battleptbn
#--------------------------------------------------------------------------
def load_notetags_battleptbn
@ptbn_pass = false
@ptbn_half = false
@ptbn_instant = false
@ptbn_gain = 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YES::REGEXP::BATTLER::PTB_ACTIONS
@ptbn_actions = Array.new($1.to_i, 1)
when YES::REGEXP::BATTLER::PTB_PASS
@ptbn_pass = true
when YES::REGEXP::BATTLER::PTB_HALF
@ptbn_half = true
when YES::REGEXP::BATTLER::PTB_INSTANT
@ptbn_instant = true
when YES::REGEXP::BATTLER::PTB_GAIN
@ptbn_gain = $1.to_i
end
} # self.note.split
#---
@ptbn_actions = Array.new(YES::PTBN::MECHANISM_SETTINGS[:default_ptb], 1) if @ptbn_actions.nil?
end
end # RPG::BaseItem
#==============================================================================
# ■ BattleControl
#==============================================================================
module BattleControl
#--------------------------------------------------------------------------
# Party's Actions
# Action State: 0 - Used, 1 - Full Action, 2 - Half Action
#--------------------------------------------------------------------------
@ptbn_actions = Array.new()
#--------------------------------------------------------------------------
# alias method: setup_battle
#--------------------------------------------------------------------------
class <<self; alias ptbn_setup_battle setup_battle; end
def self.setup_battle
ptbn_setup_battle
setup_ptbn if battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: turn_end?
#--------------------------------------------------------------------------
class <<self; alias ptbn_turn_end? turn_end?; end
def self.turn_end?
return ptbn_turn_end? unless battle_type == :ptbn
return turn_end_ptbn? if battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
class <<self; alias ptbn_turn_end turn_end; end
def self.turn_end
ptbn_turn_end unless battle_type == :ptbn
turn_end_ptbn if battle_type == :ptbn
end
#--------------------------------------------------------------------------
# new method: turn_end_ptbn?
#--------------------------------------------------------------------------
def self.turn_end_ptbn?
condition = ptbn_all_used
if @ptbn_order == :party
condition = condition || $game_party.ye_movable_members.size == 0
elsif @ptbn_order == :troop
condition = condition || $game_troop.ye_movable_members.size == 0
else
return false
end
return condition
end
#--------------------------------------------------------------------------
# new method: turn_end_ptbn
#--------------------------------------------------------------------------
def self.turn_end_ptbn
@ptbn_actions.clear
@ptbn_order = @ptbn_order == :party ? :troop : :party
ptbn_calculate_actions
end
#--------------------------------------------------------------------------
# new method: setup_ptbn
#--------------------------------------------------------------------------
def self.setup_ptbn
@ptbn_order = nil
@battlers = []
#---
ptbn_init_order
end
#--------------------------------------------------------------------------
# new method: ptbn_init_order
#--------------------------------------------------------------------------
def self.ptbn_init_order
party_agi = $game_party.ye_alive_members.inject(0) { |i, b| i += b.agi }
troop_agi = $game_troop.ye_alive_members.inject(0) { |i, b| i += b.agi }
#---
if party_agi > troop_agi
@ptbn_order = :party
elsif party_agi < troop_agi
@ptbn_order = :troop
else
@ptbn_order = rand(2) < 1 ? :party : :troop
end
#---
@ptbn_order = :party if BattleManager.encounter_flag == 1
@ptbn_order = :troop if BattleManager.encounter_flag == 2
#---
ptbn_calculate_actions
end
#--------------------------------------------------------------------------
# new method: ptbn_calculate_actions
#--------------------------------------------------------------------------
def self.ptbn_calculate_actions
if @ptbn_order == :party
@ptbn_actions = $game_party.ptbn_actions
@battlers = $game_party.battle_members.dup
elsif @ptbn_order == :troop
@ptbn_actions = $game_troop.ptbn_actions
@battlers = $game_troop.members.dup
else
ptbn_init_order
end
#---
ptbn_sort_battlers
end
#--------------------------------------------------------------------------
# new method: ptbn_sort_battlers
#--------------------------------------------------------------------------
def self.ptbn_sort_battlers
@battlers.sort! { |a,b| b.agi <=> a.agi }
end
#--------------------------------------------------------------------------
# new method: ptbn_evaluate_action
# Result State:
# 0 - Normal, 1 - Rewarded, 4 - Evade, 5 - Miss, 2 - Strong, 6 - Absorb
# 7 - Reflect, 8 - half turn, 9 - instant, 3 - Immunity
#--------------------------------------------------------------------------
def self.ptbn_evaluate_action(state)
return if state == 9
case state
when 10..99
@ptbn_actions.each_index { |i| if @ptbn_actions[i] > 0; @ptbn_actions[i] = 0; break; end }
(state - 10).times {
changed = false
@ptbn_actions.each_with_index { |s,i|
next unless s < 1
@ptbn_actions[i] = 2
changed = true
break
}
@ptbn_actions.insert(0, 2) unless changed
}
when 1
if ptbn_all_rewarded
@ptbn_actions.each_index { |i| if @ptbn_actions[i] > 0; @ptbn_actions[i] = 0; break; end }
else
@ptbn_actions.each_index { |i| if @ptbn_actions[i] == 1; @ptbn_actions[i] = 2; break; end }
end
when 0
@ptbn_actions.each_index { |i| if @ptbn_actions[i] > 0; @ptbn_actions[i] = 0; break; end }
when 8
@ptbn_actions.each_index { |i|
if @ptbn_actions[i] == 2
@ptbn_actions[i] = 0
break
elsif @ptbn_actions[i] == 1
@ptbn_actions[i] = 2
break
end
}
else
i = 1
case state
when 4
i += YES::PTBN::MECHANISM_SETTINGS[:lose_evade]
when 5
i += YES::PTBN::MECHANISM_SETTINGS[:lose_miss]
when 2
i += YES::PTBN::MECHANISM_SETTINGS[:lose_strong]
when 6
i += YES::PTBN::MECHANISM_SETTINGS[:lose_absorb]
when 7
i += YES::PTBN::MECHANISM_SETTINGS[:lose_reflect]
when 3
i += YES::PTBN::MECHANISM_SETTINGS[:lose_immunity]
end
j = 0
@ptbn_actions.each_index { |id|
if @ptbn_actions[id] > 0
@ptbn_actions[id] = 0
j += 1
end
break if j >= i
}
end
end
#--------------------------------------------------------------------------
# new method: ptbn_all_rewarded
#--------------------------------------------------------------------------
def self.ptbn_all_rewarded
result = true
@ptbn_actions.each { |i| if i == 1; result = false; break; end }
result
end
#--------------------------------------------------------------------------
# new method: ptbn_all_used
#--------------------------------------------------------------------------
def self.ptbn_all_used
result = true
@ptbn_actions.each { |i| if i > 0; result = false; break; end }
result
end
#--------------------------------------------------------------------------
# new method: ptbn_order
#--------------------------------------------------------------------------
def self.ptbn_order
@ptbn_order
end
#--------------------------------------------------------------------------
# new method: ptbn_actions
#--------------------------------------------------------------------------
def self.ptbn_actions
@ptbn_actions
end
#--------------------------------------------------------------------------
# new method: ptbn_index
#--------------------------------------------------------------------------
def self.ptbn_index(actor)
@battlers.index(actor) + 1
end
#--------------------------------------------------------------------------
# new method: ptbn_clear_actions
#--------------------------------------------------------------------------
def self.ptbn_clear_actions
@ptbn_actions.each_index { |i| @ptbn_actions[i] = 0 }
end
#--------------------------------------------------------------------------
# new method: ptbn_sort_battlers
#--------------------------------------------------------------------------
def self.ptbn_get_battler
loop do
battler = @battlers.shift
@battlers.push(battler)
@cur_battler = battler
return nil if self.turn_end?
next unless battler.movable?
return battler
end
end
end # BattleControl
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# alias method: turn_start
#--------------------------------------------------------------------------
class <<self; alias ptbn_turn_start turn_start; end
def self.turn_start
ptbn_turn_start unless BattleControl.battle_type == :ptbn
turn_start_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
class <<self; alias ptbn_turn_end turn_end; end
def self.turn_end
ptbn_turn_end unless BattleControl.battle_type == :ptbn
turn_end_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: on_encounter
#--------------------------------------------------------------------------
class <<self; alias ptbn_on_encounter on_encounter; end
def self.on_encounter
ptbn_on_encounter
BattleControl.ptbn_init_order if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# new method: turn_start_ptbn
#--------------------------------------------------------------------------
def self.turn_start_ptbn
@phase = :turn
clear_actor
end
#--------------------------------------------------------------------------
# new method: turn_end_ptbn
#--------------------------------------------------------------------------
def self.turn_end_ptbn
@phase = :turn_end
@preemptive = false
@surprise = false
$game_troop.increase_turn
end
end # BattleManager
#==============================================================================
# ■ Game_ActionResult
#==============================================================================
class Game_ActionResult
#--------------------------------------------------------------------------
# Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :item
#--------------------------------------------------------------------------
# alias method: make_damage
#--------------------------------------------------------------------------
alias ptbn_make_damage make_damage
def make_damage(value, item)
ptbn_make_damage(value, item)
@item = item
end
end # Game_ActionResult
#==============================================================================
# ■ Game_Unit
#==============================================================================
class Game_Unit
#--------------------------------------------------------------------------
# new method: ptbn_actions
#--------------------------------------------------------------------------
def ptbn_actions
ye_alive_members.inject([]) { |r,b| r += b.ptbn_actions }
end
end # Game_Unit
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :ptbn_state
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias ptbn_initialize initialize
def initialize
ptbn_initialize
@ptbn_state = 0
end
#--------------------------------------------------------------------------
# new method: ptbn_actions
#--------------------------------------------------------------------------
def ptbn_actions
if actor?
return actor.ptbn_actions
else
return enemy.ptbn_actions
end
end
#--------------------------------------------------------------------------
# alias method: item_apply
#--------------------------------------------------------------------------
alias ptbn_item_apply item_apply
def item_apply(user, item)
ptbn_item_apply(user, item)
return unless user
return unless SceneManager.scene_is?(Scene_Battle)
last_state = user.ptbn_state
user.ptbn_state = 0
if item.ptbn_instant
user.ptbn_state = 9
elsif item.ptbn_pass || item.ptbn_half
user.ptbn_state = 8
elsif item.ptbn_gain > 0
user.ptbn_state = item.ptbn_gain + 10
end
return if item.damage.none? || item.ptbn_pass || item.ptbn_instant
if @result.missed
user.ptbn_state = 5
elsif @result.evaded
user.ptbn_state = 4
elsif @result.critical
user.ptbn_state = 1
elsif user.magic_reflection
user.ptbn_state = 7
elsif item_element_rate(user, @result.item) > 1
user.ptbn_state = 1
elsif item_element_rate(user, @result.item) == 0
user.ptbn_state = 3
elsif item_element_rate(user, @result.item) < 1 && item_element_rate(user, @result.item) > 0
user.ptbn_state = 2
elsif item_element_rate(user, @result.item) < 0
user.ptbn_state = 6
end
user.ptbn_state = [last_state, user.ptbn_state].max if last_state < 8
end
end # Game_Battler
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# alias method: input
#--------------------------------------------------------------------------
alias ptbn_input input
def input
if BattleControl.battle_type == :ptbn
if @actions[@action_input_index] == nil
@actions[@action_input_index] = Game_Action.new(self)
end
end
return ptbn_input
end
end # Game_Actor
#==============================================================================
# ■ Window_ActorCommand
#==============================================================================
class Window_ActorCommand < Window_Command
#--------------------------------------------------------------------------
# alias method: process_dir6
#--------------------------------------------------------------------------
if $imported["YEA-BattleEngine"]
alias ptbn_process_dir6 process_dir6
def process_dir6
return if BattleControl.battle_type == :ptbn
ptbn_process_dir6
end
end
end # Window_ActorCommand
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: process_condition
#--------------------------------------------------------------------------
alias ptbn_process_condition process_condition
def process_condition
return ptbn_process_condition unless BattleControl.battle_type == :ptbn
return process_condition_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: process_in_turn
#--------------------------------------------------------------------------
alias ptbn_process_in_turn process_in_turn
def process_in_turn
ptbn_process_in_turn unless BattleControl.battle_type == :ptbn
process_in_turn_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: update_info_viewport
#--------------------------------------------------------------------------
alias ptbn_update_info_viewport update_info_viewport
def update_info_viewport
ptbn_update_info_viewport unless BattleControl.battle_type == :ptbn
update_info_viewport_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: next_command
#--------------------------------------------------------------------------
alias ptbn_next_command next_command
def next_command
ptbn_next_command unless BattleControl.battle_type == :ptbn
next_command_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: prior_command
#--------------------------------------------------------------------------
alias ptbn_prior_command prior_command
def prior_command
ptbn_prior_command unless BattleControl.battle_type == :ptbn
prior_command_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: command_fight
#--------------------------------------------------------------------------
alias ptbn_command_fight command_fight
def command_fight
ptbn_command_fight unless BattleControl.battle_type == :ptbn
command_fight_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: command_escape
#--------------------------------------------------------------------------
alias ptbn_command_escape command_escape
def command_escape
ptbn_command_escape unless BattleControl.battle_type == :ptbn
command_escape_ptbn if BattleControl.battle_type == :ptbn
end
#--------------------------------------------------------------------------
# alias method: use_item
#--------------------------------------------------------------------------
alias ptbn_use_item use_item
def use_item
ptbn_use_item
BattleControl.ptbn_evaluate_action(@subject.ptbn_state) if BattleControl.battle_type == :ptbn
@ptbn_turn_gauge.refresh if $imported["YES-PTBNGauge"] && @subject.ptbn_state >= 10
@subject.ptbn_state = 0
end
#--------------------------------------------------------------------------
# new method: process_condition_ptbn
#--------------------------------------------------------------------------
def process_condition_ptbn
inputting = @actor_command_window.active || @skill_window.active ||
@item_window.active || @actor_window.active || @enemy_window.active
inputting = inputting || @summon_window.active if $imported["YES-GuardianSummon"]
return !inputting
end
#--------------------------------------------------------------------------
# new method: process_in_turn_ptbn
#--------------------------------------------------------------------------
def process_in_turn_ptbn
if @status_window.close?
@status_window.open
end
@actor_command_window.close
@status_window.unselect
return if @subject
#---
@ptbn_status_window.refresh
battler = BattleControl.ptbn_get_battler
return unless battler
battler.make_actions
@subject = battler
#---
if @subject.inputable? and battler.is_a?(Game_Actor)
@actor_command_window.setup(@subject)
BattleManager.set_actor(battler)
@status_window.select(BattleManager.actor.index)
end
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: update_info_viewport_ptbn
#--------------------------------------------------------------------------
def update_info_viewport_ptbn
move_info_viewport(0) if @party_command_window.active
move_info_viewport(128) if @actor_command_window.active
move_info_viewport(64) if BattleManager.in_turn? && process_condition
end
#--------------------------------------------------------------------------
# new method: next_command_ptbn
#--------------------------------------------------------------------------
def next_command_ptbn
@status_window.show
@actor_command_window.show
@status_aid_window.hide if $imported["YEA-BattleEngine"]
end
#--------------------------------------------------------------------------
# new method: prior_command_ptbn
#--------------------------------------------------------------------------
def prior_command_ptbn
$imported["YEA-BattleEngine"] ? redraw_current_status : @status_window.refresh
if @subject && @subject.actor?
@backup_subject = @subject
end
command_fight_ptbn
#start_party_command_selection
end
#--------------------------------------------------------------------------
# new method: command_fight_ptbn
#--------------------------------------------------------------------------
def command_fight_ptbn
turn_start
if @backup_subject
@subject = @backup_subject
@actor_command_window.setup(@subject)
BattleManager.set_actor(@subject)
@status_window.select(BattleManager.actor.index)
@backup_subject = nil
end
end
#--------------------------------------------------------------------------
# new method: command_escape_ptbn
#--------------------------------------------------------------------------
def command_escape_ptbn
unless BattleManager.process_escape
BattleControl.ptbn_clear_actions
turn_start
end
end
#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
alias ptbn_turn_end turn_end
def turn_end
ptbn_turn_end
return unless BattleControl.battle_type == :ptbn
@party_command_window.deactivate
@ptbn_turn_gauge.refresh if $imported["YES-PTBNGauge"]
end
def on_skill_ok
@skill = @skill_window.item
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
if [email protected]_selection? || @skill.ptbn_pass
@skill_window.hide
next_command
elsif @skill.for_opponent?
select_enemy_selection
else
select_actor_selection
end
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
Code:
#==============================================================================
# ■ Luna Engine: PTB Pass Command Fix
#==============================================================================
# Put this below Yanfly Engine Ace - Battle Command List
#==============================================================================
class Scene_Battle < Scene_Base
def command_use_skill
@skill = $data_skills[@actor_command_window.current_ext]
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
status_redraw_target(BattleManager.actor)
if $imported["YEA-BattleEngine"]
$game_temp.battle_aid = @skill
if @skill.for_opponent?
select_enemy_selection
elsif @skill.for_friend? && [email protected]_pass
select_actor_selection
else
next_command
$game_temp.battle_aid = nil
end
else
if [email protected]_selection? || @skill.ptbn_pass
next_command
elsif @skill.for_opponent?
select_enemy_selection
else
select_actor_selection
end
end
end
end
Code:
#==============================================================================
# ■ Luna Engine: PTB Patch I
#==============================================================================
# Fixes something, I forgot. Probably reflect.
#==============================================================================
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: item_apply
#--------------------------------------------------------------------------
alias ptbn_patch_item_apply item_apply
def item_apply(user, item)
ptbn_patch_item_apply(user, item)
return unless user
return unless SceneManager.scene_is?(Scene_Battle)
last_state = user.ptbn_state
user.ptbn_state = 0
if item.ptbn_instant
user.ptbn_state = 9
elsif item.ptbn_pass || item.ptbn_half
user.ptbn_state = 8
elsif item.ptbn_gain > 0
user.ptbn_state = item.ptbn_gain + 10
end
return if item.damage.none? || item.ptbn_pass || item.ptbn_instant
if @result.missed
user.ptbn_state = 5
elsif @result.evaded
user.ptbn_state = 4
elsif @result.critical
user.ptbn_state = 1
elsif user.magic_reflection
user.ptbn_state = 7
elsif item_element_rate(user, @result.item) > 1
user.ptbn_state = 1
elsif item_element_rate(user, @result.item) == 0
user.ptbn_state = 3
elsif item_element_rate(user, @result.item) < 1 && item_element_rate(user, @result.item) > 0
user.ptbn_state = 2
elsif item_element_rate(user, @result.item) < 0
user.ptbn_state = 6
end
user.ptbn_state = [last_state, user.ptbn_state].max if last_state < 8
end
end # Game_Battler
Code:
#==============================================================================
# ■ PTB Patch and Add-Ons
#==============================================================================
# This script fixes the paralysis state and you can still retain a turn.
#
# Notetagging a weapon or an armour with <PTB_ACTIONS: 3> for example
# it will take the highest value of them as the base amount of turns for that
# actor.
#
# To add or take away from base:
# <addptbs 1>
# <addptbs -4>
#
# For skill costs
# <ptbs_cost 2>
#==============================================================================
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# new method: load_notetags_battleptbn
#--------------------------------------------------------------------------
def self.load_notetags_battleptbn
groups = [$data_actors, $data_enemies, $data_skills, $data_items, $data_weapons, $data_armors]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_battleptbn
end
end
end
end # DataManager
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# new method: ptbn_actions
#--------------------------------------------------------------------------
def ptbn_actions
return [] if !movable?
if actor?
return actor.ptbn_actions
else
return enemy.ptbn_actions
end
end
#--------------------------------------------------------------------------
# new method: skill_conditions_met?
#--------------------------------------------------------------------------
def skill_conditions_met?(skill)
return super(skill) && (BattleControl.ptbn_actions.clone - [0]).length >= skill.ptbn_cost
end
#--------------------------------------------------------------------------
# alias method: item_apply
#--------------------------------------------------------------------------
def item_apply(user, item)
ptbn_item_apply(user, item)
return unless user
return unless SceneManager.scene_is?(Scene_Battle)
BattleControl.additonal_cost(item.ptbn_cost)
last_state = user.ptbn_state
user.ptbn_state = 0
if item.ptbn_instant
user.ptbn_state = 9
elsif item.ptbn_pass || item.ptbn_half
user.ptbn_state = 8
elsif item.ptbn_gain > 0
user.ptbn_state = item.ptbn_gain + 10
end
return if item.damage.none? || item.ptbn_pass || item.ptbn_instant
if @result.missed
user.ptbn_state = 5
elsif @result.evaded
user.ptbn_state = 4
elsif @result.critical
user.ptbn_state = 1
elsif user.magic_reflection
user.ptbn_state = 7
elsif item_element_rate(user, @result.item) > 1
user.ptbn_state = 1
elsif item_element_rate(user, @result.item) == 0
user.ptbn_state = 3
elsif item_element_rate(user, @result.item) < 1 && item_element_rate(user, @result.item) > 0
user.ptbn_state = 2
elsif item_element_rate(user, @result.item) < 0
user.ptbn_state = 6
end
user.ptbn_state = [last_state, user.ptbn_state].max if last_state < 8
end
end # Game_Battler
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# new method: ptbn_actions
#--------------------------------------------------------------------------
def ptbn_actions
return [] if !movable?
base = actor.ptbn_actions
add = 0
for equip in @equips
next if equip.object == nil
base = equip.object.ptbn_actions if equip.object.ptbn_actions.length > base.length
add += equip.object.addptbs
end
if add >= 0
return base + Array.new(add, 1)
else
if base.length <= add * -1
return []
else
return Array.new(base.length + add, 1)
end
end
end
end # Game_Actor
#==============================================================================
# ■ Fomar you messed up the formating
#==============================================================================
class RPG::EquipItem
def addptbs
if @addptbs.nil?
if @note =~ /<addptbs (.*)>/i
@addptbs = $1.to_i
else
@addptbs = 0
end
end
@addptbs
end
end
class RPG::UsableItem
def ptbn_cost
if @ptbn_cost.nil?
if @note =~ /<ptbs_cost (.*)>/i
@ptbn_cost = $1.to_i
else
@ptbn_cost = 1
end
end
@ptbn_cost
end
end
#==============================================================================
# ■ BattleControl
#==============================================================================
module BattleControl
#--------------------------------------------------------------------------
# new method: ptbn_evaluate_action
# Result State:
# 0 - Normal, 1 - Rewarded, 4 - Evade, 5 - Miss, 2 - Strong, 6 - Absorb
# 7 - Reflect, 8 - half turn, 9 - instant, 3 - Immunity
#--------------------------------------------------------------------------
def self.additonal_cost(cost)
cost -= 1
return if cost == 0
@ptbn_actions.each_index { |i| if @ptbn_actions[i] > 0; @ptbn_actions[i] = 0; cost -= 1; break if cost == 0; end }
end
end
Code:
#==============================================================================
#
# ▼ Yami Engine Symphony - Battle Control
# -- Last Updated: 2012.11.01
# -- Level: Nothing
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YES-BattleControl"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.30 - Bugfix for Save and Load.
# 2012.07.30 - Bugfix for Large Party.
# 2012.07.09 - Compatible with: Battle PTB.
# 2012.07.05 - Compatible with: Battle TBB.
# 2012.07.04 - Compatible with: Battle CTB.
# 2012.07.01 - Started and Finished Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script controls the Battle flow and manages battle mechanism from Yami
# Engine Symphony. This is requirement for Battle Mechanism of Yami Engine
# Symphony.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# To change Battle Type (Battle Mechanism) during gameplay, use this script call
# BattleControl.change_btype(type)
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YES
module BattleControl
# Set Default Battle.
DEFAULT_BATTLE_TYPE = :ptbn
end # BattleControl
end # YES
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ■ BattleControl
#==============================================================================
module BattleControl
#--------------------------------------------------------------------------
# setup
#--------------------------------------------------------------------------
def self.setup
@last_size = 0
@battlers = []
filter_battlers
setup_battle
end
#--------------------------------------------------------------------------
# filter_battlers
#--------------------------------------------------------------------------
def self.filter_battlers
@last_size = @battlers.size
@battlers = $game_party.members + $game_troop.members
@last_size = @last_size == 0 ? @battlers.size : @last_size
end
#--------------------------------------------------------------------------
# setup_battle
#--------------------------------------------------------------------------
def self.setup_battle
# Compatible Method.
end
#--------------------------------------------------------------------------
# turn_end?
#--------------------------------------------------------------------------
def self.turn_end?
return true
end
#--------------------------------------------------------------------------
# turn_end
#--------------------------------------------------------------------------
def self.turn_end
# Compatible Method.
end
#--------------------------------------------------------------------------
# correct_battle_type
#--------------------------------------------------------------------------
def self.correct_battle_type(type)
case type
when :dtb; return :dtb
when :ctb; return $imported["YES-BattleCTB"] ? :ctb : :dtb
when :tbb; return $imported["YES-BattleTBB"] ? :tbb : :dtb
when :ptbn; return $imported["YES-BattlePTBN"] ? :ptbn : :dtb
when :atb; return $imported["YES-BattleATB"] ? :atb : :dtb
else; return :dtb
end
end
#--------------------------------------------------------------------------
# battle_type
#--------------------------------------------------------------------------
def self.battle_type
return $game_system.battle_type
end
#--------------------------------------------------------------------------
# change_btype
#--------------------------------------------------------------------------
def self.change_btype(type)
$game_system.battle_type = correct_battle_type(type)
end
end # BattleControl
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# alias method: setup
#--------------------------------------------------------------------------
class <<self; alias yes_bc_setup setup; end
def self.setup(troop_id, can_escape = true, can_lose = false)
yes_bc_setup(troop_id, can_escape, can_lose)
BattleControl.setup()
end
#--------------------------------------------------------------------------
# new method: encounter_flag
#--------------------------------------------------------------------------
def self.encounter_flag
return 1 if @preemptive
return 2 if @surprise
return 0
end
#--------------------------------------------------------------------------
# new method: set_actor
#--------------------------------------------------------------------------
def self.set_actor(actor)
@actor_index = actor.index
end
end # BattleManager
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :battle_type
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias yes_bc_initialize initialize
def initialize
yes_bc_initialize
@battle_type = BattleControl.correct_battle_type(YES::BattleControl::DEFAULT_BATTLE_TYPE)
end
end # Game_System
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# Define method :screen_x
#--------------------------------------------------------------------------
unless Game_Actor.instance_methods.include?(:screen_x)
def screen_x
return self.index
end
end
end # Game_Actor
#==============================================================================
# ■ Game_Unit
#==============================================================================
class Game_Unit
#--------------------------------------------------------------------------
# new method: ye_alive_members
#--------------------------------------------------------------------------
def ye_alive_members
self.is_a?(Game_Party) ? battle_members.select {|member| member.alive? } : members.select {|member| member.alive? }
end
#--------------------------------------------------------------------------
# new method: ye_movable_members
#--------------------------------------------------------------------------
def ye_movable_members
self.is_a?(Game_Party) ? battle_members.select {|member| member.movable? } : members.select {|member| member.movable? }
end
end # Game_Unit
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# overwrite method: update
#--------------------------------------------------------------------------
def update
super
if BattleManager.in_turn? && process_condition
process_in_turn
process_event
process_action
end
BattleManager.judge_win_loss
end
#--------------------------------------------------------------------------
# new method: process_in_turn
#--------------------------------------------------------------------------
def process_in_turn
# Compatible Method.
end
#--------------------------------------------------------------------------
# new method: process_condition
#--------------------------------------------------------------------------
def process_condition
return true if BattleControl.battle_type == :dtb
end
#--------------------------------------------------------------------------
# overwrite method: process_action
#--------------------------------------------------------------------------
def process_action
return if scene_changing?
if !@subject || [email protected]_action
@subject = BattleManager.next_subject
end
unless @subject
return turn_end if BattleControl.turn_end?
return
end
if @subject.current_action
@subject.current_action.prepare
if @subject.current_action.valid?
@status_window.open
execute_action
end
@subject.remove_current_action
end
process_action_end unless @subject.current_action
end
#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
alias yes_bc_turn_end turn_end
def turn_end
return yes_bc_turn_end if BattleControl.battle_type == :dtb
return unless BattleControl.turn_end?
while BattleControl.turn_end?
BattleControl.turn_end
yes_bc_turn_end
#---
turn_start if BattleControl.battle_type == :ctb
turn_start if BattleControl.battle_type == :tbb
turn_start if BattleControl.battle_type == :ptbn
turn_start if BattleControl.battle_type == :atb
end
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
Thank you in advance for any guidance, input, help, or general direction!