Well, I believe this is something already known: reducing the strike_distances of the short-range melee weapons to very low values and having the medium-range melee weapons with somewhat higher values allows for that effect. For example, you can set the swords anim family to:
Code:
type MTW2_Swordsman
parent MTW2_Mace
remove_attack_anims
strike_distances 0.2 0.4 0.6 0.8 1.0
While the spears anim family has:
Code:
type MTW2_Spear
strike_distances 1.40 2.20 3.2 3.5 4.0
It's important to keep in mind that the units charge with their secondary weapons, when switch to the primary weapons (if they are melee) right after contact and then get back to the secondary weapons if the strike_distances are appropriate. It doesn't matter which is the primary or the secondary weapons (spears or swords), that effect is always the same. Also, you need to wait some moments to see them switching the weapons and getting the effect that I described. I also noticed that many soldiers that ran too deep into the enemy ranks didn't even switch to the primary weapons, which was very interesting (perhaps being surrounded negated any possibility of triggering the spears' strike_distances?)