Problem with drain script form the ATOA ACBS

Hello, dear forum. Im a user of the ATOA ACBS, which can be downloaded here. http://workupload.com/file/OOmU2prO. The script itself has many modifications from the the creaotr of this script which are under main, so they're uneffective until they are put above main. Well I wanted to use the drain scritpt and put it above main, but the scirpt didint do anything. I really believe, that it was coded wrong. In the script I posted, the skill 116 is meant to drain HP from the enemy, but when I use it, nothing happens. Can anyone help me by looking at the code and try it out himself?

Thanks in advance!


  1. #==============================================================================
  2. # Skill Drain
  3. # By Atoa
  4. #==============================================================================
  5. # This script allow to create skills and equips that adds the effect 'drain'
  6. # of HP and SP.
  7. # That way attacks and skills can absorb part of the damage caused
  8. #==============================================================================
  9.  
  10. module Atoa
  11.   # Do not remove this line
  12.   Drain_Action = {'Skill' => {}, 'Weapon' => {}, 'Item' => {}}
  13.   # Do not remove this line
  14.  
  15.   # Drain_Action[action_type][id] = {drain_type => [success, rate, anim_id, pop, show_excedent],...}
  16.   # action_type = action type
  17.   #   action_type = 'Skill' for skills, 'Weapon' for weapons, 'Item' for items
  18.   # id = ID of the skill/weapon/item
  19.   # drain_type = drain type
  20.   #   'hp' for HP drain, 'sp' for SP drain
  21.   # success = absorb success rate
  22.   # rate = % of damage converted in HP/SP
  23.   # anim_id = ID of the animation shown when absorb HP/SP, leave nil or 0 for
  24.   #   no animation
  25.   #
  26.  
  27.   Drain_Action['Skill'][116] = {'hp' => [100, 50, nil, true, false],
  28.                                 'sp' =>[100, 50, 18, true, false]}
  29.  
  30.   Drain_Action['Weapon'][43] = {'hp' => [50, 50, nil, true, true]}
  31.  
  32.  
  33. end
  34.  
  35. #==============================================================================
  36. # ■ Atoa Module
  37. #==============================================================================
  38. $atoa_script = {} if $atoa_script.nil?
  39. $atoa_script['Atoa Drain'] = true
  40.  
  41. #==============================================================================
  42. # ■ Game_Battler
  43. #------------------------------------------------------------------------------
  44. # Esta classe gerencia os jogadores da batalha.
  45. # Esta classe identifica os Aliados ou Heróis como (Game_Actor) e
  46. # os Inimigos como (Game_Enemy).
  47. #==============================================================================
  48.  
  49. class Game_Battler
  50.   #--------------------------------------------------------------------------
  51.   # Variáveis Públicas
  52.   #--------------------------------------------------------------------------
  53.   attr_accessor :base_absorb
  54.   #--------------------------------------------------------------------------
  55.   # Inicialização do Objeto
  56.   #--------------------------------------------------------------------------
  57.   alias initialize_drain initialize
  58.   def initialize
  59.     initialize_drain
  60.     @base_absorb = 0
  61.   end
  62. end
  63.  
  64. #==============================================================================
  65. # ■ Scene_Battle
  66. #------------------------------------------------------------------------------
  67. # Esta classe processa a tela de Batalha
  68. #==============================================================================
  69.  
  70. class Scene_Battle
  71.   #--------------------------------------------------------------------------
  72.   # Atualização da fase 4 do personagem (parte 1)
  73.   #     battler : Battler ativo
  74.   #--------------------------------------------------------------------------
  75.   alias step4_part1_drain step4_part1
  76.   def step4_part1(battler)
  77.     step4_part1_drain(battler)
  78.     set_drain_damage(battler)
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # Atualização da fase 4 do personagem (parte 3)
  82.   #     battler : Battler ativo
  83.   #--------------------------------------------------------------------------
  84.   alias step4_part3_drain step4_part3
  85.   def step4_part3(battler)
  86.     step4_part3_drain(battler)
  87.     action = battler.now_action
  88.     if action != nil and Drain_Action[action.type_name] != nil and
  89.        Drain_Action[action.type_name].include?(action_id(action))
  90.       absorb_damage(battler, battler.base_absorb, Drain_Action[action.type_name][action_id(action)].dup)
  91.     end
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # Definir dano do dreno
  95.   #     battler : Battler ativo
  96.   #--------------------------------------------------------------------------
  97.   def set_drain_damage(battler)
  98.     battler.base_absorb = 0
  99.     for target in battler.target_battlers
  100.       battler.base_absorb += target.damage if target.damage.numeric?
  101.     end
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # Absover dano
  105.   #     battler : Battler ativo
  106.   #     absorb  : valor de absorção
  107.   #     action  : Ação
  108.   #--------------------------------------------------------------------------
  109.   def absorb_damage(battler, absorb, action)
  110.     for type in action.keys
  111.       if type == 'hp' and (action[type][0] >= rand(100))
  112.         base_absorb = ((absorb * action[type][1]) / 100).to_i
  113.         if base_absorb > 0
  114.           difference = battler.maxhp - battler.hp
  115.           base_absorb = [base_absorb, difference].min
  116.         elsif base_absorb < 0
  117.           base_absorb = [base_absorb, - battler.hp].max
  118.         end
  119.         if base_absorb != 0
  120.           battler.damage = - base_absorb
  121.           battler.hp -= battler.damage
  122.           battler.animation_id = action[type][2].nil? ? 0 : action[type][2]
  123.           battler.damage_pop = action[type][3]
  124.           wait(3) if battler.damage != 0
  125.         end
  126.       end
  127.       if type == 'sp' and (action[type][0] >= rand(100))
  128.         base_absorb = ((absorb * action[type][1]) / 100).to_i
  129.         if base_absorb > 0
  130.           difference = battler.maxsp - battler.sp
  131.           base_absorb = [base_absorb, difference].min
  132.         elsif base_absorb < 0
  133.           base_absorb = [base_absorb, - battler.sp].max
  134.         end
  135.         if base_absorb != 0
  136.           battler.damage = - base_absorb
  137.           battler.sp -= battler.damage
  138.           battler.animation_id = action[type][2].nil? ? 0 : action[type][2]
  139.           battler.damage_pop = action[type][3]
  140.           battler.sp_damage = action[type][3]
  141.           wait(3) if battler.damage != 0
  142.         end
  143.       end
  144.     end
  145.   end
  146. end
Expand to see the code.

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