[ACE] Counterattack Help

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,028
Reaction score
345
First Language
English
Primarily Uses
RMVXA
Hi! It's me again with something probably stupid simple.

VX Ace set up its Counterattack function to basically be dodge -> counter. I've set up a berserk skill for a character that gives them 100% counter but because the game has the character dodge then counter, it makes so the character really never takes damage (when you know, the downside of berserk should be crap defense in exchange for attack).

My question is
: how do you make it so the character has to take damage before they counter? As funny as it is that a character will still counterattack even if the attack misses, it just doesn't work for me.

I figure it's in Scene_Battle (and I'm probably wrong because my ability to script is like zilch) but nothing sounds like it would change the dodging.
If this has been answered before, I'm sorry I could not find it despite multiple google searches and the search function on this very forum.

Thanks!
 

sleepy_sealion

Need to work harder!
Veteran
Joined
Jan 4, 2018
Messages
241
Reaction score
357
First Language
English
Primarily Uses
RMVXA
That's something I've been searching for too.

I couldn't find anything in there that seems to disable the incoming attack and Ctrl-Qing the part of the code that triggers the counter attack in Scene_Battle doesn't seem to stop the attack cancel - only the attack that comes after.

What I ended up doing is have a method that runs on certain attacks and checks for a state in my physical move forumla's like:
Code:
def counter(a,b)
 b.state?(counter_state_id)
   a.hp -= b.atk
  end
end
Though it doesn't look right, it does let me test the counter at least.

You might be able to do that as an alternative if you can find a script that can "b" to force an action instead?
I think there might be a Yanfly script that can do that.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,631
Reaction score
5,267
First Language
Indonesian
Primarily Uses
RMVXA
For starter, it could be like this
Code:
class Scene_Battle
  def invoke_item(target, item)
    if rand < target.item_mrf(@subject, item)
      invoke_magic_reflection(target, item)
    else
      apply_item_effects(apply_substitute(target, item), item)
    end
    @subject.last_target_index = target.index
  end
  #--------------------------------------------------------------------------
  # * Apply Skill/Item Effect
  #--------------------------------------------------------------------------
  def apply_item_effects(target, item)
    target.item_apply(@subject, item)
    refresh_status
    @log_window.display_action_results(target, item)
    if rand < target.item_cnt(@subject, item)
      invoke_counter_attack(target, item)
    end
  end
end
I never really use counter that much
 

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,028
Reaction score
345
First Language
English
Primarily Uses
RMVXA
@TheoAllen That does work but it also gets rid of the skill animations. It's a start so thank you.

EDIT: Er, scratch that. There's something amiss with it and Yanfly together that is affecting the animations. I think I can figure out what's going on. I do appreciate the help, thank you!

OK yes, I got it. Thank you very much!
 
Last edited:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,631
Reaction score
5,267
First Language
Indonesian
Primarily Uses
RMVXA
It will be better if you explain what's going on. What Yanfly script was it, and how u solved it in case some people searched for the same issue
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

The universe does not want me to do another letsplay it seems... I keep bumping into problem after problem... Oh well. Still have several days to sort them out.
I now have something new to learn. Lesson suggestions?
Finally with a new PC! Now I can do nice things both coding and gaming
nvidia release the IA paint to lsd landscape simulator
i just try , it very fun
"If the lion knew her own strength, hard were it for anyone to rule her". This would be my custom title if I had enough spaces for it. Coming off of personal pain, I'm glad I found the original quote I've tweaked.

Forum statistics

Threads
93,459
Messages
912,618
Members
122,988
Latest member
negajo
Top