Envision, Create, Share

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

blitz/input button problem

Script Title:
"Tactical skill" by Claimh (blitz skill)
RMXP or RMVX:
RMXP
Detailed Description:
When i use a skill, i'm supposed to see the combination of the buttons that I have to press to execute this skill during the fight but it doesn't show up...:(
So i wanted to know if someone can solve my problem and modify the script (cause i don't know nothing about ruby ^^) so it will work.
thx for the future answers ;)
Here is the script that i use
Code:
#==============================================================================

# ■ Tactical Skills Ver.1.4.0          by Claimh

#------------------------------------------------------------------------------

# Skill is made to move with command input.

# When it fails in command input, power decrease (& animation change)

#==============================================================================

 

module TacticalSkill

#==============================================================================

# â–¡ Customizing START

#==============================================================================

  # Keys

  A = Input::A            # Keyboard:Z

  B = Input::B            # Keyboard:X

  C = Input::C            # Keyboard:C

  X = Input::X            # Keyboard:A

  Y = Input::Y            # Keyboard:S

  Z = Input::Z            # Keyboard:D

  L = Input::L            # Keyboard:Q

  R = Input::R            # Keyboard:W

  UP = Input::UP

  DOWN = Input::DOWN

  LEFT = Input::LEFT

  RIGHT = Input::RIGHT

 

  # Time to input a key

  KEY_SEC = 1.0

 

  # Graphics/Windowskins

  T_BAR_NAME = "bar"

 

  # キータイプを切り替えるスイッチID(表示の切り替えが出来ます)

  # I'm not entirely sure, but I think this switches it from keyboard input to gamepad input.

  #   ON  (Gamepad)

  # OFF (Keyboard)

  KEY_TYPE_ID = 4

 

  # Allow skills that will attack all enemies when completed

  ALL_ATK = true

  # Skills that, when completed, will attack all enemies

  ALL_ATK_SK = [57, 61]

 

  # Skill Settings

  T_SKILL = {

    #SkillID => [[Key1,Key2,etc],Percent(%)(,Fail AnimationID)]

        1 => [[UP,RIGHT,RIGHT,UP], 15],

        7 => [[UP,DOWN,UP,UP,DOWN,UP], 0],

        8 => [[X,C,Z], 50],

        9 => [[DOWN,X,A,B], 50],

        10 => [[LEFT,UP], 50],

        11 => [[L,X,R], 50],

        12 => [[X,C,RIGHT,R], 50],

        13 => [[UP,RIGHT], 50],

        14 => [[L,Z,A], 50],

        15 => [[R,X,X,DOWN], 50],

        16 => [[DOWN, RIGHT], 50],

        17 => [[A,B,C], 50],

        18 => [[Y,X,DOWN,B], 50],

        19 => [[LEFT,DOWN], 50],

        20 => [[Z,Y,A], 50],

        21 => [[B,C,X,L], 50],

        22 => [[RIGHT,DOWN], 50],

        23 => [[A,B,R], 50],

        24 => [[X,Y,LEFT,R], 50],

        25 => [[LEFT,RIGHT], 50],

        26 => [[X,L,B], 50],

        27 => [[LEFT,X,C,Z], 50],

        28 => [[LEFT,DOWN], 50],

        29 => [[C,X,A], 50],

        30 => [[X,Z,C,UP], 50],

        31 => [[UP,DOWN,X], 0],

        32 => [[LEFT,RIGHT,L,R], 50],

        57 => [[A, C], 12],

        58 => [[C, X, UP], 50],

        59 => [[A, UP, RIGHT, A], 50],

        60 => [[Z, C, A, B], 50],

        61 => [[X, C], 23],

        62 => [[UP, X, DOWN], 50],

        63 => [[LEFT, C, Y, A], 50],

        64 => [[X, C, Y, A], 50],

        65 => [[Y, A], 50],

        66 => [[RIGHT, B, A], 50],

        67 => [[LEFT, UP, Z, A], 50],

        68 => [[Y, B, Y, A], 50],

        69 => [[LEFT, A], 50],

        70 => [[A, C, A], 50],

        71 => [[B, B, A, A], 50],

        72 => [[A, B, X, Y], 50],

        73 => [[X, A], 50],

        74 => [[Y, A, B], 50],

        75 => [[LEFT, RIGHT, Y, A], 50],

        76 => [[A, C, L, A], 50],

        77 => [[R, X], 50],

        78 => [[L, C, R], 50],

        79 => [[LEFT, L, RIGHT, R], 50],

        80 => [[C, C, Z, RIGHT], 50]

  }

 

  # ※失敗時のアニメーションを変える場合は数箇所コメントを外す必要があります。

#==============================================================================

# â–¡ Customizing END

#==============================================================================

end

 

#==============================================================================

# â–  Input

#==============================================================================

module Input

  module_function

  #--------------------------------------------------------------------------

  # ● 指定キー以外のキー入力判定

  #--------------------------------------------------------------------------

  def n_trigger?(num)

    if trigger?(num)

      return false

    elsif trigger?(A) or trigger?(B) or trigger?(C) or

          trigger?(X) or trigger?(Y) or trigger?(Z) or

          trigger?(L) or trigger?(R) or

          trigger?(UP) or trigger?(DOWN) or trigger?(RIGHT) or trigger?(LEFT)

        return true

    end

    return false    # 未入力または使用しないキーの場合

  end

  #--------------------------------------------------------------------------

  # ● キー変換テーブル(表示文字取得用)

  #--------------------------------------------------------------------------

  def key_converter(key)

    # ゲームパッドタイプ

    if $game_switches[TacticalSkill::KEY_TYPE_ID]

      case key

      when A

        return "A"

      when B

        return "B"

      when C

        return "C"

      when X

        return "X"

      when Y

        return "Y"

      when Z

        return "Z"

      when L

        return "R"

      when R

        return "L"

      end

    # キーボードタイプ

    else

      case key

      when A

        return "Z"

      when B

        return "X"

      when C

        return "C"

      when X

        return "A"

      when Y

        return "S"

      when Z

        return "D"

      when L

        return "Q"

      when R

        return "W"

      end

    end

    case key

    when UP

      return "↑"

    when DOWN

      return "↓"

    when LEFT

      return "←"

    when RIGHT

      return "→"

    end

  end

end

 

#==============================================================================

# â–  Game_Battler

#==============================================================================

class Game_Battler

  attr_accessor   :tact_flag

  #--------------------------------------------------------------------------

  # ● オブジェクト初期化

  #--------------------------------------------------------------------------

  alias initialize_tactical initialize

  def initialize

    initialize_tactical     # 原物

    @tact_flag = false

    @tact_skill_ok = false

  end

  #--------------------------------------------------------------------------

  # ● スキルの効果適用

  #     user  : スキルの使用者 (バトラー)

  #     skill : スキル

  #--------------------------------------------------------------------------

  alias skill_effect_tactical skill_effect

  def skill_effect(user, skill)

    if $scene.is_a?(Scene_Battle) and user.tact_flag

      skill_copy = $data_skills[skill.id].dup

      skill.power = skill.power * TacticalSkill::T_SKILL[skill.id][1] / 100

      skill.hit = 0 if skill.power == 0   # 威力0で命中しない補正

    end

    ret = skill_effect_tactical(user, skill)

    if $scene.is_a?(Scene_Battle) and user.tact_flag

      user.tact_flag = false

      $data_skills[skill.id] = skill_copy.dup

    end

    return ret

  end

end

 

#==============================================================================

# â–  Scene_Battle

#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------

  # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)

  #--------------------------------------------------------------------------

  alias update_phase4_step2_tactical update_phase4_step2

  def update_phase4_step2

    update_phase4_step2_tactical

    # 初期化

    @active_battler.tact_flag = false

    #@miss_flag = false      # Miss時にアニメーションを変える時にコメント外す

  end

  #--------------------------------------------------------------------------

  # ● スキルアクション 結果作成

  #--------------------------------------------------------------------------

  alias make_skill_action_result_tactical make_skill_action_result

  def make_skill_action_result

    # 先に判定

    # 強制アクションでなければ

    unless @active_battler.current_action.forcing

      # SP 切れなどで使用できなくなった場合

      unless @active_battler.skill_can_use?(@active_battler.current_action.skill_id)

        # アクション強制対象のバトラーをクリア

        $game_temp.forcing_battler = nil

        # ステップ 1 に移行

        @phase4_step = 1

        return

      end

    end

    

    if @active_battler.is_a?(Game_Actor)

      if !TacticalSkill::T_SKILL[@active_battler.current_action.skill_id].nil?

        # タクティカルスキル発動

        make_tactical_skill_result

      end

    end

    if TacticalSkill::ALL_ATK and @tact_skill_ok

      if TacticalSkill::ALL_ATK_SK.include?(@skill.id)

        skill_copy = @skill.dup

        @skill.scope = 2

      end

    end

    make_skill_action_result_tactical   # 原物

    if TacticalSkill::ALL_ATK and @tact_skill_ok

      if TacticalSkill::ALL_ATK_SK.include?(@skill.id)

        @tact_skill_ok = false

        @skill = $data_skills[skill_copy.id] = skill_copy.dup

      end

    end

    # Miss時にアニメーションを変える時にコメント外す

    #if @miss_flag

    #  @miss_flag = false

    #  unless TacticalSkill::T_SKILL[@skill.id][2].nil?

    #    @animation2_id = TacticalSkill::T_SKILL[@skill.id][2]

    #  end

    #end

  end

  #--------------------------------------------------------------------------

  # ● タクティカルスキル 結果作成

  #--------------------------------------------------------------------------

  def make_tactical_skill_result

    # 閃き時コマンドなし

    #return if @active_battler.flash_flag

 

    tact_skill = TacticalSkill::T_SKILL[@active_battler.current_action.skill_id][0]

    time = TacticalSkill::KEY_SEC * tact_skill.size * Graphics.frame_rate

    key_count = 0

    @active_battler.tact_flag = true

    # キー入力&カウントウィンドウ作成

    window_keycount = Window_KeyCount.new(tact_skill)

    window_counter = Window_KeyCounter.new

    #「戦闘位置補正」併用時にコメント外す

    #case $game_party.actors.size

    #when 1

    #  actor_x = 240

    #when 2

    #  actor_x = @active_battler.index * 240 + 120

    #when 3

    #  actor_x = @active_battler.index * 200 + 40

    #when 4

      actor_x = @active_battler.index * 1

    #end

    window_keycount.x = window_counter.x = actor_x

 

    for i in 0...time

      # キー入力に成功?

      if Input.trigger?(tact_skill[key_count])

        key_count += 1

        window_keycount.key_in

      elsif Input.n_trigger?(tact_skill[key_count])   # 違うキーを押した

        #@miss_flag = true      # Miss時にアニメーションを変える時にコメント外す

        # Miss時 SE演奏

        #Audio.se_play("Audio/SE/" + "ファイル名")

        break

      end

      # 全キー入力完了

      if key_count >= tact_skill.size

        window_keycount.text_in("Complete")

        # Complete時 SE演奏

        #Audio.se_play("Audio/SE/" + "ファイル名")

        @active_battler.tact_flag = false

        @tact_skill_ok = true if TacticalSkill::ALL_ATK

        break

      end

      # 進捗バーの更新

      window_counter.refresh((i*100/time).truncate)

      Graphics.update

      Input.update

    end

    # 何も入力しなかった => ミス

    if @active_battler.tact_flag

      window_keycount.text_in("Miss")

    end

    # Miss、Complete表示用のウェイト

    for i in 0...10

      Graphics.update

      @spriteset.update

    end

    window_keycount.dispose

    window_counter.dispose

  end

end

 

#==============================================================================

# â–  Window_Base

#==============================================================================

class Window_Base < Window

  #--------------------------------------------------------------------------

  # ● バー表示

  #       x       : x表示位置

  #       y       : y表示位置

  #       current : 進捗率(%)

  #--------------------------------------------------------------------------

  def draw_counter_bar(x, y, current)

    bitmap = RPG::Cache.windowskin(TacticalSkill::T_BAR_NAME)

    cw = bitmap.width * current / 100

    ch = bitmap.height

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x, y, bitmap, src_rect)

  end

