I want to introduce passive states that can be obtained through out the game that give different benefits, ranging from stats to unique effects and one of those I want to do is Critical Hit Effects and I found yanfly's example and for some reason it is not working.
Other codes from his tips&tricks work just fine, but for some reason this is the only one that seems to do nothing. I am not an expert at all at Java script, I just know the basics to edit these things to suite my own needs, but the thing is the base code that he provides doesn't even work for me.
Establish Effect>
// Check if the attack is a physical attack that dealt HP damage from a critical hit.
if (this.isPhysical() && target.result().hpDamage > 0 && target.result().critical) {
// Create an ATK buff that lasts 5 turns.
var param = 2;
var turns = 5;
// Create an AGI buff that lasts 5 turns.
user.addBuff(param, turns);
var param = 6;
var turns = 5;
user.addBuff(param, turns);
// Check if target is alive.
if (target.isAlive()) {
// Create a DEF debuff that lasts 5 turns.
var param = 3;
var turns = 5;
// Create an AGI debuff that lasts 5 turns.
target.addDebuff(param, turns);
var param = 6;
var turns = 5;
target.addDebuff(param, turns);
}
}
I just want to get it working and thats it, from there I can figure things out myself as I just wanted to make passives that give like +1 ATK or +1/DEF then getting crits or applying states.
If anyone has a solution to this thank you!
Other codes from his tips&tricks work just fine, but for some reason this is the only one that seems to do nothing. I am not an expert at all at Java script, I just know the basics to edit these things to suite my own needs, but the thing is the base code that he provides doesn't even work for me.
Establish Effect>
// Check if the attack is a physical attack that dealt HP damage from a critical hit.
if (this.isPhysical() && target.result().hpDamage > 0 && target.result().critical) {
// Create an ATK buff that lasts 5 turns.
var param = 2;
var turns = 5;
// Create an AGI buff that lasts 5 turns.
user.addBuff(param, turns);
var param = 6;
var turns = 5;
user.addBuff(param, turns);
// Check if target is alive.
if (target.isAlive()) {
// Create a DEF debuff that lasts 5 turns.
var param = 3;
var turns = 5;
// Create an AGI debuff that lasts 5 turns.
target.addDebuff(param, turns);
var param = 6;
var turns = 5;
target.addDebuff(param, turns);
}
}
I just want to get it working and thats it, from there I can figure things out myself as I just wanted to make passives that give like +1 ATK or +1/DEF then getting crits or applying states.
If anyone has a solution to this thank you!