Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Skills : Drain & Osmosis

Skills : Drain/Osmosis
Version: 3.5
By: Kain Nobel

Introduction

This script is deticated to handling skills that absorb HP and SP. With this, you can set the custom font and display strings of HP/SP absorb damage and specify each skills direct, percent and allowed variance to absorb.

Features

  • Set Skills that can drain HP/SP
  • You can set the direct HP/SP drawn from each skill's damage
  • You can set the percent HP/SP drawn from each skill's damage
  • You can set a variance on HP/SP drawn from each skill's damage
  • Set the font/color and string display of absored HP/SP
  • Set the returning animation of absorbtion
  • Automatically applies Drain HP element tag to skills that drain HP.
  • Automatically applies Drain SP element tag to skills that drain SP.
  • Settings are all commented and easy for non-scripters to understand.

Script

Code:
#===============================================================================

# ** Skills : Drain/Osmosis

#===============================================================================

 

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

SDK.log('Skills.Drain/Osmosis', 'Kain Nobel ©', 3.5, '2009.06.17')

SDK.check_requirements(2.4, [1, 2])

#-------------------------------------------------------------------------------

# * SDK Enabled Test : Begin

#-------------------------------------------------------------------------------

if SDK.enabled?('Skills.Drain/Osmosis')

 

#===============================================================================

# ** RPG::Skill

#===============================================================================

 

class RPG::Skill

  #=============================================================================

  # ** RPG::Skill::Drain

  #=============================================================================

  module Drain

    #---------------------------------------------------------------------------

    # * HP Drain Element Tag ID (set inside Database/System tab).

    #---------------------------------------------------------------------------

    HP_Element_Tag = nil

    #---------------------------------------------------------------------------

    # * SP Drain Element Tag ID (set inside Database/System tab).

    #---------------------------------------------------------------------------

    SP_Element_Tag = nil

    #---------------------------------------------------------------------------

    # * Font Name for Drain Damage String.

    #---------------------------------------------------------------------------

    DamageFontName = "Arial Black"

    #---------------------------------------------------------------------------

    # * Font Size for Drain Damage String.

    #---------------------------------------------------------------------------

    DamageFontSize = 28

    #---------------------------------------------------------------------------

    # * Damage font for drain damage is bolded?

    #---------------------------------------------------------------------------

    DamageFontBold = false

    #---------------------------------------------------------------------------

    # * Damage font for drain damage is italicized?

    #---------------------------------------------------------------------------

    DamageFontItal = false

    #---------------------------------------------------------------------------

    # * Color for text outline displaying HP drain value.

    #---------------------------------------------------------------------------

    HP_ColorBack = Color.new(0, 160, 0)

    #---------------------------------------------------------------------------

    # * Color for main text color displaying HP drain value.

    #---------------------------------------------------------------------------

    HP_ColorMain = Color.new(0, 255, 0)

    #---------------------------------------------------------------------------

    # * Color for text outline displaying SP drain value.

    #---------------------------------------------------------------------------

    SP_ColorBack = Color.new(160, 0, 160)

    #---------------------------------------------------------------------------

    # * Color for main text color displaying SP drain value.

    #---------------------------------------------------------------------------

    SP_ColorMain = Color.new(255, 0, 255)

    #---------------------------------------------------------------------------

    # * Reformat the Damage String for draining HP    (ie "HP +[x]") [x] = value

    #---------------------------------------------------------------------------

    HP_DamageFormat = "HP +[x]"

    #---------------------------------------------------------------------------

    # * Reformat the Damage String for draining SP    (ie "HP +[x]") [x] = value

    #---------------------------------------------------------------------------

    SP_DamageFormat = "SP +[x]"

    #---------------------------------------------------------------------------

    # * Animation played to the reciever of drained HP/SP.      (skill_id => n)

    #---------------------------------------------------------------------------

    Animation   = {7 => 15}

    #---------------------------------------------------------------------------

    # * The percent to drain from damage inflicted on HP.       (skill_id => n)

    #---------------------------------------------------------------------------

    HP_Percent  = {1 => 100, 6 => 100, 7 => 100, 9 => 100}

    #---------------------------------------------------------------------------

    # * A direct value to drain from damage inflicted on HP.    (skill_id => n)

    #---------------------------------------------------------------------------

    HP_Direct   = {}

    #---------------------------------------------------------------------------

    # * Allowed variance to +/- from sub total HP drained.      (skill_id => n)

    #---------------------------------------------------------------------------

    HP_Variance = {}

    #---------------------------------------------------------------------------

    # * The percent to drain from damage inflicted on SP.       (skill_id => n)

    #---------------------------------------------------------------------------

    SP_Percent   = {}

    #---------------------------------------------------------------------------

    # * A direct value to drain from damage inflicted on SP.    (skill_id => n)

    #---------------------------------------------------------------------------

    SP_Direct    = {}

    #---------------------------------------------------------------------------

    # * Allowed variance to +/- from sub total SP drained.      (skill_id => n)

    #---------------------------------------------------------------------------

    SP_Variance = {}

    #---------------------------------------------------------------------------

    # * Critical Flag to be set when draining (this is an scripter thing...)

    #---------------------------------------------------------------------------

    Critical_Flag = "Drain/Osmosis"

    #---------------------------------------------------------------------------

    # * Default Settings (You might not want to modify these...)

    #---------------------------------------------------------------------------

    Animation.default   = 0

    HP_Percent.default  = 0

    HP_Direct.default   = 0

    HP_Variance.default = 0

    SP_Percent.default  = 0

    SP_Direct.default   = 0

    SP_Variance.default = 0

  end

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :drainskill_rpgskill_initialize, :initialize

  #-----------------------------------------------------------------------------

  # * Object Initialization

  #-----------------------------------------------------------------------------

  def initialize

    drainskill_rpgskill_initialize

    if self.drain_hp? && !@element_set.include?(Drain::HP_Element_Tag)

      unless Drain::HP_Element_Tag.nil?

        @element_set << Drain::HP_Element_Tag

      end

    end

    if self.drain_sp? && !@element_set.include?(Drain::SP_Element_Tag)

      unless Drain::SP_Element_Tag.nil?

        @element_set << Drain::SP_Element_Tag

      end

    end

  end

  #-----------------------------------------------------------------------------

  # * Drain Animation

  #-----------------------------------------------------------------------------

  def drain_animation

    return Drain::Animation[@id]

  end

  #-----------------------------------------------------------------------------

  # * HP Drain Percent

  #-----------------------------------------------------------------------------

  def hp_drain_percent

    return Drain::HP_Percent[@id]

  end

  #-----------------------------------------------------------------------------

  # * HP Drain Direct

  #-----------------------------------------------------------------------------

  def hp_drain_direct

    return Drain::HP_Direct[@id]

  end

  #-----------------------------------------------------------------------------

  # * HP Drain Variance

  #-----------------------------------------------------------------------------

  def hp_drain_variance

    return Drain::HP_Variance[@id]

  end

  #-----------------------------------------------------------------------------

  # * SP Drain Percent

  #-----------------------------------------------------------------------------

  def sp_drain_percent

    return Drain::SP_Percent[@id]

  end

  #-----------------------------------------------------------------------------

  # * SP Drain Direct

  #-----------------------------------------------------------------------------

  def sp_drain_direct

    return Drain::SP_Direct[@id]

  end

  #-----------------------------------------------------------------------------

  # * SP Drain Variance

  #-----------------------------------------------------------------------------

  def sp_drain_variance

    return Drain::SP_Variance[@id]

  end

  #-----------------------------------------------------------------------------

  # * HP Drain

  #-----------------------------------------------------------------------------

  def hp_drain(value)

    unless hp_drain_percent.zero?

      value *= hp_drain_percent / 100.0

    end

    value += hp_drain_direct

    value += rand(2).zero? ? -hp_drain_variance : hp_drain_variance

    return Integer(value)

  end

  #-----------------------------------------------------------------------------

  # * SP Drain

  #-----------------------------------------------------------------------------

  def sp_drain(value)

    unless sp_drain_percent.zero?

      value *= sp_drain_percent / 100.0

    end

    value += sp_drain_direct

    value += rand(2).zero? ? -sp_drain_variance : sp_drain_variance

    return Integer(value)

  end

  #-----------------------------------------------------------------------------

  # * Drain?

  #-----------------------------------------------------------------------------

  def drain?

    return (hp_drain? || sp_drain?)

  end

  #-----------------------------------------------------------------------------

  # * HP Drain?

  #-----------------------------------------------------------------------------

  def hp_drain?

    return (!hp_drain_percent.zero? || !hp_drain_direct.zero?)

  end

  #-----------------------------------------------------------------------------

  # * SP Drain?

  #-----------------------------------------------------------------------------

  def sp_drain?

    return (!sp_drain_percent.zero? || !sp_drain_direct.zero?)

  end

end

 

#===============================================================================

# ** Game_BattleAction

#===============================================================================

 

class Game_BattleAction

  #-----------------------------------------------------------------------------

  # * Public Instance Variables

  #-----------------------------------------------------------------------------

  attr_accessor :drain_hp

  attr_accessor :drain_sp

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :drainskill_gmbtlact_clear, :clear

  #-----------------------------------------------------------------------------

  # * Clear

  #-----------------------------------------------------------------------------

  def clear

    drainskill_gmbtlact_clear

    @drain_hp = 0

    @drain_sp = 0

  end

end

 

#===============================================================================

# ** Game_Battler

#===============================================================================

 

class Game_Battler

  #-----------------------------------------------------------------------------

  # * Public Instance Variables

  #-----------------------------------------------------------------------------

  attr_accessor :drain_animation

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :drainskill_gmbtlr_skleff,   :skill_effect

  alias_method :drainskill_gmbtlr_skleffec, :skill_effect_effective_correction

  #-----------------------------------------------------------------------------

  # * Skill Effect

  #-----------------------------------------------------------------------------

  def skill_effect(user, skill)

    unless skill.drain?

      return drainskill_gmbtlr_skleff(user, skill)

    end

    old_hp, old_sp = self.hp, self.sp

    effective = drainskill_gmbtlr_skleff(user, skill)

    last_damage = self.damage

    self.damage = 0

    hit, hit_result = skill_effect_first_hit_result(user, skill)

    effective = skill_effect_effective_correction(effective, hit)

    if hit_result

      power = skill_effect_power(user, skill)

      rate = skill_effect_rate(user, skill)

      skill_effect_base_damage(power, rate)

      skill_effect_element_correction(skill)

      if self.damage > 0

        skill_effect_guard_correction

      end

      skill_effect_disperation(skill)

      hit, hit_result = skill_effect_second_hit_result(user, skill)

      effective = skill_effect_effective_correction(effective, hit)

    end

    if hit_result

      effective = true if skill_effect_physical_hit_result(skill)

      last_sp = self.sp

      self.sp -= self.damage

      effective = self.sp != last_sp

      @state_changed = false

      effective |= states_plus(skill.plus_state_set)

      effective |= states_minus(skill.minus_state_set)

      skill_effect_power0(skill)

    else

      skill_effect_miss

    end

    skill_effect_damagefix

    hp_drain = skill.hp_drain(old_hp - self.hp)

    sp_drain = skill.sp_drain(old_sp - self.sp)

    user.hp += [hp_drain, 0].max

    user.sp += [sp_drain, 0].max

    self.damage   = last_damage

    user.critical = RPG::Skill::Drain::Critical_Flag

    begin

      user.current_action.drain_hp += hp_drain

      user.current_action.drain_sp += sp_drain

    rescue

      p user.current_action, hp_drain, sp_drain

      exit  

    end

    user.damage = Array.new

    user.damage << [user.current_action.drain_hp, 0].max

    user.damage << [user.current_action.drain_sp, 0].max

    unless skill.drain_animation.zero? || skill.drain_animation.nil?

      user.drain_animation = skill.drain_animation

    end

    return effective

  end

  #-----------------------------------------------------------------------------

  # * Skill Effect Effective Correction

  #-----------------------------------------------------------------------------

  def skill_effect_effective_correction(effective, hit)

    return (rand(2) <= 1) if effective.is_a?(Array)

    drainskill_gmbtlr_skleffec(effective, hit)

  end

end

 

#===============================================================================

# ** Scene_Battle

#===============================================================================

 

class Scene_Battle < SDK::Scene_Base

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :drainskill_scnbtl_updatep4s6,       :update_phase4_step6

  #-----------------------------------------------------------------------------

  # * Update Phase 4 : Step 6

  #-----------------------------------------------------------------------------

  def update_phase4_step6

    draining_battlers.each do |battler|

      battler.damage_pop = true

      unless battler.drain_animation == 0 || battler.drain_animation.nil?

        battler.animation_id = battler.drain_animation

        battler.animation_hit = true

        battler.drain_animation = nil

      end

    end

    drainskill_scnbtl_updatep4s6

  end

  #-----------------------------------------------------------------------------

  # * Draining Battlers

  #-----------------------------------------------------------------------------

  def draining_battlers

    battlers = Array.new

    $game_party.actors.each do |actor|

      if actor.current_action.drain_hp || actor.current_action.drain_sp

        battlers << actor

      end

    end

    $game_troop.enemies.each do |enemy|

      if enemy.current_action.drain_hp || enemy.current_action.drain_sp

        battlers << enemy

      end

    end

    battlers.each do |battler|

      battler.current_action.drain_hp = 0

      battler.current_action.drain_sp = 0

    end

    battlers

  end

end

 

#===============================================================================

# ** RPG::Sprite

#===============================================================================

 

class RPG::Sprite < ::Sprite

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :drainskill_RPGsprite_damage, :damage

  #-----------------------------------------------------------------------------

  # * Damage

  #-----------------------------------------------------------------------------

  def damage(value, critical)

    unless value.is_a?(Array) && critical == RPG::Skill::Drain::Critical_Flag

      drainskill_RPGsprite_damage(value, critical)

      return

    end

    dispose_damage

    hp_drain = RPG::Skill::Drain::HP_DamageFormat.dup

    hp_drain.gsub!("[x]", "#{value[0]}")

    hp_drain.gsub!("+", "-") if value[0] < 0

    sp_drain = RPG::Skill::Drain::SP_DamageFormat.dup

    sp_drain.gsub!("[x]", "#{value[1]}")

    sp_drain.gsub!("+", "-") if value[1] < 0

    bitmap = Bitmap.new(160, 8 + (RPG::Skill::Drain::DamageFontSize * 2))

    bitmap.font.name    = RPG::Skill::Drain::DamageFontName

    bitmap.font.size    = RPG::Skill::Drain::DamageFontSize

    bitmap.font.bold    = RPG::Skill::Drain::DamageFontBold

    bitmap.font.italic  = RPG::Skill::Drain::DamageFontItal

    bitmap.font.color = RPG::Skill::Drain::HP_ColorBack

    bitmap.draw_text(-1, 12-1, 160, 40, hp_drain, 1)

    bitmap.draw_text(+1, 12-1, 160, 40, hp_drain, 1)

    bitmap.draw_text(-1, 12+1, 160, 40, hp_drain, 1)

    bitmap.draw_text(+1, 12+1, 160, 40, hp_drain, 1)

    bitmap.font.color = RPG::Skill::Drain::HP_ColorMain

    bitmap.draw_text(0, 12, 160, 40, hp_drain, 1)

    bitmap.font.color = RPG::Skill::Drain::SP_ColorBack

    y = bitmap.font.size + 2

    bitmap.draw_text(-1, y-1, 160, 40, sp_drain, 1)

    bitmap.draw_text(+1, y-1, 160, 40, sp_drain, 1)

    bitmap.draw_text(-1, y+1, 160, 40, sp_drain, 1)

    bitmap.draw_text(+1, y+1, 160, 40, sp_drain, 1)

    bitmap.font.color = RPG::Skill::Drain::SP_ColorMain

    bitmap.draw_text(0, y, 160, 40, sp_drain, 1)

    @_damage_sprite = ::Sprite.new(self.viewport)

    @_damage_sprite.bitmap = bitmap

    @_damage_sprite.ox = 80

    @_damage_sprite.oy = 20

    @_damage_sprite.x = self.x

    @_damage_sprite.y = self.y - self.oy / 2

    @_damage_sprite.z = 3000

    @_damage_duration = 40

  end

end

 

#-------------------------------------------------------------------------------

# * SDK Enabled Test : End

#-------------------------------------------------------------------------------

end

Instructions

Place below SDK, above main. Please read the instructions on the settings in the script, they are all commented and easy to understand. If you have any further questions please don't be shy to ask.

FAQ

I'll add later if need be...

Compatibility

The version posted @ Punk's Hideout doesn't work with my BattleLog, please use the one posted here.

This script requires SDK 2.4 because of the way it breaks down Game_Battler#skill_effect method. Without SDK, the skill_effect method is a friggin' mess and hard to effectively alias stuff like this to, sorry :/

Author's Notes

Vote Trickster for member you most want to come back! My coding concepts in this is very much like he would've done, I think he'd be proud to know he's influencing another scripter to be great like him ;)

You can also vote me Scripter if the Year if you'd like, but only if you really feel I am as there are a few other great minds around here ;)

Terms and Conditions

Free to use in commercial and non-commercial projects alike, please don't forget to credit Kain Nobel.
 
Hello, I am wondering you should help me.

It is possible to put a small video (swf or avi) instead of the default animation?

I have Flash and Avi player scripts working, maybe it is possible or maybe not.
I have no idea about writting ruby sorry.

I really enjoy any news from you, Nice work mate.

Bye.
 
Well, in order for an AVI script to work in general within the battle scene, it all depends on if it requires changing the $scene object, ie $scene = Scene_AVI.new or something. If it does then it might mess something up when trying to go back to the point you were in the battle scene, I'd have to look into it (but I'm not gonna have the time to look into that anytime soon, sorry.)

Otherwise, if the AVI script opens a new Game.exe thread to display then yes, you should be able to play an AVI through any skill by having it call a CommonEvent, in theory. Do you understand what I'm talking about?

I can't really help you more on that subject, I don't have an AVI script (or any .avi or .swf files for that matter), but there recently was a topic in Script Support which you should look up which covered this matter, I believe the answer was found. It was posted about a week or two, so if you dig you should eventually find it.

BTW, I'm glad you enjoy my work, thank you for stopping by! :D

And thank you too MCsephiroth13! :D
 
[Shit removed]

Dude you could not spam other peoples topics with off topic problems? Make a new thread in script support please.
 
@superfanqui : Thank you for that, but this topic doesn't have anything to do with playing video animations for skills or the ZTBS. If you need a compatability fix for a certain battle system, thats understandable and in that case I'll look into it, but please don't ask anymore about the video script, use script support instead, thanks.

Also, you might want to contact Gubid about fixing the CommonEvent issue when using skills, since he's the author of that battle system and I know little to nothing about it.

@DoctorChaos : Yes, I'll make a non-SDK version as soon as I find some free time, but I do have alot going on right now so it might be a couple weeks. Please keep in mind, without SDK other skill_effect mods probably won't stack smoothy or might be ignored, this is the only downfall of non-SDK. If you don't have any other skill_effect additions though, it should work fine when its posted.

On the other hand, you can still use the SDK's method split of skill_effect for now without having to actually have the SDK installed. Just paste it above all other custom scripts which modify that method and they should work fine, in theory.

Code:
class Game_Battler

  #--------------------------------------------------------------------------

  # * Apply Skill Effects

  #--------------------------------------------------------------------------

  def skill_effect(user, skill)

    # Skill Effects Setup

    skill_effect_setup

    # Return False If Out of Scope

    return false if skill_effect_scope(skill)

    # Setup Effective

    effective = skill_effect_effective_setup(skill)

    # First hit detection

    hit, hit_result = skill_effect_first_hit_result(user, skill)

    # Set effective flag if skill is uncertain

    effective = skill_effect_effective_correction(effective, hit)

    # If hit occurs

    if hit_result

      # Calculate power

      power = skill_effect_power(user, skill)

      # Calculate rate

      rate = skill_effect_rate(user, skill)

      # Calculate basic damage

      skill_effect_base_damage(power, rate)

      # Element correction

      skill_effect_element_correction(skill)

      # If damage value is strictly positive

      if self.damage > 0

        # Guard correction

        skill_effect_guard_correction

      end

      # Dispersion

      skill_effect_disperation(skill)

      # Second hit detection

      hit, hit_result = skill_effect_second_hit_result(user, skill)

      # Set effective flag if skill is uncertain

      effective = skill_effect_effective_correction(effective, hit)

    end

    # If hit occurs

    if hit_result

      # Physical Hit Detection

      effective = true if skill_effect_physical_hit_result(skill)

      # Deal Damage

      effective = skill_effect_damage

      # State change

      @state_changed = false

      effective |= states_plus(skill.plus_state_set)

      effective |= states_minus(skill.minus_state_set)

      # Skill Effect 0 Power Test

      skill_effect_power0(skill)

    # If miss occurs

    else

      # Apply Miss Effects

      skill_effect_miss

    end

    # Skill Effect Damage Fix

    skill_effect_damagefix

    # End Method

    return effective

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Setup

  #--------------------------------------------------------------------------

  def skill_effect_setup

    self.critical = false

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Scope Test

  #--------------------------------------------------------------------------

  def skill_effect_scope(skill)

    # If skill scope is for ally with 1 or more HP, and your own HP = 0,

    # or skill scope is for ally with 0, and your own HP = 1 or more

    return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or

            ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Effective Setup

  #--------------------------------------------------------------------------

  def skill_effect_effective_setup(skill)

    effective = false

    return effective |= skill.common_event_id > 0

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : First Hit Result

  #--------------------------------------------------------------------------

  def skill_effect_first_hit_result(user, skill)

    hit = skill.hit

    if skill.atk_f > 0

      hit *= user.hit / 100

    end

    return hit, (rand(100) < hit)

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Skill Effective

  #--------------------------------------------------------------------------

  def skill_effect_effective_correction(effective, hit)

    return effective |= hit < 100

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Power

  #--------------------------------------------------------------------------

  def skill_effect_power(user, skill)

    power = skill.power + user.atk * skill.atk_f / 100

    if power > 0

      power -= self.pdef * skill.pdef_f / 200

      power -= self.mdef * skill.mdef_f / 200

      power = [power, 0].max

    end

    return power

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Rate

  #--------------------------------------------------------------------------

  def skill_effect_rate(user, skill)

    # Calculate rate

    rate = 20

    rate += (user.str * skill.str_f / 100)

    rate += (user.dex * skill.dex_f / 100)

    rate += (user.agi * skill.agi_f / 100)

    rate += (user.int * skill.int_f / 100)

    # Return Rate

    return rate

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Base Damage

  #--------------------------------------------------------------------------

  def skill_effect_base_damage(power, rate)

    self.damage = power * rate / 20

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Element Correction

  #--------------------------------------------------------------------------

  def skill_effect_element_correction(skill)

    self.damage *= elements_correct(skill.element_set)

    self.damage /= 100

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Guard Correction

  #--------------------------------------------------------------------------

  def skill_effect_guard_correction

    self.damage /= 2 if self.guarding?

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Disperation

  #--------------------------------------------------------------------------

  def skill_effect_disperation(skill)

    if skill.variance > 0 and self.damage.abs > 0

      amp = [self.damage.abs * skill.variance / 100, 1].max

      self.damage += rand(amp+1) + rand(amp+1) - amp

    end

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Second Hit Detection

  #--------------------------------------------------------------------------

  def skill_effect_second_hit_result(user, skill)

    eva = 8 * self.agi / user.dex + self.eva

    hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100

    hit = self.cant_evade? ? 100 : hit

    return hit, (rand(100) < hit)

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Physical Hit Result

  #--------------------------------------------------------------------------

  def skill_effect_physical_hit_result(skill)

    # If physical attack has power other than 0

    if skill.power != 0 and skill.atk_f > 0

      # State Removed by Shock

      remove_states_shock

      # Return True

      return true

    end

    # Return False

    return false

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Damage

  #--------------------------------------------------------------------------

  def skill_effect_damage

    # Substract damage from HP

    last_hp = self.hp

    self.hp -= self.damage

    return self.hp != last_hp

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Power 0 Test

  #--------------------------------------------------------------------------

  def skill_effect_power0(skill)

    # If power is 0

    if skill.power == 0

      # Set damage to an empty string

      self.damage = ""

      # If state is unchanged

      unless @state_changed

        # Set damage to "Miss"

        self.damage = 'Miss'

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Miss

  #--------------------------------------------------------------------------

  def skill_effect_miss

    self.damage = 'Miss'

  end

  #--------------------------------------------------------------------------

  # * Skill Effect : Damage Fix

  #--------------------------------------------------------------------------

  def skill_effect_damagefix

    self.damage = nil unless $game_temp.in_battle

  end

end
 
Nice worked out how to event it so that it "drains" skills from enemies first make a nonresistance skill called Lanced or what ever you want to call it and then attach a battle event to it so that when lance is used and the character that is your "Kimarhri" uses the skill on an enemy that has a skill that can be learned it shows the text of: "character name" has learnt skill "skill name". And that is how it is done.

Also how do I edit it? The instructions arn't that clear so help appreceated thanks.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top