MP Cost based on alive party members

I tried doing it myself but I cannot figure it out. What I wanted to do was make a skill cost 8 MP but the cost is multiplied per ally alive meaning if there are 5 party members and they're all alive it would cost 40. How do I do this effect?
if you yse yanfly's skill core, putting this in the notetag should do it
Code:
<Custom MP Cost>
cost = item.mpCost * user.friendsUnit().aliveMembers().length;
</Custom MP Cost>
if you yse yanfly's skill core, putting this in the notetag should do it
Code:
<Custom MP Cost>
cost = item.mpCost * user.friendsUnit().aliveMembers().length;
</Custom MP Cost>
That worked thanks

Original thread: https://forums.rpgmakerweb.com/threads/mp-cost-based-on-alive-party-members.170890/