Hello, I have been using MOG scripts recently and have been able to successfully implement a QTE for skills the player tries to do against the enemy. If the player is successful, the attack lands, however, if the player fails the blitz, the attack fails.
The problem arises when I try to do the same thing, but in reverse. I am trying to make it so that the enemy troop has attacks that prompt a quick time event in blitz fashion where if you are successful, you dodge the attack, and if you aren't, the attack hits you.
I first tried this with the blitz script and nothing happened. I got a little closer to achieving this when using the chain command script, however still couldn't.
Would anyone be able to assist me? I can provide additional resources if needed.
The problem arises when I try to do the same thing, but in reverse. I am trying to make it so that the enemy troop has attacks that prompt a quick time event in blitz fashion where if you are successful, you dodge the attack, and if you aren't, the attack hits you.
I first tried this with the blitz script and nothing happened. I got a little closer to achieving this when using the chain command script, however still couldn't.
Would anyone be able to assist me? I can provide additional resources if needed.
#==============================================================================
# +++ MOG - Blitz Commands (v1.6) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Permite ativar ações através de sequência de comandos.
#==============================================================================
# UTILIZAÇÃO
#==============================================================================
# No banco de dados de habilidades ou itens, coloque o seguinte comentário na
# caixa de notas.
#
# <Blitz Command>
#
# * Lembre-se de definir a sequência de botões no editor de script antes de
# usar a habilidade
#
# Para definir uma velocidade especifica na sequência de botões use o cometário
# abaixo.
#
# <Blitz Speed = X>
#
#==============================================================================
# Arquivos necessários. Graphics/System/
#==============================================================================
#
# Blitz_Background.png
# Blitz_Flash.png
# Blitz_Layout.png
# Blitz_Meter.png
# Chain_Command.png
#
#==============================================================================
# Histórico
#==============================================================================
# v1.6 - Melhoria na codificação.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_blitz_commands] = true
module MOG_BLITZ_COMMANDS
#Definição do tempo para inserir os comandos. (tempo X quantidade de comandos)
DEFAULT_INPUT_DURATION = 30
#==============================================================================
# BLITZ_INPUT = { SKILL_ID => [COMMAND] }
#
# SKILL_ID = ID da habilidade no banco de dados.
# COMMANDS = Defina aqui a sequência de botões.
# (Para fazer a sequência use os comandos abaixo)
#
# "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W"
#
# Exemplo de utilização
#
# BLITZ_INPUT = {
# 25=>["Down","D","S","Right"],
# 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
# 80=>["Shift","D"]
# }
#==============================================================================
BLITZ_INPUT = {
22=>["Left","Up","Right","Down","Up","Down","Left","Right","Z"],
51=>["Up","Down","Left","Right","Z"],
53=>["X","Z","A","S","D"],
61=>["Z","D","X","Right","Left"],
62=>["Right","Left","Right","Q","Z","Z","D","X","Right","Left"],
66=>["Right","Up","Up","Z"],
69=>["X","Right","Left","Z","Z"],
74=>["Down","Right","Down","Right","A"],
999=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
"Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"]
}
#Ativar animação da imagem de fundo.
BACKGROUND_ENABLE = false
#Velocidade de deslize da imagem de fundo.
BACKGROUND_SCROLL_SPEED = [30,0]
#Posição do layout.
BLITZ_POSITION = [0,0]
#Posição do botão.
BUTTON_POSITION = [265,170]
#Posição do medidor de tempo.
METER_POSITION = [63,249]
#Posição do sprite Flash.
FLASH_POSITION = [0,146]
#Posição do ícone.
ICON_POSITION = [0,0]
#Posição do nome da skill
SKILL_NAME_POSITION = [180,140]
#Definição das palavras usadas no sistema blitz.
BLITZ_WORDS = ["Missed!", "Timeover", "Success!"]
#Configuração da fonte.
FONT_SIZE = 22
FONT_COLOR = Color.new(255,255,255)
#Prioridade dos sprites.
BLITZ_Z = 10500
#Som ao acertar.
RIGHT_SE = "Chime1"
#Som ao errar.
WRONG_SE = "Buzzer1"
#Definição do som ao ativar o sistema.
BLITZ_START_SE = "Saint9"
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :blitz_commands
attr_accessor :blitz_commands_phase
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_blits_commands_initialize initialize
def initialize
@blitz_commands = [false,0] ; @blitz_commands_phase = false
mog_blits_commands_initialize
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Use Item
#--------------------------------------------------------------------------
alias mog_blitz_commands_use_item use_item
def use_item
if can_execute_blitz_input?
blitz_before_action
execute_blitz_input
blitz_after_action
unless $game_temp.blitz_commands[1] == nil
return if !$game_temp.blitz_commands[0]
end
end
mog_blitz_commands_use_item
end
#--------------------------------------------------------------------------
# ● Blitz Before Action
#--------------------------------------------------------------------------
def blitz_before_action
record_window_data if $imported[:mog_atb_system]
if $imported[:mog_menu_cursor]
@chain_curor_x = $game_temp.menu_cursor[2]
$game_temp.menu_cursor[2] = -999
force_cursor_visible(false)
end
end
#--------------------------------------------------------------------------
# ● Blitz After ACtion
#--------------------------------------------------------------------------
def blitz_after_action
restore_window_data if $imported[:mog_atb_system]
if $imported[:mog_menu_cursor] and @chain_curor_x != nil
$game_temp.menu_cursor[2] = @chain_curor_x
end
end
#--------------------------------------------------------------------------
# ● Can Execute Blitz Input
#--------------------------------------------------------------------------
def can_execute_blitz_input?
return false if [email protected]_a?(Game_Actor)
return false if @subject.restriction != 0
return true
end
#--------------------------------------------------------------------------
# ● Execute Blitz Input
#--------------------------------------------------------------------------
def execute_blitz_input
$game_temp.blitz_commands[0] = false
action_id = @subject.current_action.item.note =~ /<Blitz Command>/ ? @subject.current_action.item.id : nil
$game_temp.blitz_commands[1] = action_id
return if action_id == nil
blitz_command_sequence = MOG_BLITZ_COMMANDS::BLITZ_INPUT[action_id]
if $imported[:mog_menu_cursor]
valor_x = $game_temp.menu_cursor[2] ; $game_temp.menu_cursor[2] = -999
force_cursor_visible(false)
end
if blitz_command_sequence != nil
blitz_sq = Blitz_Commands.new(blitz_command_sequence, @subject ,action_id)
loop do
$game_temp.blitz_commands_phase = true
(blitz_sq.update ; Input.update) unless @spriteset.animation?
@spriteset.update ; Graphics.update ; update_info_viewport
break if blitz_sq.phase == 9
end
blitz_sq.dispose
end
$game_temp.menu_cursor[2] = valor_x if $imported[:mog_menu_cursor]
$game_temp.blitz_commands_phase = false
end
end
#==============================================================================
# Game Temp
#==============================================================================
class Game_Temp
attr_accessor :cache_blitz_command
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_blitz_command_initialize initialize
def initialize
mog_blitz_command_initialize
cache_blt_cmd
end
#--------------------------------------------------------------------------
# ● Cache Blt Cmd
#--------------------------------------------------------------------------
def cache_blt_cmd
@cache_blitz_command = []
@cache_blitz_command.push(Cache.system("Blitz_Background"))
@cache_blitz_command.push(Cache.system("IconSet"))
@cache_blitz_command.push(Cache.system("Blitz_Flash"))
@cache_blitz_command.push(Cache.system("Blitz_Meter"))
@cache_blitz_command.push(Cache.system("Blitz_Layout"))
@cache_blitz_command.push(Cache.system("Chain_Battle_Command"))
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_blitz_commands_initialize initialize
def initialize
$game_temp.cache_blt_cmd
mog_blitz_commands_initialize
end
end
#==============================================================================
# Blitz Commands
#==============================================================================
class Blitz_Commands
include MOG_BLITZ_COMMANDS
attr_accessor 😛hase
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(sequence, subject,action_id)
@phase = 0 ; @actor = subject ; @skill = $data_skills[action_id]
@skillname = @skill.name ; @action_id = action_id
@chain_command = sequence ; @end = false
duration = @skill.note =~ /<Blitz Speed = (\d+)>/i ? $1.to_i : DEFAULT_INPUT_DURATION
@timer_max = duration * @chain_command.size ; @timer_max = 1 if @timer_max < 1
@timer = @timer_max ; @Com = 0 ; @com_index = 0 ; @new_x = 0
Audio.se_play("Audio/SE/" + BLITZ_START_SE, 100, 100) rescue nil
create_sprites
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_background ; create_layout ; create_buttons ; create_meter
create_flash ; create_skill_name ; create_icon
end
#--------------------------------------------------------------------------
# ● Create Background
#--------------------------------------------------------------------------
def create_background
@background = Plane.new ; @background.opacity = 0
@background.bitmap = $game_temp.cache_blitz_command[0]
@background.z = BLITZ_Z ; @background.visible = BACKGROUND_ENABLE
end
#--------------------------------------------------------------------------
# ● Create Icon
#--------------------------------------------------------------------------
def create_icon
@icon_image = $game_temp.cache_blitz_command[1]
@icon_sprite = Sprite.new ; @icon_sprite.bitmap = Bitmap.new(24,24)
@icon_sprite.z = BLITZ_Z + 3
@org_x2 = 80 + ICON_POSITION[0] - @Center + SKILL_NAME_POSITION[0]
@icon_sprite.x = @org_x2 ; @icon_sprite.opacity = 0
@icon_sprite.y = ICON_POSITION[1] + SKILL_NAME_POSITION[1]
icon_rect = Rect.new(@skill.icon_index % 16 * 24, @skill.icon_index / 16 * 24, 24, 24)
@icon_sprite.bitmap.blt(0,0, @icon_image, icon_rect)
end
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def create_skill_name
@skill_name = Sprite.new ; @skill_name.bitmap = Bitmap.new(200,32)
@skill_name.bitmap.font.size = FONT_SIZE
@skill_name.z = BLITZ_Z + 3 ; @skill_name.y = SKILL_NAME_POSITION[1]
@skill_name.opacity = 0 ; refresh_skill_name
end
#--------------------------------------------------------------------------
# ● Refresh Skill Name
#--------------------------------------------------------------------------
def refresh_skill_name
cm = @skillname.to_s.split(//).size
@Center = ((200 / @skill_name.bitmap.font.size) * cm / 2) + 5
@org_x = SKILL_NAME_POSITION[0] ; @skill_name.x = @org_x
@skill_name.bitmap.font.color = Color.new(0,0,0)
@skill_name.bitmap.draw_text(1,1,200,32,@skillname.to_s,1)
@skill_name.bitmap.font.color = FONT_COLOR
@skill_name.bitmap.draw_text(0,0,200,32,@skillname.to_s,1)
end
#--------------------------------------------------------------------------
# ● Create Flash
#--------------------------------------------------------------------------
def create_flash
@flash_type = 0 ; @flash_image = $game_temp.cache_blitz_command[2]
@flash_cw = @flash_image.width ; @flash_ch = @flash_image.height / 2
@Flash = Sprite.new ; @flash.bitmap = Bitmap.new(@flash_cw,@flash_ch)
@flash.x = FLASH_POSITION[0] ; @flash.y = FLASH_POSITION[1]
@flash.z = BLITZ_Z + 2 ; @flash.opacity = 0 ; @flash.blend_type = 1
refresh_flash
end
#--------------------------------------------------------------------------
# ● Refresh Flash
#--------------------------------------------------------------------------
def refresh_flash
@flash.bitmap.clear
f_scr = Rect.new(0,@flash_type * @flash_ch,@flash_cw,@flash_ch)
@flash.bitmap.blt(0,0,@flash_image,f_scr)
end
#--------------------------------------------------------------------------
# ● Create Meter
#--------------------------------------------------------------------------
def create_meter
@meter_image = $game_temp.cache_blitz_command[3]
@meter_cw = @meter_image.width ; @meter_ch = @meter_image.height
@meter_sprite = Sprite.new
@meter_sprite.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@meter_sprite.x = METER_POSITION[0] ; @meter_sprite.y = METER_POSITION[1]
@meter_sprite.z = BLITZ_Z + 2 ; @meter_sprite.opacity = 0 ; update_meter
end
#--------------------------------------------------------------------------
# ● Update Meter
#--------------------------------------------------------------------------
def update_meter
return if @meter_sprite == nil
@meter_sprite.bitmap.clear ; m_width = @meter_cw * @timer / @timer_max
m_scr = Rect.new(0,0,m_width,@meter_ch)
@meter_sprite.bitmap.blt(0,0,@meter_image, m_scr)
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new ; @layout.bitmap = $game_temp.cache_blitz_command[4]
@layout.x = BLITZ_POSITION[0] ; @layout.y = BLITZ_POSITION[1]
@layout.z = BLITZ_Z + 1 ; @layout.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Buttons
#--------------------------------------------------------------------------
def create_buttons
@image = $game_temp.cache_blitz_command[5]
@image_cw = @image.width / 13 ; @image_ch = @image.height
@image_cw_max = (@image_cw + 5) * @chain_command.size
@sprite = Sprite.new ; @sprite.bitmap = Bitmap.new(@image_cw_max,@image_ch * 2)
if @chain_command.size <= 15
@sprite.x = (Graphics.width / 2) - ((@image_cw + 5) * @chain_command.size) / 2
@new_x = 0
else
@sprite.x = (Graphics.width / 2) ; @new_x = @sprite.x
end
@sprite.x = BUTTON_POSITION[0] ; @sprite.y = BUTTON_POSITION[1]
@sprite.z = BLITZ_Z + 1 ; @sprite.opacity = 0 ; refresh_button
end
#--------------------------------------------------------------------------
# ● Refresh Button
#--------------------------------------------------------------------------
def refresh_button
return if @sprite == nil
@sprite.bitmap.clear
@chain_command.each_with_index do |i, index|
command_list_check(i)
bitmap_src_rect = Rect.new(@Com * @image_cw, 0, @image_cw, @image_ch)
if @com_index == index
@sprite.bitmap.blt(index * (@image_cw + 5) , 0, @image, bitmap_src_rect)
else
@sprite.bitmap.blt(index * (@image_cw + 5) , @image_ch, @image, bitmap_src_rect)
end
end
@new_x = BUTTON_POSITION[0] - ((@image_cw + 5) * @com_index)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_background ; dispose_layout ; dispose_buttons ; dispose_meter
dispose_flash ; dispose_name ; dispose_icon_sprite
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
@background.dispose ; @background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Icon Sprite
#--------------------------------------------------------------------------
def dispose_icon_sprite
return if @icon_sprite == nil
@icon_sprite.bitmap.dispose ; @icon_sprite.dispose ; @icon_sprite = nil
end
#--------------------------------------------------------------------------
# ● Dispose Name
#--------------------------------------------------------------------------
def dispose_name
return if @skill_name == nil
@skill_name.bitmap.dispose ; @skill_name.dispose ; @skill_name = nil
end
#--------------------------------------------------------------------------
# ● Dispose Flash
#--------------------------------------------------------------------------
def dispose_flash
return if @Flash == nil
@flash.bitmap.dispose ; @flash.dispose ; @Flash = nil
end
#--------------------------------------------------------------------------
# ● Dispose Meter
#--------------------------------------------------------------------------
def dispose_meter
return if @meter_sprite == nil
@meter_sprite.bitmap.dispose ; @meter_sprite.dispose ; @meter_sprite = nil
end
#--------------------------------------------------------------------------
# ● Dispose Buttons
#--------------------------------------------------------------------------
def dispose_buttons
return if @sprite == nil
@sprite.bitmap.dispose ; @sprite.dispose ; @sprite = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout == nil
@layout.dispose ; @layout = nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
if @end and @sprite.x == @new_x
update_flash ; update_background ; update_end
return
end
update_background ; update_timer ; update_command ; update_slide_command
update_meter ; update_flash ; update_opacity
end
#--------------------------------------------------------------------------
# ● Update Opacity
#--------------------------------------------------------------------------
def update_opacity
return if @sprite.opacity == nil
@sprite.opacity += 10 ; @layout.opacity += 10
@meter_sprite.opacity += 10 ; @skill_name.opacity += 10
@background.opacity += 10 ; @icon_sprite.opacity += 10
end
#--------------------------------------------------------------------------
# ● Update End
#--------------------------------------------------------------------------
def update_end
fs = 6 ; @icon_sprite.opacity -= fs ; @background.opacity -= fs
@skill_name.opacity -= fs ; @sprite.opacity -= fs ; @layout.opacity -= fs
@meter_sprite.opacity -= fs ; @phase = 9 if @background.opacity == 0
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += BACKGROUND_SCROLL_SPEED[0]
@background.oy += BACKGROUND_SCROLL_SPEED[1]
end
#--------------------------------------------------------------------------
# ● Update Flash
#--------------------------------------------------------------------------
def update_flash
return if @Flash == nil or @flash.opacity == 0
@flash.opacity -= 10
end
#--------------------------------------------------------------------------
# ● Update Timer
#--------------------------------------------------------------------------
def update_timer
return if @timer == 0
@timer -= 1 ; wrong_command(1) if @timer == 0
end
#--------------------------------------------------------------------------
# ● Update Slide Command
#--------------------------------------------------------------------------
def update_slide_command
return if @sprite == nil or @sprite.x == @new_x
slide_speed = 5 + ((@sprite.x - @new_x).abs / 5)
@sprite.x -= slide_speed ; @sprite.x = @new_x if @sprite.x < @new_x
end
end
#==============================================================================
# Blitz Commands
#==============================================================================
class Blitz_Commands
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
return if @end
if Input.trigger?(Input::X) ; check_command(0)
elsif Input.trigger?🙂Z) ; check_command(1)
elsif Input.trigger?🙂Y) ; check_command(2)
elsif Input.trigger?🙂A) ; check_command(3)
elsif Input.trigger?🙂C) ; check_command(4)
elsif Input.trigger?🙂😎 ; check_command(5)
elsif Input.trigger?🙂L) ; check_command(6)
elsif Input.trigger?🙂R) ; check_command(7)
elsif Input.trigger?🙂RIGHT) ; check_command(8)
elsif Input.trigger?🙂LEFT) ; check_command(9)
elsif Input.trigger?🙂DOWN) ; check_command(10)
elsif Input.trigger?🙂UP) ; check_command(11)
end
end
#--------------------------------------------------------------------------
# ● command_list_check
#--------------------------------------------------------------------------
def command_list_check(command)
case command
when "A" ; @Com = 0
when "D" ; @Com = 1
when "S" ; @Com = 2
when "Shift" ; @Com = 3
when "Z" ; @Com = 4
when "X" ; @Com = 5
when "Q" ; @Com = 6
when "W" ; @Com = 7
when "Right" ; @Com = 8
when "Left" ; @Com = 9
when "Down" ; @Com = 10
when "Up" ; @Com = 11
else ; @Com = 12
end
end
#--------------------------------------------------------------------------
# ● check_command
#--------------------------------------------------------------------------
def check_command(com)
if com != -1
right_input = false
@chain_command.each_with_index do |i, index|
if index == @com_index
command_list_check(i) ; right_input = true if @Com == com
end end
else
command_list_check(@com_index) ; right_input = true
end
if right_input
next_command
else
wrong_command(0)
end
end
#--------------------------------------------------------------------------
# ● Next Command
#--------------------------------------------------------------------------
def next_command
@flash.opacity = 255 ; @flash_type = 0 ; @com_index += 1
Audio.se_play("Audio/SE/" + RIGHT_SE, 100, 100)
refresh_button ; refresh_flash
if @com_index == @chain_command.size
@end = true ; @skill_name.bitmap.clear
@skill_name.bitmap.draw_text(0,0,200,32,BLITZ_WORDS[2].to_s,1)
@icon_sprite.visible = false ; $game_temp.blitz_commands[0] = true
end
end
#--------------------------------------------------------------------------
# ● wrong_command
#--------------------------------------------------------------------------
def wrong_command(type)
Audio.se_play("Audio/SE/" + WRONG_SE, 100, 100) ; @flash.opacity = 255
@flash_type = 1 ;@skill_name.bitmap.clear ; @end = true
wname = type == 0 ? BLITZ_WORDS[0] : BLITZ_WORDS[1]
$game_temp.blitz_commands[0] = false
@skill_name.bitmap.draw_text(0,0,200,32,wname.to_s,1)
@icon_sprite.visible = false ; refresh_flash
end
end
# +++ MOG - Blitz Commands (v1.6) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Permite ativar ações através de sequência de comandos.
#==============================================================================
# UTILIZAÇÃO
#==============================================================================
# No banco de dados de habilidades ou itens, coloque o seguinte comentário na
# caixa de notas.
#
# <Blitz Command>
#
# * Lembre-se de definir a sequência de botões no editor de script antes de
# usar a habilidade
#
# Para definir uma velocidade especifica na sequência de botões use o cometário
# abaixo.
#
# <Blitz Speed = X>
#
#==============================================================================
# Arquivos necessários. Graphics/System/
#==============================================================================
#
# Blitz_Background.png
# Blitz_Flash.png
# Blitz_Layout.png
# Blitz_Meter.png
# Chain_Command.png
#
#==============================================================================
# Histórico
#==============================================================================
# v1.6 - Melhoria na codificação.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_blitz_commands] = true
module MOG_BLITZ_COMMANDS
#Definição do tempo para inserir os comandos. (tempo X quantidade de comandos)
DEFAULT_INPUT_DURATION = 30
#==============================================================================
# BLITZ_INPUT = { SKILL_ID => [COMMAND] }
#
# SKILL_ID = ID da habilidade no banco de dados.
# COMMANDS = Defina aqui a sequência de botões.
# (Para fazer a sequência use os comandos abaixo)
#
# "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W"
#
# Exemplo de utilização
#
# BLITZ_INPUT = {
# 25=>["Down","D","S","Right"],
# 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
# 80=>["Shift","D"]
# }
#==============================================================================
BLITZ_INPUT = {
22=>["Left","Up","Right","Down","Up","Down","Left","Right","Z"],
51=>["Up","Down","Left","Right","Z"],
53=>["X","Z","A","S","D"],
61=>["Z","D","X","Right","Left"],
62=>["Right","Left","Right","Q","Z","Z","D","X","Right","Left"],
66=>["Right","Up","Up","Z"],
69=>["X","Right","Left","Z","Z"],
74=>["Down","Right","Down","Right","A"],
999=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
"Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"]
}
#Ativar animação da imagem de fundo.
BACKGROUND_ENABLE = false
#Velocidade de deslize da imagem de fundo.
BACKGROUND_SCROLL_SPEED = [30,0]
#Posição do layout.
BLITZ_POSITION = [0,0]
#Posição do botão.
BUTTON_POSITION = [265,170]
#Posição do medidor de tempo.
METER_POSITION = [63,249]
#Posição do sprite Flash.
FLASH_POSITION = [0,146]
#Posição do ícone.
ICON_POSITION = [0,0]
#Posição do nome da skill
SKILL_NAME_POSITION = [180,140]
#Definição das palavras usadas no sistema blitz.
BLITZ_WORDS = ["Missed!", "Timeover", "Success!"]
#Configuração da fonte.
FONT_SIZE = 22
FONT_COLOR = Color.new(255,255,255)
#Prioridade dos sprites.
BLITZ_Z = 10500
#Som ao acertar.
RIGHT_SE = "Chime1"
#Som ao errar.
WRONG_SE = "Buzzer1"
#Definição do som ao ativar o sistema.
BLITZ_START_SE = "Saint9"
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :blitz_commands
attr_accessor :blitz_commands_phase
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_blits_commands_initialize initialize
def initialize
@blitz_commands = [false,0] ; @blitz_commands_phase = false
mog_blits_commands_initialize
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Use Item
#--------------------------------------------------------------------------
alias mog_blitz_commands_use_item use_item
def use_item
if can_execute_blitz_input?
blitz_before_action
execute_blitz_input
blitz_after_action
unless $game_temp.blitz_commands[1] == nil
return if !$game_temp.blitz_commands[0]
end
end
mog_blitz_commands_use_item
end
#--------------------------------------------------------------------------
# ● Blitz Before Action
#--------------------------------------------------------------------------
def blitz_before_action
record_window_data if $imported[:mog_atb_system]
if $imported[:mog_menu_cursor]
@chain_curor_x = $game_temp.menu_cursor[2]
$game_temp.menu_cursor[2] = -999
force_cursor_visible(false)
end
end
#--------------------------------------------------------------------------
# ● Blitz After ACtion
#--------------------------------------------------------------------------
def blitz_after_action
restore_window_data if $imported[:mog_atb_system]
if $imported[:mog_menu_cursor] and @chain_curor_x != nil
$game_temp.menu_cursor[2] = @chain_curor_x
end
end
#--------------------------------------------------------------------------
# ● Can Execute Blitz Input
#--------------------------------------------------------------------------
def can_execute_blitz_input?
return false if [email protected]_a?(Game_Actor)
return false if @subject.restriction != 0
return true
end
#--------------------------------------------------------------------------
# ● Execute Blitz Input
#--------------------------------------------------------------------------
def execute_blitz_input
$game_temp.blitz_commands[0] = false
action_id = @subject.current_action.item.note =~ /<Blitz Command>/ ? @subject.current_action.item.id : nil
$game_temp.blitz_commands[1] = action_id
return if action_id == nil
blitz_command_sequence = MOG_BLITZ_COMMANDS::BLITZ_INPUT[action_id]
if $imported[:mog_menu_cursor]
valor_x = $game_temp.menu_cursor[2] ; $game_temp.menu_cursor[2] = -999
force_cursor_visible(false)
end
if blitz_command_sequence != nil
blitz_sq = Blitz_Commands.new(blitz_command_sequence, @subject ,action_id)
loop do
$game_temp.blitz_commands_phase = true
(blitz_sq.update ; Input.update) unless @spriteset.animation?
@spriteset.update ; Graphics.update ; update_info_viewport
break if blitz_sq.phase == 9
end
blitz_sq.dispose
end
$game_temp.menu_cursor[2] = valor_x if $imported[:mog_menu_cursor]
$game_temp.blitz_commands_phase = false
end
end
#==============================================================================
# Game Temp
#==============================================================================
class Game_Temp
attr_accessor :cache_blitz_command
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_blitz_command_initialize initialize
def initialize
mog_blitz_command_initialize
cache_blt_cmd
end
#--------------------------------------------------------------------------
# ● Cache Blt Cmd
#--------------------------------------------------------------------------
def cache_blt_cmd
@cache_blitz_command = []
@cache_blitz_command.push(Cache.system("Blitz_Background"))
@cache_blitz_command.push(Cache.system("IconSet"))
@cache_blitz_command.push(Cache.system("Blitz_Flash"))
@cache_blitz_command.push(Cache.system("Blitz_Meter"))
@cache_blitz_command.push(Cache.system("Blitz_Layout"))
@cache_blitz_command.push(Cache.system("Chain_Battle_Command"))
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_blitz_commands_initialize initialize
def initialize
$game_temp.cache_blt_cmd
mog_blitz_commands_initialize
end
end
#==============================================================================
# Blitz Commands
#==============================================================================
class Blitz_Commands
include MOG_BLITZ_COMMANDS
attr_accessor 😛hase
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(sequence, subject,action_id)
@phase = 0 ; @actor = subject ; @skill = $data_skills[action_id]
@skillname = @skill.name ; @action_id = action_id
@chain_command = sequence ; @end = false
duration = @skill.note =~ /<Blitz Speed = (\d+)>/i ? $1.to_i : DEFAULT_INPUT_DURATION
@timer_max = duration * @chain_command.size ; @timer_max = 1 if @timer_max < 1
@timer = @timer_max ; @Com = 0 ; @com_index = 0 ; @new_x = 0
Audio.se_play("Audio/SE/" + BLITZ_START_SE, 100, 100) rescue nil
create_sprites
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites
create_background ; create_layout ; create_buttons ; create_meter
create_flash ; create_skill_name ; create_icon
end
#--------------------------------------------------------------------------
# ● Create Background
#--------------------------------------------------------------------------
def create_background
@background = Plane.new ; @background.opacity = 0
@background.bitmap = $game_temp.cache_blitz_command[0]
@background.z = BLITZ_Z ; @background.visible = BACKGROUND_ENABLE
end
#--------------------------------------------------------------------------
# ● Create Icon
#--------------------------------------------------------------------------
def create_icon
@icon_image = $game_temp.cache_blitz_command[1]
@icon_sprite = Sprite.new ; @icon_sprite.bitmap = Bitmap.new(24,24)
@icon_sprite.z = BLITZ_Z + 3
@org_x2 = 80 + ICON_POSITION[0] - @Center + SKILL_NAME_POSITION[0]
@icon_sprite.x = @org_x2 ; @icon_sprite.opacity = 0
@icon_sprite.y = ICON_POSITION[1] + SKILL_NAME_POSITION[1]
icon_rect = Rect.new(@skill.icon_index % 16 * 24, @skill.icon_index / 16 * 24, 24, 24)
@icon_sprite.bitmap.blt(0,0, @icon_image, icon_rect)
end
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def create_skill_name
@skill_name = Sprite.new ; @skill_name.bitmap = Bitmap.new(200,32)
@skill_name.bitmap.font.size = FONT_SIZE
@skill_name.z = BLITZ_Z + 3 ; @skill_name.y = SKILL_NAME_POSITION[1]
@skill_name.opacity = 0 ; refresh_skill_name
end
#--------------------------------------------------------------------------
# ● Refresh Skill Name
#--------------------------------------------------------------------------
def refresh_skill_name
cm = @skillname.to_s.split(//).size
@Center = ((200 / @skill_name.bitmap.font.size) * cm / 2) + 5
@org_x = SKILL_NAME_POSITION[0] ; @skill_name.x = @org_x
@skill_name.bitmap.font.color = Color.new(0,0,0)
@skill_name.bitmap.draw_text(1,1,200,32,@skillname.to_s,1)
@skill_name.bitmap.font.color = FONT_COLOR
@skill_name.bitmap.draw_text(0,0,200,32,@skillname.to_s,1)
end
#--------------------------------------------------------------------------
# ● Create Flash
#--------------------------------------------------------------------------
def create_flash
@flash_type = 0 ; @flash_image = $game_temp.cache_blitz_command[2]
@flash_cw = @flash_image.width ; @flash_ch = @flash_image.height / 2
@Flash = Sprite.new ; @flash.bitmap = Bitmap.new(@flash_cw,@flash_ch)
@flash.x = FLASH_POSITION[0] ; @flash.y = FLASH_POSITION[1]
@flash.z = BLITZ_Z + 2 ; @flash.opacity = 0 ; @flash.blend_type = 1
refresh_flash
end
#--------------------------------------------------------------------------
# ● Refresh Flash
#--------------------------------------------------------------------------
def refresh_flash
@flash.bitmap.clear
f_scr = Rect.new(0,@flash_type * @flash_ch,@flash_cw,@flash_ch)
@flash.bitmap.blt(0,0,@flash_image,f_scr)
end
#--------------------------------------------------------------------------
# ● Create Meter
#--------------------------------------------------------------------------
def create_meter
@meter_image = $game_temp.cache_blitz_command[3]
@meter_cw = @meter_image.width ; @meter_ch = @meter_image.height
@meter_sprite = Sprite.new
@meter_sprite.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@meter_sprite.x = METER_POSITION[0] ; @meter_sprite.y = METER_POSITION[1]
@meter_sprite.z = BLITZ_Z + 2 ; @meter_sprite.opacity = 0 ; update_meter
end
#--------------------------------------------------------------------------
# ● Update Meter
#--------------------------------------------------------------------------
def update_meter
return if @meter_sprite == nil
@meter_sprite.bitmap.clear ; m_width = @meter_cw * @timer / @timer_max
m_scr = Rect.new(0,0,m_width,@meter_ch)
@meter_sprite.bitmap.blt(0,0,@meter_image, m_scr)
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new ; @layout.bitmap = $game_temp.cache_blitz_command[4]
@layout.x = BLITZ_POSITION[0] ; @layout.y = BLITZ_POSITION[1]
@layout.z = BLITZ_Z + 1 ; @layout.opacity = 0
end
#--------------------------------------------------------------------------
# ● Create Buttons
#--------------------------------------------------------------------------
def create_buttons
@image = $game_temp.cache_blitz_command[5]
@image_cw = @image.width / 13 ; @image_ch = @image.height
@image_cw_max = (@image_cw + 5) * @chain_command.size
@sprite = Sprite.new ; @sprite.bitmap = Bitmap.new(@image_cw_max,@image_ch * 2)
if @chain_command.size <= 15
@sprite.x = (Graphics.width / 2) - ((@image_cw + 5) * @chain_command.size) / 2
@new_x = 0
else
@sprite.x = (Graphics.width / 2) ; @new_x = @sprite.x
end
@sprite.x = BUTTON_POSITION[0] ; @sprite.y = BUTTON_POSITION[1]
@sprite.z = BLITZ_Z + 1 ; @sprite.opacity = 0 ; refresh_button
end
#--------------------------------------------------------------------------
# ● Refresh Button
#--------------------------------------------------------------------------
def refresh_button
return if @sprite == nil
@sprite.bitmap.clear
@chain_command.each_with_index do |i, index|
command_list_check(i)
bitmap_src_rect = Rect.new(@Com * @image_cw, 0, @image_cw, @image_ch)
if @com_index == index
@sprite.bitmap.blt(index * (@image_cw + 5) , 0, @image, bitmap_src_rect)
else
@sprite.bitmap.blt(index * (@image_cw + 5) , @image_ch, @image, bitmap_src_rect)
end
end
@new_x = BUTTON_POSITION[0] - ((@image_cw + 5) * @com_index)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
dispose_background ; dispose_layout ; dispose_buttons ; dispose_meter
dispose_flash ; dispose_name ; dispose_icon_sprite
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
def dispose_background
return if @background == nil
@background.dispose ; @background = nil
end
#--------------------------------------------------------------------------
# ● Dispose Icon Sprite
#--------------------------------------------------------------------------
def dispose_icon_sprite
return if @icon_sprite == nil
@icon_sprite.bitmap.dispose ; @icon_sprite.dispose ; @icon_sprite = nil
end
#--------------------------------------------------------------------------
# ● Dispose Name
#--------------------------------------------------------------------------
def dispose_name
return if @skill_name == nil
@skill_name.bitmap.dispose ; @skill_name.dispose ; @skill_name = nil
end
#--------------------------------------------------------------------------
# ● Dispose Flash
#--------------------------------------------------------------------------
def dispose_flash
return if @Flash == nil
@flash.bitmap.dispose ; @flash.dispose ; @Flash = nil
end
#--------------------------------------------------------------------------
# ● Dispose Meter
#--------------------------------------------------------------------------
def dispose_meter
return if @meter_sprite == nil
@meter_sprite.bitmap.dispose ; @meter_sprite.dispose ; @meter_sprite = nil
end
#--------------------------------------------------------------------------
# ● Dispose Buttons
#--------------------------------------------------------------------------
def dispose_buttons
return if @sprite == nil
@sprite.bitmap.dispose ; @sprite.dispose ; @sprite = nil
end
#--------------------------------------------------------------------------
# ● Dispose Layout
#--------------------------------------------------------------------------
def dispose_layout
return if @layout == nil
@layout.dispose ; @layout = nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
if @end and @sprite.x == @new_x
update_flash ; update_background ; update_end
return
end
update_background ; update_timer ; update_command ; update_slide_command
update_meter ; update_flash ; update_opacity
end
#--------------------------------------------------------------------------
# ● Update Opacity
#--------------------------------------------------------------------------
def update_opacity
return if @sprite.opacity == nil
@sprite.opacity += 10 ; @layout.opacity += 10
@meter_sprite.opacity += 10 ; @skill_name.opacity += 10
@background.opacity += 10 ; @icon_sprite.opacity += 10
end
#--------------------------------------------------------------------------
# ● Update End
#--------------------------------------------------------------------------
def update_end
fs = 6 ; @icon_sprite.opacity -= fs ; @background.opacity -= fs
@skill_name.opacity -= fs ; @sprite.opacity -= fs ; @layout.opacity -= fs
@meter_sprite.opacity -= fs ; @phase = 9 if @background.opacity == 0
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_background
return if @background == nil
@background.ox += BACKGROUND_SCROLL_SPEED[0]
@background.oy += BACKGROUND_SCROLL_SPEED[1]
end
#--------------------------------------------------------------------------
# ● Update Flash
#--------------------------------------------------------------------------
def update_flash
return if @Flash == nil or @flash.opacity == 0
@flash.opacity -= 10
end
#--------------------------------------------------------------------------
# ● Update Timer
#--------------------------------------------------------------------------
def update_timer
return if @timer == 0
@timer -= 1 ; wrong_command(1) if @timer == 0
end
#--------------------------------------------------------------------------
# ● Update Slide Command
#--------------------------------------------------------------------------
def update_slide_command
return if @sprite == nil or @sprite.x == @new_x
slide_speed = 5 + ((@sprite.x - @new_x).abs / 5)
@sprite.x -= slide_speed ; @sprite.x = @new_x if @sprite.x < @new_x
end
end
#==============================================================================
# Blitz Commands
#==============================================================================
class Blitz_Commands
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
return if @end
if Input.trigger?(Input::X) ; check_command(0)
elsif Input.trigger?🙂Z) ; check_command(1)
elsif Input.trigger?🙂Y) ; check_command(2)
elsif Input.trigger?🙂A) ; check_command(3)
elsif Input.trigger?🙂C) ; check_command(4)
elsif Input.trigger?🙂😎 ; check_command(5)
elsif Input.trigger?🙂L) ; check_command(6)
elsif Input.trigger?🙂R) ; check_command(7)
elsif Input.trigger?🙂RIGHT) ; check_command(8)
elsif Input.trigger?🙂LEFT) ; check_command(9)
elsif Input.trigger?🙂DOWN) ; check_command(10)
elsif Input.trigger?🙂UP) ; check_command(11)
end
end
#--------------------------------------------------------------------------
# ● command_list_check
#--------------------------------------------------------------------------
def command_list_check(command)
case command
when "A" ; @Com = 0
when "D" ; @Com = 1
when "S" ; @Com = 2
when "Shift" ; @Com = 3
when "Z" ; @Com = 4
when "X" ; @Com = 5
when "Q" ; @Com = 6
when "W" ; @Com = 7
when "Right" ; @Com = 8
when "Left" ; @Com = 9
when "Down" ; @Com = 10
when "Up" ; @Com = 11
else ; @Com = 12
end
end
#--------------------------------------------------------------------------
# ● check_command
#--------------------------------------------------------------------------
def check_command(com)
if com != -1
right_input = false
@chain_command.each_with_index do |i, index|
if index == @com_index
command_list_check(i) ; right_input = true if @Com == com
end end
else
command_list_check(@com_index) ; right_input = true
end
if right_input
next_command
else
wrong_command(0)
end
end
#--------------------------------------------------------------------------
# ● Next Command
#--------------------------------------------------------------------------
def next_command
@flash.opacity = 255 ; @flash_type = 0 ; @com_index += 1
Audio.se_play("Audio/SE/" + RIGHT_SE, 100, 100)
refresh_button ; refresh_flash
if @com_index == @chain_command.size
@end = true ; @skill_name.bitmap.clear
@skill_name.bitmap.draw_text(0,0,200,32,BLITZ_WORDS[2].to_s,1)
@icon_sprite.visible = false ; $game_temp.blitz_commands[0] = true
end
end
#--------------------------------------------------------------------------
# ● wrong_command
#--------------------------------------------------------------------------
def wrong_command(type)
Audio.se_play("Audio/SE/" + WRONG_SE, 100, 100) ; @flash.opacity = 255
@flash_type = 1 ;@skill_name.bitmap.clear ; @end = true
wname = type == 0 ? BLITZ_WORDS[0] : BLITZ_WORDS[1]
$game_temp.blitz_commands[0] = false
@skill_name.bitmap.draw_text(0,0,200,32,wname.to_s,1)
@icon_sprite.visible = false ; refresh_flash
end
end
#===============================================================================
# +++ MOG - Chain Commands (v1.4) +++
#===============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#===============================================================================
# Sistema de sequência de botões para ativar switchs.
#
# Serão necessárias as seguintes imagens. (Graphics/System)
#
# Chain_Cursor.png
# Chain_Command.png
# Chain_Layout.png
# Chain_Timer_Layout.png
# Chain_Timer_Meter.png
#
#===============================================================================
#
# Para ativar o script use o comando abaixo. (*Call Script)
#
# chain_commands(ID)
#
# ID - Id da switch.
#
#===============================================================================
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 1.4 - Correção do crash aleatório.
# v 1.3 - Melhoria no sistema de dispose
# v 1.2 - Melhoria na codificação e correção de alguns glitches.
# v 1.1 - Animação de fade ao sair da cena de chain.
# - Opção de definir a prioridade da hud na tela.
#==============================================================================
module MOG_CHAIN_COMMANDS
#==============================================================================
# CHAIN_COMMAND = { SWITCH_ID => [COMMAND] }
#
# SWITCH_ID = ID da switch
# COMMANDS = Defina aqui a sequência de botões.
# (Para fazer a sequência use os comandos abaixo)
#
# "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W"
#
# Exemplo de utilização
#
# CHAIN_SWITCH_COMMAND = {
# 25=>["Down","D","S","Right"],
# 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
# 80=>["Shift","D"]
# }
#==============================================================================
CHAIN_SWITCH_COMMAND = {
5=>["X","Right","Left","Z","Z"],
6=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
"Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"],
8=>["Up","Down","Left","Right","Z"]
}
#Duração para colocar os comandos. (A duração é multiplicado pela quantidade
#de comandos) *60 = 1 sec
CHAIN_INPUT_DURATION = 30
#Som ao acertar.
CHAIN_RIGHT_SE = "Chime1"
#Som ao errar.
CHAIN_WRONG_SE = "Buzzer1"
#Switch que ativa o modo automático.
CHAIN_AUTOMATIC_MODE_SWITCH_ID = 20
#Definição da prioridade da hud na tela
CHAIN_HUD_Z = 300
end
#===============================================================================
# ■ Chain Commands
#===============================================================================
class Chain_Commands
include MOG_CHAIN_COMMANDS
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
@action_id = $game_temp.chain_switch_id
@chain_command = CHAIN_SWITCH_COMMAND[@action_id]
@chain_command = ["?"] if @chain_command == nil
duration = [[CHAIN_INPUT_DURATION, 1].max, 9999].min
@timer_max = duration * @chain_command.size
@timer = @timer_max
@slide_time = [[60 / duration, 10].max, 60].min
@change_time = 0
if $game_switches[CHAIN_AUTOMATIC_MODE_SWITCH_ID]
@auto = true
else
@auto = false
end
@Com = 0
end
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
dispose
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap2
create_chain_command
create_cusrsor
create_layout
create_meter
create_text
create_number
Graphics.transition
loop do
Graphics.update
Input.update
update
break if SceneManager.scene != self
end
dispose
end
#--------------------------------------------------------------------------
# ● Create Cursor
#--------------------------------------------------------------------------
def create_cusrsor
@fy_time = 0
@Fy = 0
@com_index = 0
@cursor = Sprite.new
@cursor.bitmap = Cache.system("Chain_Cursor")
@cursor.z = 4 + CHAIN_HUD_Z
@cursor_space = ((@bitmap_cw + 5) * @chain_command.size) / 2
if @chain_command.size <= 20
@cursor.x = (544 / 2) - @cursor_space + @cursor_space * @com_index
else
@cursor.x = (544 / 2)
end
@cursor.y = (416 / 2) + 30
end
#--------------------------------------------------------------------------
# ● Create Chain Command
#--------------------------------------------------------------------------
def create_chain_command
@image = Cache.system("Chain_Command")
width_max = ((@image.width / 13) + 5) * @chain_command.size
@bitmap = Bitmap.new(width_max,@image.height * 2)
@bitmap_cw = @image.width / 13
@bitmap_ch = @image.height
index = 0
for i in @chain_command
command_list_check(i)
bitmap_src_rect = Rect.new(@Com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
if index == 0
@bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
else
@bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch, @image, bitmap_src_rect)
end
index += 1
end
@sprite = Sprite.new
@sprite.bitmap = @bitmap
if @chain_command.size <= 15
@sprite.x = (544 / 2) - ((@bitmap_cw + 5) * @chain_command.size) / 2
@new_x = 0
else
@sprite.x = (544 / 2)
@new_x = @sprite.x
end
@sprite.y = (416 / 2) + 30 - @bitmap_ch - 15
@sprite.z = 3 + CHAIN_HUD_Z
@sprite.zoom_x = 1.5
@sprite.zoom_y = 1.5
end
#--------------------------------------------------------------------------
# * create_layout
#--------------------------------------------------------------------------
def create_layout
@back = Plane.new
@back.bitmap = Cache.system("Chain_Layout")
@back.z = 0
@layout = Sprite.new
@layout.bitmap = Cache.system("Chain_Timer_Layout")
@layout.z = 1 + CHAIN_HUD_Z
@layout.x = 160
@layout.y = 150
end
#--------------------------------------------------------------------------
# * create_meter
#--------------------------------------------------------------------------
def create_meter
@meter_flow = 0
@meter_image = Cache.system("Chain_Timer_Meter")
@meter_bitmap = Bitmap.new(@meter_image.width,@meter_image.height)
@meter_range = @meter_image.width / 3
@meter_width = @meter_range * @timer / @timer_max
@meter_height = @meter_image.height
@meter_src_rect = Rect.new(@meter_range, 0, @meter_width, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
@meter_sprite = Sprite.new
@meter_sprite.bitmap = @meter_bitmap
@meter_sprite.z = 2 + CHAIN_HUD_Z
@meter_sprite.x = 220
@meter_sprite.y = 159
update_flow
end
#--------------------------------------------------------------------------
# ● Create Text
#--------------------------------------------------------------------------
def create_text
@text = Sprite.new
@text.bitmap = Bitmap.new(200,32)
@text.z = 2 + CHAIN_HUD_Z
@text.bitmap.font.name = "Georgia"
@text.bitmap.font.size = 25
@text.bitmap.font.bold = true
@text.bitmap.font.italic = true
@text.bitmap.font.color.set(255, 255, 255,220)
@text.x = 230
@text.y = 100
end
#--------------------------------------------------------------------------
# ● Create Number
#--------------------------------------------------------------------------
def create_number
@combo = 0
@Number = Sprite.new
@number.bitmap = Bitmap.new(200,64)
@number.z = 2 + CHAIN_HUD_Z
@number.bitmap.font.name = "Arial"
@number.bitmap.font.size = 24
@number.bitmap.font.bold = true
@number.bitmap.font.color.set(0, 255, 255,200)
@number.bitmap.draw_text(0, 0, 200, 32, "Ready",1)
@number.x = 30
@number.y = 100
end
#--------------------------------------------------------------------------
# ● Pre Dispose
#--------------------------------------------------------------------------
def exit
loop do
Graphics.update
@sprite.x += 5
@layout.x -= 5
@meter_sprite.x -= 5
@text.x -= 2
@text.opacity -= 5
@sprite.opacity -= 5
@layout.opacity -= 5
@meter_sprite.opacity -= 5
@number.opacity -= 5
@back.opacity -= 5
@cursor.visible = false
break if @sprite.opacity == 0
end
SceneManager.call(Scene_Map)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
return if @layout == nil
Graphics.freeze
@background_sprite.bitmap.dispose
@background_sprite.dispose
@bitmap.dispose
@sprite.bitmap.dispose
@sprite.dispose
@cursor.bitmap.dispose
@cursor.dispose
@meter_image.dispose
@meter_bitmap.dispose
@meter_sprite.bitmap.dispose
@meter_sprite.dispose
@layout.bitmap.dispose
@layout.dispose
@layout = nil
@back.bitmap.dispose
@back.dispose
@text.bitmap.dispose
@text.dispose
@number.bitmap.dispose
@number.dispose
@image.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_command
update_cursor_slide
update_flow
update_change_time
end
#--------------------------------------------------------------------------
# ● Change_Time
#--------------------------------------------------------------------------
def update_change_time
return unless @auto
@change_time += 1
check_command(-1) if @change_time >= CHAIN_INPUT_DURATION - 1
end
#--------------------------------------------------------------------------
# ● Update Flow
#--------------------------------------------------------------------------
def update_flow
@timer -= 1
@meter_sprite.bitmap.clear
@meter_width = @meter_range * @timer / @timer_max
@meter_src_rect = Rect.new(@meter_flow, 0, @meter_width, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
@meter_flow += 20
@meter_flow = 0 if @meter_flow >= @meter_image.width - @meter_range
wrong_command if @timer == 0 and @auto == false
end
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
return if @auto
if Input.trigger?(Input::X)
check_command(0)
elsif Input.trigger?(Input::Z)
check_command(1)
elsif Input.trigger?(Input::Y)
check_command(2)
elsif Input.trigger?(Input::A)
check_command(3)
elsif Input.trigger?(Input::C)
check_command(4)
elsif Input.trigger?(Input::😎
check_command(5)
elsif Input.trigger?(Input::L)
check_command(6)
elsif Input.trigger?(Input::R)
check_command(7)
elsif Input.trigger?(Input::RIGHT)
check_command(8)
elsif Input.trigger?(Input::LEFT)
check_command(9)
elsif Input.trigger?(Input:😀OWN)
check_command(10)
elsif Input.trigger?(Input::UP)
check_command(11)
end
end
#--------------------------------------------------------------------------
# ● command_list_check
#--------------------------------------------------------------------------
def command_list_check(command)
case command
when "A"
@Com = 0
when "D"
@Com = 1
when "S"
@Com = 2
when "Shift"
@Com = 3
when "Z"
@Com = 4
when "X"
@Com = 5
when "Q"
@Com = 6
when "W"
@Com = 7
when "Right"
@Com = 8
when "Left"
@Com = 9
when "Down"
@Com = 10
when "Up"
@Com = 11
else
@Com = 12
end
end
#--------------------------------------------------------------------------
# ● check_command
#--------------------------------------------------------------------------
def check_command(com)
index = 0
if com != -1
right_input = false
for i in @chain_command
if index == @com_index
command_list_check(i)
right_input = true if @Com == com
end
index += 1
end
else
command_list_check(@com_index)
@change_time = 0
right_input = true
end
if right_input
refresh_number
next_command
else
wrong_command
end
end
#--------------------------------------------------------------------------
# ● Next Command
#--------------------------------------------------------------------------
def next_command
@com_index += 1
Audio.se_play("Audio/SE/" + CHAIN_RIGHT_SE, 100, 100)
if @com_index == @chain_command.size
$game_switches[@action_id] = true
exit
$game_map.need_refresh = true
end
refresh_command
refresh_text(0)
end
#--------------------------------------------------------------------------
# ● wrong_command
#--------------------------------------------------------------------------
def wrong_command
Audio.se_play("Audio/SE/" + CHAIN_WRONG_SE, 100, 100)
refresh_text(1)
exit
$game_player.jump(0,0)
end
#--------------------------------------------------------------------------
# ● Refresh Command
#--------------------------------------------------------------------------
def refresh_command
@sprite.bitmap.clear
index = 0
for i in @chain_command
command_list_check(i)
bitmap_src_rect = Rect.new(@Com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
if @com_index == index
@bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
else
@bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch, @image, bitmap_src_rect)
end
index += 1
end
if @chain_command.size > 15
@new_x = (544 / 2) - ((@bitmap_cw + 5) * @com_index)
else
@cursor.x = (544 / 2) - @cursor_space + ((@bitmap_cw + 5) * @com_index)
end
end
#--------------------------------------------------------------------------
# ● Refresh Text
#--------------------------------------------------------------------------
def refresh_text(type)
@text.bitmap.clear
if type == 0
if @com_index == @chain_command.size
@text.bitmap.font.color.set(55, 255, 55,220)
@text.bitmap.draw_text(0, 0, 200, 32, "Perfect!",1)
else
@text.bitmap.font.color.set(55, 155, 255,220)
@text.bitmap.draw_text(0, 0, 200, 32, "Success!",1)
end
else
@text.bitmap.font.color.set(255, 155, 55,220)
if @timer == 0
@text.bitmap.draw_text(0, 0, 200, 32, "Time Limit!",1)
else
@text.bitmap.draw_text(0, 0, 200, 32, "Fail!",1)
end
end
@text.x = 230
@text.opacity = 255
end
#--------------------------------------------------------------------------
# ● Refresh Number
#--------------------------------------------------------------------------
def refresh_number
@combo += 1
@number.bitmap.clear
@number.bitmap.font.size = 34
@number.bitmap.draw_text(0, 0, 200, 32, @combo.to_s,1)
@number.opacity = 255
@number.zoom_x = 2
@number.zoom_y = 2
end
#--------------------------------------------------------------------------
# ● Update Cursor Slide
#--------------------------------------------------------------------------
def update_cursor_slide
@sprite.zoom_x -= 0.1 if @sprite.zoom_x > 1
@sprite.zoom_y -= 0.1 if @sprite.zoom_y > 1
@text.x -= 2 if @text.x > 210
@text.opacity -= 5 if @text.opacity > 0
@sprite.x -= @slide_time if @sprite.x > @new_x and @chain_command.size > 15
if @number.zoom_x > 1
@number.zoom_x -= 0.1
@number.zoom_y -= 0.1
end
if @fy_time > 15
@Fy += 1
elsif @fy_time > 0
@Fy -= 1
else
@Fy = 0
@fy_time = 30
end
@fy_time -= 1
@cursor.oy = @Fy
end
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :chain_switch_id
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_chain_commands_initialize initialize
def initialize
@chain_switch_id = 0
mog_chain_commands_initialize
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● Chain Commands
#--------------------------------------------------------------------------
def chain_commands(switch_id = 0)
return if switch_id <= 0
$game_temp.chain_switch_id = switch_id
SceneManager.call(Chain_Commands)
wait(1)
end
end
#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
@background_bitmap2 = nil
#--------------------------------------------------------------------------
# ● Snapshot For Background2
#--------------------------------------------------------------------------
def snapshot_for_background2
@background_bitmap2.dispose if @background_bitmap2
@background_bitmap2 = Graphics.snap_to_bitmap
end
#--------------------------------------------------------------------------
# ● Background Bitmap2
#--------------------------------------------------------------------------
def background_bitmap2
@background_bitmap2
end
end
#===============================================================================
# ■ Scene Map
#===============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_chain_commands_terminate terminate
def terminate
SceneManager.snapshot_for_background2
mog_chain_commands_terminate
end
end
$mog_rgss3_chain_commands = true
# +++ MOG - Chain Commands (v1.4) +++
#===============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#===============================================================================
# Sistema de sequência de botões para ativar switchs.
#
# Serão necessárias as seguintes imagens. (Graphics/System)
#
# Chain_Cursor.png
# Chain_Command.png
# Chain_Layout.png
# Chain_Timer_Layout.png
# Chain_Timer_Meter.png
#
#===============================================================================
#
# Para ativar o script use o comando abaixo. (*Call Script)
#
# chain_commands(ID)
#
# ID - Id da switch.
#
#===============================================================================
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 1.4 - Correção do crash aleatório.
# v 1.3 - Melhoria no sistema de dispose
# v 1.2 - Melhoria na codificação e correção de alguns glitches.
# v 1.1 - Animação de fade ao sair da cena de chain.
# - Opção de definir a prioridade da hud na tela.
#==============================================================================
module MOG_CHAIN_COMMANDS
#==============================================================================
# CHAIN_COMMAND = { SWITCH_ID => [COMMAND] }
#
# SWITCH_ID = ID da switch
# COMMANDS = Defina aqui a sequência de botões.
# (Para fazer a sequência use os comandos abaixo)
#
# "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W"
#
# Exemplo de utilização
#
# CHAIN_SWITCH_COMMAND = {
# 25=>["Down","D","S","Right"],
# 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
# 80=>["Shift","D"]
# }
#==============================================================================
CHAIN_SWITCH_COMMAND = {
5=>["X","Right","Left","Z","Z"],
6=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
"Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"],
8=>["Up","Down","Left","Right","Z"]
}
#Duração para colocar os comandos. (A duração é multiplicado pela quantidade
#de comandos) *60 = 1 sec
CHAIN_INPUT_DURATION = 30
#Som ao acertar.
CHAIN_RIGHT_SE = "Chime1"
#Som ao errar.
CHAIN_WRONG_SE = "Buzzer1"
#Switch que ativa o modo automático.
CHAIN_AUTOMATIC_MODE_SWITCH_ID = 20
#Definição da prioridade da hud na tela
CHAIN_HUD_Z = 300
end
#===============================================================================
# ■ Chain Commands
#===============================================================================
class Chain_Commands
include MOG_CHAIN_COMMANDS
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
@action_id = $game_temp.chain_switch_id
@chain_command = CHAIN_SWITCH_COMMAND[@action_id]
@chain_command = ["?"] if @chain_command == nil
duration = [[CHAIN_INPUT_DURATION, 1].max, 9999].min
@timer_max = duration * @chain_command.size
@timer = @timer_max
@slide_time = [[60 / duration, 10].max, 60].min
@change_time = 0
if $game_switches[CHAIN_AUTOMATIC_MODE_SWITCH_ID]
@auto = true
else
@auto = false
end
@Com = 0
end
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
dispose
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap2
create_chain_command
create_cusrsor
create_layout
create_meter
create_text
create_number
Graphics.transition
loop do
Graphics.update
Input.update
update
break if SceneManager.scene != self
end
dispose
end
#--------------------------------------------------------------------------
# ● Create Cursor
#--------------------------------------------------------------------------
def create_cusrsor
@fy_time = 0
@Fy = 0
@com_index = 0
@cursor = Sprite.new
@cursor.bitmap = Cache.system("Chain_Cursor")
@cursor.z = 4 + CHAIN_HUD_Z
@cursor_space = ((@bitmap_cw + 5) * @chain_command.size) / 2
if @chain_command.size <= 20
@cursor.x = (544 / 2) - @cursor_space + @cursor_space * @com_index
else
@cursor.x = (544 / 2)
end
@cursor.y = (416 / 2) + 30
end
#--------------------------------------------------------------------------
# ● Create Chain Command
#--------------------------------------------------------------------------
def create_chain_command
@image = Cache.system("Chain_Command")
width_max = ((@image.width / 13) + 5) * @chain_command.size
@bitmap = Bitmap.new(width_max,@image.height * 2)
@bitmap_cw = @image.width / 13
@bitmap_ch = @image.height
index = 0
for i in @chain_command
command_list_check(i)
bitmap_src_rect = Rect.new(@Com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
if index == 0
@bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
else
@bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch, @image, bitmap_src_rect)
end
index += 1
end
@sprite = Sprite.new
@sprite.bitmap = @bitmap
if @chain_command.size <= 15
@sprite.x = (544 / 2) - ((@bitmap_cw + 5) * @chain_command.size) / 2
@new_x = 0
else
@sprite.x = (544 / 2)
@new_x = @sprite.x
end
@sprite.y = (416 / 2) + 30 - @bitmap_ch - 15
@sprite.z = 3 + CHAIN_HUD_Z
@sprite.zoom_x = 1.5
@sprite.zoom_y = 1.5
end
#--------------------------------------------------------------------------
# * create_layout
#--------------------------------------------------------------------------
def create_layout
@back = Plane.new
@back.bitmap = Cache.system("Chain_Layout")
@back.z = 0
@layout = Sprite.new
@layout.bitmap = Cache.system("Chain_Timer_Layout")
@layout.z = 1 + CHAIN_HUD_Z
@layout.x = 160
@layout.y = 150
end
#--------------------------------------------------------------------------
# * create_meter
#--------------------------------------------------------------------------
def create_meter
@meter_flow = 0
@meter_image = Cache.system("Chain_Timer_Meter")
@meter_bitmap = Bitmap.new(@meter_image.width,@meter_image.height)
@meter_range = @meter_image.width / 3
@meter_width = @meter_range * @timer / @timer_max
@meter_height = @meter_image.height
@meter_src_rect = Rect.new(@meter_range, 0, @meter_width, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
@meter_sprite = Sprite.new
@meter_sprite.bitmap = @meter_bitmap
@meter_sprite.z = 2 + CHAIN_HUD_Z
@meter_sprite.x = 220
@meter_sprite.y = 159
update_flow
end
#--------------------------------------------------------------------------
# ● Create Text
#--------------------------------------------------------------------------
def create_text
@text = Sprite.new
@text.bitmap = Bitmap.new(200,32)
@text.z = 2 + CHAIN_HUD_Z
@text.bitmap.font.name = "Georgia"
@text.bitmap.font.size = 25
@text.bitmap.font.bold = true
@text.bitmap.font.italic = true
@text.bitmap.font.color.set(255, 255, 255,220)
@text.x = 230
@text.y = 100
end
#--------------------------------------------------------------------------
# ● Create Number
#--------------------------------------------------------------------------
def create_number
@combo = 0
@Number = Sprite.new
@number.bitmap = Bitmap.new(200,64)
@number.z = 2 + CHAIN_HUD_Z
@number.bitmap.font.name = "Arial"
@number.bitmap.font.size = 24
@number.bitmap.font.bold = true
@number.bitmap.font.color.set(0, 255, 255,200)
@number.bitmap.draw_text(0, 0, 200, 32, "Ready",1)
@number.x = 30
@number.y = 100
end
#--------------------------------------------------------------------------
# ● Pre Dispose
#--------------------------------------------------------------------------
def exit
loop do
Graphics.update
@sprite.x += 5
@layout.x -= 5
@meter_sprite.x -= 5
@text.x -= 2
@text.opacity -= 5
@sprite.opacity -= 5
@layout.opacity -= 5
@meter_sprite.opacity -= 5
@number.opacity -= 5
@back.opacity -= 5
@cursor.visible = false
break if @sprite.opacity == 0
end
SceneManager.call(Scene_Map)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
return if @layout == nil
Graphics.freeze
@background_sprite.bitmap.dispose
@background_sprite.dispose
@bitmap.dispose
@sprite.bitmap.dispose
@sprite.dispose
@cursor.bitmap.dispose
@cursor.dispose
@meter_image.dispose
@meter_bitmap.dispose
@meter_sprite.bitmap.dispose
@meter_sprite.dispose
@layout.bitmap.dispose
@layout.dispose
@layout = nil
@back.bitmap.dispose
@back.dispose
@text.bitmap.dispose
@text.dispose
@number.bitmap.dispose
@number.dispose
@image.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_command
update_cursor_slide
update_flow
update_change_time
end
#--------------------------------------------------------------------------
# ● Change_Time
#--------------------------------------------------------------------------
def update_change_time
return unless @auto
@change_time += 1
check_command(-1) if @change_time >= CHAIN_INPUT_DURATION - 1
end
#--------------------------------------------------------------------------
# ● Update Flow
#--------------------------------------------------------------------------
def update_flow
@timer -= 1
@meter_sprite.bitmap.clear
@meter_width = @meter_range * @timer / @timer_max
@meter_src_rect = Rect.new(@meter_flow, 0, @meter_width, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
@meter_flow += 20
@meter_flow = 0 if @meter_flow >= @meter_image.width - @meter_range
wrong_command if @timer == 0 and @auto == false
end
#--------------------------------------------------------------------------
# ● Update Command
#--------------------------------------------------------------------------
def update_command
return if @auto
if Input.trigger?(Input::X)
check_command(0)
elsif Input.trigger?(Input::Z)
check_command(1)
elsif Input.trigger?(Input::Y)
check_command(2)
elsif Input.trigger?(Input::A)
check_command(3)
elsif Input.trigger?(Input::C)
check_command(4)
elsif Input.trigger?(Input::😎
check_command(5)
elsif Input.trigger?(Input::L)
check_command(6)
elsif Input.trigger?(Input::R)
check_command(7)
elsif Input.trigger?(Input::RIGHT)
check_command(8)
elsif Input.trigger?(Input::LEFT)
check_command(9)
elsif Input.trigger?(Input:😀OWN)
check_command(10)
elsif Input.trigger?(Input::UP)
check_command(11)
end
end
#--------------------------------------------------------------------------
# ● command_list_check
#--------------------------------------------------------------------------
def command_list_check(command)
case command
when "A"
@Com = 0
when "D"
@Com = 1
when "S"
@Com = 2
when "Shift"
@Com = 3
when "Z"
@Com = 4
when "X"
@Com = 5
when "Q"
@Com = 6
when "W"
@Com = 7
when "Right"
@Com = 8
when "Left"
@Com = 9
when "Down"
@Com = 10
when "Up"
@Com = 11
else
@Com = 12
end
end
#--------------------------------------------------------------------------
# ● check_command
#--------------------------------------------------------------------------
def check_command(com)
index = 0
if com != -1
right_input = false
for i in @chain_command
if index == @com_index
command_list_check(i)
right_input = true if @Com == com
end
index += 1
end
else
command_list_check(@com_index)
@change_time = 0
right_input = true
end
if right_input
refresh_number
next_command
else
wrong_command
end
end
#--------------------------------------------------------------------------
# ● Next Command
#--------------------------------------------------------------------------
def next_command
@com_index += 1
Audio.se_play("Audio/SE/" + CHAIN_RIGHT_SE, 100, 100)
if @com_index == @chain_command.size
$game_switches[@action_id] = true
exit
$game_map.need_refresh = true
end
refresh_command
refresh_text(0)
end
#--------------------------------------------------------------------------
# ● wrong_command
#--------------------------------------------------------------------------
def wrong_command
Audio.se_play("Audio/SE/" + CHAIN_WRONG_SE, 100, 100)
refresh_text(1)
exit
$game_player.jump(0,0)
end
#--------------------------------------------------------------------------
# ● Refresh Command
#--------------------------------------------------------------------------
def refresh_command
@sprite.bitmap.clear
index = 0
for i in @chain_command
command_list_check(i)
bitmap_src_rect = Rect.new(@Com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
if @com_index == index
@bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
else
@bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch, @image, bitmap_src_rect)
end
index += 1
end
if @chain_command.size > 15
@new_x = (544 / 2) - ((@bitmap_cw + 5) * @com_index)
else
@cursor.x = (544 / 2) - @cursor_space + ((@bitmap_cw + 5) * @com_index)
end
end
#--------------------------------------------------------------------------
# ● Refresh Text
#--------------------------------------------------------------------------
def refresh_text(type)
@text.bitmap.clear
if type == 0
if @com_index == @chain_command.size
@text.bitmap.font.color.set(55, 255, 55,220)
@text.bitmap.draw_text(0, 0, 200, 32, "Perfect!",1)
else
@text.bitmap.font.color.set(55, 155, 255,220)
@text.bitmap.draw_text(0, 0, 200, 32, "Success!",1)
end
else
@text.bitmap.font.color.set(255, 155, 55,220)
if @timer == 0
@text.bitmap.draw_text(0, 0, 200, 32, "Time Limit!",1)
else
@text.bitmap.draw_text(0, 0, 200, 32, "Fail!",1)
end
end
@text.x = 230
@text.opacity = 255
end
#--------------------------------------------------------------------------
# ● Refresh Number
#--------------------------------------------------------------------------
def refresh_number
@combo += 1
@number.bitmap.clear
@number.bitmap.font.size = 34
@number.bitmap.draw_text(0, 0, 200, 32, @combo.to_s,1)
@number.opacity = 255
@number.zoom_x = 2
@number.zoom_y = 2
end
#--------------------------------------------------------------------------
# ● Update Cursor Slide
#--------------------------------------------------------------------------
def update_cursor_slide
@sprite.zoom_x -= 0.1 if @sprite.zoom_x > 1
@sprite.zoom_y -= 0.1 if @sprite.zoom_y > 1
@text.x -= 2 if @text.x > 210
@text.opacity -= 5 if @text.opacity > 0
@sprite.x -= @slide_time if @sprite.x > @new_x and @chain_command.size > 15
if @number.zoom_x > 1
@number.zoom_x -= 0.1
@number.zoom_y -= 0.1
end
if @fy_time > 15
@Fy += 1
elsif @fy_time > 0
@Fy -= 1
else
@Fy = 0
@fy_time = 30
end
@fy_time -= 1
@cursor.oy = @Fy
end
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :chain_switch_id
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_chain_commands_initialize initialize
def initialize
@chain_switch_id = 0
mog_chain_commands_initialize
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● Chain Commands
#--------------------------------------------------------------------------
def chain_commands(switch_id = 0)
return if switch_id <= 0
$game_temp.chain_switch_id = switch_id
SceneManager.call(Chain_Commands)
wait(1)
end
end
#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
@background_bitmap2 = nil
#--------------------------------------------------------------------------
# ● Snapshot For Background2
#--------------------------------------------------------------------------
def snapshot_for_background2
@background_bitmap2.dispose if @background_bitmap2
@background_bitmap2 = Graphics.snap_to_bitmap
end
#--------------------------------------------------------------------------
# ● Background Bitmap2
#--------------------------------------------------------------------------
def background_bitmap2
@background_bitmap2
end
end
#===============================================================================
# ■ Scene Map
#===============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_chain_commands_terminate terminate
def terminate
SceneManager.snapshot_for_background2
mog_chain_commands_terminate
end
end
$mog_rgss3_chain_commands = true