As far as I can tell any non-war animal runs from nearby danger (which may need a path both for the attacker or the attackee.) then generates a haul animal to pasture job. which my dwarfs must immediately drop everything to do.
I often have a general pen near my entrance for grazers early on witch doubles as early warning for thieves and 'nappers.
so i'm not sure if an animal watchtower would help.
My first plan didn't go too well but I just had some success with the following test setup, using a meeting zone instead of a pen:
#########
#gImh^H.#
#########
g - Goblin
I - Fortification
m - Meeting zone
^ - Pressure plate linked to the hatch
h - Hatch
H - Giant hamster
. - Floor
Things to note:
* There's no actual escape path that leads out of hostile LOS.
* There's no path between the goblin and the hamster.
First, I drop the hamster in from above. After recovering from the stun, it paths towards the meeting zone and triggers the plate. Hatch opens, blocking the path, and hamster keeps standing there like a moron. This is why I was having trouble with my other plan: when the hamster's path was suddenly blocked, instead of pathing somewhere else it just stood there indefinitely. In this design, the weird pathing thing is used to keep the hamster in place when there's no hostiles in sight.
Next, I drop the goblin on the other side of the fortifications. At this point, the comatose hamster goes haywire and starts running back and forth between the pressure plate and the other end of the corridor. It was being a bit of a jerk up until that point so seeing it panic was most satisfying. I'll probably place another pressure plate on what is currently empty floor and use that as the output.
Next up:
* Hatchless design. Is the path blocking trick necessary? Will the hamster path to the meeting zone and stay there or will it wonder around?
* Range testing. Does distance figure into the fleeing behaviour? Getting different behaviour at different ranges could be amazingly helpful for calculating position.
Hmm. I wonder if it would be possible to create angles that obstruct line of sight from a certain distance but not from another. Like so:
Sideview:
H
####
####
#### x g
H - Giant hamster
x - Goblin out of FOV
g - Goblin within FOV
Anyone want to help test some of this stuff? It seems like useful information for other projects as well.