Problem with Yanfly's Phoenix Ring Item

I've been playtesting my game, and I noticed that, during a battle where the Player is supposed to lose, the Phoenix Ring from Yanfly's Tips and Tricks (http://yanfly.moe/?s=phoenix+ring) keeps bringing the Player back to life, even after the ring was supposed to "break". I've updated everything I can think of, rewatched the video several times to see if I've missed something, and this still happens.


Here's the code I used:


<Custom Apply Effect>


if (target.isActor()) {


var ring = $dataArmors[79];


if (target.hasArmor(ring)) {


target.discardEquip(ring);


target.startAnimation(42);


var hp = Math.floor(target.mhp * 0.25);


target.gainHp(hp);


target.startDamagePopup();


}


}


</Custom Apply Effect>


79 is the slot where I put this ring. What am I doing wrong?
There was recently an Auto-Life Tips & Tricks on Yanfly's website that addressed this scenario, I think, but you could certainly designate unwinnable battles by setting a Switch ON beforehand (and setting it Off afterward) and nesting that whole code block in an "if" statement that checks whether the switch is Off.  That way nothing at all will happen if a character dies during these unwinnable battles while wearing the Phoenix Ring.


If the Ring is NEVER destroyed when used, even during winnable battles, then you have some kind of other problem (either incorrect method calls in your own code block, or a bug in Yanfly's script).
There was recently an Auto-Life Tips & Tricks on Yanfly's website that addressed this scenario, I think, but you could certainly designate unwinnable battles by setting a Switch ON beforehand (and setting it Off afterward) and nesting that whole code block in an "if" statement that checks whether the switch is Off.  That way nothing at all will happen if a character dies during these unwinnable battles while wearing the Phoenix Ring.


If the Ring is NEVER destroyed when used, even during winnable battles, then you have some kind of other problem (either incorrect method calls in your own code block, or a bug in Yanfly's script).



I watched that video, but, to my memory, it didn't really have anything to add... Also, for the non-winnable battle, I did some stuff with conditional branches to make sure the Player doesn't have the ring equipped during that scenario, but it feels like a band-aid solution to the real problem.


Well, I just tried out whether or not the ring works during winnable battles and, after revival glitching my way to victory, I checked my equipment and the ring was still equipped. Also, I noticed a while back that sometimes the items listed are numbered larger than they actually are. For example, in one slot, it says the Player has two Phoenix Rings, when I only gave the Player one. And if I equip one of the "two rings", then the item disappears from the list. It's a bit hard to explain, so I'll attach a couple screenshots.


Items I gave Player:
Dryad Ring: 1


Ring of Revival: 1


Lucky Charm: 1


zeeScreenShot.pngzeeScreenShot001.png


I don't know if these are related, though...
I checked the code base and $dataArmors[x], Game_Actor.hasArmor(armor), and Game_Actor.discardEquip(armor) are all valid lines you can call.


Therefore, if the revive itself is actually working at the right time, then I'd work under the assumption that your functionality is correct and that a bug or incompatibility (such as an overwritten discardEquip method) caused by another script is what is causing your problem.  Seeing that you are definitely using a custom Equip Menu script of some sort (maybe one of Yan's maybe not, I don't know), this would be my first instinct at what could be the culprit.


Try using your Custom Apply Effect in a clean project with no other scripts besides Custom Apply Effects and whatever scripts are required for it, and see if it works properly there.  If it doesn't (or if you're already doing so and the screen I see is one of the required scripts), then you should report the bug to Yanfly using the bug report method he describes.
I checked the code base and $dataArmors[x], Game_Actor.hasArmor(armor), and Game_Actor.discardEquip(armor) are all valid lines you can call.


Therefore, if the revive itself is actually working at the right time, then I'd work under the assumption that your functionality is correct and that a bug or incompatibility (such as an overwritten discardEquip method) caused by another script is what is causing your problem.  Seeing that you are definitely using a custom Equip Menu script of some sort (maybe one of Yan's maybe not, I don't know), this would be my first instinct at what could be the culprit.


Try using your Custom Apply Effect in a clean project with no other scripts besides Custom Apply Effects and whatever scripts are required for it, and see if it works properly there.  If it doesn't (or if you're already doing so and the screen I see is one of the required scripts), then you should report the bug to Yanfly using the bug report method he describes.

Actually, I am using Yanfly's Equip Menu Plugin. Most of my plugins are Yanfly's, though I have a couple stragglers that I would imagine would mess with the items like this. Mostly I have Plugins from HimeWorks (which haven't really been a problem with any of Yanfly's stuff), and, well...maybe it's better to show you. (All the stuff above the highlighted line are Yanfly Plugins.)


Untitled.png


As you can see, none of them alter the Equipment or Items. (Including the ones in another language. I can provide links to those.) So, I don't really understand how or why any of these plugins would clash with the equipment stuff. But, I'll give the new game thing a try anyway.
@Wavelength Alright, so I tried it out with a new save file with only three plugins installed--Yanfly's Core Engine, Yanfly's Item Core, and Yanfly's Buffs and States Core. I entered a battle with the ring equipped, and Harold refused to stay dead, just like with my protagonist from my main game. What should I do? (I can provide video for this if need be.)

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-yanflys-phoenix-ring-item.62894/