Problems with counteraatack addon of Atoa Custom Battle System
#1
Hello guys. I just signed in because of this problem :(
Im using rpg xp for about 6 years but I dont have knowledge about rgss so its up to you to help me.

Im working ona rpg xp project. I cant continue my project if nobody helps me solving my problem.
For my project im using the atoa custom battle system. If you dont kwow the battle system check it here: http://victorscripts.wordpress.com/rpg-m...-system-3/
It is made by victor sans, a skilled scripter.

Its a siedview battle system which is very good made. It is for the rpg xp. In addition, it's a complete script yet the creator of the script also made some addons and modifications to this game.
All of them are below main and they need put above main to get them activated. if they are below main they not active. I put the demo fo newest version of the battle system below.

Now my problem: I downloaded the script: As I said the creator put many addons to this game like reflection skill, counterattack skill, drain skill etc. And they're below main which means they're not activated yet. Only if you put it above main they get activated. These are the instructions oft he creator of this script.

So I downloaded the demo and put the counterattack skill above main. Once the player or the enemy is effected with the Counteratack status which is id 91 in my project, the player or the enemy counters every attack, phy/magical skill with an attack. I want to say: I do not use any other script beside the original script. I didint create a own project but opened the demo.

Once the addon is activated and and a hero is about making a action I get an error, which makes me very upset. I put the error message I get below.
I really dont know what I did wrong or why I get these errors. I didint change anything from the script.

Im going to post the Line where I get the error message:
I also want to say that I didint change anything on the script. I just put the addon above like the creator said it in his instructions.
I also dont use any other scripts. I used the demo as my project. So there must be something wrong in the script, right?

I need your help because I cant contintue my project.

Code:
#==============================================================================# Counter Attack# by Atoa#==============================================================================# This script allows actors/enemies to use counter-attack with# different conditions.#==============================================================================
module Atoa  # Don't change or delete these lines.  Counter_Setting = {'Actor' => {}, 'Enemy' => {}, 'Skill' => {}, 'State' => {},    'Armor' => {}, 'Weapon' => {}}  # Don't change or delete these lines.
  # Counter_Setting[Type][ID] = {Activation => Effect,...}
  # Type : Counter-Attack Type  #     'Actor' for actors  #     'Enemy' for enemies  #     'Skill' for skills (the skill has to be learnt)  #     'State' for effects  #     'Armor' for armors  #     'Weapon' for weapons    # Activation = {'type' => type, 'condition' => condition, 'action' => specific action}  #  Type: Action which will activate the counter  #   0 = Normal Attack  #   1 = Attack Skills  #   2 = Magic Skills  #   3 = Specific Actions  #   4 = Any attack or skill  #  # Condition: Needed Conditions to counter  # This can be left out (counter will always be executed)  # Text String with the condition to be used can be script commands and available  # methods from Game_Battler Class.  #  #    You can add other atrributes using its respective script commands  #      "user" - user/attacker (the one who is attacking)  #      "target" - target (the one who is being attacked and will counter)  #      "skill" - skill  #      "damage" - damage dealt on the target  #    Examples:  #      "damamge.numeric? and damage >= 200" # if damage is a numeric value    #                      #greater or equal to 200  #  #      "damamge.numeric? and damage > 50 * target.maxhp / 100" # if damage is a numeric value  #                       #greater than  50% target max hp  #      "damage == Miss_Message" # if damage is not a value but a message error  #                       #  (when "miss" message shows up)  #      "rand(100) < 50" # If random value from 0 to 100 is less than 50  #                       # (50% chance of countering)  #      "rand(100) < 70 and target.hp < target.maxhp / 2" # If random value from 0 to 100  #                       # is less than 70 (70% chance of countering) and only  #                       # if taget has half of its full hp  #  #     IMPORTANT: to verifuy if a value is "greater or less" when damage is related,  #       it's extremely important to use 'damage.numeric?' method to check  #       if damage is a numberic value. If you use operator like "<" and ">" for verifications  #       using texts, there will be an error, since damage can be shown as texts.  #  #  Specific Action : This value can only be used if "Type" is equal to 3  #    It has to be a list containing all skill IDs that will make counter  #    work
  # Effect = [[Type, Target(, [ID], Cost)],...]  # Effect = {'type' => Type, 'target' => Target, 'id' => [ID], 'cost' => Cost, wait => Wait}  #  Type : Attack Type  #    0 = Normal Attack  #    1 = Skill  #    2 = Itens  #  Target: Action target, it can be left out. If left out the target will be  #   the action default ones  #    0 = Enemies (one only target actions will always hit the target battler)  #    1 = Allies (one only target actions will always hit the user)  #  ID : Numeric value or list containing action/skill IDs available   #    only if type is 1 or 2  #    If more than one value is set, the action will be random among  #    available actions.  #  Cost : Action cost, true or false. Only if type is 1 or 2.  #    If true, the skill will just be executed if the cost can be payed  #    and it will consume its SP or Item cost.  #  Wait : Waiting time, true or false, it can be left out.  #    If true, after attackin, the battler will hold on until counter-attack action ends,  #    and then returns to its position.
  Counter_Setting['Actor'][1] = {    {'type' => 0} => {'type' => 0, 'wait' => true},     # Counter any physical attack and target waits until action ends.    {'type' => 2, 'condition' => 'target.in_danger?'} => {'type' => 2, 'id' => 1, 'cost' => true},    # Counter against magic using potions if the battler hp is in danger    {'type' => 4, 'condition' => 'damage.numeric? and damage > 1000'} => {'type' => 1, 'id' => 1, 'cost' => true},    # Counter any attack that can deal more than 1000 damage using Cure in him/herself  }    Counter_Setting['Actor'][2] = {    {'type' => 0} => {'type' => 0, 'wait' => true},     # Always counter any physical attack and target wait until it ends to returno to its position    {'type' => 2, 'condition' => 'target.in_danger?'} => {'type' => 2, 'id' => 1, 'cost' => true},    # Counter skills using a potion in him/herself if HP is  in danger    {'type' => 4, 'condition' => 'damage.numeric? and damage > 1000'} => {'type' => 1, 'id' => 1, 'cost' => true},    # Counter any attack that deals more than 1000 damage using cure skill in himself/herself  }    Counter_Setting['Actor'][3] = {    {'type' => 0} => {'type' => 0, 'wait' => true},     # Always counter any physical attack and target wait until it ends to return to its position        {'type' => 2, 'condition' => 'target.in_danger?'} => {'type' => 2, 'id' => 1, 'cost' => true},    # Counter skills using a potion in him/herself if HP is in danger    {'type' => 4, 'condition' => 'damage.numeric? and damage > 1000'} => {'type' => 1, 'id' => 1, 'cost' => true},    # Counter any attack that deals more than 1000 damage using cure skill in himself/herself  }    Counter_Setting['Actor'][4] = {    {'type' => 0} => {'type' => 0, 'wait' => true},     # Always counter any physical attack and target wait until it ends to return to its position    {'type' => 2, 'condition' => 'target.in_danger?'} => {'type' => 2, 'id' => 1, 'cost' => true},    # Counter skills using a potion in him/herself if HP is in danger    {'type' => 4, 'condition' => 'damage.numeric? and damage > 1000'} => {'type' => 1, 'id' => 1, 'cost' => true},    # Counter any attack that deals more than 1000 damage using cure skill in himself/herself  }     Counter_Setting['Enemy'][11] = {    {'type' => 0, 'condition' => 'damage != Miss_Message'} => {'type' => 0, 'wait' => true},     # Counter any pysical attack if damage is dealt and target wait until counter ends    {'type' => 2, 'condition' => 'target.hp < 50 * target.maxhp / 100'} => {'type' => 1, 'id' => 3, 'cost' => true},    # Counter against skills using Cura in him/herself if HP is 50%    {'type' => 4, 'condition' => 'damage.numeric? and damage > 1000'} => {'type' => 1, 'id' => 110, 'cost' => true},    # Counter against any attack that deals more than 1000 damage using    # skill "Celcius Attack"  }  end#==============================================================================# ** Atoa Module#==============================================================================$atoa_script = {} if $atoa_script.nil?$atoa_script['Atoa Counter Attack'] = true
#==============================================================================# ** Game_Battler#------------------------------------------------------------------------------#  This class deals with battlers. It's used as a superclass for the Game_Actor#  and Game_Enemy classes.#==============================================================================
class Game_Battler  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_accessor :counter_action  attr_accessor :counter_action_set  attr_accessor :counter_targets  attr_accessor :counter_cost  attr_accessor :wait_counter  attr_accessor :valid_counters  attr_accessor :counter_waiting  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  alias initialize_counter initialize  def initialize    @counter_targets = []    @valid_counters = []    initialize_counter  end  #--------------------------------------------------------------------------  # * Applying Normal Attack Effects  #     attacker : battler  #--------------------------------------------------------------------------  alias attack_effect_counter attack_effect  def attack_effect(attacker)    effective = attack_effect_counter(attacker)    if $game_temp.in_battle and attacker != self and not attacker.counter_action_set      damage = attacker.target_damage[self]      set_counter_condition(attacker, damage)    end    return effective  end  #--------------------------------------------------------------------------  # * Apply Skill Effects  #     user  : user  #     skill : skill  #--------------------------------------------------------------------------  alias skill_effect_counter skill_effect  def skill_effect(user, skill)    effective = skill_effect_counter(user, skill)    if $game_temp.in_battle and user != self and not user.counter_action_set       damage = user.target_damage[self]      set_counter_condition(user, damage, skill)    end    return effective  end  #--------------------------------------------------------------------------  # * Consume skill cost  #     skill : skill  #--------------------------------------------------------------------------  alias consume_skill_cost_counter consume_skill_cost  def consume_skill_cost(skill)    return if self.counter_action_set and not self.counter_cost    consume_skill_cost_counter(skill)  end   #--------------------------------------------------------------------------  # * Set counter condition  #     user    : user  #     damage  : damage  #     skill   : skill  #--------------------------------------------------------------------------        def set_counter_condition(user, damage, skill = nil)    if self.actor?      set_counter(user, damage, skill, 'Actor')      set_counter(user, damage, skill, 'Skill')      set_counter(user, damage, skill, 'Armor')      set_counter(user, damage, skill, 'Weapon')    else      set_counter(user, damage, skill, 'Enemy')    end    set_counter(user, damage, skill, 'State')    return if @valid_counters.empty?    self.counter_action = @valid_counters[rand(@valid_counters.size)]  end  #--------------------------------------------------------------------------  # * Set counter  #     user    : user  #     damage  : damage  #     skill   : skill  #     kind    : kind  #--------------------------------------------------------------------------        def set_counter(user, damage, skill, kind)    if kind == 'Actor' and Counter_Setting['Actor'][self.id] != nil      counter = Counter_Setting['Actor'][self.id].dup      set_counter_values(user, damage, skill, kind, counter)    end    if kind == 'Enemy' and Counter_Setting['Enemy'][self.id] != nil      counter = Counter_Setting['Enemy'][self.id].dup      set_counter_values(user, damage, skill, kind, counter)    end    if kind == 'State'      for id in self.states        if Counter_Setting['State'][id] != nil          counter = Counter_Setting['State'][id]          set_counter_values(user, damage, skill, kind, counter)        end      end    end    if kind == 'Skill'      for id in self.skills        if Counter_Setting['Skill'][id] != nil          counter = Counter_Setting['Skill'][id]          set_counter_values(user, damage, skill, kind, counter)        end      end    end    if kind == 'Armor'      for armor in self.armors        id = armor.id        if Counter_Setting['Armor'][id] != nil          counter = Counter_Setting['Armor'][id]          set_counter_values(user, damage, skill, kind, counter)        end      end    end    if kind == 'Weapon'      for weapon in self.weapons        id = weapon.id        if Counter_Setting['Weapon'][id] != nil          counter = Counter_Setting['Weapon'][id]          set_counter_values(user, damage, skill, kind, counter)        end      end    end  end  #--------------------------------------------------------------------------  # * Set counter values  #     user    : user  #     damage  : damage  #     skill   : skill  #     kind    : kind  #     counter : settings  #--------------------------------------------------------------------------    def set_counter_values(user, damage, skill, kind, counter)    for condition in counter.keys      current = counter[condition]      next if skill.nil? and not [0, 4].include?(condition['type'])      next if skill != nil and not skill.magic? and not [1, 4].include?(condition['type'])      next if skill != nil and skill.magic? and not [2, 4].include?(condition['type'])      next if skill != nil and condition['action'] != nil and not              condition['action'].include?(skill.id)      next if condition['condition'] != nil and not eval(get_condition(condition))      next if current['cost'] and current['type'] == 1 and cant_counter_skill(current['id'])      next if current['cost'] and current['type'] == 2 and cant_counter_item(current['id'])      @valid_counters << set_counter_action(current)    end  end  #--------------------------------------------------------------------------  # * Get condition  #     condition : current setting  #--------------------------------------------------------------------------    def get_condition(condition)    current = condition['condition']    current.gsub!(/target/i) {"self"}    return current  end  #--------------------------------------------------------------------------  # * Allow skill for counter  #     current : current setting  #--------------------------------------------------------------------------    def cant_counter_skill(current)    return (not skill_can_use?(current)) if current.numeric?    for skill_id in current      return false if skill_can_use?(skill_id)    end    return true  end  #--------------------------------------------------------------------------  # * Allow item for counter  #     current : current setting  #--------------------------------------------------------------------------    def cant_counter_item(current)    return (self.actor? and not $game_party.item_can_use?(current)) if current.numeric?    for item_id in current      return false if $game_party.item_can_use?(item_id) or not self.actor?    end    return true  end  #--------------------------------------------------------------------------  # * Set counter action  #     current : current setting  #--------------------------------------------------------------------------    def set_counter_action(current)    if current['type'] == 1 and current['id'].is_a?(Array)      available_skills = []      for skill_id in current        available_skills << skill_id if skill_can_use?(skill_id) or not current['cost']      end      action = available_skills[rand(available_skills.size)]    elsif current['type'] == 2 and current['id'].is_a?(Array)      available_skills = []      for item_id in current        available_skills << skill_id if $game_party.item_can_use?(item_id) or not                                        current['cost'] or not self.actor?      end      action = available_skills[rand(available_skills.size)]    else      action = current['id']    end    return current.dup  end  end
#==============================================================================# ** Scene_Battle#------------------------------------------------------------------------------#  This class performs battle screen processing.#==============================================================================
class Scene_Battle  #--------------------------------------------------------------------------  # * Start battler turn  #     battler : battler  #--------------------------------------------------------------------------  alias battler_turn_counter battler_turn if $atoa_script["Atoa ATB"] or $atoa_script["Atoa CTB"]  def battler_turn(battler)    return if battler.counter_action_set    battler_turn_counter(battler)  end  #--------------------------------------------------------------------------  # * Update battler phase 5 (part 1)  #     battler : active battler  #--------------------------------------------------------------------------  alias step2_part1_counter step2_part1  def step2_part1(battler)    for target in $game_party.actors + $game_troop.enemies      if target.dead?        target.counter_action = nil        target.counter_action_set = false        target.counter_waiting = nil        target.wait_counter = false        target.counter_cost = false        target.current_action.clear        target.action_scope = 0      end    end    step2_part1_counter(battler)    if battler.cast_action != nil and battler.counter_action_set      battler.current_phase = "Phase 2-1"      return    end  end  #--------------------------------------------------------------------------  # * Update battler phase 5 (part 1)  #     battler : active battler  #--------------------------------------------------------------------------  alias step5_part1_counter step5_part1  def step5_part1(battler)    step5_part1_counter(battler)    if battler.counter_waiting != nil      battler.counter_waiting.wait_counter = false      battler.counter_waiting = nil    end    for target in $game_party.actors + $game_troop.enemies      if target.counter_action != nil and target.inputable? and not          target.hp0? and not battler.counter_action_set        set_counter_action(battler, target)        target.counter_action_set = true        @action_battlers.unshift(target)        @action_battlers.uniq!        if target.returning? and target.moving?          target.current_phase = 'Phase 2-1'          target.target_x = target.actual_x          target.target_y = target.actual_y        end      end      target.counter_action = nil    end  end  #--------------------------------------------------------------------------  # * Update battler phase 5 (part 2)  #     battler : active battler  #--------------------------------------------------------------------------  alias step5_part2_counter step5_part2  def step5_part2(battler)    return if battler.wait_counter    step5_part2_counter(battler)  end  #--------------------------------------------------------------------------  # * Update battler phase 5 (part 4)  #     battler : active battler  #--------------------------------------------------------------------------  alias step5_part4_counter step5_part4  def step5_part4(battler)    step5_part4_counter(battler)    battler.counter_action_set = false    battler.valid_counters.clear  end  #--------------------------------------------------------------------------  # * Set action cost  #     battler : battler  #--------------------------------------------------------------------------  alias set_action_cost_counter set_action_cost if $atoa_script['Atoa CTB']  def set_action_cost(battler)    if battler.counter_action_set      battler.current_cost = 0      return    end    set_action_cost_counter(battler)  end  #--------------------------------------------------------------------------  # * ATB reset  #     battler : active battler  #--------------------------------------------------------------------------  alias reset_atb_counter reset_atb if $atoa_script['Atoa ATB']  def reset_atb(battler)    return if battler.counter_action_set    reset_atb_counter(battler)  end  #--------------------------------------------------------------------------  # * Set item consum  #     battler : battler  #--------------------------------------------------------------------------  alias consum_item_cost_counter consum_item_cost  def consum_item_cost(battler)    return if battler.counter_action_set and not battler.counter_cost    consum_item_cost_counter(battler)  end  #--------------------------------------------------------------------------  # * Set counter action  #     battler : battler  #     target  : target  #--------------------------------------------------------------------------  def set_counter_action(battler, target)    action = target.counter_action    target.counter_info = [target.current_action.kind, target.current_action.basic,      target.current_action.skill_id, target.current_action.item_id, target.action_scope]    target.current_action.kind = action["type"]    target.current_action.basic = 0 if action["type"] == 0    target.current_action.skill_id = action["id"] if action["type"] == 1    target.current_action.item_id = action["id"] if action["type"] == 2    target.counter_cost = action["cost"]    if action["type"] == 1 or action["type"] == 2      id = target.current_action.skill_id if action["type"] == 1      id = target.current_action.item_id if action["type"] == 2      target.current_skill = $data_skills[id] if action["type"] == 1      target.current_item = $data_items[id] if action["type"] == 2    end    target.current_action.target_index = battler.index    if action["type"] == 1      scope = 7      target.action_scope = scope     elsif action["type"] == 0      scope = oposite_side(battler, target) ? 1 : 3      target.action_scope = scope     end    if (target.current_skill != nil or target.current_item != nil) and not       oposite_side(battler, target)      current_action = target.current_skill if target.current_skill != nil      current_action = target.current_item if target.current_item != nil      case current_action.scope      when 1 then scope = 3      when 2 then scope = 4      when 3 then scope = 1      when 4 then scope = 2      when 5 then scope = 1      when 6 then scope = 2      end      target.action_scope = scope    end    set_target_battlers(target, scope)    target.action_scope = 0    if action["wait"]      battler.wait_counter = true      target.counter_waiting = battler      battler.pose_id = @spriteset.battler(battler).set_idle_pose    end  endend


Attached Files
.png   fehler2.png (Size: 35.71 KB / Downloads: 5)
.png   fehler1.png (Size: 101.68 KB / Downloads: 3)
.rar   atoa custom battle system 3 - eng.rar (Size: 2.51 MB / Downloads: 2)
Reply }
#2
It has been years since I messed around with Atoa's ...er ... Victor's system. Winking with a tongue sticking out It was interesting that he was developing his system while I was developing my sideview script to work with other battlesystems (turning frontviews systems into sideviews).

I took a brief look and got the same error as you described, so I did a little search for the phrase 'cast_action'. Apparently, you need to use either Atoa... *COUGH* Victor's "Add | Atoa ATB" or "Add | Atoa CTB" script with it. He used to go by ATOA for some years. These two scripts (choose one) create the cast_action' value that the counter attack script is looking for. Once I loaded one of these two scripts, the error popup vanished.

However, I am STUMPED as hell as to how to make an actor perform a counter attack. I mean I tried THIS:
Code:
Counter_Setting['Actor'][1] = {
    {'type' => 4 } => {'type' => 0}
  }
As far as I know, that should make actor #1 perform a counter attack if it suffers any attack (Type => 4) with a normal attack (type =>0).

I would like a better set of instructions myself. It woulda been nice if the script add-on said 'Needs either the ATB or CTB addon to work.'

Perhaps, Victor will come by and lend a hand. He's a member here too.
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
(07-06-2014, 03:43 AM)DerVVulfman Wrote: It has been years since I messed around with Atoa's ...er ... Victor's system. Winking with a tongue sticking out It was interesting that he was developing his system while I was developing my sideview script to work with other battlesystems (turning frontviews systems into sideviews).

I took a brief look and got the same error as you described, so I did a little search for the phrase 'cast_action'. Apparently, you need to use either Atoa... *COUGH* Victor's "Add | Atoa ATB" or "Add | Atoa CTB" script with it. He used to go by ATOA for some years. These two scripts (choose one) create the cast_action' value that the counter attack script is looking for. Once I loaded one of these two scripts, the error popup vanished.

However, I am STUMPED as hell as to how to make an actor perform a counter attack. I mean I tried THIS:
Code:
Counter_Setting['Actor'][1] = {
    {'type' => 4 } => {'type' => 0}
  }
As far as I know, that should make actor #1 perform a counter attack if it suffers any attack (Type => 4) with a normal attack (type =>0).

I would like a better set of instructions myself. It woulda been nice if the script add-on said 'Needs either the ATB or CTB addon to work.'

Perhaps, Victor will come by and lend a hand. He's a member here too.




It still doesnt work. If somebody attacks someone who is inflicted with the status id 91 which (is used as counterattack) I get an error in line 475/76
I used the ATB addon and the CTB.

Code:
target.counter_info = [target.current_action.kind, target.current_action.basic,target.current_action.skill_id, target.current_action.item_id, target.action_scope]


The funny thing is, that this part of the code is never used again only once in 475/6

At the CTB addon the hero doesnt do anything when he is atackted while having a counterattack status. Did the enemy or actor replied to attacks because of counterattack script? I mean did you see it in demo?


I have to questions: Is it not possible to edit the script so that you dont need one of the ctb/atb addons?
And the other one:


Cant you at least define the method currenct_action and the target_index for me.

I think this would really help me alot and maybe solve my problem. I want to test wheither I can make it through condinational branch beside with scripting
Reply }
#4
I have the demo. I inserted the ATB addon (not the CTB addon) above the counter attack script, and then set up 'ALL' my actors to perform a simple general attack if they were themselves attacked. Each one had:
Code:
{'type' => 4 } => {'type' => 0}
in their case. I deleted everything else as I didn't want any counter attack except that one. And I got nothing.

