How make damage shield like this?

I want kind of a shield.

this shield is immune, if damage not over in 900 or Variable.

ex) the enemy hp is 5, but enemy use skill and get shield.
and Actor attack to enemy but damage is 500, so it can't damaged to enemy.
but if damage over 900, then enemy damage only 1.

like this need 5 attack over 900.

sorry poor english.
Hey, I'm kinda new here, but I think I got your problem.

First, you'll need two Yanfly plugins:

Battle Engine Core: http://www.yanfly.moe/wiki/Battle_Engine_Core_(YEP)

Buff & States Core: http://www.yanfly.moe/wiki/Buffs_&_States_Core_(YEP)

Install them, them create a State that will be your shield. Copy/Paste this code into the notetag:

Code:
<Custom Apply Effect>
// Calculate the threshhold for the effect
var threshhold = 900

// Set the state counter to display the threshhold
target.setStateCounter(stateId, threshhold);

// Create the text stating the effect's threshhold
var text = '<CENTER>\\c[4]' + state.name + '\\c[0] blocks damage under \\c[4]' + threshhold + '\\c[0]!';
// Set the wait time for the message
var wait = 60;
// Display the text.
BattleManager.addText(text, wait);

// Create a text explaining what elements can pierce the effect
text = '<CENTER>Deal more than \\c[4]' + threshhold + '\\c[0] damage to deal damage!'
// Display the text
BattleManager.addText(text, 10);
</Custom Apply Effect>

<Custom Regenerate Effect>
// Calculate the threshhold
var threshhold = 900;
// Display the threshhold on the state
target.setStateCounter(stateId, threshhold);
</Custom Regenerate Effect>

<Custom React Effect>
// Check if the action deals HP damage
if (this.isHpEffect() && value > 0) {

// Calculate the threshhold
  var threshhold = 900;

//Check if was pierced
  var pierced = value > threshhold;

  // Create a text to be displayed
  var text = '<CENTER>\\c[4]' + state.name + '\\c[0]';
 
// Set the wait time
  var wait = 60;
 
// Check if the effect was pierced
  if (pierced) {
    value = 1;
  
// And state that it was pierced
    text += ' has been pierced!';
   
// Display the text
    BattleManager.addText(text, wait);
  } else {
  
// If it wasn't, then set the damage to 0
    value = 0;
   
// Start a barrier animation (ID of the animation you want for blocking damage.)
    target.startAnimation(53);
   
// Display the text stating how much damage it blocks
    text += ' blocks damage under \\c[4]' + threshhold + '\\c[0]!';
   
// Add the text
    BattleManager.addText(text, wait);
  
// Create a new line stating how to pierce the effect
    text = '<CENTER>Deal more than \\c[4]' + threshhold + '\\c[0] damage to deal damage!'
  
// Add the text
    BattleManager.addText(text, 0);
  }
}
</Custom React Effect>

I think this is what you want. If you have any doubts I'll be here. If somethings goes wrong too hahaha.


This code is just a little manipulation of Yanfly's Fire Aura tip he/she gave.
The original: http://www.yanfly.moe/wiki/Fire_Aura_(MV_Plugin_Tips_&_Tricks)
Hey, I'm kinda new here, but I think I got your problem.

First, you'll need two Yanfly plugins:

Battle Engine Core: http://www.yanfly.moe/wiki/Battle_Engine_Core_(YEP)

Buff & States Core: http://www.yanfly.moe/wiki/Buffs_&_States_Core_(YEP)

Install them, them create a State that will be your shield. Copy/Paste this code into the notetag:

Code:
<Custom Apply Effect>
// Calculate the threshhold for the effect
var threshhold = 900

// Set the state counter to display the threshhold
target.setStateCounter(stateId, threshhold);

// Create the text stating the effect's threshhold
var text = '<CENTER>\\c[4]' + state.name + '\\c[0] blocks damage under \\c[4]' + threshhold + '\\c[0]!';
// Set the wait time for the message
var wait = 60;
// Display the text.
BattleManager.addText(text, wait);

// Create a text explaining what elements can pierce the effect
text = '<CENTER>Deal more than \\c[4]' + threshhold + '\\c[0] damage to deal damage!'
// Display the text
BattleManager.addText(text, 10);
</Custom Apply Effect>

<Custom Regenerate Effect>
// Calculate the threshhold
var threshhold = 900;
// Display the threshhold on the state
target.setStateCounter(stateId, threshhold);
</Custom Regenerate Effect>

