Good question. I'm 99% sure it's only the dwarves' observer skills determine how close the enemy can get before spooking them.
All dwarves Any dwarf that can see will get spooked at a certain distance.
Further testing lead to a range of 17 to 25 tiles of space needed depending on whether the dwarf is just a dabbling observer or a legendary +5 observer.
The first test was entirely done with 1 dwarf with the following stats (I'm just guessing which ones might have an effect here):
Gap Required: 20 tilesDiscipline: Dabbling (0)
Siege Operator: Talented (6)
Concentration: Dabbling (0)
Observer: Adequate: (2)
In the second round of tests, the ballista was moved 1 tile closer to the zombie, such that 19 tiles of space (including 1 tile of ballista and 1 tile of fortification) separate the operator; the military commander was ordered to prepare the ballista to fire; and the lever was pulled. The commander immediately fled. The ballista was then moved back 1 tile such that 20 tiles of space separate them. This caused the commander to also flee. Ultimately, the ballista had to be relocated such that 25 tiles separate are between the center of the ballista and the undead in order for the commander to hold strong. The commander's stats are:
Gap Required: 25 tilesDiscipline: Legendary +5 (20)
Siege Operator: No experience (-)
Concentration: Talented (6)
Observer: Legendary +5 (20)
I'm thinking it's the observer skill at work. Discipline (unless offset by observer) skill does not seem to have any effect. It also appears that siege operator skill has no effect on the spook range. Interestingly, the change from 0 observer skill to 2 observer skill increased the distance required by 3. Lower level skill gains here seem to have greater effects.
A stonemason with the following skill levels was also tested to find the other end of the minimum fright distance:
Gap Required: 17 tilesDiscipline: No experience (-)
Siege Operator: No experience (-)
Concentration: No experience (-)
Observer: Dabbling (0)
The stonemason was able to man the ballista with a gap of only 17 tiles between their operator position and the undead.
In the image above, the crosshairs vertically line up with the center point of the ballista when the commander or the stonemason fled. The up stairs align with the center of the ballista where they would sit happily awaiting to fire. And the upward pointing triangles indicate the width of the ballista to make counting tiles of space easier.
Setting up ballistas with a 25 tile gap is just about a whole vertical screen for me:
The commander committed suicide by running into a platinum minecart grinder after concluding these fear tests...
I'm not really doing this with a good test fort, so I'm going to end my experiments here. I just wanted to set up an effective ballista battery, and needed to know how much of a dead zone to leave in front. Eventually, I'll post the effectiveness of steel tipped ballista bolts against various targets, but that's going to take a while to get set up.
Further science could be done to figure out:
- At what observer skill levels does the distance required change?
- Better control over varying dwarf skills to explore that 1% chance some other skill affects the distance
Edit: Formatting