Originally Posted by
Callistonian
Yes, copying the format of vanilla pike units, there are three things you must edit:
1) set up the primary and secondary attacks in EDU (and any other data there like unit category, attributes, etc. that may change as a result of your edits).
2) set up the primary and secondary skeletons in battle_models.modeldb (bmdb), again copy how they did it for vanilla pikes, if you've never edited bmdb before, there are plenty of guides on this on TWC
3) edit the unit model(s) to set up the primaryactive0 and secondaryactive0 mesh groups. Iirc, the vanilla Sergeants unit starts with spear and shield, all you would need to do is port in a sword model and add its texture to the Sergeant's textures (body or attachments texture, doesn't matter), UV it, assign it to the hand joint, set the comment to secondaryactive0, and you're good to go. There are a few YouTube videos that cover similar processes.
You may also want to change the unit description in export_units.txt. And I would also suggest testing that your data is set up correctly such that the unit uses their spears at all, I'm guessing you want them to at least use spears to absorb a charge. You could set their spear attack to something absurdly large (I think 63 is the max) and test with and without the absurd value to see if it ever works and if so how long it lasts.