[XP] Demi Skills Script problem

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
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
185
Reaction score
67
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
185
Reaction score
67
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
103
Reaction score
2
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
185
Reaction score
67
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 Profile Posts

Finally finished my first big game since joining the forums! Please check out Petal Knights! https://forums.rpgmakerweb.com/index.php?threads/petal-knights-playable-now.117898/
Back home now :cutesmile:

Many thanks to all my fellow game devs. for all the support during this crazy time.

Feeling a bit rough but much better then bein' hospitalized at least.

Now time to get back to the code :D
Added skill ranges, and very basic implementation of scope, with a rule called "empty tile" that simply returns true if the selected tile is empty (has a battler), and false otherwise


This means movement range and attack ranges are all automatically implemented.

More info: https://himeworks.itch.io/grid-battle-system/devlog/167442/devlog-3-basic-skill-range
Stone masons are hard at work creating beautiful sculptures for your games...
When you realize @Kupotepo is a champion among RM Web users, and it all makes sense now:

Forum statistics

Threads
100,465
Messages
976,273
Members
132,082
Latest member
nwr
Top