3 years ago

When a character counterattacks they always use the default attack command.

Here's a tutorial on how to make counterattacking use different skills upon being inflicted with a state in VX Ace.


First you need to be able to counterattack of course. This can simply be done by going to the Features of a state/weapon/armor and add this:

screenshot_2023-04-09_174636.png

Which is the rate of which counterattacking will activate.

Then go to the script editor and then click on Scene_Battle. Around line 615 is the code def invoke_counter_attack(target, item)

screenshot_2023-04-09_173308.png

here the skill used for counterattacking is the default attack command. replace the attack_skill line at 617 with this:

if target.state?(3)

attack_skill = $data_skills[221]

else

attack_skill = $data_skills[target.attack_skill_id]

end

screenshot_2023-04-09_173746.png

this will make so that when the counterattacking user is inflicted with state 3, which would be the blind state:

screenshot_2023-04-09_173809.png

they will counterattack with the skill with the ID 221. (note that characters with the death state can't counterattack.)

You can change skill 221 to skill 2 so that the counterattack is the guard skill.

If you want to show the attack animation for the counterattack skill, add this below the state conditional branch:

target, @subject = @subject, target

show_animation([target], attack_skill.animation_id)

target, @subject = @subject, target

screenshot_2023-04-09_180829.png

#rpgmaker #rpgmakervxace #scripting #rgss



18 comments

Loading...

Next up

Y/N can do whatever she wants in her secret underground hideout as long as she doesn't touch the bombs in the storage room.

Y/N the normal teenage high school girl who is not an assassin.

Side Missions where you can assassinate civilians for money and items, requested by corrupt officials and businessmen!

While I was busy with my personal life, I've been trying to figure out the aesthetic of this game and since the hourly soundtrack is made in Microsoft Music Producer (an old Windows 98 program) I've decided to make the UI retro stuff inspired :) - Martin

Y/N desires but a glimpse of the sunlight.... unfortunately, she is not like other girls.

BATTLE SYSTEM IN MY RPG MAKER XP GAME

(srry I forgot to link the post to my game :CC)

#IndieDev #GameDev #videogames #indiegames

New design for weapon shop that makes the wares more interesting to look at.

Weapon Attribute Absorption. Give one weapon an attribute of another weapon.

¡Antes del próximo recado, la familia de Ciro debe sentarse a comer !

Pero falta su papá. Que sujeto más extraño...

------------

Before the next errand, Ciro and his family must sit down to eat !

But his dad is missing. What a strange man...

Train against a Bot whose stats and elemental weaknesses you can modify.