set MP to zero when changing equipment

I've been trying to figure out all day how to set an actor's MP to 0 when changing equipment. I have tried calling user.setMp(0) and user.gainMp(-1000) when my item is equipped, but neither of these has any effect. I've tried doing this through Yanfly plugins and WAY_CustomOnEquipEval from Waynee95. Any assistance that can be provided for how to do this is much appreciated.
If you want your actor to set their MP to 0 whenever they change equipment, i think a simple plugin can do that. Something like this probably.

JavaScript:
//=============================================================================
// resetMPEquip.js v1.0
//=============================================================================

/*:
 * @plugindesc set mp to 0 when do equipping.
 * @author edho08
 */
 
var resetMPE = {} || resetMPE;
 
resetMPE.ori_changeEquip = Game_Actor.prototype.changeEquip;
resetMPE.ori_forceChangeEquip = Game_Actor.prototype.forceChangeEquip;

Game_Actor.prototype.changeEquip = function(slotId, item){
    resetMPE.ori_changeEquip.call(this, slotId, item);
    this._mp = 0;
}

Game_Actor.prototype.forceChangeEquip = function(slotId, item){
    resetMPE.ori_forceChangeEquip.call(this, slotId, item);
    this._mp = 0;
}

*Note: i use a supposed private var _mp from actor, you can change it with another func that change MP.
Thanks for your help! I dug a little deeper and discovered where the MP was being set in Yanfly's plugin, but I really only want to set it to 0 when I change weapons. I'm pretty sure I can rework what you posted so it checks for that via slotId. Thanks again!
If you got it to work would you mind sharing it? I was also interested in something like this.

Original thread: https://forums.rpgmakerweb.com/threads/set-mp-to-zero-when-changing-equipment.127310/