how do I make formations. I want 5 characters following my main character and I want them to follow me and do different formation like circle, all at front, all behind me. and attack at my command.
Initially making a formation like this is straightforward - distribute the circle in segments for each follower, then steer the follower so that he remains at an expected distance and angle from his leader.
Holding such a formation through varying terrain is a non-trivial task. Judging from how general your question is, it sounds like you have little experience in AI. Is that correct? For starters, you may want to read articles on AIGameDev on the topic. This are very different if you want to hold said formation in land, for instance, than if you want to do it in space.