Looks like I am terrible at constructing sentences,
No you are absolutely correct, sort of.
Your assuming they all act in unison which I dont want them to, having so many chances to drop off means they all can act individually.
I can change their AI behavior on the fly,
but with the way you portrayed it, if a group of zombies spot you, the whole horde moves in unison towards you.
This is good for zombies but Im not making zombies, lets use a different analogy, how about an army soldier.
When they form a army, a leader is who sets the first goal to move, but at any point the player approaches an individual army soldier, they dont ALL jump on the player, its only the few that spot the player that do; Else, they continue moving along their path set by the leader
when to many soldiers get close to each other, I want a box to spawn around them, count the number of soldiers.
The box count is used to PICK from any zombie in the horde to act as the leader.
When a leader is elected, the leader spawns another object, this object is a "CallToAction", it selects every soldier overlapping it ( its a large object ) and spawns yet another object which is a way point which sets the X and Y pos for their path finding to move towards.
This part I can absolutely do, this is easy, its just the first step I can't do of making a box follow them to count everyone still in it.
Any soldiers that don't hit the CallToAction are dropped off, they didnt make it, or they were too far away.
Rereading my last post's order only made sense in my head, but yeah I can see how its confusing.
The first formula you sent me was incredibly close to what I wanted, but the way it behaved upon further testing showed it wasn't quite what I was looking for, and on top of that,
was not exactly what you said it did, here, let me post the original formula you made to see if I got anything confused:
so for both X and y I did with adjustments for both obviously:
AIGroup.x+300*((zombie.x-AIGroup.x)/sqrt((zombie.X-AIGroup.X)^2+(zombie.Y-AIGroup.Y)^2))
so if I typed this correctly, the original formula said " hoard.x ", plus radius number,
times Zombie.x subtracted by hoard.x,
Then divide both by a square root of the power of 2, plus zombie.Y and hoard.Y to the power of 2.
Upon further testing this seemed to have just worked like a lerp(), just longer written,
It did have some weird effects to it that I can't quite explain where it looked like it was trying to get the position of ALL AI within that radius, but I imagine thats only because this effects all AI within that radius, so the box just teleports around trying to move over every single one.
It did favor the first AI instance that initiated it though, so it usually hovered around it.
Most of the solutions above either work but are impossible to add,
Or don't work at all.
I genuinely think its a misunderstanding thats stopping us from coming to a solid conclusion, this should be as simple as an expression, I just can't think of it.
So instead of focusing on the whole goal I just need to know how you make a box follow multiple of the same sprites that are close to eachother.