Enemies faction ? (plugin request, RMMV)

Hello there.

In the game I'm currently making, I have some enemies creatures who are hostiles towards other enemies creatures (as the description and the story of these creatures tells to the player). For example, the player might encounter a rare creature, a Cave Dragon, which is really rare to see. When the player encounter him, he's out because he search for food (other creatures). So in the troop of the battle, there are this Dragon and its preys.

I was thinking it might be better to make it so the preys attacks the player, but also attack the Dragon, and the same for the Dragon.

So I searched if there was any faction-plugin that let the game developer put a faction ID or a faction name in enemy notetag so that when the AI control an enemy, it'll attack any enemies who aren't from the same faction but also attacks the player (actors) sometimes, and will heal only the enemies from the same faction.

I'm not searching for it to change the loose/win conditions, the battle is won if all the enemies are dead.

That's being said, I didn't find any plugins that provide this, I searched for few hours now.

I hope I detailed enough, I'm just seeking for a way to make multiples enemies-factions so some enemies attacks other enemies during the battle if they're in the same troop and have a different faction.

Thank you for your time !
I think it is too hard and time-consuming to do
because it's not a new thing
but it's never happened in any version of rpg maker
I don't know, I used a little bit javascript so I have no idea how hard it could be.

I was thinking it'll only takes to make so when the enemy make a decision (the function that is doing this) check for each of his allies if one of them have a different faction content in its notetag, and if it has, when he's using a skill only versus enemy, can also includes them (and if only allies actions, exclude them).
Make it so he counts how many enemies aren't from his faction, and do the RNG for which one he attacks like this, including the actors members. If the RNG output is bigger than the number of actors, then it means he chose to attack one of the enemy who aren't from the same faction, and apply the action to a battler enemy instead of the battler actors.

Well, I know how to programs in others language, and I don't know how hard it is to be implemented in the RPG Maker MV with javascript, so I'm not saying it's not hard. I'm just saying for someone who knows how to program with javascript, it might be pretty easy actually.

But I still don't know, so if a javascript programmer come here, feel free to correct me.
And thanks for anyone who will try to make this !
I don't know, I used a little bit javascript so I have no idea how hard it could be.

I was thinking it'll only takes to make so when the enemy make a decision (the function that is doing this) check for each of his allies if one of them have a different faction content in its notetag, and if it has, when he's using a skill only versus enemy, can also includes them (and if only allies actions, exclude them).
Make it so he counts how many enemies aren't from his faction, and do the RNG for which one he attacks like this, including the actors members. If the RNG output is bigger than the number of actors, then it means he chose to attack one of the enemy who aren't from the same faction, and apply the action to a battler enemy instead of the battler actors.

Well, I know how to programs in others language, and I don't know how hard it is to be implemented in the RPG Maker MV with javascript, so I'm not saying it's not hard. I'm just saying for someone who knows how to program with javascript, it might be pretty easy actually.

But I still don't know, so if a javascript programmer come here, feel free to correct me.
And thanks for anyone who will try to make this !
I think problem is it will not compatible with other famous plugin
and as I say too hard not that it’s real super hard
it just no one interest to put effort to do that thing for free
first of all free plugin is base on author project or interesting
maybe no one interested in factioning yet

and I’m not sure is there some kind of charm or confuse in rpgm
maybe that will do the trick make it got that state before battle start

lasting I think of cut scene battle
so force damaged on enemy by eventing maybe

Original thread: https://forums.rpgmakerweb.com/threads/enemies-faction-plugin-request-rmmv.119681/