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,842
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,034
Reaction score
5,906
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 Threads

Latest Posts

Latest Profile Posts

My home state baseball team is going back to the World Series for the first time since 1999. I remember when they went in 1995 and won, that was like the best day of my life. (I'm a huge baseball fan and yes I'm talking about the Braves).
FL Studio is a huge step up from LMMS but I'm having such a tough time with it D:<
The new Dune movie reminds me of the game Dune 2 made by Westwood. A quality product on its own, but extremely disloyal to its source of inspiration.
Terrible Writing Advice, you've done it again.
1635026211997.png
Feeling like my new profile picture is nice. Thinking of making it semi-permanent, does any one has an opinion? Does it look too evil or does it work as a public profile picture? :)
Bishiba.png

Forum statistics

Threads
116,037
Messages
1,095,171
Members
151,374
Latest member
Wangnuoyu
Top