KingS001

Villager
Member
Joined
Jul 26, 2018
Messages
9
Reaction score
2
First Language
Germany
Primarily Uses
RMMV
After 5 years I finally are about to finish my game. However now there is a problem that I have not found a perfect solution yet and I can't procrastinate it anymore - so I'm asking the first time for help.

I would like to have an enemy that cannot be defeated by any of the following four elements. Below, I list the elements and their corresponding numbers:

Explosion = 10, Technology = 11, Nature = 12, Blood = 14.

Making the enemy immune to other elements is not an option, as it has a skill that reflects any other damage received proportionally. The easiest approach seems to be giving the enemy a state (numbered 145) that makes it invincible and then ignoring/removing this state upon being hit by one of these four elements.

I'm using Yanflys Elementcore plugin.
 

Kes

Regular
Regular
Joined
Aug 3, 2012
Messages
23,808
Reaction score
13,729
First Language
English
Primarily Uses
RMMZ
In the slot for this enemy click on the Traits box top right.
1685887327667.png
The very first option is Element Rate. Click on the little arrow to the right of physical and you will see a drop down list of all your elements. Select one. Then change the 100% to 0%.
Repeat for the other elements.

EDIT
Re-reading your post, I may have misunderstood what you want. Is it that you don't want them to be affected by those elements or that you don't want their HP to drop below 1 if they are hit by one of the elements?

Your proposed solution might not work. State 145 removed by being hit with one of the elements. Next attack is with another of those elements. Now no protection, so it will be defeated with one of the elements that you don't want it to be.
 
Last edited:

KingS001

Villager
Member
Joined
Jul 26, 2018
Messages
9
Reaction score
2
First Language
Germany
Primarily Uses
RMMV
Your proposed solution might not work. State 145 removed by being hit with one of the elements. Next attack is with another of those elements. Now no protection, so it will be defeated with one of the elements that you don't want it to be.

Yes. The enemy is not immune.

I will try to explain what the enemy can fully do. It is a little complicated so bear with me on this:

The enemy can deal back any damage that he takes in % damage back to the opponent. For example if he takes 30% damage because of fire spell, then he will always survive this and deal 30% back to the player. (I already have this working!) After an attack he regenerates always 100% of his HP back.
The ability has a weakness. The 4 elements that I mentioned. The enemy can't repell this type of attacks back. So he will take damage from them. The 4 types of elements are the only way to defeat him.

Currently I am forced to make the enemy "invincible" since a fire attack can deal over 100% and kill him in one shot which is not intended.
So my thought was to find a workaround. The problem that I currently have is that I can't make him invincible since the enemy won't die, but I can't make him not invincible since he can get oneshotted.
So I thought to remove the state when hit by one of the 4 effective elements.
 

AphoticAmaranth

An Ordinary Human
Regular
Joined
Mar 29, 2020
Messages
398
Reaction score
669
First Language
English
Primarily Uses
RMMV
So I thought to remove the state when hit by one of the 4 effective elements.

That won't work because once you remove the state by using the correct element once, any other element can defeat the enemy.

What I would instead suggest is to check if the element is of the correct element AND the damage is equal to or greater than the enemy's remaining HP, and only remove the state if both of those conditions are met. You'll probably need Yanfly's Buff & States core plugin for that, and a Custom React Effect on the invincibility state.
 

KingS001

Villager
Member
Joined
Jul 26, 2018
Messages
9
Reaction score
2
First Language
Germany
Primarily Uses
RMMV
That won't work because once you remove the state by using the correct element once, any other element can defeat the enemy.

What I would instead suggest is to check if the element is of the correct element AND the damage is equal to or greater than the enemy's remaining HP, and only remove the state if both of those conditions are met. You'll probably need Yanfly's Buff & States core plugin for that, and a Custom React Effect on the invincibility state.
That sounds good. How can I do this? I have nearly every Yanfly plugin - Buff and States are one of them. However I'm not that good at writing scripts from the grouns. I can only understand and alter them.
 

AphoticAmaranth

An Ordinary Human
Regular
Joined
Mar 29, 2020
Messages
398
Reaction score
669
First Language
English
Primarily Uses
RMMV
To add the state at the start of the battle, under your troop's battle event, create a page with Conditions: Turn 0 + 0 * X and Span: Battle. Create a new event command, "Change Enemy State" (under the third tab), and add the invincibility state to the enemies.


To remove the state, you can use this code in the notetag of the state (requires Yanfly's buff and states core)
Code:
<Custom React Effect>
if(value >= target.hp)
{
  switch(this.item().damage.elementId)
  {
    case 10:
    case 11:
    case 12:
    case 14:
      target.removeState(145);
    break;
      default:
    break;
  }
}
</Custom React Effect>

What this basically does is that when being hit, before the damage is applied, it will check if the value is greater than or equal to remaining HP, and if so, it will proceed to check the element of the attack/skill. If it is 10, 11, 12, or 14, it will remove state 145; otherwise, nothing happens.
 

KingS001

Villager
Member
Joined
Jul 26, 2018
Messages
9
Reaction score
2
First Language
Germany
Primarily Uses
RMMV
thank you very much. it works!
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,960
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Support. Thank you.

 

Latest Profile Posts

OMG Y'all. I found an alternate Google Drive I 100% forgot I had. All my crusty old game files from 2014 (when I signed up) are in there. When I like...maybe actually make a prototype thread it's gonna be so much fun taking everyone down my memory lane.
We are at the finish line!!! Thank you COMMUNITY!!!
GameCompletion.jpg
Well, my cat died. Just had a feeling something was off, and went to check.
Someone abandoned her a while ago when she was pregnant, and she wandered into my yard.
Took her to the vet, and did all the usual stuff, making sure she had all the shots and no one was looking for her.
She had the kittens. I kept 1, and found a home for the rest. (Continued because of the limit)
Most disappointing adult event: buying a house that no one comes to on Halloween.

Most redeeming adult event: having a kid to take out trick-or-treating again.
Why is it always "people meant to be in your life, will be"? Why don't those people realize it works in reverse? If you were meant to be in THEIR LIVES, you would be?

Forum statistics

Threads
134,902
Messages
1,251,738
Members
177,719
Latest member
nestharon
Top