I'm having a problem not only with a couple of custom states I have added but also with the default poison state. For some reason, when these states are applied, they carry out their normal functions, but at the end of every turn will display a '0' damage number on the enemy, and I have noticed that enemies impacted by these states never die, it's like they have infinite health. I can put as much damage as I want into them, but they will not die. Even if the enemy is damaged by an amount greater than its max health in a single move or turn, it will not die - it is functionally immortal despite none of the states inflicting immortality. Attached are the impacted states - Scathed and Bust! formerly had negative HP regenerations for a poison-like effect, but I thought that was causing the problem and got rid of it. What could the issue be? I'm not very well-versed in finding debug logs for this engine, F8 menu didn't help much.
Certain states cause enemies to become functionally immortal
RPG Maker MV SupportThere's nothing wrong in your states, so you need to troubleshoot your plugins. Some of them may have plugin parameters where you choose certain state IDs to represent plugin functionality.
Turn off all of your plugins, make sure your enemies behave correctly then. If that works, then turn back on half of your plugins and go from there as a process of elimination.
If you still get the 0 damage with all plugins off, you might have something funky in a troop event.
Turn off all of your plugins, make sure your enemies behave correctly then. If that works, then turn back on half of your plugins and go from there as a process of elimination.
If you still get the 0 damage with all plugins off, you might have something funky in a troop event.
Tried your plugin recommendation to no avail. I shouldn't think it's a troop event, considering the enemies I'm testing on don't have any battle/troop events. Is it possible that something got corrupted along the way? I dug through Buff/States Core and didn't see anything that would particularly conflict with it. It's really only these few states - others like blindness, confusion etc. work just fine.
To be clear, you're saying that when you
-select all of your plugins and turn them off
-save the project
-start a new play test
you're still getting the error with 0 damage during the regeneration phase and the enemies can't die?
I don't see how that's possible from your screenshots. Only the poison state has anything going on during regeneration, and none of them have any traits that would prevent death.
I see state 1 still says Knockout, did you edit anything in that state? That can cause unexpected behavior to happen with death.
-select all of your plugins and turn them off
-save the project
-start a new play test
you're still getting the error with 0 damage during the regeneration phase and the enemies can't die?
I don't see how that's possible from your screenshots. Only the poison state has anything going on during regeneration, and none of them have any traits that would prevent death.
I see state 1 still says Knockout, did you edit anything in that state? That can cause unexpected behavior to happen with death.
Maybe this is a breakthrough. First, I discovered the Scathed skill is not bugged, I'm just a goober and didn't realize that the enemy was already impacted by the Bust! immortality bug at the same time, and just happened to have Scathed. The skill I'm using to add the Bust! state doesn't add them in the traditional way - the state is added via the damage formula based on a funky line of randomization code that I made up. Notably, if I apply the state directly - the intended method in the effects tab of a skill, add state 100% - the state works as intended and does not have the immortality bug.
Is it possible that adding states with b.addState causes the immortality bug? I'll paste the skill's damage formula here.
Bust! skill:
r=((Math.randomInt(21)) + (Math.randomInt(21))); r < 21? r * 10 : r > 21? b.addState(0019) : r = 21? 2500 : 9999
This skill is a blackjack sort of thing, where if the two random numbers rolled add up to a value greater than 21, no damage is directly inflicted, but the Bust! state is intended to be applied. When done this way, the state's application causes the immortality bug. I made a debug skill where the only effect is add state 100% as per RPGMaker's effects tab for skills, like normal, and it works.
Is it possible that adding states with b.addState causes the immortality bug? I'll paste the skill's damage formula here.
Bust! skill:
r=((Math.randomInt(21)) + (Math.randomInt(21))); r < 21? r * 10 : r > 21? b.addState(0019) : r = 21? 2500 : 9999
This skill is a blackjack sort of thing, where if the two random numbers rolled add up to a value greater than 21, no damage is directly inflicted, but the Bust! state is intended to be applied. When done this way, the state's application causes the immortality bug. I made a debug skill where the only effect is add state 100% as per RPGMaker's effects tab for skills, like normal, and it works.
It may not be responsible for that bug you mentioned, but your Yanfly plugins are out of order and that can cause odd effects at times. You need to organize them exactly how they're ordered on Yanfly's website.
You have multiple errors in your code.
First, when referring to IDs (or any other number) always ignore leading zeros. You're turning that state ID into an octal value, and an invalid one. That is surely what's bugging your enemies.
Then, near the end you have "r=21" which is assigning a value, not checking for it to be true with "==". That means that will always be evaluated as true.
So there are two places (r=21 and the b.addState) which will not return any damage value from the formula, which will result in the enemy taking 0 damage.
I suggest you double-check your JavaScript syntax. I'd also suggest you take all that out of the damage formula - when you get into adding states and triple-nested ternary statements, it's better to use a plugin and move the effects into there.
First, when referring to IDs (or any other number) always ignore leading zeros. You're turning that state ID into an octal value, and an invalid one. That is surely what's bugging your enemies.
Then, near the end you have "r=21" which is assigning a value, not checking for it to be true with "==". That means that will always be evaluated as true.
So there are two places (r=21 and the b.addState) which will not return any damage value from the formula, which will result in the enemy taking 0 damage.
I suggest you double-check your JavaScript syntax. I'd also suggest you take all that out of the damage formula - when you get into adding states and triple-nested ternary statements, it's better to use a plugin and move the effects into there.
Fixed leading zeroes in b.addState from 0019 to just 19, as well as the = vs. == syntax, but still getting the immortality bug when state is inflicted via damage formula.
What plugin would you recommend replacing this skill's effect with? I'm not super knowledgeable about plugin coding for RPGMaker - I inherited this project from a friend that never finished it, so I'm doing it for him. He knew a little bit about plugin coding with skills - some earlier skills use it, but mine don't because I just haven't needed to, until now I guess.
I'd guess because you left the rest of the formula there, so you're still using the b.addState() call as what's being returned as the damage.
When you try to tell the engine to inflict damage with things that aren't numbers, it can do screwy things.
Yanfly's Skill Core.
Is the randomInt(21) part correct? That will generate a number between 0-20. Is it supposed to be 1-21? I'm going with that, but it's simple enough for you to change back if you want.
Leave the skill's damage formula in the database with a 0, then use these notetags:
Code:
<Pre-Damage Eval>
user.draw=Math.randomInt(21)+Math.randomInt(21)+2;
if (user.draw<=21)
value=user.draw*10;
</Pre-Damage Eval>
<After Eval>
if (user.draw>21)
target.addState(19);
delete user.draw;
</After Eval>
I'm not sure what your intent is in the original formula with the 2500 and 9999 values, but the above code is doing what you described textually. If you need to modify it, you can (or ask how if you're not sure).
1-21 or 0-20 either is fine, both depart from my absolute original concept intent with the skill but they've worked for how it's been in-game. 2500 is supposed to be if the added value, r, is equal to exactly 21. 9999 was just a debug value for me to see if it was going through the code correctly, to catch any r values that somehow were not above, below, or equal to 21 (a problem I encountered with earlier versions of the formula). I should be able to tack on the if (user.draw==21) statement with your code - would this go in the pre-damage evaluation?
Well then what did you actually want?
Then do
Code:
<Pre-Damage Eval>
user.draw=Math.randomInt(21)+Math.randomInt(21)+2;
if (user.draw==21)
value=2500;
else if (user.draw<21)
value=user.draw*10;
</Pre-Damage Eval>
Yep, that looks like how I put it in. Thanks for your help! Skill works just fine now.
Original thread: https://forums.rpgmakerweb.com/threads/certain-states-cause-enemies-to-become-functionally-immortal.152885/