end

 

#==============================================================================

# â–  Window_KeyCounter

#------------------------------------------------------------------------------

#  進捗率を表示するバー

#==============================================================================

class Window_KeyCounter < Window_Base

  #--------------------------------------------------------------------------

  # ● オブジェクト初期化

  #     key :キー配列

  #--------------------------------------------------------------------------

  def initialize

    super(0, 256, 150, 80)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.opacity = 0

    self.z = 1            # バトラーよりも奥に表示

    refresh(0)

  end

  #--------------------------------------------------------------------------

  # ● リフレッシュ

  #       current = 進捗率(%)

  #--------------------------------------------------------------------------

  def refresh(current)

    self.contents.clear

    #draw_counter_bar(0, 0, 100-current)    # 進捗方向:←

    draw_counter_bar(0, 0, current)         # 進捗方向:→

  end

end

 

#==============================================================================

# â–  Window_KeyCount

#------------------------------------------------------------------------------

#  入力するキーを表示するウィンドウ。

#==============================================================================

class Window_KeyCount < Window_Base

  #--------------------------------------------------------------------------

  # ● オブジェクト初期化

  #     key :キー配列

  #--------------------------------------------------------------------------

  def initialize(key)

    super(0, 220, 150, 80)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.opacity = 160    # 半透明

    self.z = 0            # 進捗バーよりも奥に表示

    @key = key

    @key_count = 0

    refresh

  end

  #--------------------------------------------------------------------------

  # ● リフレッシュ

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    for i in [email=0...@key.size]0...@key.size[/email]

      x = i * 32    # 文字間の間隔:32

      if i < @key_count

        self.contents.font.color = knockout_color

      else

        self.contents.font.color = normal_color

      end

      self.contents.draw_text(x, 0, 100, 32, Input.key_converter(@key[i]))

    end

  end

  #--------------------------------------------------------------------------

  # ● キーカウント

  #--------------------------------------------------------------------------

  def key_in

    @key_count += 1

    refresh

  end

  #--------------------------------------------------------------------------

  # ● テキスト表示

  #       text : テキスト

  #--------------------------------------------------------------------------

  def text_in(text)

    self.contents.clear

    self.contents.draw_text(0, 0, 100, 32, text, 1)

  end

end
Other Scripts I am using (in order):
ATB
 

Thank you for viewing

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

Discord

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

Content

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