I then swapped the ATB addon with the CTB. Hey, you can't use both at the same time. And with the same luck.... none.

I did some testing, and found the set_counter_condition method that detects who the attacker and defender are, and confirmed that it is passing the data, but the freakin counter attack isn't HAPPENING!!!!

You want a reaction if actor #17 is attacked by an enemy, right? Fine. I wrote an end run around. Paste THIS below the counterattack script. Just remember that the counter attack script needs either the ATB or CTB addon too.

Code:
# COUNTER ATTACK ADDENDUM

#  This system merely uses Atoa's counter attack system for the purposes of
#  turning on a switch which can be used to trigger an event, be it a battle
#  event or map event.

#
  DEFENDING_ACTOR     = 17   # This is your chosen actor (You'll prolly use 17)
  DEFENDING_STATE     = 91  # If the actor has to be status inflicted (else nil)
  
  ENEMY_INDEX         = nil #2   # Know the index of the enemy? If not, set to nil
  AGGRESSIVE_ENEMY_ID = nil #1   # Want to go by an ID Enemy Database ID?
  
  COUNTER_SWITCH_ID   = 15  # This sets what RMXP switch is turned on for your
                            # responce

                            
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================

class Game_Temp
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias counter_attack_addon_initialize initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :battle_enemy_index       # Index of current enemy in battle
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # The original call
    counter_attack_addon_initialize
    @battle_enemy_index = 0  
  end
