Hello! Apologies in advance if this is not the best place for a question like this.
I'm trying to create a custom state with the Yanfly Buffs and States Core that will mark the affected target. Whenever the caster of the state damages the target, I want to deal an extra 25% damage. If the caster of the state kills the target, I want the caster to gain 25 TP.
My knowledge of coding is pretty rudimentary, but I tried to implement this by tweaking some of the code from Yanfly's Tips & Tricks. Neither effect is working right now, and I suspect the problem lies with the (origin == user) conditional, but I'm far from certain about that. Is this the correct way to check whether the caster of a particular skill is also the original caster of this state? If so, is there a problem elsewhere in the code?
Thanks!
<Category: Bypass Death Removal>
<Custom React Effect>
// Check if the attacker is the caster
if (origin == user) {
value *= 1.25;
}
</Custom React Effect>
<Custom Respond Effect>
// Check if Enduring Grudge target's HP is at 0.
if (target.hp <= 0) {
// Remove the Enduring Grudge state.
target.removeState(26);
// Check if the attacker is the caster
if (origin == user) {
// Play an animation on the attacker.
user.startAnimation(51);
// Attacker gains TP.
user.gainTp(25);
}
}
</Custom Respond Effect>
I'm trying to create a custom state with the Yanfly Buffs and States Core that will mark the affected target. Whenever the caster of the state damages the target, I want to deal an extra 25% damage. If the caster of the state kills the target, I want the caster to gain 25 TP.
My knowledge of coding is pretty rudimentary, but I tried to implement this by tweaking some of the code from Yanfly's Tips & Tricks. Neither effect is working right now, and I suspect the problem lies with the (origin == user) conditional, but I'm far from certain about that. Is this the correct way to check whether the caster of a particular skill is also the original caster of this state? If so, is there a problem elsewhere in the code?
Thanks!
<Category: Bypass Death Removal>
<Custom React Effect>
// Check if the attacker is the caster
if (origin == user) {
value *= 1.25;
}
</Custom React Effect>
<Custom Respond Effect>
// Check if Enduring Grudge target's HP is at 0.
if (target.hp <= 0) {
// Remove the Enduring Grudge state.
target.removeState(26);
// Check if the attacker is the caster
if (origin == user) {
// Play an animation on the attacker.
user.startAnimation(51);
// Attacker gains TP.
user.gainTp(25);
}
}
</Custom Respond Effect>