I see that there's no way to have an entity target itself with an interaction (such as a transformation) when it wants to attack an enemy. Has anyone discovered a workaround for this or any way to specify a necessary interaction condition that will only be met when the entity is attacking something?
There is the typical "pong" style interactions where you have an attack interaction that gives the enemy an attack interaction which does what you originally wanted. This suffers from a couple drawbacks, for one you need to make two interactions for each interaction you want, and you also can't control who the enemy ill use the interaction on (unless you restrict it so only a certain caste or creature has the "ability").
I have been working on a way to allow self-only (and also friendly only) attacks using DFHack (basically a "built-in" pong style where you use an interaction against an enemy, but DFHack applies it to you instead), but have had minimal luck. My current best method uses the reports to find the square of whomever used the attack interaction, and then finds the unit on the square. Some obvious problems with that are, multiple units on the same square, several reports happening at once and the wrong square being chosen, and units moving out of the square between the report and the check. Obviously these problems may even be worse than the normal "pong" interactions, although in a different way.
I am still trying to find a better way, you would think that DF would keep track of who used what interaction somehow (i.e. unit blah infected unit blah2 with syndrome x), but maybe it doesn't. Maybe that information is lost. I will keep trying to find something, though any advice/help is welcome.