Save-Point
BattleAktionFX XP - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: BattleAktionFX XP (/thread-13371.html)



BattleAktionFX XP - kyonides - 12-27-2025

BattleAktionFX XP

by Kyonides

Introduction

After reading lots of stuff on Discord on some Follow Up Skill script for VX ACE, I thought XP badly needed to get something like that. This is how this script came into existence! Shocked

Currently, there are 4 options available:
  • :repeat for repeating the skill cast a few moments ago.
  • :random_skill for picking a skill from the current actor's or enemy's list of available skills / action.
  • :foe_skill for choosing a skill from an opponent's list of available skills / actions.
  • Some predefined skill ID - it might fail if the battler doesn't know it.
  • nil - it means nothing in Latin.

To add a new skill to the list, follow this example here:
Code:
SKILL_FX[57] = [:repeat, :random_skill]

57 would stand for the actual skill ID.

During gameplay, the script will pick one of those options randomly, unless there's just 0 or 1 there.

And yes, Ghost Golem enemies might escape or guard or do nothing if they got no valid action to perform at that point.

The Script
Code:
# * BattleAktionFX XP * #
#   Scripter : Kyonides
#   v0.5.0 - 2025-12-29

# Let your actors or troopers get an extra action for certain skills
# IF AND ONLY IF they meet some of the predefined criteria.

# Warning!
# Enemies using a skill's effect might escape or guard if they've got
# no available action left!

# Available Options:
# :repeat, :random_skill, :foe_skill, a specific skill ID, nil

module BAktionFX
  MAX_EXTRA_ACTIONS = 1
  SKILL_FX = {} # Please leave this line alone!
  SKILL_FX.default = [] # Please leave this line alone!
  # [Skill ID] = [Option1, etc.]
  SKILL_FX[57] = [:repeat, :random_skill]
  extend self
  def set_make_targets(set_targets)
    @set_targets = set_targets
  end

  def skip?
    MAX_EXTRA_ACTIONS == @extra_actions or @skill_hits == 0
  end

  def process_skill(battler, skill_id)
    if skip?
      clear
      return
    end
    action = battler.current_action
    fx = SKILL_FX[skill_id]
    slots = fx.size
    fx = fx[rand(slots)]
    case fx
    when nil
      clear
      return
    when :repeat
      kind, basic, fx = action.data
    when :random_skill
      kind, basic, fx = battler.find_extra_action
    when :foe_skill
      kind, basic, fx = battler.find_foe_action
    end
    skill = $data_skills[fx]
    unless skill
      clear
      return
    end
    @set_targets.call(skill.scope)
    @targets = @targets.call.flatten
    if @targets.empty?
      clear
      return
    end
    @targets = nil
    @extra_actions += 1
    @skill_hits = 0
    action.set(kind, basic, fx)
    true
  end

  def clear
    @skill_hits = @extra_actions = 0
  end
  attr_accessor :extra_actions, :skill_hits, :targets
end

class Game_BattleAction
  def data
    [@kind, @basic, @skill_id]
  end

  def set(akind, abasic, askill_id)
    @kind = akind
    @basic = abasic
    @skill_id = askill_id
  end
end

class Game_Battler
  alias :kyon_btl_akt_fx_gm_btlr_sk_fx :skill_effect
  def skill_effect(user, skill)
    result = kyon_btl_akt_fx_gm_btlr_sk_fx(user, skill)
    BAktionFX.skill_hits += 1 if result and @damage.is_a?(Integer)
    result
  end

  def set_opponent_action(foes)
    return [0, rand(3) + 1, 0] if foes.empty?
    total = foes.size
    foe = foes[rand(total)]
    foe.find_extra_action
  end

  def skill_can_use_extra?(skill)
    return false if dead? or skill.sp_cost > self.sp
    return false if skill.atk_f == 0 and self.restriction == 1
    skill.occasion < 2 and rand(100) < 50
  end
  attr_accessor :extra_action
end