end



#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias counter_attack_addon_set_counter_condition set_counter_condition
  #--------------------------------------------------------------------------
  # * Set counter condition
  #     user    : user
  #     damage  : damage
  #     skill   : skill
  #--------------------------------------------------------------------------      
  def set_counter_condition(user, damage, skill = nil)
    if self.actor?
      if self.id == DEFENDING_ACTOR
        if user.is_a?(Game_Enemy)
          flag_0 = false
          flag_0 = self if user.states.include?(DEFENDING_STATE)
          flag_0 = true if DEFENDING_STATE.nil?
          flag_1 = false
          flag_1 = true if user.id == AGGRESSIVE_ENEMY_ID
          flag_1 = true if AGGRESSIVE_ENEMY_ID.nil?
          flag_2 = false
          flag_2 = true if $game_temp.battle_enemy_index == ENEMY_INDEX
          flag_2 = true if ENEMY_INDEX.nil?          
          # If all conditions are met
          if (flag_0 && flag_1 && flag_2)
            $game_switches[COUNTER_SWITCH_ID] = true
            return
          end
        end
      end
    end
    # The original call
    counter_attack_addon_set_counter_condition(user, damage, skill)
  end
end

I set the actor to be tested as actor #17, he requires to be inflicted by state #91, and I 'nil'ed out the enemy data, so any enemy attacking him will turn on an RPGMaker switch. That switch, I defined as switch #15.