<Custom React Effect>
// Check if the action deals HP damage
if (this.isHpEffect() && value > 0) {

// Calculate the threshhold
  var threshhold = 900;

//Check if was pierced
  var pierced = value > threshhold;

  // Create a text to be displayed
  var text = '<CENTER>\\c[4]' + state.name + '\\c[0]';

// Set the wait time
  var wait = 60;

// Check if the effect was pierced
  if (pierced) {
    value = 1;

// And state that it was pierced
    text += ' has been pierced!';
 
// Display the text
    BattleManager.addText(text, wait);
  } else {

// If it wasn't, then set the damage to 0
    value = 0;
 
// Start a barrier animation (ID of the animation you want for blocking damage.)
    target.startAnimation(53);
 
// Display the text stating how much damage it blocks
    text += ' blocks damage under \\c[4]' + threshhold + '\\c[0]!';
 
// Add the text
    BattleManager.addText(text, wait);

// Create a new line stating how to pierce the effect
    text = '<CENTER>Deal more than \\c[4]' + threshhold + '\\c[0] damage to deal damage!'

// Add the text
    BattleManager.addText(text, 0);
  }
}
</Custom React Effect>

I think this is what you want. If you have any doubts I'll be here. If somethings goes wrong too hahaha.


This code is just a little manipulation of Yanfly's Fire Aura tip he/she gave.
The original: http://www.yanfly.moe/wiki/Fire_Aura_(MV_Plugin_Tips_&_Tricks)

OMG thx to help !
This perfect !

Very thankyou so much !

But just one thing if pierce and damage, damage animation repeat one more.
can remove damage animation?
I don't know if it is exactly what you want, but:
forum2.png


That part of the code make the Shield animation plays whenever the shield isn't pierced. It plays the animation with ID 53 (or whatever number you put there).
If you want to remove repetitive defense animations, just delete that line of the code.

But about repetitive attack/damage animations when it's pierced... I don't think this code get to do something to them, maybe it's somewhere else.

Oh, and if you change something and works let me know! 🙂
I don't know if it is exactly what you want, but:
View attachment 143950

That part of the code make the Shield animation plays whenever the shield isn't pierced. It plays the animation with ID 53 (or whatever number you put there).
If you want to remove repetitive defense animations, just delete that line of the code.

But about repetitive attack/damage animations when it's pierced... I don't think this code get to do something to them, maybe it's somewhere else.

Oh, and if you change something and works let me know! 🙂

Thx to help
It is a little different to describe it as an animation after damage.
To be precise, every attack is animated, then 'boom' and the enemy flickers and damages, right?
That effect comes out once more.

However, since I am using a lot of plug-ins, it may be stuck somewhere.
but since there are only plugins related to damage or animation, only yanfly's plugin was asked.
I tested the shield here and haven't got this damage animation twice... Maybe its something with the skill you're using to pierce or apply it?

Could you send a print of the state and the skill used to apply the state? It may help me find what's happening.
I tested the shield here and haven't got this damage animation twice... Maybe its something with the skill you're using to pierce or apply it?

Could you send a print of the state and the skill used to apply the state? It may help me find what's happening.


Actually not the skill, i use battle event get state in enemy.

and used damage skill just normal attack.

and this is state note

<Custom Apply Effect>
var threshhold = 900
target.setStateCounter(stateId, threshhold);

var text = '<CENTER>\\c[4]' + '\\it[206]\\c[0]' + '효과!' + ' 데미지 \\c[4]' + threshhold + '\\c[0]! 이하는 완전방어한다!';
var wait = 60;
BattleManager.addText(text, wait);

text = '<CENTER>Deal more than \\c[4]' + threshhold + '\\c[0] damage to deal damage!'
BattleManager.addText(text, 10);

<Custom Regenerate Effect>
var threshhold = 900;
target.setStateCounter(stateId, threshhold);
</Custom Regenerate Effect>

<Custom React Effect>
if (this.isHpEffect() && value > 0) {
var threshhold = 900;
var pierced = value > threshhold;
var text = '<CENTER>\\c[4]' + state.name + '\\c[0] 효과!';
var wait = 60;
if (pierced) {
value = 1;
text += ' 관통했다!';
BattleManager.addText(text, wait);
} else {
value = 0;
target.startAnimation(53);
text += ' 데미지 \\c[4]' + threshhold + ' \\c[0]! 이하는 완전 방어한다!';
BattleManager.addText(text, wait);
text = '<CENTER> \\c[4]' + threshhold + '\\c[0] 이상의 데미지를 줘야한다!'
BattleManager.addText(text, 0);
}
}
</Custom React Effect>
I don't know what can be going wrong...

