v17Glitch when my Pokemon faint

This thread pertains to v17 of Pokémon Essentials.

Seenit45

Novice
Member
I came across this new glitch when my Pokemon faints. The fainting animation plays out and the text saying my Pokemon fainted does appear, but instead of switching the screen for me to pick another Pokemon to send out, the game continues on as if my Pokemon didn't faint. If I go into my party, it shows that my "fainted" Pokemon has 1 HP left, even though the last round had its HP go down to zero, and the game definitely said that my Pokemon fainted.

The main issue is that I'm not sure what caused this. I think it's because of effects like the screens or Stealth Rock, since it was during battles when these were active that this happened, although, again, I don't know for certain.

What else could have caused this?

TechSkylander1518

Wiki Dweeb
Member
Maybe it's something to do with HP EVs? Like, say my Pokemon uses Explosion and gets taken out, but Explosion is enough to take out an opponent and get enough HP EVs to get one more point- that could maybe cause something like that?

A play-by-play would probably help narrow it down a bit more, if you can remember what happened?

Morningdew

Novice
Member
I came across this new glitch when my Pokemon faints. The fainting animation plays out and the text saying my Pokemon fainted does appear, but instead of switching the screen for me to pick another Pokemon to send out, the game continues on as if my Pokemon didn't faint. If I go into my party, it shows that my "fainted" Pokemon has 1 HP left, even though the last round had its HP go down to zero, and the game definitely said that my Pokemon fainted.

The main issue is that I'm not sure what caused this. I think it's because of effects like the screens or Stealth Rock, since it was during battles when these were active that this happened, although, again, I don't know for certain.

What else could have caused this?
Is this in a vanilla 17.2 version?

Seenit45

Novice
Member
Maybe it's something to do with HP EVs? Like, say my Pokemon uses Explosion and gets taken out, but Explosion is enough to take out an opponent and get enough HP EVs to get one more point- that could maybe cause something like that?

A play-by-play would probably help narrow it down a bit more, if you can remember what happened?
Well, here's how it went in a test battle:
• The opposing trainer sent out a Shedinja, which activates Reflect. After I make Shedinja faint with my Vileplume, the opposing trainer sents out Jellicent.
• Jellicent uses Ice Beam, which makes my Vileplume drop to 0 HP and faint.
• However, instead of switching to my party's screen, the game continues as if the Vileplume has 1 HP left as I said.
• Jellicent uses Ice Beam again and Vileplume faints for good.
It might have something to do with the EV's, since I did some changes to my script, like giving custom EV sets to NPC trainers, but I don't see how that would affect my own team.

Which part of the script do you think would cause something like this?

Here's the debug log of the test battle, by the way (Vileplume's full HP is 112):
Round 1
[AI] The opposing Shedinja's moves: Reflect=225
[AI] Prefer Reflect
[Priority] The opposing Shedinja (1), Vileplume (0)
The opposing Shedinja used Reflect
Vileplume used Stun Spore
[Status change] The opposing Shedinja was paralyzed
Move did 1 hit(s), total damage=0
[End of round]
[Status damage] The opposing Shedinja took damage from paralysis
[HP change] The opposing Shedinja lost 1 HP (1=>0)
[Pokémon fainted] The opposing Shedinja
[Send out Pokémon] Opponent sent out Jellicent in position 1

Round 2
[AI] Ice Beam damage calculated (374=>160% of target's 111 HP), score change 130=>290
[AI] The opposing Jellicent's moves: Ice Beam=290
[AI] Prefer Ice Beam
[Priority] The opposing Jellicent (1), Vileplume (0)
The opposing Jellicent used Ice Beam
Move's damage calculated to be 374
[HP change] Vileplume lost 111 HP (111=>0)
Move did 1 hit(s), total damage=111
[Pokémon fainted] Vileplume
[End of round]

Round 3
[AI] Ice Beam damage calculated (370=>160% of target's 1 HP), score change 130=>290
[AI] The opposing Jellicent's moves: Ice Beam=290
[AI] Prefer Ice Beam
[Priority] The opposing Jellicent (1), Vileplume (0)
The opposing Jellicent used Ice Beam
Move's damage calculated to be 328
[HP change] Vileplume lost 1 HP (1=>0)
[Move effect triggered] Ice Beam's added effect
Move did 1 hit(s), total damage=1
[End of round]
[Send out Pokémon] Player sent out Rampardos in position 0

Also, here are Vileplume's EVs and IVs;

Is this in a vanilla 17.2 version?
No, I did change up the script a bit.

TechSkylander1518

Wiki Dweeb
Member
Well, here's how it went in a test battle:
• The opposing trainer sent out a Shedinja, which activates Reflect. After I make Shedinja faint with my Vileplume, the opposing trainer sents out Jellicent.
• Jellicent uses Ice Beam, which makes my Vileplume drop to 0 HP and faint.
• However, instead of switching to my party's screen, the game continues as if the Vileplume has 1 HP left as I said.
• Jellicent uses Ice Beam again and Vileplume faints for good.
Well, good news, I think that was definitely the problem! Every 4 EVs gained in a stat is +1 to the relevant stats. Assuming that screencap you're giving is Vileplume after the battle, your Vileplume had 50 HP EVs before battling Shedinja, and defeating it gave her 2 HP EVs, bring her up to 52 and having enough for one more HP point.

The bad news is I'm not quite sure why the new HP point wasn't immediately calculated. Is it possible the changes you made did something where Pokemon's stats are recalculated during fainting?

Seenit45

Novice
Member
Well, good news, I think that was definitely the problem! Every 4 EVs gained in a stat is +1 to the relevant stats. Assuming that screencap you're giving is Vileplume after the battle, your Vileplume had 50 HP EVs before battling Shedinja, and defeating it gave her 2 HP EVs, bring her up to 52 and having enough for one more HP point.

The bad news is I'm not quite sure why the new HP point wasn't immediately calculated. Is it possible the changes you made did something where Pokemon's stats are recalculated during fainting?
I think I managed to solve it.

The main issue was that I had a level cap script that would keep a Pokemon from gaining experience if it reached certain level. My Vileplume was already at its max level, but it still gained EV's from beating Shedinja, which would in turn cause it to keep 1 HP even if it fainted later in the battle.

To solve this, I had to go to "def pbGainExpOne" and add
Ruby:
thispoke.calcStats
before
Ruby:
evgain*=2 if thispoke.pokerusStage>=1 # Infected or cured
After this, the test battle went fine.

Thanks a lot for the help!