Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Problem with drain script form the ATOA ACBS
#1
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? I posted this in several forums, but didint get any help...


Thanks in advance!


Code:
#==============================================================================
# Skill Drain
# By Atoa
#==============================================================================
# This script allow to create skills and equips that adds the effect 'drain'
# of HP and SP.
# That way attacks and skills can absorb part of the damage caused
#==============================================================================

module Atoa
 # Do not remove this line
 Drain_Action = {'Skill' => {}, 'Weapon' => {}, 'Item' => {}}
 # Do not remove this line

 # Drain_Action[action_type][id] = {drain_type => [success, rate, anim_id, pop, show_excedent],...}
 # action_type = action type
 #   action_type = 'Skill' for skills, 'Weapon' for weapons, 'Item' for items
 # id = ID of the skill/weapon/item
 # drain_type = drain type
 #   'hp' for HP drain, 'sp' for SP drain
 # success = absorb success rate
 # rate = % of damage converted in HP/SP
 # anim_id = ID of the animation shown when absorb HP/SP, leave nil or 0 for
 #   no animation
 #

 Drain_Action['Skill'][116] = {'hp' => [100, 50, nil, true, false],
                               'sp' =>[100, 50, 18, true, false]}

 Drain_Action['Weapon'][43] = {'hp' => [50, 50, nil, true, true]}


end

#==============================================================================
# ■ Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script['Atoa Drain'] = true

#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# Esta classe gerencia os jogadores da batalha.
# Esta classe identifica os Aliados ou Heróis como (Game_Actor) e
# os Inimigos como (Game_Enemy).
#==============================================================================

class Game_Battler
 #--------------------------------------------------------------------------
 # Variáveis Públicas
 #--------------------------------------------------------------------------
 attr_accessor :base_absorb
 #--------------------------------------------------------------------------
 # Inicialização do Objeto
 #--------------------------------------------------------------------------
 alias initialize_drain initialize
 def initialize
   initialize_drain
   @base_absorb = 0
 end
end

#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# Esta classe processa a tela de Batalha
#==============================================================================

class Scene_Battle
 #--------------------------------------------------------------------------
 # Atualização da fase 4 do personagem (parte 1)
 #     battler : Battler ativo
 #--------------------------------------------------------------------------
 alias step4_part1_drain step4_part1
 def step4_part1(battler)
   step4_part1_drain(battler)
   set_drain_damage(battler)
 end
 #--------------------------------------------------------------------------
 # Atualização da fase 4 do personagem (parte 3)
 #     battler : Battler ativo
 #--------------------------------------------------------------------------
 alias step4_part3_drain step4_part3
 def step4_part3(battler)
   step4_part3_drain(battler)
   action = battler.now_action
   if action != nil and Drain_Action[action.type_name] != nil and
      Drain_Action[action.type_name].include?(action_id(action))
     absorb_damage(battler, battler.base_absorb, Drain_Action[action.type_name][action_id(action)].dup)
   end
 end
 #--------------------------------------------------------------------------
 # Definir dano do dreno
 #     battler : Battler ativo
 #--------------------------------------------------------------------------
 def set_drain_damage(battler)
   battler.base_absorb = 0
   for target in battler.target_battlers
     battler.base_absorb += target.damage if target.damage.numeric?
   end
 end
 #--------------------------------------------------------------------------
 # Absover dano
 #     battler : Battler ativo
 #     absorb  : valor de absorção
 #     action  : Ação
 #--------------------------------------------------------------------------
 def absorb_damage(battler, absorb, action)
   for type in action.keys
     if type == 'hp' and (action[type][0] >= rand(100))
       base_absorb = ((absorb * action[type][1]) / 100).to_i
       if base_absorb > 0
         difference = battler.maxhp - battler.hp
         base_absorb = [base_absorb, difference].min
       elsif base_absorb < 0
         base_absorb = [base_absorb, - battler.hp].max
       end
       if base_absorb != 0
         battler.damage = - base_absorb
         battler.hp -= battler.damage
         battler.animation_id = action[type][2].nil? ? 0 : action[type][2]
         battler.damage_pop = action[type][3]
         wait(3) if battler.damage != 0
       end
     end
     if type == 'sp' and (action[type][0] >= rand(100))
       base_absorb = ((absorb * action[type][1]) / 100).to_i
       if base_absorb > 0
         difference = battler.maxsp - battler.sp
         base_absorb = [base_absorb, difference].min
       elsif base_absorb < 0
         base_absorb = [base_absorb, - battler.sp].max
       end
       if base_absorb != 0
         battler.damage = - base_absorb
         battler.sp -= battler.damage
         battler.animation_id = action[type][2].nil? ? 0 : action[type][2]
         battler.damage_pop = action[type][3]
         battler.sp_damage = action[type][3]
         wait(3) if battler.damage != 0
       end
     end
   end
 end
end
Reply }
#2
You're right. There is an error in the script. It uses base_absorb to hold the amount of damage that is initially inflicted on the target, which is fine by me. But the script attempts to check how much damage the target suffers before the damage is even applied. Ow. No damage inflicted, no value pushed into base_absorb.

Lines 75-79 read as
Code:
alias step4_part1_drain step4_part1
  def step4_part1(battler)
    step4_part1_drain(battler)
    set_drain_damage(battler)
  end

Change them to
Code:
alias step4_part2_drain step4_part2
  def step4_part2(battler)
    step4_part2_drain(battler)
    set_drain_damage(battler)
  end
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#3
Thank you so much!!!!!
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   The z-space problem of displaying sprites icogil 28 7,063 03-05-2023, 03:31 AM
Last Post: DerVVulfman
   ACBS - Atoa Custom Battle System and TP System zlsl 2 3,577 10-20-2021, 05:09 AM
Last Post: zlsl
   Script compatibility help Lord Vectra 3 3,402 07-25-2021, 11:42 PM
Last Post: DerVVulfman
   Adding face script on Cogwheel's RTAB Battle Status rekkatsu 15 12,403 08-25-2020, 03:09 AM
Last Post: DerVVulfman
   "Wait" in the script Whisper 13 13,282 04-28-2020, 04:06 PM
Last Post: Whisper
   Skill Cooldown script Fenriswolf 11 13,703 12-10-2019, 11:10 AM
Last Post: Fenriswolf
   I want to add an Atoa Custom Battle System command cut-in. zlsl 11 11,532 11-11-2019, 08:55 PM
Last Post: DerVVulfman
   Question about ACBS (Atoa Custom Battle System) aeliath 10 10,586 08-08-2019, 02:50 PM
Last Post: aeliath
   Atoa Individual Battle Commands Geminil 3 6,004 08-02-2017, 03:17 AM
Last Post: DerVVulfman
   Help iwth script (RGSS Player crash) Whisper 3 6,382 06-17-2017, 05:03 PM
Last Post: Whisper



Users browsing this thread: