Adding Party Member when Using Escape

Problem A
How can I add a party member when I using the Escape skill? Doesn't seem to work


Problem B
Also, how can I add a skill were I gain Magic when i damage the enemy?

Tried this but it doesnt work: a.gainMp(10); a.atk * 2 - b.def * 2
A:Escape has a certain chance of failure.
B:You need to have YEP_BuffsStatesCore.
Add status to your actor.
<Custom Establish Effect>

if (value > 0 && this.isHpEffect()) {

user.gainMp(10);

}

</Custom Establish Effect>
What @Ivkeai said for part B isn't going to work without dealing with states. I recommend using Yanfly Skill Core with the note tag below, place itin the skill that allows the user to gain mp.
<Post-Damage Eval>
if (value > 0 && this.isHpEffect() && user.isActor()) {

user.gainMp(10);

}
</Post-Damage Eval>
Use YEP Life stealing plugin.It can also be MP stealing.
There is a MP Drain property in the Damage type section of the skill window.

Original thread: https://forums.rpgmakerweb.com/threads/adding-party-member-when-using-escape.90984/