These are editable at the top of the script.

You wanted a conditional branch to occur if an actor was attacked? There you go.

Just be sure to reset the switch when needed.
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 }
#5
I really dont know what I did wrong..

I put the CTB above.

and your addon script below the counterattack script.

But when I attack a monster a monster I get an error in these line 475 & 476

Code:
target.counter_info = [target.current_action.kind, target.current_action.basic,
target.current_action.skill_id, target.current_action.item_id, target.action_scope]


Does it work on you? can your try this: if a hero is attacked while having the status id 91, in battle the message dfdf343 (just an example) should show up. of course with the switch 15 as a trigger.
I want to test it out. Because I get an error on line in 475 when attacking somebody.

Can you upload your edited game when it really works fine? I'm so frustated about this script. Tried to contact the devolper of this script but he rejects me and keep banning my messages in his blog.
Why would such a skilled scripter make such bugs in his works?

There are a lot of bugs in his script.
The reflection skill is not working too.
-If the enemy is inflicted with a status it shows up but it does not fade out when the status is already gone.
-if a actor is confused he goes from the screen and the game freezes after a while.

And his last update of the script is form year 2011 while so many people keep posting bugs found in his work. Such a sloppy work he made in his script.
And in additon this guy is very stubborn. Never replies. He keeps telling me that I did something wrong while every person I talked to agrees to what I said
Reply }
#6
Confused Okayyyy... A little more needs to be worked out.

