Yanfly Tips & Tricks - Toxic (Pokémon) - RPG Maker MV - Enemy is not dissapearing

Hello there,

I recreated the "Toxic" effect created by Yanfly. The status and spell are working well, but I have problem with "ghosts". Enemy is not dissapearing after last tick (killing blow) of the toxic status. Instead of that some of them (not all, last one dissapeared without problem) will return as "ghosts" (see screen).

There is no problem (or at least I did not find any) when I switch collapse effect to none, but I would like to keep "normal" collapse effect.

Any idea how to solve this?

Thanks.
S.
Add this at the bottom of the Regenerate notetag:
Code:
if (target.hp <= 0)
    target.performCollapse();
Did you change anything about the state notetag? If you did, we need a screenshot of it. You might need to use user.performCollapse() if the poison killed them, but iirc custom regenerate effects handle that
You might need to use user.performCollapse() if the poison killed them, but iirc custom regenerate effects handle that
It's there, but I'm not sure it works correctly. It uses isDead() for the check, which is not immediately true - the death state doesn't get applied until the battler's hp is 0 and it gets refreshed.

That's why in the middle of notetags checking the hp directly is more reliable.

We'll see if the suggestion above fixes it.
I tried to add the code, but still I'm seeing even more ghosts. Am I doing something wrong?

Spoiler: State code
JavaScript:
<Custom Apply Effect>
this._toxicCounter = 1;
</Custom Apply Effect>

<Custom Regenerate Effect>
var n = this._toxicCounter / 3;
var value = Math.floor(n * user.mhp * -1);
user.gainHp(value);
this._toxicCounter += 1;
if (target.hp <= 0)
    target.performCollapse();
</Custom Regenerate Effect>
maybe turn the way around?
Code:
<Custom Regenerate Effect>
if (target.hp > 0)
   var n = this._toxicCounter / 3;
   var value = Math.floor(n * user.mhp * -1);
   user.gainHp(value);
   this._toxicCounter += 1;
else
    target.performCollapse();
</Custom Regenerate Effect>

not sure if brackets are required, but it's slightly different 🙂
maybe turn the way around?
Yes, brackets were be required, and no that wouldn't work. That would kill the enemy even if they didn't take damage.

@Sussuri I'm not sure what's causing that graphical glitch. Have you tried some basic troubleshooting, like turning off all the other plugins, saving your project, and starting a new play test?

Are you doing this in a battle test or in a play test game?
Good idea, but unfortunately it's still the same :/

P.S.: I tried it and you need to use {} else the code won't work 😀

@ATT_Turan I tried it in battle test and in game, but it's the same. Some of the characters are glitching. They are going to fade away, but then the opacity will rise again so they re-appear.

I did test it in new game and it was the same, although it was not affecting same characters. (for example bandit C instead of A or 😎. Maybe I am missing something simple... I will try some more testing tomorrow since it's pretty late for me.

Thank you for the help anyway. Have a good day, all of you.

EDIT: I'm adding screenshots of State and Skill, maybe there is something wrong. (I tried to change "damage" to HP damage but nothing changed)
And to confirm, you're doing this after turning off all plugins aside from Buffs & States, saving your project, and starting a new game?
@ATT_Turan Yes. And I did my homework again today since I have more time to do so and it's not late night for me 😀 . I found out, that plugin in conflict is most likely Action Sequence Pack 2 (YEP). I was turning on plugin after plugin and the problem was visible after turning on this one.

I don't want this plugin to be turned off, since the battle is more boring without it. Do you have any idea how to fix this?
I found out, that plugin in conflict is most likely Action Sequence Pack 2 (YEP). I was turning on plugin after plugin and the problem was visible after turning on this one.
Nice, but theres more than just one side to this plugin conflict. If Action sequences 2 contributes to it, theres other parts. Its a very commonly used plugin, and youre presenting an unusual problem with it. Action sequences 2 and buffs & states together alone in a new project doesnt cause it on my end, nor do they in my main one with all kinds of other plugins.

just 2 points that might be relevant. you havent shown your plugin list to confirm either:
- are your yanfly plugins in the correct order? if theyre not in the order as theyre shown here, all kinds of bugs can happen.
- are your plugins up to date? it wouldnt be the first time someones shown up with outdated versions of plugins that carried bugs that were already fixed. buffs & states and action sequences should be 1.16 and 1.13 respectively
Hi @Robro33, thanks for your input.

I double checked the order of YEP plugins and it should be the same as in the page you recommended. Also, the buffs & states and Action sequences are the versions 1.16 and 1.13. Do you think there can be conflict with other plugins?

When it comes to skill connected with Toxic state, there is none action sequence. Those bandits have only 1 skill, which is basic attack skill and there is used action sequence.

This is my action sequence for attack:
Spoiler: attack action sequence
Code:
<Pre-Damage Eval>
if (user.isStateAffected(21)) {
  user.gainMp(-5);
}
</Pre-Damage Eval>

<setup action>
display action
immortal: targets, true
</setup action>
<target action>
camera focus: target
opacity not focus: 0, 60
opacity character 2: 255, 0
wait for opacity
if user.attackMotion() !== 'missile'
 move user: targets, front, 20
else
perform start
end
zoom: 100%, 30
camera screen: target, front center, 30
camera focus: target, front center, 30
wait for movement
motion attack: user
wait: 10
attack animation: target
wait for animation
action effect
</target action>

<follow action>
zoom: 100%, 60
opacity not focus: 100%, 120
</follow action>


I'm sending my plugin list as an attachment as well.

EDIT: I removed the "Attack" skill from Bandits and give them the only skill "Wait". Now the "ghosts" are not appearing, so the conflict/problem should be connected to the "Attack" skill with the action sequence above.
i still cant get the same issue with the skill youve shared.
try this. disable every plugin except yanfly's battle engine, action sequences, buffs and states, and the skill core. see if that works.

if it works, reenable all your plugins group by group and test between groups so see which one causes the issue from there
if just those few plugins presents the same issue, perhaps try redownloading the plugins and report back
Um...read through your Attack action sequence.

In the setup action, it sets the targets to immortal (which is unnecessary since you're only doing one hit), and it never turns it off.

So if you ever attack anything, it's getting stuck with an immortal state on it.

Delete that command.
it is unnecessary, but the default finish action turns off immortality on the targets (and default setup also turns it on regardless. so an attack without any AS tags would do the same things in terms of immortality). the enemy did remain where they were if they had to move for the skill, but when they took the toxic damage they still died and disappeared for me
@Robro33 Good call, my brain saw that bottom tag as a finish action, but it's a follow.

Who uses follow? 😛
For the imortal status in action sequence - I turned it off and result was the same as Robro mentioned (but it's interesting call).
When I changed follow on finish the battlers didn't want to return to original position. They will return eventually, but the other side has to attack first.

For the plugin testing:
Active plugins - CoreEngine (v1.32), BattleEngineCore (v1.51), ActSeqPack 1 (v1.13), 2 (v1.13) ,3 (v1.05), BuffsStatesCore (v1.16) and SkillCore (v1.13) were active and the bug is still present.
When I changed follow on finish the battlers didn't want to return to original position. They will return eventually, but the other side has to attack first.
No one said you should do that - I simply commented that I'd never found a use for follow action. Anything you put there could either go at the end of target action or into the finish action (in addition to the actual finishing things, like moving back).

I guess it's a matter of style for me, but I don't like having empty sections that do the pre-programmed parts. If I program a skill, I want it all doing what I say. shrug

But, then, I've also edited the pre-programmed parts in the code, so my usage is clearly not typical 🤣

For what it's worth, I think the problem may be number-related. I've seen weird stuff like this happen when battlers are hit for decimal values and stuff. I looked at your tag for it earlier and didn't see how that would be the case, but what happens if you change your Regenerate notetag so instead of
Code:
user.gainHp(value)
you have
Code:
user.gainHp(-1000)

(also, just for the correct style, change the stuff below from me that says target to user)
I was just curious what will happen and shared a feedback with you, that's all 😀 But I have an idea - if you are using the action sequence for attack that will just move one actor to enemy and everyone else is faded out, can you share it with me? I think the error causing the problem is rooted there, so I would like to try some "verified" action sequence for attack. If that's possible of course, I don't want to be pushy.

I tried to change to code, the user (bandit) will take -1000hp, but the ghost will appear anyway.

Spoiler: Edited code for toxic state
Code:
<Custom Apply Effect>
this._toxicCounter = 1;
</Custom Apply Effect>

<Custom Regenerate Effect>
var n = this._toxicCounter / 3;
var value = Math.floor(n * user.mhp * -1);
user.gainHp(-1000);
this._toxicCounter += 1;
if (user.hp <= 0)
    user.performCollapse();
</Custom Regenerate Effect>
For the plugin testing:
i added the other action sequence plugins and i have the exact same set of plugins. i cannot replicate the issue.
just to make sure. when you open up rpg_core.js with a text editor, what version does it say across the top? 1.6.2?

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-tips-tricks-toxic-pokemon-rpg-maker-mv-enemy-is-not-dissapearing.172451/