Have Enemy Counter-attack whoever hit it?

Status
Not open for further replies.

DSBwizzardMakesGame

Happy to be here
Member
Joined
Jun 20, 2021
Messages
4
Reaction score
0
First Language
English
Primarily Uses
RMMZ
I have been trying for hours to make this work. I have an enemy that, when hit by any entity (friend or foe) should use a certain Skill on that same entity. I am using VisuStella's AutoSkillTriggers Plugin to make my enemy use a Skill instantly upon being hit. Up until this point it's worked fantastically, however I cannot make my Enemy remember which Troop Member hit it last, only Actors.

When hit by an Actor, my enemy instantly casts a Skill that performs this simple Common Event, shown below:

1624145347055.png

I have been unable to replicate this success when my enemy is hit by a fellow Troop Member. Is there some means of telling my enemy to use a Skill on / target specifically the Troop Member that hit it last?

"Control Variables -> Last Enemy Index to Act" does store the last-acting enemy, however "Force Action" does not let me use a variable as the index to target, and I believe only assumes I want my Enemy to target an Actor.

1624146785923.png


For plugins that would affect any of this, I use VisuStella's Battle Core, AutoSkillTriggers, and AggroControlSystem. I've tried many things - aggressive use of variables, Action Sequence Events, using the Taunt state created with AggroControlSystem, etc. - to no avail.

Your help is incredibly appreciated.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,851
First Language
English
Primarily Uses
RMVXA
My instinct is that the only issue here is that your Board Breaker skill probably has the "One Enemy" scope, which means that it cannot be used on allies of the user. There is a lot of underlying logic in the engine that would make it impractical or impossible to use skills which are supposed to target enemies, on allies.

What you could do in this case to get around it would be to create a second Board Breaker skill that does the exact same thing as the original, but this time has 1 Ally as its Scope. Do what you were already doing with setting a variable to Last Enemy Index to Act and checking the variable in a bunch of conditional branches to force it to use the duplicate Board Breaker skill on the appropriate ally that had targeted it.
 

DSBwizzardMakesGame

Happy to be here
Member
Joined
Jun 20, 2021
Messages
4
Reaction score
0
First Language
English
Primarily Uses
RMMZ
Thank you so much! I've figured this out. Your revelation that a Skill's Scope aiming at one side of the field prevents the skill from targeting the other side of the field was key. I created a duplicate Skill to target 1 Ally, just like you mentioned, and this is working.

The other issue I had was trying to use a Skill on my Enemy unit, to call a Common Event that requested the Last Enemy Index to Act. By using a Skill to check this, the result would always be the Enemy using said Skill (because indeed, it was the most recent Enemy to perform an Action).

To get around this, and have my Last Enemy Index to Act variable actually be the previous enemy and not the currently-acting enemy, I utilized a feature of VisuStella Battle Core's Action Sequence Events. I gave the following Notetag to my enemy that wants to counter-attack when struck by a damage-dealing Skill:

<JS Pre-Damage as Target>
$gameTemp.reserveCommonEvent(15)
</JS Pre-Damage as Target>

(Common Event 15 silently updates the LastActingEnemy Variable.)

This causes my Enemy to call Common Event 15 when it is targeted by a damage-dealing action, but importantly before said Enemy performs any actions, which assigns the Last Enemy Index to Act variable correctly. After this, the skill I set up with VisuStella's AutoSkillTriggers triggers.

With these changes to when the variable is determined, and the aforementioned Scope/Skill duplication as you suggested, my Enemy now knows who hit it last (be it friend or foe) and uses the appropriate skill on the appropriate target.

Thanks again!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,115
Reaction score
5,968
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Profile Posts

Mod name: "[Game name] Gameplay Overhaul"
What they actually mean: "Here is a mod that makes the game harder."
I decided to reinstall one of my most favourite game of all times, Gothic 2. Time to get back to Khorinis!
So much game make... I needs to rest. The foods call.
-Casino with bunnysuit green check.png
1638563168795.png
Monday December 6th 2021 at 7PM Hawkzombie will stream A Thief's Voyage on his Twitch.

Hawkzombie Twitch

Check it out.​

Forum statistics

Threads
117,164
Messages
1,105,069
Members
153,252
Latest member
Rostilab
Top