http://forums.taleworlds.net/index.p...c,62492.0.html
I rearranged the scripts for coherence/comprehension. Eliminated those warnings. And marked clearly all parts with "Form Ranks" to ease you modder's work. Download link is here:
Source code
Form Ranks kit v1.31.9.0728
File History:
v1.31
Command Cursor added
Follow order added
v1.3
Tactical charge added
Key configuration
AI formations
Order panel added
v1.2
first release
multi-array first introduced
Features:
Array(battle) assignment: Talk to NPCs in your party. You can see option "I'm planning to raise a new battle command...". By doing this you assign that NPC as the leader of your new array.
Array(battle) men management: After assignning array, camp, in the menu click "Take an action". In the next menu you should see the option "Manage battle arrays". Click on it then you see the list of your battle arrays. Your main battle won't be listed here. Click on the array you want to assign men to, the next menu you should click "summon ** battle" to see the troop exchange window. In case you assign more troops than the sub-commander can lead, you can't navigate out of the menu.
Battlefield Controls: Also in the camp menu -> Take an action -> Formation Keys Configuration, you can set up your preferred keys. Here's a list of functions for all keys:
* Battle! (Default key '6' to '=', back slash and '1' for Everyone just as in Native) - Choose the Battle or all Battles as order listener. By holding 'ctrl' key you can select multiple Battles or unselect one from them.
Next/Previous formation (Default key 'y' and 'u') - to select formations
Stand closer/Spread out (Default key 'f8' and 'f9') - to order formations to change density
Hold this position (Default key 'f1') - to order formations move to player's position
Auto rotation (Default key 'g') - to toggle formations between keeping the same direction or always face enemies
Apply formation (Default key 'k') - to order Battles for the formation selected
Charge/Fall back/Halt (Default key 'b', 'm' and 'n' respectively) - to order formations to move in a certain speed. Pressed multiple times can accelerate the formations.
Tactical charge (Default key 'h') - to apply the built-in formation charge strategy for a Battle. Further explanation will follow.
Move forward/backward/left/right (Default arrow keys) - to move formaitons ten meters toward a direction.
Turn left/right (Default key comma and period) - to order formations to turn 15 degrees
Dismiss formation (Default key 'o') - to order battles dismiss formation and charge freely
View Order Panel (Default key 'x') - to bring up the order panel for formations
AI formations: In the key config menu you can also choose to enable or disable the AI formations, that is, whether the enemies and allies can use formations. When AI formations disabled, Native tactics will be applied for enemies and allies in battle field. The AI now is acceptable. They would choose to attack or defense. Basically the AI will be who greatly utilized the tactical charge,it's also easier

.
About Tactical Charge: This is a new thing compared to previous version. Basically it binds a tactical action to a specific formation. So if a battle is in a formation, say, wedge formation, then when applying tactical charge, the formation will do back & forth cavalry charge, as wedge formation is typically for cavalries.
Here's a list of paired formations and tactical charges:
Lines - For ranged units, formation will march toward enemies until from a certain distance and start firing.
Phalanxes - For melee units, formation will simply march toward enemies and crush anything in between.
Wedges - For cavalries, formations will charge through enemy formations, turn back, and charge again.
Squares - Same as Phalanxes.
Order Panel: Just something filling the Native Order Panel frame. So it has similar functions as the Native one. All orders can be given by clicking buttons. And also, order "move to this position" can be given by clicking ont the map!
Skills requirement: Compared to native, both players renown and leadership skill have now less effect on the party's capacity. i. e. you can lead less men in your party. This is to balance the extra men you can have in your battle arrays.
Formulas: main battle capacity = player's leadership*3+renown/68+base(10)
battle array capacity = NPC leader's tactics*2+NPC leader's intelligence+main battle capacity/battle array no.(so 2 for veward battle, 3 for reaward battle, 4 for forth battle and so on... The last side battle would have the least capacity)
max num of arrays(excluding main battle) = min{player's tactics -1, 8}
Previous known bugs fixed. So please find the new ones!
Last thing: New game recommended. But you can use your native samegames "in theory", you'll suffer minor losses like a wrong honor record or kicked out from your faction XD. If you have a savegame of my previous version, I think it's fine to use it without having trouble, as I always tested this new version on my old character and never created a new one :-P. Also, the key config is new thing, if you don't start a new game, remember to set up the keys before running into any battles!
Special thanks to 小一乱跑 who's designed the nice title pics!

Here you can see how AI does the formations:
And here's a video that could somehow show the features:
demo
Based on the game play videos I made a trailer. Enjoy!
Trailer
Download:
from Google code
from mbrepository
Source:
I rearranged the scripts for coherence/comprehension. Eliminated those warnings. And marked clearly all parts with "Form Ranks" to ease you modder's work. Download link is here:
Source code
Under Modules are the MOD files. To install, first make an exact copy of the folder Mount&Blade/modules/native, rename it as FormRanks, and copy all MOD files into that folder, replace all.
Source code is under src. Files I changed: module_constants.py module_dialogs.py module_game_menus.py module_mission_templates.py module_presentations.py module_scripts.py module_simple_triggers.py module_strings.py
module_constants.py module_dialogs.py module_game_menus.py module_mission_template.py module_scripts.py module_strings.py module_triggers.py
To Modders: Search "Form Ranks" for my code.
Credits:
Command Cursor by dstemmer