11-08-2019, 09:16 AM
(This post was last modified: 08-13-2020, 07:15 AM by kyonides.
Edit Reason: First Update
)
KBoomEffect XP
by Kyonides Arkanthes
Introduction
Did you ever want your monster to explode if some normal or magical attack hit him?

Now you can for sure!

You can make the monster explode due to physical or magical attacks or even both of them!

Warning
This scriptlet does not depend on the default battle damage formula.


XP Script
Code:
# * KBoomEffect XP
# Scripter : Kyonides Arkanthes
# 2019-11-08 - with actual explosions!
# This scriptlet lets you make your monster explode when they get hit by some
# physical or magical attack.
module KBoom
FAILURE = "Unharmed"
ANIME_ID = 99
# MonsterID => [SuccessRate, AllHeroes?, Variance %], etc.
PHYSICAL_ATK = { 1 => [99, true, 5] }
# MonsterID => [SuccessRate, AllHeroes?, SkillID1, etc.], etc.
MAGICAL_ATK = { 1 => [40, true, 60] }
end
class Game_Battler
alias :kyon_boom_effect_gm_battler_ae :attack_effect
alias :kyon_boom_effect_gm_battler_se :skill_effect
def attack_effect(user)
rate, all, variance = KBoom::PHYSICAL_ATK[self.id]
return setup_ignition(user, rate, all, variance, nil) if @troop_id and rate
kyon_boom_effect_gm_battler_ae(user)
end
def skill_effect(user, skill)
rate, all, *skills = KBoom::MAGICAL_ATK[self.id]
if @troop_id and rate and skills.include?(skill.id)
return setup_ignition(user, rate, all, skill.variance, skill)
end
kyon_boom_effect_gm_battler_se(user, skill)
end
def setup_ignition(user, rate, multiple, variance, skill)
@will_explode = rand(100) < rate
if @will_explode
power = skill ? skill.power : self.atk
targets = multiple ? $game_party.survivors : [user]
targets.each{|h| ignition_target(h, power, variance) }
end
@damage = @hp
@hp = 0
@will_explode
end
def ignition_target(user, power, variance)
power = power * @hp / user.pdef
return user.damage = KBoom::FAILURE if power < 1
amp = [power.abs * variance / 100, 1].max
power += rand(amp+1) + rand(amp+1) - amp
user.damage = power
user.hp -= power
user.explosion_pop = true
end
def clear_explosion() @will_explode = @explode = nil end
attr_accessor :will_explode, :explode, :explosion_pop
end
class Game_Party
def survivors() @actors.select{|a| a.hp > 0 } end
end
class Sprite_Battler
alias :kyon_boom_effect_sbt_up :update
def update
kyon_boom_effect_sbt_up
return unless @battler and @battler.explode
animation($data_animations[KBoom::ANIME_ID], true)
@battler.clear_explosion
end
end
class Scene_Battle
alias :kyon_boom_effect_up_ph4_s4 :update_phase4_step4
alias :kyon_boom_effect_up_ph4_s5 :update_phase4_step5
def update_phase4_step4
kyon_boom_effect_up_ph4_s4
@target_battlers.each{|target| target.explode = target.will_explode }
end
def update_phase4_step5
kyon_boom_effect_up_ph4_s5
for target in $game_party.actors
target.damage_pop = target.explosion_pop
target.explosion_pop = nil
end
end
end
Terms & Conditions
You must include my nickname and the current website's URL in your game credits.
You are free to use it in non commercial games.
Give me a free copy of your completed game if you include at least 2 of my scripts!

"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]](https://www.save-point.org/images/userbars/SP1-Scripter.png)
![[Image: SP1-Writer.png]](https://www.save-point.org/images/userbars/SP1-Writer.png)
![[Image: SP1-Poet.png]](https://www.save-point.org/images/userbars/SP1-Poet.png)
![[Image: SP1-PixelArtist.png]](https://www.save-point.org/images/userbars/SP1-PixelArtist.png)
![[Image: SP1-Reporter.png]](https://i.postimg.cc/GmxWbHyL/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!
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, OpenChest XP VX & ACE
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]](https://www.save-point.org/images/userbars/SP1-Scripter.png)
![[Image: SP1-Writer.png]](https://www.save-point.org/images/userbars/SP1-Writer.png)
![[Image: SP1-Poet.png]](https://www.save-point.org/images/userbars/SP1-Poet.png)
![[Image: SP1-PixelArtist.png]](https://www.save-point.org/images/userbars/SP1-PixelArtist.png)
![[Image: SP1-Reporter.png]](https://i.postimg.cc/GmxWbHyL/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!

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, OpenChest XP VX & ACE