MV Weapon effects based on enemy HP

I want to make a weapon that has a passive when the enemy's HP is less than 30%, the player's attack will always be critical or can give certain effects such as burning. can anyone help?
Do you have Yanfly's plugin collection or Auto Passive States?
I haven't tried it, is there any recommendation for a Yanfly plugin?
You'd need Auto Passive States for this at the least.
You'd need Auto Passive States for this at the least.
Thanks for the advice, it was very helpful. but how to apply an automatic passive states to the player if the enemy's HP drops below 30%?
You wouldn't apply the state if the enemy's HP drops below 30%; you'd give the passive state a custom condition of having the weapon equipped, then have a <Custom Confirm Effect> that does the critical. Oh, forgot to add that you'll need Buffs & States Core as well, I thought that would be a given since it's a base for Auto Passive States but didn't factor in that you wouldn't know that. 😛
Do you mind if I ask you to write an example of "passive state a custom condition" ? I
really appreciate that.
Do you mind if I ask you to write an example of "passive state a custom condition" ? I
really appreciate that.
Absolutely - however, as some advice, the first thing you should always do when installing a plugin (and, really, before doing so) is read the documentation.

You might not understand everything, you might not remember it all, but you should know what it does and what its options are - even if you're only installing it because someone else told you to.

So, for this, you need two things. In the notes of the weapon in your database, you put
Code:
<Passive State: X>
where X is the ID (no zeros in front) of a state in your database. It doesn't matter what you call it, but don't give it an icon.

Then, in the notes for that state, put:
Code:
<Custom Confirm Effect>
if (target.hp<Math.floor(target.mhp*0.3))
{
    your stuff here
}
</Custom Confirm Effect>

To determine what "your stuff here is," you need to actually say exactly what you want to happen.
Thanks ATT_Turan, you saved me a post. 😛
as you place a post to reply 😛

but this is kinda intresting, because will the effect only work on the enemy
lower than 30%? or if a enemy out of 4 is lower than 30% HP?

as it could remove the state if you target the enemy higher than 30%.

but lunatic code isn't for everyone, there is also a tip and trick on yanfly
website that can give you some idea's with little modifications =)
I'm not very sure what you're asking...I think you might be confused.
but this is kinda intresting, because will the effect only work on the enemy
lower than 30%? or if a enemy out of 4 is lower than 30% HP?
It has the condition if (target hp < 30%), so it is only looking at the enemy you have targeted with your skill. Actually, I should do a quick modification so that it doesn't change stuff if you're healing a party member under 30%.

But, regardless, there's nothing there looking at any other enemies, so I'm not sure where "a enemy out of 4" is coming from.
as it could remove the state if you target the enemy higher than 30%.
No it couldn't, there's nothing in that code that's removing a state. The passive state is on the weapon, the only way to remove it is to unequip it. The notetag in the state is taking effect during the skill execution, it's not a condition for the state to be active or not.


@Lpdp make this modification:
Code:
if (!target.isActor() && target.hp<Math.floor(target.mhp*0.3))
Wow, thanks a lot everyone. it really helped me.

Original thread: https://forums.rpgmakerweb.com/threads/weapon-effects-based-on-enemy-hp.144472/