I got it in my demo....
I got it to detect my player to be hit....
Hell, I even got it to know WHICH freakin enemy in the troop attacked, so I was able to force a return attack in a TROOPS response when the set Switch was turned on...

BUT I CANNOT TURN THE FREAKIN' SWITCH OFF? Shocked

Sarcasm A bit more needs work, because I am pretty sure you don't want the guy to keep attacking the counter-attacked enemy target automatically when his turn comes up.
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 }
#7
hmm I dont understand it to 100% because my english su****

So you managed to get the swtich 15 on?
Cant you just make this:
Go to battle troops and set the swtich 15 as a trigger. You need to make the battle event as "moment"
And then simply switch the swtich 15 to off.

What about the error im getting?

target.counter_info = [target.current_action.kind, target.current_action.basic,
target.current_action.skill_id, target.current_action.item_id, target.action_scope]

these lines are very crazy. Because this line is never used again so I can easly erase them or put a # before them to deactivate them.
I think we need the help of the author. HE needs to fix his script.
Even if we manage to make it throw the swtich. I dont want the counterattack to overlap the actual attack.

For example, if the actor uses a skill. Then someone attacks the actor and he counters. he should counterattack AND use his skill. Overlapping would be very bad.

btw. can you upload your work here even if its not finished yet because I didint even manged it to turn the switch on.
Reply }
#8
Ugh, the counterattack system is kinda faulty indeed.

