Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 KBackFire
#1
KBackFire
XP & VX versions

by Kyonides Arkanthes

Introduction

Have you ever dreamed of letting your heroes suffer the consequences of using a skill that is too powerful for such weaklings?

Well, now Alex aka Aluxes knows how it feels like.
By the way, I don't know how the ghosts can stand him even for a second! Shocked

It is not a plug & play script because you need to configure the KBackFire module first to make it work properly.  Don't worry pals! It's quite easy to tweak it!

Since version 1.0.1 you can also specify the Skill Backfire's Hit Rate! Two Thumbs Up! 

The Script
for the Default Battle Systems

XP Script

Code:
# * KBackFire XP - Default BS
#   Scripter : Kyonides Arkanthes
#   v1.0.1 - 2022-06-26
# * Non Plug & Play Script * #

# The script that allows your heroes to get hurt by a sudden attack for using a
# skill that is way above their current fighting skills.

# * Script Call * #
# KBackFire.show_damage_pop = true (or false)

# * Aliased Methods * #
# Game_Battler#skill_effect
# Scene_Battle#update_phase4_step4 #update_phase4_step4

module KBackFire
  @show_damage_pop = true
  ANIMATION_ID = 101
  SKILLS = {} # Do Not Edit This Line!
  # [SkillID] = { Minimum Level => Damage %, ... , :hit_rate => 1 through 100 }
  SKILLS[57] = { 5 => 150, 10 => 125, 15 => 100, 20 => 75, 25 => 50,
    30 => 25, :hit_rate => 75 }
  # * End of Setup Section * #
  extend self
  @battlers = []
  def setup
    @battlers.each do |battler|
      battler.animation_id = ANIMATION_ID
      battler.animation_hit = true
    end
  end

  def hurt!
    @battlers.each{|battler| battler.damage_pop = @show_damage_pop }
    @battlers.clear
  end
  def <<(battler) @battlers << battler end
  attr_reader :battlers
  attr_accessor :show_damage_pop
end

class Game_Battler
  alias :kyon_backfire_gm_btlr_skill_fx :skill_effect
  def skill_backfire(user, data)
    lvl = user.level
    levels = data.keys.sort.select{|v| lvl < v }
    return if levels.empty? or rand(100) >= data[:hit_rate]
    dmg_percent = data[levels.min]
    user.damage = (@damage / 100 * dmg_percent).round
    user.hp -= user.damage
    KBackFire << user
  end

  def skill_effect(user, skill)
    result = kyon_backfire_gm_btlr_skill_fx(user, skill)
    skill_data = KBackFire::SKILLS[skill.id]
    skill_backfire(user, skill_data) if result and user.actor? and skill_data
    result
  end
  def actor?() @actor_id != nil end
  def damage?() @damage != nil end
end

class Scene_Battle
  alias :kyon_backfire_scn_btl_up_ph4_s4 :update_phase4_step4
  alias :kyon_backfire_scn_btl_up_ph4_s5 :update_phase4_step5
  def update_phase4_step4
    kyon_backfire_scn_btl_up_ph4_s4
    KBackFire.setup
  end

  def update_phase4_step5
    kyon_backfire_scn_btl_up_ph4_s5
    KBackFire.hurt!
  end
end

VX Script

Code:
# * KBackFire VX - Default BS
#   Scripter : Kyonides Arkanthes
#   v1.0.1 - 2022-06-26
# * Non Plug & Play Script * #

# The script that allows your heroes to get hurt by a sudden attack for using a
# skill that is way above their current fighting skills.

# * Script Call * #
# KBackFire.show_damage_pop = true (or false)

# * Aliased Methods * #
# Game_Battler#skill_effect
# Scene_Battle#update_phase4_step4 #update_phase4_step4

module KBackFire
  DAMAGE_MESSAGE = "The skill backfired! "
  SKILLS = {} # Do Not Edit This Line!
  # [SkillID] = { Minimum Level => Damage %, ... , :hit_rate => 1 through 100 }
  SKILLS[67] = { 10 => 125, 15 => 100, 20 => 75, 25 => 50,
    30 => 25, :hit_rate => 75 }
end
# * End of Setup Section * #
class Game_Battler
  alias :kyon_backfire_gm_btlr_skill_fx :skill_effect
  alias :kyon_backfire_gm_btlr_exec_dmg :execute_damage
  attr_accessor :skill_backfired
  attr_writer :hp_damage
  def backfire_damage
    @skill_backfired = true
    self.hp -= @hp_damage
  end

  def skill_backfire(user, skill)
    data = KBackFire::SKILLS[skill.id]
    return unless data
    dmg = skill.damage_to_mp ? @mp_damage : @hp_damage
    return if dmg < 1
    lvl = user.level
    levels = data.keys.sort.select{|v| lvl < v }
    return if levels.empty? or rand(100) >= data[:hit_rate]
    dmg_percent = data[levels.min]
    user.hp_damage = (dmg / 100 * dmg_percent).round
    user.backfire_damage
  end

  def skill_effect(user, skill)
    kyon_backfire_gm_btlr_skill_fx(user, skill)
    return if @skipped or @missed or @evaded or user.is_a?(Game_Enemy)
    skill_backfire(user, skill)
  end
end

class Scene_Battle
  alias :kyon_backfire_scn_btl_exec_act_skill :execute_action_skill
  def execute_action_skill
    kyon_backfire_scn_btl_exec_act_skill
    display_backfire_damage if @active_battler.skill_backfired
  end

  def display_backfire_damage
    @active_battler.skill_backfired = nil
    line_number = @message_window.line_number
    timer = line_number != @message_window.line_number ? 20 : 5
    wait(timer)
    @message_window.back_to(line_number)
    text = KBackFire::DAMAGE_MESSAGE + Vocab::ActorDamage
    text = sprintf(text, @active_battler.name, @active_battler.hp_damage)
    @active_battler.hp_damage = 0
    Sound.play_actor_damage
    $game_troop.screen.start_shake(5, 5, 10)
    @message_window.add_instant_text(text)
    wait(30)
  end
end



Terms & Conditions

Free as in Beer and Shocked speech for commercial and non commercial games as long as you are not a Ghost ghost.
Just mention me and the forum where you have found it in your game credits. Winking
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX
Reply }
#2
Double Update!

Now both Alex and Ralph can begin a new journey in their own RGSS worlds!
Sadly, their bad reputation precedes them... just as expected. Laughing

Since version 1.0.1 you can also specify the Skill Backfire's Hit Rate! [Image: thumbs.gif] 

Happy with a sweat Well, I guess that's pretty much all, folks!
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX
Reply }




Users browsing this thread: