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

Skills : Drain/Osmosis Spoiler
  1. #===============================================================================
  2. # ** Skills : Drain/Osmosis
  3. #===============================================================================
  4.  
  5. #-------------------------------------------------------------------------------
  6. # * SDK Log
  7. #-------------------------------------------------------------------------------
  8. SDK.log('Skills.Drain/Osmosis', 'Kain Nobel ©', 3.5, '2009.06.17')
  9. SDK.check_requirements(2.4, [1, 2])
  10. #-------------------------------------------------------------------------------
  11. # * SDK Enabled Test : Begin
  12. #-------------------------------------------------------------------------------
  13. if SDK.enabled?('Skills.Drain/Osmosis')
  14.  
  15. #===============================================================================
  16. # ** RPG::Skill
  17. #===============================================================================
  18.  
  19. class RPG::Skill
  20.   #=============================================================================
  21.   # ** RPG::Skill::Drain
  22.   #=============================================================================
  23.   module Drain
  24.     #---------------------------------------------------------------------------
  25.     # * HP Drain Element Tag ID (set inside Database/System tab).
  26.     #---------------------------------------------------------------------------
  27.     HP_Element_Tag = nil
  28.     #---------------------------------------------------------------------------
  29.     # * SP Drain Element Tag ID (set inside Database/System tab).
  30.     #---------------------------------------------------------------------------
  31.     SP_Element_Tag = nil
  32.     #---------------------------------------------------------------------------
  33.     # * Font Name for Drain Damage String.
  34.     #---------------------------------------------------------------------------
  35.     DamageFontName = "Arial Black"
  36.     #---------------------------------------------------------------------------
  37.     # * Font Size for Drain Damage String.
  38.     #---------------------------------------------------------------------------
  39.     DamageFontSize = 28
  40.     #---------------------------------------------------------------------------
  41.     # * Damage font for drain damage is bolded?
  42.     #---------------------------------------------------------------------------
  43.     DamageFontBold = false
  44.     #---------------------------------------------------------------------------
  45.     # * Damage font for drain damage is italicized?
  46.     #---------------------------------------------------------------------------
  47.     DamageFontItal = false
  48.     #---------------------------------------------------------------------------
  49.     # * Color for text outline displaying HP drain value.
  50.     #---------------------------------------------------------------------------
  51.     HP_ColorBack = Color.new(0, 160, 0)
  52.     #---------------------------------------------------------------------------
  53.     # * Color for main text color displaying HP drain value.
  54.     #---------------------------------------------------------------------------
  55.     HP_ColorMain = Color.new(0, 255, 0)
  56.     #---------------------------------------------------------------------------
  57.     # * Color for text outline displaying SP drain value.
  58.     #---------------------------------------------------------------------------
  59.     SP_ColorBack = Color.new(160, 0, 160)
  60.     #---------------------------------------------------------------------------
  61.     # * Color for main text color displaying SP drain value.
  62.     #---------------------------------------------------------------------------
  63.     SP_ColorMain = Color.new(255, 0, 255)
  64.     #---------------------------------------------------------------------------
  65.     # * Reformat the Damage String for draining HP    (ie "HP +[x]") [x] = value
  66.     #---------------------------------------------------------------------------
  67.     HP_DamageFormat = "HP +[x]"
  68.     #---------------------------------------------------------------------------
  69.     # * Reformat the Damage String for draining SP    (ie "HP +[x]") [x] = value
  70.     #---------------------------------------------------------------------------
  71.     SP_DamageFormat = "SP +[x]"
  72.     #---------------------------------------------------------------------------
  73.     # * Animation played to the reciever of drained HP/SP.      (skill_id => n)
  74.     #---------------------------------------------------------------------------
  75.     Animation   = {7 => 15}
  76.     #---------------------------------------------------------------------------
  77.     # * The percent to drain from damage inflicted on HP.       (skill_id => n)
  78.     #---------------------------------------------------------------------------
  79.     HP_Percent  = {1 => 100, 6 => 100, 7 => 100, 9 => 100}
  80.     #---------------------------------------------------------------------------
  81.     # * A direct value to drain from damage inflicted on HP.    (skill_id => n)
  82.     #---------------------------------------------------------------------------
  83.     HP_Direct   = {}
  84.     #---------------------------------------------------------------------------
  85.     # * Allowed variance to +/- from sub total HP drained.      (skill_id => n)
  86.     #---------------------------------------------------------------------------
  87.     HP_Variance = {}
  88.     #---------------------------------------------------------------------------
  89.     # * The percent to drain from damage inflicted on SP.       (skill_id => n)
  90.     #---------------------------------------------------------------------------
  91.     SP_Percent   = {}
  92.     #---------------------------------------------------------------------------
  93.     # * A direct value to drain from damage inflicted on SP.    (skill_id => n)
  94.     #---------------------------------------------------------------------------
  95.     SP_Direct    = {}
  96.     #---------------------------------------------------------------------------
  97.     # * Allowed variance to +/- from sub total SP drained.      (skill_id => n)
  98.     #---------------------------------------------------------------------------
  99.     SP_Variance = {}
  100.     #---------------------------------------------------------------------------
  101.     # * Critical Flag to be set when draining (this is an scripter thing...)
  102.     #---------------------------------------------------------------------------
  103.     Critical_Flag = "Drain/Osmosis"
  104.     #---------------------------------------------------------------------------
  105.     # * Default Settings (You might not want to modify these...)
  106.     #---------------------------------------------------------------------------
  107.     Animation.default   = 0
  108.     HP_Percent.default  = 0
  109.     HP_Direct.default   = 0
  110.     HP_Variance.default = 0
  111.     SP_Percent.default  = 0
  112.     SP_Direct.default   = 0
  113.     SP_Variance.default = 0
  114.   end
  115.   #-----------------------------------------------------------------------------
  116.   # * Alias Listings
  117.   #-----------------------------------------------------------------------------
  118.   alias_method :drainskill_rpgskill_initialize, :initialize
  119.   #-----------------------------------------------------------------------------
  120.   # * Object Initialization
  121.   #-----------------------------------------------------------------------------
  122.   def initialize
  123.     drainskill_rpgskill_initialize
  124.     if self.drain_hp? && !@element_set.include?(Drain::HP_Element_Tag)
  125.       unless Drain::HP_Element_Tag.nil?
  126.         @element_set << Drain::HP_Element_Tag
  127.       end
  128.     end
  129.     if self.drain_sp? && !@element_set.include?(Drain::SP_Element_Tag)
  130.       unless Drain::SP_Element_Tag.nil?
  131.         @element_set << Drain::SP_Element_Tag
  132.       end
  133.     end
  134.   end
  135.   #-----------------------------------------------------------------------------
  136.   # * Drain Animation
  137.   #-----------------------------------------------------------------------------
  138.   def drain_animation
  139.     return Drain::Animation[@id]
  140.   end
  141.   #-----------------------------------------------------------------------------
  142.   # * HP Drain Percent
  143.   #-----------------------------------------------------------------------------
  144.   def hp_drain_percent
  145.     return Drain::HP_Percent[@id]
  146.   end
  147.   #-----------------------------------------------------------------------------
  148.   # * HP Drain Direct
  149.   #-----------------------------------------------------------------------------
  150.   def hp_drain_direct
  151.     return Drain::HP_Direct[@id]
  152.   end
  153.   #-----------------------------------------------------------------------------
  154.   # * HP Drain Variance
  155.   #-----------------------------------------------------------------------------
  156.   def hp_drain_variance
  157.     return Drain::HP_Variance[@id]
  158.   end
  159.   #-----------------------------------------------------------------------------
  160.   # * SP Drain Percent
  161.   #-----------------------------------------------------------------------------
  162.   def sp_drain_percent
  163.     return Drain::SP_Percent[@id]
  164.   end
  165.   #-----------------------------------------------------------------------------
  166.   # * SP Drain Direct
  167.   #-----------------------------------------------------------------------------
  168.   def sp_drain_direct
  169.     return Drain::SP_Direct[@id]
  170.   end
  171.   #-----------------------------------------------------------------------------
  172.   # * SP Drain Variance
  173.   #-----------------------------------------------------------------------------
  174.   def sp_drain_variance
  175.     return Drain::SP_Variance[@id]
  176.   end
  177.   #-----------------------------------------------------------------------------
  178.   # * HP Drain
  179.   #-----------------------------------------------------------------------------
  180.   def hp_drain(value)
  181.     unless hp_drain_percent.zero?
  182.       value *= hp_drain_percent / 100.0
  183.     end
  184.     value += hp_drain_direct
  185.     value += rand(2).zero? ? -hp_drain_variance : hp_drain_variance
  186.     return Integer(value)
  187.   end
  188.   #-----------------------------------------------------------------------------
  189.   # * SP Drain
  190.   #-----------------------------------------------------------------------------
  191.   def sp_drain(value)
  192.     unless sp_drain_percent.zero?
  193.       value *= sp_drain_percent / 100.0
  194.     end
  195.     value += sp_drain_direct
  196.     value += rand(2).zero? ? -sp_drain_variance : sp_drain_variance
  197.     return Integer(value)
  198.   end
  199.   #-----------------------------------------------------------------------------
  200.   # * Drain?
  201.   #-----------------------------------------------------------------------------
  202.   def drain?
  203.     return (hp_drain? || sp_drain?)
  204.   end
  205.   #-----------------------------------------------------------------------------
  206.   # * HP Drain?
  207.   #-----------------------------------------------------------------------------
  208.   def hp_drain?
  209.     return (!hp_drain_percent.zero? || !hp_drain_direct.zero?)
  210.   end
  211.   #-----------------------------------------------------------------------------
  212.   # * SP Drain?
  213.   #-----------------------------------------------------------------------------
  214.   def sp_drain?
  215.     return (!sp_drain_percent.zero? || !sp_drain_direct.zero?)
  216.   end
  217. end
  218.  
  219. #===============================================================================
  220. # ** Game_BattleAction
  221. #===============================================================================
  222.  
  223. class Game_BattleAction
  224.   #-----------------------------------------------------------------------------
  225.   # * Public Instance Variables
  226.   #-----------------------------------------------------------------------------
  227.   attr_accessor :drain_hp
  228.   attr_accessor :drain_sp
  229.   #-----------------------------------------------------------------------------
  230.   # * Alias Listings
  231.   #-----------------------------------------------------------------------------
  232.   alias_method :drainskill_gmbtlact_clear, :clear
  233.   #-----------------------------------------------------------------------------
  234.   # * Clear
  235.   #-----------------------------------------------------------------------------
  236.   def clear
  237.     drainskill_gmbtlact_clear
  238.     @drain_hp = 0
  239.     @drain_sp = 0
  240.   end
  241. end
  242.  
  243. #===============================================================================
  244. # ** Game_Battler
  245. #===============================================================================
  246.  
  247. class Game_Battler
  248.   #-----------------------------------------------------------------------------
  249.   # * Public Instance Variables
  250.   #-----------------------------------------------------------------------------
  251.   attr_accessor :drain_animation
  252.   #-----------------------------------------------------------------------------
  253.   # * Alias Listings
  254.   #-----------------------------------------------------------------------------
  255.   alias_method :drainskill_gmbtlr_skleff,   :skill_effect
  256.   alias_method :drainskill_gmbtlr_skleffec, :skill_effect_effective_correction
  257.   #-----------------------------------------------------------------------------
  258.   # * Skill Effect
  259.   #-----------------------------------------------------------------------------
  260.   def skill_effect(user, skill)
  261.     unless skill.drain?
  262.       return drainskill_gmbtlr_skleff(user, skill)
  263.     end
  264.     old_hp, old_sp = self.hp, self.sp
  265.     effective = drainskill_gmbtlr_skleff(user, skill)
  266.     last_damage = self.damage
  267.     self.damage = 0
  268.     hit, hit_result = skill_effect_first_hit_result(user, skill)
  269.     effective = skill_effect_effective_correction(effective, hit)
  270.     if hit_result
  271.       power = skill_effect_power(user, skill)
  272.       rate = skill_effect_rate(user, skill)
  273.       skill_effect_base_damage(power, rate)
  274.       skill_effect_element_correction(skill)
  275.       if self.damage > 0
  276.         skill_effect_guard_correction
  277.       end
  278.       skill_effect_disperation(skill)
  279.       hit, hit_result = skill_effect_second_hit_result(user, skill)
  280.       effective = skill_effect_effective_correction(effective, hit)
  281.     end
  282.     if hit_result
  283.       effective = true if skill_effect_physical_hit_result(skill)
  284.       last_sp = self.sp
  285.       self.sp -= self.damage
  286.       effective = self.sp != last_sp
  287.       @state_changed = false
  288.       effective |= states_plus(skill.plus_state_set)
  289.       effective |= states_minus(skill.minus_state_set)
  290.       skill_effect_power0(skill)
  291.     else
  292.       skill_effect_miss
  293.     end
  294.     skill_effect_damagefix
  295.     hp_drain = skill.hp_drain(old_hp - self.hp)
  296.     sp_drain = skill.sp_drain(old_sp - self.sp)
  297.     user.hp += [hp_drain, 0].max
  298.     user.sp += [sp_drain, 0].max
  299.     self.damage   = last_damage
  300.     user.critical = RPG::Skill::Drain::Critical_Flag
  301.     begin
  302.       user.current_action.drain_hp += hp_drain
  303.       user.current_action.drain_sp += sp_drain
  304.     rescue
  305.       p user.current_action, hp_drain, sp_drain
  306.       exit  
  307.     end
  308.     user.damage = Array.new
  309.     user.damage << [user.current_action.drain_hp, 0].max
  310.     user.damage << [user.current_action.drain_sp, 0].max
  311.     unless skill.drain_animation.zero? || skill.drain_animation.nil?
  312.       user.drain_animation = skill.drain_animation
  313.     end
  314.     return effective
  315.   end
  316.   #-----------------------------------------------------------------------------
  317.   # * Skill Effect Effective Correction
  318.   #-----------------------------------------------------------------------------
  319.   def skill_effect_effective_correction(effective, hit)
  320.     return (rand(2) <= 1) if effective.is_a?(Array)
  321.     drainskill_gmbtlr_skleffec(effective, hit)
  322.   end
  323. end
  324.  
  325. #===============================================================================
  326. # ** Scene_Battle
  327. #===============================================================================
  328.  
  329. class Scene_Battle < SDK::Scene_Base
  330.   #-----------------------------------------------------------------------------
  331.   # * Alias Listings
  332.   #-----------------------------------------------------------------------------
  333.   alias_method :drainskill_scnbtl_updatep4s6,       :update_phase4_step6
  334.   #-----------------------------------------------------------------------------
  335.   # * Update Phase 4 : Step 6
  336.   #-----------------------------------------------------------------------------
  337.   def update_phase4_step6
  338.     draining_battlers.each do |battler|
  339.       battler.damage_pop = true
  340.       unless battler.drain_animation == 0 || battler.drain_animation.nil?
  341.         battler.animation_id = battler.drain_animation
  342.         battler.animation_hit = true
  343.         battler.drain_animation = nil
  344.       end
  345.     end
  346.     drainskill_scnbtl_updatep4s6
  347.   end
  348.   #-----------------------------------------------------------------------------
  349.   # * Draining Battlers
  350.   #-----------------------------------------------------------------------------
  351.   def draining_battlers
  352.     battlers = Array.new
  353.     $game_party.actors.each do |actor|
  354.       if actor.current_action.drain_hp || actor.current_action.drain_sp
  355.         battlers << actor
  356.       end
  357.     end
  358.     $game_troop.enemies.each do |enemy|
  359.       if enemy.current_action.drain_hp || enemy.current_action.drain_sp
  360.         battlers << enemy
  361.       end
  362.     end
  363.     battlers.each do |battler|
  364.       battler.current_action.drain_hp = 0
  365.       battler.current_action.drain_sp = 0
  366.     end
  367.     battlers
  368.   end
  369. end
  370.  
  371. #===============================================================================
  372. # ** RPG::Sprite
  373. #===============================================================================
  374.  
  375. class RPG::Sprite < ::Sprite
  376.   #-----------------------------------------------------------------------------
  377.   # * Alias Listings
  378.   #-----------------------------------------------------------------------------
  379.   alias_method :drainskill_RPGsprite_damage, :damage
  380.   #-----------------------------------------------------------------------------
  381.   # * Damage
  382.   #-----------------------------------------------------------------------------
  383.   def damage(value, critical)
  384.     unless value.is_a?(Array) && critical == RPG::Skill::Drain::Critical_Flag
  385.       drainskill_RPGsprite_damage(value, critical)
  386.       return
  387.     end
  388.     dispose_damage
  389.     hp_drain = RPG::Skill::Drain::HP_DamageFormat.dup
  390.     hp_drain.gsub!("[x]", "#{value[0]}")
  391.     hp_drain.gsub!("+", "-") if value[0] < 0
  392.     sp_drain = RPG::Skill::Drain::SP_DamageFormat.dup
  393.     sp_drain.gsub!("[x]", "#{value[1]}")
  394.     sp_drain.gsub!("+", "-") if value[1] < 0
  395.     bitmap = Bitmap.new(160, 8 + (RPG::Skill::Drain::DamageFontSize * 2))
  396.     bitmap.font.name    = RPG::Skill::Drain::DamageFontName
  397.     bitmap.font.size    = RPG::Skill::Drain::DamageFontSize
  398.     bitmap.font.bold    = RPG::Skill::Drain::DamageFontBold
  399.     bitmap.font.italic  = RPG::Skill::Drain::DamageFontItal
  400.     bitmap.font.color = RPG::Skill::Drain::HP_ColorBack
  401.     bitmap.draw_text(-1, 12-1, 160, 40, hp_drain, 1)
  402.     bitmap.draw_text(+1, 12-1, 160, 40, hp_drain, 1)
  403.     bitmap.draw_text(-1, 12+1, 160, 40, hp_drain, 1)
  404.     bitmap.draw_text(+1, 12+1, 160, 40, hp_drain, 1)
  405.     bitmap.font.color = RPG::Skill::Drain::HP_ColorMain
  406.     bitmap.draw_text(0, 12, 160, 40, hp_drain, 1)
  407.     bitmap.font.color = RPG::Skill::Drain::SP_ColorBack
  408.     y = bitmap.font.size + 2
  409.     bitmap.draw_text(-1, y-1, 160, 40, sp_drain, 1)
  410.     bitmap.draw_text(+1, y-1, 160, 40, sp_drain, 1)
  411.     bitmap.draw_text(-1, y+1, 160, 40, sp_drain, 1)
  412.     bitmap.draw_text(+1, y+1, 160, 40, sp_drain, 1)
  413.     bitmap.font.color = RPG::Skill::Drain::SP_ColorMain
  414.     bitmap.draw_text(0, y, 160, 40, sp_drain, 1)
  415.     @_damage_sprite = ::Sprite.new(self.viewport)
  416.     @_damage_sprite.bitmap = bitmap
  417.     @_damage_sprite.ox = 80
  418.     @_damage_sprite.oy = 20
  419.     @_damage_sprite.x = self.x
  420.     @_damage_sprite.y = self.y - self.oy / 2
  421.     @_damage_sprite.z = 3000
  422.     @_damage_duration = 40
  423.   end
  424. end
  425.  
  426. #-------------------------------------------------------------------------------
  427. # * SDK Enabled Test : End
  428. #-------------------------------------------------------------------------------
  429. end
Expand to see the code.


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.
Way to spam his thread >.>

Anyway, cool script. handy indeed :)
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.
Can you make a non-SDK version for me?
it will be mush appreciated.
@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.

Game_Battler#skill_effect split (without SDK) Spoiler
  1. class Game_Battler
  2.   #--------------------------------------------------------------------------
  3.   # * Apply Skill Effects
  4.   #--------------------------------------------------------------------------
  5.   def skill_effect(user, skill)
  6.     # Skill Effects Setup
  7.     skill_effect_setup
  8.     # Return False If Out of Scope
  9.     return false if skill_effect_scope(skill)
  10.     # Setup Effective
  11.     effective = skill_effect_effective_setup(skill)
  12.     # First hit detection
  13.     hit, hit_result = skill_effect_first_hit_result(user, skill)
  14.     # Set effective flag if skill is uncertain
  15.     effective = skill_effect_effective_correction(effective, hit)
  16.     # If hit occurs
  17.     if hit_result
  18.       # Calculate power
  19.       power = skill_effect_power(user, skill)
  20.       # Calculate rate
  21.       rate = skill_effect_rate(user, skill)
  22.       # Calculate basic damage
  23.       skill_effect_base_damage(power, rate)
  24.       # Element correction
  25.       skill_effect_element_correction(skill)
  26.       # If damage value is strictly positive
  27.       if self.damage > 0
  28.         # Guard correction
  29.         skill_effect_guard_correction
  30.       end
  31.       # Dispersion
  32.       skill_effect_disperation(skill)
  33.       # Second hit detection
  34.       hit, hit_result = skill_effect_second_hit_result(user, skill)
  35.       # Set effective flag if skill is uncertain
  36.       effective = skill_effect_effective_correction(effective, hit)
  37.     end
  38.     # If hit occurs
  39.     if hit_result
  40.       # Physical Hit Detection
  41.       effective = true if skill_effect_physical_hit_result(skill)
  42.       # Deal Damage
  43.       effective = skill_effect_damage
  44.       # State change
  45.       @state_changed = false
  46.       effective |= states_plus(skill.plus_state_set)
  47.       effective |= states_minus(skill.minus_state_set)
  48.       # Skill Effect 0 Power Test
  49.       skill_effect_power0(skill)
  50.     # If miss occurs
  51.     else
  52.       # Apply Miss Effects
  53.       skill_effect_miss
  54.     end
  55.     # Skill Effect Damage Fix
  56.     skill_effect_damagefix
  57.     # End Method
  58.     return effective
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # * Skill Effect : Setup
  62.   #--------------------------------------------------------------------------
  63.   def skill_effect_setup
  64.     self.critical = false
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # * Skill Effect : Scope Test
  68.   #--------------------------------------------------------------------------
  69.   def skill_effect_scope(skill)
  70.     # If skill scope is for ally with 1 or more HP, and your own HP = 0,
  71.     # or skill scope is for ally with 0, and your own HP = 1 or more
  72.     return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  73.             ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # * Skill Effect : Effective Setup
  77.   #--------------------------------------------------------------------------
  78.   def skill_effect_effective_setup(skill)
  79.     effective = false
  80.     return effective |= skill.common_event_id > 0
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # * Skill Effect : First Hit Result
  84.   #--------------------------------------------------------------------------
  85.   def skill_effect_first_hit_result(user, skill)
  86.     hit = skill.hit
  87.     if skill.atk_f > 0
  88.       hit *= user.hit / 100
  89.     end
  90.     return hit, (rand(100) < hit)
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # * Skill Effect : Skill Effective
  94.   #--------------------------------------------------------------------------
  95.   def skill_effect_effective_correction(effective, hit)
  96.     return effective |= hit < 100
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * Skill Effect : Power
  100.   #--------------------------------------------------------------------------
  101.   def skill_effect_power(user, skill)
  102.     power = skill.power + user.atk * skill.atk_f / 100
  103.     if power > 0
  104.       power -= self.pdef * skill.pdef_f / 200
  105.       power -= self.mdef * skill.mdef_f / 200
  106.       power = [power, 0].max
  107.     end
  108.     return power
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # * Skill Effect : Rate
  112.   #--------------------------------------------------------------------------
  113.   def skill_effect_rate(user, skill)
  114.     # Calculate rate
  115.     rate = 20
  116.     rate += (user.str * skill.str_f / 100)
  117.     rate += (user.dex * skill.dex_f / 100)
  118.     rate += (user.agi * skill.agi_f / 100)
  119.     rate += (user.int * skill.int_f / 100)
  120.     # Return Rate
  121.     return rate
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # * Skill Effect : Base Damage
  125.   #--------------------------------------------------------------------------
  126.   def skill_effect_base_damage(power, rate)
  127.     self.damage = power * rate / 20
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # * Skill Effect : Element Correction
  131.   #--------------------------------------------------------------------------
  132.   def skill_effect_element_correction(skill)
  133.     self.damage *= elements_correct(skill.element_set)
  134.     self.damage /= 100
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # * Skill Effect : Guard Correction
  138.   #--------------------------------------------------------------------------
  139.   def skill_effect_guard_correction
  140.     self.damage /= 2 if self.guarding?
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # * Skill Effect : Disperation
  144.   #--------------------------------------------------------------------------
  145.   def skill_effect_disperation(skill)
  146.     if skill.variance > 0 and self.damage.abs > 0
  147.       amp = [self.damage.abs * skill.variance / 100, 1].max
  148.       self.damage += rand(amp+1) + rand(amp+1) - amp
  149.     end
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # * Skill Effect : Second Hit Detection
  153.   #--------------------------------------------------------------------------
  154.   def skill_effect_second_hit_result(user, skill)
  155.     eva = 8 * self.agi / user.dex + self.eva
  156.     hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  157.     hit = self.cant_evade? ? 100 : hit
  158.     return hit, (rand(100) < hit)
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # * Skill Effect : Physical Hit Result
  162.   #--------------------------------------------------------------------------
  163.   def skill_effect_physical_hit_result(skill)
  164.     # If physical attack has power other than 0
  165.     if skill.power != 0 and skill.atk_f > 0
  166.       # State Removed by Shock
  167.       remove_states_shock
  168.       # Return True
  169.       return true
  170.     end
  171.     # Return False
  172.     return false
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # * Skill Effect : Damage
  176.   #--------------------------------------------------------------------------
  177.   def skill_effect_damage
  178.     # Substract damage from HP
  179.     last_hp = self.hp
  180.     self.hp -= self.damage
  181.     return self.hp != last_hp
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # * Skill Effect : Power 0 Test
  185.   #--------------------------------------------------------------------------
  186.   def skill_effect_power0(skill)
  187.     # If power is 0
  188.     if skill.power == 0
  189.       # Set damage to an empty string
  190.       self.damage = ""
  191.       # If state is unchanged
  192.       unless @state_changed
  193.         # Set damage to "Miss"
  194.         self.damage = 'Miss'
  195.       end
  196.     end
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # * Skill Effect : Miss
  200.   #--------------------------------------------------------------------------
  201.   def skill_effect_miss
  202.     self.damage = 'Miss'
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # * Skill Effect : Damage Fix
  206.   #--------------------------------------------------------------------------
  207.   def skill_effect_damagefix
  208.     self.damage = nil unless $game_temp.in_battle
  209.   end
  210. end
Expand to see the code.
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.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=65562