So I'm attempting to copy a skill from Yanfly Tips and Tricks MZ version again. I'm trying to make a version of Bide, where the user gains a state, takes a certain amount of damage while the state is active, and deals it back to the targets when the state is removed. I tried to modify it so it takes the physical and magical damage separately, then whichever is larger determines the damage dealt.
The problem seems to be with the damage, but I don't know why exactly? For starters, my code doesn't even show the number popups, so I'm not sure if I formatted something wrong or if it's not reading the variables?
I tried to use the original skill's code as a reference, but even that's not working. The damage actually popup shows, which is why I thought I did something wrong, but for some reason the number is always 0.
So yeah, at this point I just have no idea what to try. The attack the enemy did is Physical, and I've already turned off my non-Visustella plugins to make sure it wasn't a compatibility issue, but I'll send them just in case. Theo_StackingStates was the non-Visustella I temporarily turned off, no difference.
The problem seems to be with the damage, but I don't know why exactly? For starters, my code doesn't even show the number popups, so I'm not sure if I formatted something wrong or if it's not reading the variables?
JavaScript:
<JS On Add State>
user._physicalDamageTaken = 0;
user._magicalDamageTaken = 0;
</JS On Add State>
<JS Pre-Damage As Target>
if (this.isPhysical() && value > 0) {
target._physicalDamageTaken += value;
} else if (this.isMagical() && value > 0) {
target._magicalDamageTaken += value;
}
</JS Pre-Damage As Target>
<JS On Erase State>
$gameTemp.requestAnimation([user], 97);
if (user._physicalDamageTaken >= user._magicalDamageTaken) {
const damage = Math.ceil(user._physicalDamageTaken);
} else {
const damage = Math.ceil(user._magicalDamageTaken);
}
const enemies = user.opponentsUnit().aliveMembers();
for (const enemy of enemies) {
$gameTemp.requestAnimation([enemy], 107);
enemy.gainHp(-damage);
enemy.startDamagePopup();
enemy.clearResult();
}
delete user._physicalDamageTaken;
delete user._magicalDamageTaken;
</JS On Erase State>
I tried to use the original skill's code as a reference, but even that's not working. The damage actually popup shows, which is why I thought I did something wrong, but for some reason the number is always 0.
JavaScript:
<Hide State Turns>
<JS On Add State>
user._bide = 0;
</JS On Add State>
<JS Pre-Damage As Target>
if (value > 0) {
target._bide += value;
}
</JS Pre-Damage As Target>
<JS On Erase State>
$gameTemp.requestAnimation([user], 97);
const damage = Math.ceil(user._bide * 2);
const enemies = user.opponentsUnit().aliveMembers();
for (const enemy of enemies) {
$gameTemp.requestAnimation([enemy], 107);
enemy.gainHp(-damage);
enemy.startDamagePopup();
enemy.clearResult();
}
delete user._bide;
</JS On Erase State>
So yeah, at this point I just have no idea what to try. The attack the enemy did is Physical, and I've already turned off my non-Visustella plugins to make sure it wasn't a compatibility issue, but I'll send them just in case. Theo_StackingStates was the non-Visustella I temporarily turned off, no difference.