khzmusik
Well-known member
you need to edit them to read this:
<property name="AITarget-1" value="SetAsTargetNearestEnemySDX, Mods" data="class=EntityAlive,80"/>
<property name="AITarget-2" value="SetAsTargetIfLeaderAttackedSDX, Mods" data="class=EntityAlive"/>
<property name="AITarget-3" value="SetAsTargetNearestEnemySDX, Mods" data="class=EntityAlive,80"/>
<property name="AITarget-4" value="SetAsTargetIfHurtSDX, Mods" data="class=EntityAlive"/>
Interesting. I'll have to dig deeper to figure out why that works.
I spent my entire day neck-deep in the C# code, figuring out exactly how this all worked. And from what I can tell, the number ("N") in "AITarget-N" (and also "AITask-N") is the priority. Higher priorities will take precedence over lower priorities.
From comments in the code, the blank task is there to ensure that the unspecified "AITarget-N" properties aren't inherited from the parent XML class.
So, your change is to make the "SetAsTargetIfHurtSDX" task take precedence over the "SetAsTargetNearestEnemySDX" and "SetAsTargetIfLeaderAttackedSDX" tasks. (You also inherited all the "AITarget-N" properties where "N" was higher than 4, but I don't think there are any in the base class, so I don't think that makes a difference.)
At least that's what I think, from looking at the decompiled C# code, but it's not exactly clear. I still have a whole lot to learn about TFP AI, and none of it is exactly straightforward.