I just tested it on a basic level, sending little bits of code to bring up popup screens so I could trace how it works. Believe it or not, I managed to see the Actor #1 perform an actual 'counterattack' .... ONCE! Yet, there is nothing saying 'happens 10% of the time'. It apparently will perform a counter attack, but sporadically.

And the following:
Code:
target.counter_info = [target.current_action.kind, target.current_action.basic,
target.current_action.skill_id, target.current_action.item_id, target.action_scope]

.... I did a check. No where in his entire demo does 'counter_info' appear other than that one line. It has to be a leftover or something totally incomplete. If it was meant to use another value other than counter_info, Victor didn't change it.
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 }
#9
Okay I managed to solve this problem. This topic can be closed by now.
EDIT: Theres still little problem: The actor does also counterattack when somebody uses a heal skill or a cure skill. Is there a chance to fix that problem? Please do not cloe.

Here is what I've done to make it work. First how to make it work WITHOUT an ctb or atb addon

1. put the counterattack addon above main.
2. go to line 475/ 476 put an # infront of these lines.
They should look like this now:

Code:
#target.counter_info = [target.current_action.kind, target.current_action.basic,#target.current_action.skill_id, target.current_action.item_id, target.action_scope]


3. go to line 387
and replace this line here:


Code:
if battler.cast_action != nil and battler.counter_action_set

