ALL you can do is train them to react to circumstances,and hope the training takes because no matter how much you train for battle,you are NOT prepared for the reality of it versus the training. No HUGE adrenaline dump in training.
Some will be quick to adapt after the first shock of reality,and some will cower and tremble. Some will fire every bullet they have an not aim a single one of them.
All that training goes right out the window at the first instant of contact. If you are lucky,the troops under your command will quickly recover and start to return fire. If you are VERY lucky,maybe half of it will even be aimed fire.