RGSS3 - Forced Formation

I have a little doubts about Formation in Ace that I want to have an answer with. Seeing how the community quickly helps (thanks for that by the way), I would like to ask how I can create a forced formation? For example, I want to force to place all Soldier class on second while all Monk class on the first. So for example I have Eric (soldier), Natalie (monk) and Terence (paladin). With that, if I ever do a script call, it should force Natalie to be the first member then having eric on the second. or probably a formation that you want as a shortcut.
If I understand this correctly, you want to sort the members of the party according to class with a script call? It can be done, just need to sort the @actors array in $game_party according to some rules.

class Game_Party < Game_Unit CLASS_SORT_RULES = [2, 1, 3] #the class id sorting def sort_by_class @actors.sort! { |a, b| a = $data_actors[a] b = $data_actors if a.class_id != b.class_id CLASS_SORT_RULES.index(a.class_id) <=> CLASS_SORT_RULES.index(b.class_id) else a.id <=> b.id end } $game_player.refresh $game_map.need_refresh = true end endclass Game_Interpreter def sort_party_by_class $game_party.sort_by_class end end After adding this snippet, calling sort_party_by_class in an event will sort the party according to the specified rule.
Oh that's amazing ShadowLurk! It works! Since I have ten classes, I created 10 sorts as well, and it works fine as I want to. Amazing 🙂

Mods can close this, as it was resolved by Shadow. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/rgss3-forced-formation.24615/