Creating a skill that draws enemy aggro for one turn

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
Hello everyone!
I want to create a skill called protect, and it's a very crucial skill to my game as the whole battle system and style kind of revolves around it, and it's very important to the plot. The skill essentially protects an ally for one turn from all incoming sources of damage, but also causes all enemies to attack that ally. There are more effects to it but this is the part that I need help with right now.
I would like to make it so that when the ally has the state "protected" enemies always attack that ally and not any other allies. Do you know of a way to do this? I use Moghunter's Chrono Engine so if there's a plugin that can help do that I need to make sure it's compatible with that.
Thanks for you help~! <3
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,858
Reaction score
515
First Language
English
Primarily Uses
N/A
Use TRG, PDR and MDR. Make the PDR and MDR * 0, and make TRG * 1000. It can be done without scripts.
 

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
Use TRG, PDR and MDR. Make the PDR and MDR * 0, and make TRG * 1000
What do those acronyms stand for? They're spelled out in my program. Do you mean Physical Damage Rate, Magic Damage Rate, and Target Rate? I put the Target Rate * 1000 but it didn't change anything, is there something I'm missing?
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,858
Reaction score
515
First Language
English
Primarily Uses
N/A
Yes its physical and magical damage rate. You'll want to make those * 0. don't worry, it only affects incoming damage, not outgoing

Edit: You might also want to set allies target rate to * 0
 

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
Yes its physical and magical damage rate. You'll want to make those * 0. don't worry, it only affects incoming damage, not outgoing
Oh don't worry, I already have the damage reduced to 0. What I need help with is making sure that the enemy attacks the ally without fail. Even though I set the target rate to * 1000, the enemy sometimes attacks my other ally. The whole damage reduction part works like a charm!
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,858
Reaction score
515
First Language
English
Primarily Uses
N/A
Have the skill reduce allies TRG to * 0

Edit: This could be done in the basic editor. Make a state that reduces TRG to * 0 and a state that reduces all damage to 0. Make the charecter using the skill immune to the TRG state and allies Immune to the reduce damage state. Then have it target all

Edit edit: If multipule charecters do this... you'll have to repeat the process for each of those charecters
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,367
Reaction score
1,535
First Language
English
Primarily Uses
RMMV
Have the skill reduce allies TRG to * 0

Edit: This could be done in the basic editor. Make a state that reduces TRG to * 0 and a state that reduces all damage to 0. Make the charecter using the skill immune to the TRG state and allies Immune to the reduce damage state. Then have it target all
Does doing that in the default system return their TRG to normal after the state wears off though?
 

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
Have the skill reduce allies TRG to * 0
Do you know how to do that? It appears I can't apply two different states to two different allies in the skill tab, and debuff parameters don't include target rate
Here's some screenshots:
1593713895680.png
1593713947351.png1593713989660.png
 

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
ohh, I see now, ty!
 

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
Yes

you found it? did you see the edit to my last post?
Yeah, I did, and I successfully gave the two different states to my allies, unfortunately the enemy still targets the non-protected ally :(
1593714476320.png
The shield is protected, the star is a placeholder to show me that the non-protected state is working, but as you can see from the first actor's health bar, sometimes the enemy still attacks him
 

Attachments

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,367
Reaction score
1,535
First Language
English
Primarily Uses
RMMV
Do you have Yanfly's Target Core plugin?
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,404
Reaction score
4,799
First Language
English
Primarily Uses
RMVXA
Are you using the Substitute property anywhere else in your game? If not, then all you need to do is to change this method in rpg_objects.js:

Code:
BattleManager.checkSubstitute = function(target) {
    return target.isDying() && !this._action.isCertainHit();
};
You could, for example change it to:

Code:
BattleManager.checkSubstitute = function(target) {
    return !this._action.isCertainHit();
};
Then you just need to add the Substitute feature to a State and give the battler who should be the target of enemy fire that State. Since you want to make that battler invulnerable to damage, you should also put Physical Damage Rate * 0% and Magical Damage Rate * 0% features on that state (and if you want to make the battler immune to harmful statuses as well, you can add State Rate * 0% for each of those harmful states).

Set the State to end after one turn by choosing "Turn End" for the timing and 1 ~ 1 as the numbers.

I recommend giving the action that applies this state a very high Action Speed; otherwise the enemies could hit your allies before you get the protection up!
 

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
Are you using the Substitute property anywhere else in your game? If not, then all you need to do is to change this method in rpg_objects.js:

Code:
BattleManager.checkSubstitute = function(target) {
    return target.isDying() && !this._action.isCertainHit();
};
You could, for example change it to:

Code:
BattleManager.checkSubstitute = function(target) {
    return !this._action.isCertainHit();
};
Then you just need to add the Substitute feature to a State and give the battler who should be the target of enemy fire that State. Since you want to make that battler invulnerable to damage, you should also put Physical Damage Rate * 0% and Magical Damage Rate * 0% features on that state (and if you want to make the battler immune to harmful statuses as well, you can add State Rate * 0% for each of those harmful states).

Set the State to end after one turn by choosing "Turn End" for the timing and 1 ~ 1 as the numbers.

I recommend giving the action that applies this state a very high Action Speed; otherwise the enemies could hit your allies before you get the protection up!
Thank you! I already made them invulnerable to damage and the action is instantaneous (I set it using Moghunter's Chrono Engine skill customization) but I'm a little confused on the first part.

Is that the part that makes it so that the ally draws aggro? What does the Substitute feature do and how do I add it to a state? Do I need to change it from the example you gave or is the example you gave what's going to draw the aggro?

Thank you guys so much for bearing with me and continuing to help me, I really appreciate it <3
 

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
I figured out how to add the substitute in, but the enemy is still targeting the other ally sometimes. I think it could be because the enemy is using normal attacks which are physical damage, not certain hits.
1593722163070.png
Also, since them being invulnerable to damage means setting the physical and magic damage rates to 0%, that means that the incoming attacks need to be physical or magical damage. I'm not a programmer or anything (why I'm using RPG Maker) but it seems like it substitutes if the type of incoming attack is a certain hit. Is there a way to change it so that it substitutes for physical and magical attacks?
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,858
Reaction score
515
First Language
English
Primarily Uses
N/A
Well i tried
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,404
Reaction score
4,799
First Language
English
Primarily Uses
RMVXA
Normally, Substitution behavior allows a battler to take hits for another battler if the targeted ally's HP is under 25% (that's what was checked by the isDying() method). My modification changes it so that the HP is no longer relevant in the check. This method is checked by some other method (I think it's something like performSubstitute() but not sure) to actually handle the substitution - so no, I'm not touching the method that actually does the substitution, just the conditions that it checks.

I figured out how to add the substitute in, but the enemy is still targeting the other ally sometimes. I think it could be because the enemy is using normal attacks which are physical damage, not certain hits.
View attachment 149826
...Is there a way to change it so that it substitutes for physical and magical attacks?
I don't think this is the problem. See, that bang symbol (!) means "not" in JavaScript, so the condition being checked to perform the substitute is that the action must not be a Certain Hit skill in order for the substitution to occur. If an enemy uses a regular physical or magical attack the same turn after your actor gains the Substitute state, it should work fine.

My instinct is that Mog's Chrono Engine is screwing this up. Perhaps its method of determining targets for attacks does not accommodate substitution behavior at all, or perhaps something about the way that Chrono Engine handles states is causing the state to wear off immediately (or state features to not be applied to actors properly).

Here's what I would try for now - in this order, until substitution works, then let me know what happened:
1) Give an actor the feature "Substitute" instead of a state. See whether the Substitution works in that case.
2) Just to make sure you made the edits to the code properly, put all of your actors at very low health (well below 25%, maybe 1 HP) and see whether the Substitution works now.
3) Turn Moghunter's Plugins OFF, save your game, get into battle, and see whether Substitution works now.
4) Create a new project without any plugins, modify the rpg_objects.js file in THAT project with the change I recommended, and see whether Substitution works in that project.
 

