It would be great if there were a "morale" matrix. Everytime an ally dies near a unit it lowers their morale considerably, seeing a friendly break and run would cause everyone else to panic and rout. But it could be even more in depth...
Imagine this possibility:
The goblins arrive at the fort, it is as their spies and advance scouts had described it, though with one change: a tall tower looms over the entrance, no doubt the beginning of some ambitious project. The goblin leader's mouth twists into a wicked grin. Their "megaproject" will all be for naught; it would have been better for them to have spent their time preparing defensive traps. These fools will be taught the folly of their way of life soon enough. The goblins sing war chants as they pass over the open gates in the dwarven wall. They stomp their feet in time to epic tales relating slaughter and mayhem, and thrust their weapons in the air. This is the warband of a well-known chief, not a ragtag bunch that must be spurned onwards with whips and driven ahead merely because their fear of their superiors is slightly greater than their fear of their enemies. No, these warriors know that glory is theirs to be had today, and that they will write a new chapter of the history of their people in the blood of their enemies. If they fall: eternal drinking and fighting in Goblinhalla, if they live: a slice of the famous wealth of dwarves will be awarded to them by their chief. The mood could not be better. The goblins will fight well today, meanwhile the dwarves are nowhere to be seen.
As they approach the entrance itself, their anticipation reaches a fever pitch. It is only as they approach the entrance though, that they note the tower's true height. Its highest level extends a short distance over the sheer wall. As for the fort itself: The doors are open! The goblins break into headlong run. None of them note the the overhang is dotted with hatches that are opening, that is, until objects start falling out of said hatches.
"Fear not rocks! For every goblin crushed we will kill ten more!" With that morale was maintained, until they saw that it wasn't rocks being dropped on them. It was the remnants of last year's seige....
The first wave hit the ground before the goblins reached the drop-zone. Having expected stonefall traps, perhaps bolts, and being met with bodies instead confused the goblins, put a falter in their step. The tower's height was perfectly calculated so that not all of the falls were instantly fatal. Moans and cries of pain met the goblins as they approached the entrance. Suddenly none of them felt like singing anymore.
"That's the fate of fools and of the weak!" The chief cried, dashing forward and slicing the throat of a dropped goblin who had been desperately trying to crawl. "No mere cage trap shall hold us!" Lifting his spear to the air he managed to keep morale from breaking right away.
That's when the second wave fell. Blood from a near miss splashes on the chief's face. A recruit tosses his spear on the ground and shouts "This-! This isn't what I signed up for!" He turns and runs. At the chief's signal the coward's back is filled with arrows. The rest of the goblins gulp nervously. They are committed now, not only because the punishment for desertion was death, no exceptions, but because when they'd turned to fire on the coward, they'd all noted that the distant gates in the wall were closed now. What they'd all assumed was the carelessness of a people unused to war was actually a well timed trap. They are locked in with the minds that had prepared such an unsettling welcome as this...
They turned again towards the entrance, now not inviting but foreboding. And as they trudge through a landscape of broken bodies a haunting refrain floats to them from inside the fort: a single dwarven phrase being repeated by many voices. The goblins tremble and a younger one leans closer to a scarred elder, "What is it they're saying, Xuspas?" The older goblin shakes his head slowly. "Their saying this: You came here to die. You came here to die."