with this
Code:
if battler.counter_action != nil and battler.counter_action_set



4. Put this script below your counterattack script:


Code:
class Game_Battler
define_method(:cast_action) { |*a| } unless method_defined?(:cast_action)
define_method(:counter_info=) { |*a| } unless method_defined?(:counter_info=)

def remember_current_action
@remembered_action = [@current_action.clone, self.action_scope]
end

def restore_current_action
@current_action, self.action_scope = *@remembered_action
clear_remembered_action
end

def clear_remembered_action
@remembered_action = nil
end
end


class Scene_Battle

#--------------------------------------------------------------------------
# * Check allow next action
# EDIT: Always allow Counter-Actions
#--------------------------------------------------------------------------
def allow_next_action
return false if cant_if_same
return false if cant_if_damaged_or_invisible
return false if cant_target_invisible
return true if @active_battlers.empty?
# --- EDIT: ---
@action_battlers.each_with_index do |battler, index|
next unless battler.counter_waiting != nil
next unless battler.counter_waiting.wait_counter
next if @active_battlers.include?(battler)
@action_battlers.delete_at(index)
@action_battlers.unshift(battler)
return true
end
# -------------
return false if cant_if_enemy_target and not Allow_Enemy_Target
return false if cant_target_active and not Allow_Active_Target
return false if cant_target_moving? and not Allow_Moving_Target
return true if next_before_return? and Next_Before_Return
return true if allow_same_targets? and Allow_Same_Target
return true if allow_diff_targets? and Allow_Diff_Targets
return false
end