class Game_Actor
  def find_extra_action
    skills_found = @skills.select {|sid| skill_can_use?(sid) }
    total = skills_found.size
    skill_id = skills_found[rand(total)]
    [1, 0, skill_id]
  end

  def find_foe_action
    foes = $game_troop.enemies.select {|e| e.exist? }
    set_opponent_action(foes)
  end
end

class Game_Enemy
  def find_extra_action
    return [0, rand(3) + 1, 0] unless movable?
    found_actions = []
    for action in self.actions
      n = $game_temp.battle_turn
      a = action.condition_turn_a
      b = action.condition_turn_b
      if (b == 0 and n != a) or
         (b > 0 and (n < 1 or n < a or n % b != a % b))
        next
      end
      if self.hp * 100.0 / self.maxhp > action.condition_hp
        next
      end
      if $game_party.max_level < action.condition_level
        next
      end
      switch_id = action.condition_switch_id
      if switch_id > 0 and !$game_switches[switch_id]
        next
      end
      found_actions << action
    end
    return [] if found_actions.empty?
    total = found_actions.size
    action = found_actions[rand(total)]
    action.data
  end

  def find_foe_action
    foes = $game_party.actors.select {|e| e.exist? }
    set_opponent_action(foes)
  end
end

class Scene_Battle
  alias :kyon_btl_akt_fx_scn_btl_stt_ph4 :start_phase4
  alias :kyon_btl_akt_fx_scn_btl_mk_sk_act_res :make_skill_action_result
  alias :kyon_btl_akt_fx_scn_btl_up_ph4_st6 :update_phase4_step6
  alias :kyon_btl_akt_fx_scn_btl_btl_end :battle_end
  def start_phase4
    BAktionFX.clear
    @used_skill = nil
    kyon_btl_akt_fx_scn_btl_stt_ph4
  end

  def make_skill_action_result
    if @active_battler.extra_action
      make_extra_skill_action_result
    else
      kyon_btl_akt_fx_scn_btl_mk_sk_act_res
    end
    @used_skill = @phase4_step != 1
  end

  def make_extra_skill_action_result
    @skill = $data_skills[@active_battler.current_action.skill_id]
    unless @active_battler.current_action.forcing
      unless @active_battler.skill_can_use_extra?(@skill)
        $game_temp.forcing_battler = nil
        @phase4_step = 1
        return
      end
    end
    @active_battler.sp -= @skill.sp_cost
    @status_window.refresh
    @help_window.set_text(@skill.name, 1)
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    @common_event_id = @skill.common_event_id
    set_target_battlers(@skill.scope)
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end

  def update_phase4_step6
    kyon_btl_akt_fx_scn_btl_up_ph4_st6
    @active_battler.extra_action = nil
    return unless @used_skill
    @target_battlers = []
    BAktionFX.targets = @target_battlers
    unless @embedded
      BAktionFX.set_make_targets(method(:set_target_battlers))
      @embedded = true
    end
    if BAktionFX.process_skill(@active_battler, @skill.id)
      @action_battlers.unshift @active_battler
      @active_battler.extra_action = true
    end
    @target_battlers = []
    @used_skill = nil
  end

  def battle_end(result)
    BAktionFX.clear
    kyon_btl_akt_fx_scn_btl_btl_end(result)
  end
end

Terms & Conditions

Free as in Beer beer.
Please include me in your game credits.
That's it! Tongue sticking out


RE: BattleAktionFX XP - kyonides - 12-29-2025

Script Upgrade!

While reading the past week's edition of the board's gazette, I noticed that Dog Wulfo had the incorrect impression that the :random_skill option meant a given battler could grab his or her foe's skill and cast it on anybody on the foe's team. The thing is that I had never considered that, yet, that gave me the idea that led me to publish this very same upgrade.

Now you can use the :foe_skill option to get one of your foe's skills / actions and throw it at him or her! Shocked
The problem is that it might also end up being a healing skill! Incredible Oh my!

Both options, namely :random_skill and :foe_skill, might be cast at that moment if it passes a RNG test. It doesn't matter whether or not they have learned the skill. They now have a 50% chance of casting it successfully. Happy with a sweat