Try to write " skip = true; " in the line below " text += ' 관통했다!'; " to see if works. It wouldn't be the best solution, i think, but it may work.

Unfortunately I can't test here, but let me know the outcome.
I don't know what can be going wrong...

Try to write " skip = true; " in the line below " text += ' 관통했다!'; " to see if works. It wouldn't be the best solution, i think, but it may work.

Unfortunately I can't test here, but let me know the outcome.

Try it but not different.
You mean...

value = 1;
text += ' 관통했다!';
skip = true;
BattleManager.addText(text, wait);

like this right?

but not skip.

and i know one more thing

When the damage over 900, the text " pierce " appears.
then another text show that the enemy has been damaged.

asdasdasdas.png



Maybe I do it using the Battlelog plugin.
i will check it out.
+)
ah... nope... It wasn't because of battlelog plugin.
Okay, i was able to replicate the error activating some Battle Engine plugins params.

Just give me a moment




Go to the params of Battle Engine Plugin. At the very end, there is a "Show HP Text"

For some reason, if it's set to true, it repeats the damage animation. If you set it to false, the problem should stop.
But it may be a problem if you want the damage messages on other battles.
Okay, i was able to replicate the error activating some Battle Engine plugins params.

Just give me a moment




Go to the params of Battle Engine Plugin. At the very end, there is a "Show HP Text"

For some reason, if it's set to true, it repeats the damage animation. If you set it to false, the problem should stop.
But it may be a problem if you want the damage messages on other battles.

Ah, yeah that is problem.

but another problem, i use battlelog in game.
so need to show hp text show up.

but anyway thx to help!
If you don't really need to show the "pierce" text, you can remove the lines:

" text += ' 관통했다!';
BattleManager.addText(text, wait); "

below the "value = 1;"

Then the problem stops and you keep your battlelog.
If you don't really need to show the "pierce" text, you can remove the lines:

" text += ' 관통했다!';
BattleManager.addText(text, wait); "

below the "value = 1;"

Then the problem stops and you keep your battlelog.

OMG really thx
In fact, the text of the pierce part was not necessary.
I deleted that part as you said, and everything is perfect.

We sincerely appreciate your hard work and have a nice day or night!
If you don't really need to show the "pierce" text, you can remove the lines:

" text += ' 관통했다!';
BattleManager.addText(text, wait); "

below the "value = 1;"

Then the problem stops and you keep your battlelog.

Can i question one more another thing? it similar like this

One monster starts combat with a special state.
As long as this state is present, monsters are not damaged.
In order to remove the state, it can only be removed by attacking a specific actor.

At this point, if you are attacked by an actor other than a specific actor, you want to display a specific animation.
Also, I want to display an animation when the state is released due to a specific actor attack.

In the second case, it can be made similar to the state when the state is removed from the battle event, but this is a bit different from what I want.

actually not the actor's effect. that is weapon effect.

i guess... the 900 over limit change to specific weapon or actor has state.
and if attack actor equip specific weapon, then appear break animation and removed state.

can i plz ?

sorry if you can't understad i mean in my poor english.
With no text show, this code is working for me: (remember to put the "stateId" number yourself inside "target.removeState()")

JavaScript:
<Custom React Effect>
//Get the ID of the attacker
var attacker = BattleManager._subject.actorId();

//write here the ID of the Actor that you wants to pierce the shield
var chosen = 1;


//if the attacker is different than the chosen one, value = 0. (Value = damage that will be done)
if (attacker != chosen){
  value = 0;
  target.startAnimation(53);

//if the attacker is the chosen one, remove the state.
} else {
  target.startAnimation(56);
  target.removeState(stateId);
}


</Custom React Effect>

Hope this works for you.

If you want to put text and it's having a hard time, tell me exactly when you want that (when blocks damage, when the state is applied for the first time, when it breaks, etc).

This code doesn't distinguish the weapon used by the chosen one, I'll have to dig a bit deeper to find how to do that. But see if this works fine there.
With no text show, this code is working for me: (remember to put the "stateId" number yourself inside "target.removeState()")

JavaScript:
<Custom React Effect>
//Get the index of the attacker
var attacker = BattleManager._subject.actorId();

//write here the ID of the Actor that you wants to pierce the shield
var chosen = 1;


//if the attacker is different than the chosen one, value = 0. (Value = damage that will be done)
if (attacker != chosen){
  value = 0;
  target.startAnimation(53);

//if the attacker is the chosen one, remove the state.
} else {
  target.startAnimation(56);
  target.removeState(stateId);
}