Kitty_Rika

Your friendly neighborhood neko
Veteran
Joined
Jun 30, 2020
Messages
41
Reaction score
14
First Language
English
Primarily Uses
RMMV
Normally, Substitution behavior allows a battler to take hits for another battler if the targeted ally's HP is under 25% (that's what was checked by the isDying() method). My modification changes it so that the HP is no longer relevant in the check. This method is checked by some other method (I think it's something like performSubstitute() but not sure) to actually handle the substitution - so no, I'm not touching the method that actually does the substitution, just the conditions that it checks.


I don't think this is the problem. See, that bang symbol (!) means "not" in JavaScript, so the condition being checked to perform the substitute is that the action must not be a Certain Hit skill in order for the substitution to occur. If an enemy uses a regular physical or magical attack the same turn after your actor gains the Substitute state, it should work fine.

My instinct is that Mog's Chrono Engine is screwing this up. Perhaps its method of determining targets for attacks does not accommodate substitution behavior at all, or perhaps something about the way that Chrono Engine handles states is causing the state to wear off immediately (or state features to not be applied to actors properly).

Here's what I would try for now - in this order, until substitution works, then let me know what happened:
1) Give an actor the feature "Substitute" instead of a state. See whether the Substitution works in that case.
2) Just to make sure you made the edits to the code properly, put all of your actors at very low health (well below 25%, maybe 1 HP) and see whether the Substitution works now.
3) Turn Moghunter's Plugins OFF, save your game, get into battle, and see whether Substitution works now.
4) Create a new project without any plugins, modify the rpg_objects.js file in THAT project with the change I recommended, and see whether Substitution works in that project.
It's Mog's Chrono Engine. I also have a common event that triggers text (since I'm making a tutorial battle right now) and when I turn Mog's Chrono Engine off, the common event plays and substitution works. When I turn it on, the common event doesn't play and substitution doesn't work, which is really unfortunate :( I really hope we can find some way to work around this as Chrono Engine is equally as essential to my game and I really don't want to disable it.
Thanks for your tips! Do you have any more suggestions?

By the way, methods 1 and 2 didn't work which means that Mog's Chrono Engine apparently doesnt consider substitution for attacks
 

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

Latest Threads

Latest Posts

Latest Profile Posts

When you discover great tileset resources that you completely forgot that you had. :kaomad3::kaopride:
Just got a better look at the MZ RTP. I'm very happy with it, especially the sci-fi tiles and sprites. Glad I pre-ordered.
I've just checked the VisuStella Plugins for MZ and there are already 11 plugins. The Yanfly team(perhaps a big one?) really works so effectively and efficiently that some MZ users can likely use tons of Yanfly plugins right after MZ's released (still 13 days from now). I wonder if any other plugin developer(or team) will try to compete with Yanfly this time, no matter how slim the chance to win is :)
Hello! :kaopride:I am new to RPG Maker, though I have been lurking the forums for a while. :kaoswt: Hope to make some friends and learn some stuff here! :kaothx:
And now since I've got the whole game parts working, the *contents* await.

Forum statistics

Threads
100,595
Messages
977,586
Members
132,194
Latest member
linkvaovn88com
Top