#--------------------------------------------------------------------------
# * Update battler phase 5 (part 1)
# battler : active battler
# EDIT: Do not remove Countering Targets from the queue!
#--------------------------------------------------------------------------
def step5_part1(battler)
step5_part1_counter(battler)
if battler.counter_waiting != nil
battler.counter_waiting.wait_counter = false
battler.counter_waiting = nil
end
for target in $game_party.actors + $game_troop.enemies
if target.counter_action != nil and target.inputable? and not
target.hp0? and not battler.counter_action_set
set_counter_action(battler, target)
target.counter_action_set = true
@action_battlers.unshift(target)
#@action_battlers.uniq!
if target.returning? and target.moving?
target.current_phase = 'Phase 2-1'
target.target_x = target.actual_x
target.target_y = target.actual_y
end
end
target.counter_action = nil
end
end

#--------------------------------------------------------------------------
# * Set counter action
# battler : battler
# target : target
# EDIT: Remember original action to restore it after Execution;
# Force Counter Action to suppress Restriction-Effects.
#--------------------------------------------------------------------------
alias_method(:set_counter_action_ILC_remember_action, :set_counter_action)
def set_counter_action(battler, target)
target.remember_current_action
set_counter_action_ILC_remember_action(battler, target)
target.current_action.forcing = true
end

#--------------------------------------------------------------------------
# * Update battler phase 5 (part 4)
# battler : active battler
# EDIT: Restore remembered Action when terminating a Counter
#--------------------------------------------------------------------------
def step5_part4(battler)
# ---
battler.restore_current_action if battler.counter_action_set
# ---
step5_part4_counter(battler)
battler.counter_action_set = false
battler.valid_counters.clear
end

end



Now it should work fine unless you use ctb or atb addon








5.1 If yo want to use the ctb or atb addon you have to do the same but add little things.
(REMEMBER: YOU HAVE TO DO THE SAME STEPS BEFORE TOO)


5.2 go to line 63 of the little script and replace:
Code:
target.inputable?



with
Code:
target.inputable_by_status?



5.3 Add this little code between the line 4 and 6.


Code:
alias_method(:inputable_by_status?, :inputable?)



Now it should work also if you use one of the ctb or atb addon.


Thank you very much wulfman and admin or moderator please close this topic..
Reply }
#10
I'm not a coder or anything, but I know a little to get by.... Did you add this script to your game as well?
Quote:ACBS | Config 2 - Advanced
There is a section that deals with how skills behave.... you can make all sorts of cool changes and such. I believe that skill number 91 is part of the default. I don't know if that makes a difference, but maybe the two scripts are conflicting or something?
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   ForeverZer0 Custom Resolution + Littledrago's Zoom Solitaire 20 1,207 10-27-2024, 09:32 PM
Last Post: Solitaire
   GW Animated Battle backs Patch for Atoa ACBS Solitaire 21 1,550 10-17-2024, 06:37 AM
Last Post: Solitaire
   Atoa ACBS, Equipment Set Add-on Error Solitaire 10 839 10-13-2024, 11:41 PM
Last Post: Solitaire
   ACBS - Atoa Custom Battle System and TP System zlsl 2 4,569 10-20-2021, 05:09 AM
Last Post: zlsl
   [RMXP] Showing skill gained by leveling up on battle result FrQise 12 12,656 05-07-2021, 02:05 PM
Last Post: FrQise
   Adding face script on Cogwheel's RTAB Battle Status rekkatsu 15 15,854 08-25-2020, 03:09 AM
Last Post: DerVVulfman
   I want to add an Atoa Custom Battle System command cut-in. zlsl 11 13,897 11-11-2019, 08:55 PM
Last Post: DerVVulfman
   Question about ACBS (Atoa Custom Battle System) aeliath 10 12,773 08-08-2019, 02:50 PM
Last Post: aeliath
   YAMI Battle symphony + Holder add on (Loop casting anim) Starmage 0 4,254 03-01-2018, 09:03 AM
Last Post: Starmage
   (RMVXace) Battle error with Tankentai's battle system, help. x( Starmage 0 3,911 02-14-2018, 04:25 PM
Last Post: Starmage



Users browsing this thread: 2 Guest(s)