Creating a skill where an enemy attacks you when you hit his ally

RoseRainblood

Veteran
Veteran
Joined
Nov 29, 2018
Messages
71
Reaction score
8
First Language
English
Primarily Uses
RMMV
Hello! I've been working on creating this skill but I haven't been able to get it working properly. I'm hoping someone could help!

A brief explanation of the battle encounter: If you hit Enemy 2, Enemy 1 will immediately attack the actor who hit Enemy 2. This should happen every time you hit Enemy 2 until it dies.

Right now I'm using "force action" in the Troops menu to do this. I have the conditions set as "Enemy HP, Enemy 2, 99% or below" The subject of the forced action is Enemy 1 and the target is set as "Last Target" and the skill is set as the specific attack skill I made for Enemy 1 in the Skill section of the database.

I have the span set as "Battle" and it DOES work, but Enemy 1 is only hitting the actors that hit Enemy 2 once in the battle. If I change the span to "Turn" or "Moment" than Enemy 1 hits the actors over and over again and I don't want that either. Does anyone know the best way to pull this off? My first thought was to have multiple pages with different Enemy 2 HP percentages that get lower by 10% each time, but I'm not sure if that will work or be accurate?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,379
Reaction score
1,559
First Language
English
Primarily Uses
RMMV
Are you saying you want the enemy to retaliate no matter what the actor did to its ally, or that there's just one specific skill that incurs the retaliation if used?
 

RoseRainblood

Veteran
Veteran
Joined
Nov 29, 2018
Messages
71
Reaction score
8
First Language
English
Primarily Uses
RMMV
Are you saying you want the enemy to retaliate no matter what the actor did to its ally, or that there's just one specific skill that incurs the retaliation if used?
The first one! No matter what an actor does to Enemy 2, Enemy 1 will retaliate ^_^
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,864
Reaction score
519
First Language
English
Primarily Uses
N/A
The first one! No matter what an actor does to Enemy 2, Enemy 1 will retaliate ^_^
Even if the actor heals enemy 2?

Edit: maybe it could be done with variables. Each turn, it puts enemy 2's HP into a variable. Then, after each action by the actors, it puts enemy 2's HP into a second variable. If the first variable is higher than the second variable, enemy 1 retaliates. Then, it sets the first variable to the second variable

Edit: The setting the HP into a variable each turn is so you can allow for enemy 1 healing enemy 2 and have the situation still work
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,379
Reaction score
1,559
First Language
English
Primarily Uses
RMMV
(This requires Yanfly's Buffs & States Core and Autopassive States plugins)

Give enemy 2 a passive state with the following notetag:

Code:
<Custom Respond Effect>
$gameSwitches.setValue(1, true)
</Custom Respond Effect>
Where 1 is the ID of an available switch. Then create a battle event that's triggered by the same switch, which forces action for enemy 1 to attack last target and turns the switch off.
 

RoseRainblood

Veteran
Veteran
Joined
Nov 29, 2018
Messages
71
Reaction score
8
First Language
English
Primarily Uses
RMMV
Yeah I wouldn't want it to include heals. I also just realised I wouldn't want it to include DoTs like poison either. It'd be ideal for Enemy 1 to only react when it's a normal attack or an offensive skill. Hmm...

My apologies for being confusing and giving the opposite answer now! I didn't actually realise this myself until I properly considered it. But I super appreciate your answers! Both of these ideas could be great if I wanted it to include healing/DoTs/etc.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,379
Reaction score
1,559
First Language
English
Primarily Uses
RMMV
The Custom Respond Effect will actually work for this. You'd just have to check whether the action item has a positive damage value and that it doesn't have any regeneration traits on it.
 

RoseRainblood

Veteran
Veteran
Joined
Nov 29, 2018
Messages
71
Reaction score
8
First Language
English
Primarily Uses
RMMV
The Custom Respond Effect will actually work for this. You'd just have to check whether the action item has a positive damage value and that it doesn't have any regeneration traits on it.
Oh, that's awesome then!

I've tried this and it seems to have done the trick:

Code:
<Custom Respond Effect>
if (value > 0) {
$gameSwitches.setValue(33, true)
}
</Custom Respond Effect>
For the regeneration skill side, I've put each of them as a state resist in the traits section. Is that what you mean or is it easier to use a line of code for that too?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,379
Reaction score
1,559
First Language
English
Primarily Uses
RMMV
Oh, that's awesome then!

I've tried this and it seems to have done the trick:

Code:
<Custom Respond Effect>
if (value > 0) {
$gameSwitches.setValue(33, true)
}
</Custom Respond Effect>
For the regeneration skill side, I've put each of them as a state resist in the traits section. Is that what you mean or is it easier to use a line of code for that too?
You can check whether the skill adds a state that has a negative regen trait with this code:

Code:
$dataSkills[id of skill you're checking].effects.filter(effect => effect.code == Game_Action.EFFECT_ADD_STATE).map(effect => $dataStates[effect.dataId]).some(state => state.traits.some(trait => trait.code == 22 && trait.value < 0))
 

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

Latest Threads

Latest Profile Posts

And back. Trying to work online with no internet for 1.5 days was...interesting. I felt like a character in a old Sierra game trying to find internet due to all the hoops I had to jump through just to get online for work.
grief... if MV didn't have certain plugins already, I think I'd upgrade to MZ. seeing like 10 MV plugins in 1 MZ one is hilariously convenient lol.
Have you already checkes out my mapping tutorial on the blog? I would love to hear your feedback and things you'd like to see in the future!

one of character for my upcoming game idk how to design o_O

Designing patches that can 'augmented' to clothing based armor. Such good fun. A bit time consuming due to the need to create image displays, but the patches are limited so it's not too tiring.
Note: lol, posting this made me find a couple mistakes.

Forum statistics

Threads
100,737
Messages
978,945
Members
132,359
Latest member
PhilKeepItReal
Top