</Custom React Effect>

Hope this works for you.

If you want to put text and it's having a hard time, tell me exactly when you want that (when blocks damage, when the state is applied for the first time, when it breaks, etc).

This code doesn't distinguish the weapon used by the chosen one, I'll have to dig a bit deeper to find how to do that. But see if this works fine there.


It Working well !

I don't need any text now cause if state remove, then remove text already show then state setting.
When I try it, the state removal text is output normally.

But this state removal works fine even though I haven't written stateid in "target.removeState (stateId);" yet.

It is sad that's not possible to check the conditions according to the weapon.
or... can check actor has state conditional?
if possible, i can make weapon passive state to actor!
Done:

JavaScript:
<Custom React Effect>
//Get the attacker itself
var attacker = BattleManager._subject;

//write here the ID of the Actor that you wants to pierce the shield
var chosen = 1;


//if the attacker's ID is of the Chosen, and the attacker is affected by a state, break animation and remove the shield.
if (attacker.actorId() == chosen && attacker.isStateAffected(>>State you give to the weapon<<)){

  target.startAnimation(56);
  target.removeState(stateId);


} else {

    value = 0;
    target.startAnimation(53);

  }



</Custom React Effect>

That was a very good idea to solve it haha, thanks.
Done:

JavaScript:
<Custom React Effect>
//Get the attacker itself
var attacker = BattleManager._subject;

//write here the ID of the Actor that you wants to pierce the shield
var chosen = 1;


//if the attacker's ID is of the Chosen, and the attacker is affected by a state, break animation and remove the shield.
if (attacker.actorId() == chosen && attacker.isStateAffected(>>State you give to the weapon<<)){

  target.startAnimation(56);
  target.removeState(stateId);


} else {

    value = 0;
    target.startAnimation(53);

  }



</Custom React Effect>

That was a very good idea to solve it haha, thanks.


Thx!

Working well now everything !
Done:

JavaScript:
<Custom React Effect>
//Get the attacker itself
var attacker = BattleManager._subject;

//write here the ID of the Actor that you wants to pierce the shield
var chosen = 1;


//if the attacker's ID is of the Chosen, and the attacker is affected by a state, break animation and remove the shield.
if (attacker.actorId() == chosen && attacker.isStateAffected(>>State you give to the weapon<<)){

  target.startAnimation(56);
  target.removeState(stateId);


} else {

    value = 0;
    target.startAnimation(53);

  }



</Custom React Effect>

That was a very good idea to solve it haha, thanks.


Sorry to reply once again after a while.
It seems that this script you are using is in conflict with the YEP_selection control.

1번.png



Turning off the selection control plugin will not cause an error.
What would be the problem?

And this is my code.
This is the script you told me previously.
<Custom Apply Effect>
var threshhold = 900
target.setStateCounter(stateId, threshhold);

var text = '<CENTER>\\c[4]' + '\\it[206]\\c[0]' + '효과!' + ' 데미지 \\c[4]' + threshhold + '\\c[0]! 이하는 완전방어한다!';
var wait = 60;
BattleManager.addText(text, wait);

text = '<CENTER>Deal more than \\c[4]' + threshhold + '\\c[0] damage to deal damage!'
BattleManager.addText(text, 10);
</Custom Apply Effect>

<Custom Regenerate Effect>
var threshhold = 900;
target.setStateCounter(stateId, threshhold);
</Custom Regenerate Effect>

<Custom React Effect>
if (this.isHpEffect() && value > 0) {
var threshhold = 900;
var pierced = value > threshhold;
var text = '\\c[4]' + '\\c[0]';
var wait = 0;
if (pierced) {
value = 1;
} else {
value = 0;
target.startAnimation(174);
text += '데미지 \\c[4]' + threshhold + ' \\c[0] 이하는 완전 방어한다!';
BattleManager.addText(text, wait);
text = '\\c[4]' + threshhold + '\\c[0] 이상의 데미지를 줘야한다!'
BattleManager.addText(text, 0);
}
}
</Custom React Effect>

<STATE_HELP>
데미지 900이하는 완전 방어.
</STATE_HELP>
Code:
var last = this._actionList[this._actionList.length - 1];

That's the line from BattleManager.addText that's breaking by the looks of it. I'm guessing Selection Control does something with _actionList that is interfering with it.

Original thread: https://forums.rpgmakerweb.com/threads/how-make-damage-shield-like-this.121633/