Skill with chance of damaging party members (RMMV)

Looking for a way to implement a skill, that when used by a party member, primarily deals damage to enemies but will occasionally deal damage to party members and the user at random. Is this possible in MV? Both scripts and plugins appreciated ,,
Yes, this is doable.

I'm not actively using any Yanfly plugins at the moment, but I believe this notetag is from Yanfly's Battle Engine Core plugin. I can't test this right now, but hopefully it's at least close to what you're looking for. Insert below notetag into the skill in question's "Note" section.

JavaScript:
<After Eval>
if (Math.random() < 0.666) { // <- insert percentage chance of occuring
  var allyDmg = user.atk * 4; // <- insert desired ally damage formula

  var group = user.friendsUnit();
  var allies = group.aliveMembers();
  var ally = allies[Math.floor(Math.random() * allies.length)];

  ally.startAnimation(55); // insert desired damage animation ID
  ally.gainHp(-allyDmg);

  if (ally.hp <= 0) {
    ally.die();
    ally.performCollapse();
  }
 }
</After Eval>
Yes, this is doable.

I'm not actively using any Yanfly plugins at the moment, but I believe this notetag is from Yanfly's Battle Engine Core plugin. I can't test this right now, but hopefully it's at least close to what you're looking for. Insert below notetag into the skill in question's "Note" section.

JavaScript:
<After Eval>
if (Math.random() < 0.666) { // <- insert percentage chance of occuring
  var allyDmg = user.atk * 4; // <- insert desired ally damage formula

  var group = user.friendsUnit();
  var allies = group.aliveMembers();
  var ally = allies[Math.floor(Math.random() * allies.length)];

  ally.startAnimation(55); // insert desired damage animation ID
  ally.gainHp(-allyDmg);

  if (ally.hp <= 0) {
    ally.die();
    ally.performCollapse();
  }
 }
</After Eval>
thankds for the respons e i will test it out when my computer stops being frozen ,,

Original thread: https://forums.rpgmakerweb.com/threads/skill-with-chance-of-damaging-party-members-rmmv.149554/