Help: Getting around the melee ped limit?

We’re working on a script that spawns groups of peds for the player to fight in “missions,” we’ve successfully done this with large groups of peds armed with guns. But have issues with unarmed peds/peds with melee weapons.

TL;DR: Peds are limited to 3 melee attackers per target, and the game restricts the addition of more melee attackers. How to get around?

More Detail:

I’ve encountered one issue when creating missions with peds equipped only with melee weapons.

Spawning a group of 15/20 peds with guns, all of these peds will engage and “aggro” the player peds that get near them, but spawning them unarmed or with bats will limit the number of peds actively attacking the player to 3, with 1 or 2 additional peds on the periphery of that fight aggressively shouting and in a targeted stance.

However, I’m not even sure if these periphery peds are adequately engaged, as they’ll often flicker between standing unengaged and engaged animations.

We’re creating and putting these peds into a group that hates the player. We’ve also put all sorts of flags with SetPedCombatAttributes (SetPedCombatAttributes · GitHub) and it seems there is some hard limit restricting the number of peds engaged in melee on a given target.

Does anyone know of good way to get around this? We’ve tested multiple scenarios, flags, and different ways with different weapons and behaviours. It doesn’t seem to be an issue with creating the peds, as applying:

SetPedFleeAttributes(ped, 0, false) -- sets ped to be able to flee
SetPedCombatAttributes(ped, 17, true) -- forces the ped the flee if threatened

Setting the ped to hate the player will guarantee that all peds (that wouldn’t engage before) flee from the player, but trying to force them to engage/attack the player seems to cause peds to lock up and behave oddly.

Any ideas on how to get around this three-ped melee target restriction?