[XP] Demi Skills Script problem

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
161
Reaction score
6
First Language
English
Primarily Uses
RMXP
i have the Demi Skills Script from Tons of Add-ons,
and when i have a skill that assigned with an element and as a demi skill
and when the enemy has an element that blocks (or absorb) from a specific element,
the demi skill script bypasses it
example:
i used a Dark element demi skill
and the enemy is Immune to Dark
and when i use the Dark element demi skill on that enemy
the script bypasses the elemental affinity.
any way to make Demi Skills NOT op for boss fights?
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
247
Reaction score
90
First Language
English
Primarily Uses
RMXP
Within the Demi Skill script, replace Game_Battler with this:
Code:
class Game_Battler
  
  alias skill_effect_demi_skill_later skill_effect
  def skill_effect(user, skill)
    last_hp = self.hp
    last_sr = self.sr if $crls && self.is_a?(Game_Actor)
    result = skill_effect_demi_skill_later(user, skill)
    
    if result && elements_correct(skill.element_set) <= 0
      self.damage = "No effect!"
    else
      if $game_system.DEMI_SKILL
        rate = BlizzCFG.demi_database(skill.id)
        if rate != 0
          self.hp = last_hp
          self.hp = self.hp
          self.sr = last_sr if $crls && self.is_a?(Game_Actor)
          if result || self.damage.is_a?(Numeric)
            self.damage = last_hp * rate / 100
            self.hp -= self.damage
          end
        end
      end
    end
    return result
  end
  
end
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
247
Reaction score
90
First Language
English
Primarily Uses
RMXP
Actually, looking back at this again, I made a mistake with the logic. For example, if you made any elemental non-Demi skill that the target can absorb, it will always say "No effect" rather than healing them.

This will check that a Demi skill is being used first, then check if the battler is immune/absorbs the element.
Code:
class Game_Battler
  
  alias skill_effect_demi_skill_later skill_effect
  def skill_effect(user, skill)
    last_hp = self.hp
    last_sr = self.sr if $crls && self.is_a?(Game_Actor)
    result = skill_effect_demi_skill_later(user, skill)
    if $game_system.DEMI_SKILL
      rate = BlizzCFG.demi_database(skill.id)
      if rate != 0
        if result && elements_correct(skill.element_set) <= 0
          self.damage = "No effect!"
        else
          self.hp = last_hp
          self.hp = self.hp
          self.sr = last_sr if $crls && self.is_a?(Game_Actor)
          if result || self.damage.is_a?(Numeric)
            self.damage = last_hp * rate / 100
            self.hp -= self.damage
          end
        end
      end
    end
    return result
  end
  
end
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
161
Reaction score
6
First Language
English
Primarily Uses
RMXP
nice for looking that mistake that i didn't tested earlier
(btw is there a way to make demi skills to do damage of the battler's MAX HP instead of CURRENT HP as a seperate type?)
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
247
Reaction score
90
First Language
English
Primarily Uses
RMXP
I'd assume something like this
Code:
#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG
 
  def self.demi_database(id)
    case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Demi Database
#
#   Use following template to create Demi skills:
#
#     when ID then return RATE
#
#   ID   - ID of the skill in the database
#   RATE - percentage of how much of the remaining HP should be taken away
#
#   Example:
#
#     when 88 then return 25
#  
#   Skill with ID 88 will do damage equal to 25% of the enemies' remaining HP.
#
#   Note that using values equal to or greater than 100 will kill instantly.
#   Negative values will heal instead.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 88 then return 25
    when 89 then return 50
    when 58 then return 50
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Demi Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 0
  end
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Define which skill IDs will use the enemy's Max HP value instead of their
# current HP (e.g. a skill that does 25% damage will kill a target after 4 uses)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  DEMI_USE_MAX_HP = [88, 89]
 
end

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
  alias skill_effect_demi_skill_later skill_effect
  def skill_effect(user, skill)
    last_hp = self.hp
    last_sr = self.sr if $crls && self.is_a?(Game_Actor)
    result = skill_effect_demi_skill_later(user, skill)
   
    if $game_system.DEMI_SKILL
      rate = BlizzCFG.demi_database(skill.id)
      if rate != 0
        if result && elements_correct(skill.element_set) <= 0
          self.damage = "No effect!"
        else
          self.hp = last_hp
          self.hp = self.hp
          self.sr = last_sr if $crls && self.is_a?(Game_Actor)
          if result || self.damage.is_a?(Numeric)
            val = BlizzCFG::DEMI_USE_MAX_HP.include?(skill.id) ? self.maxhp : last_hp
            self.damage = val * rate / 100
            self.hp -= self.damage
          end
        end
      end
    end
    return result
  end
 
end
Just add whatever skill IDs to the array defined in DEMI_USE_MAX_HP
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

bro how do I have over 30 OCs
A good way to mix your own music? What's the learning curve on that?
Would it be better to pay a composer?
What theme for the next windowskin? You'll decide. Tell what you wanna see and I'll try for.
I just saw in a manga an interesting mechanic - setting up a stationary teleport beacon that one can go to no matter where one is in a dungeon. I think it'll work with a similar setup to how I did my airship transition.

Ooh what if you could set up multiple beacons and choose from a list of the beacons you set up?

Hmm...
Actor2_1 added!

Forum statistics

Threads
103,255
Messages
998,376
Members
134,754
Latest member
yvsxcii
Top