I’m currently trying to add to my mod a feature where archers task swap with another version of themselves that uses a fire arrow when attacking buildings, but otherwise use only their normal arrows. Trouble is, using a class in a task type 7(Combat) doesn’t actually restrict the targets a unit can fire on.
For example: if you give a unit task 7(combat) with class 0(archers) it will still be able to attack any class, not just enemies with class 0. I’m at a loss regarding what I could do to restrict which units can be targeted.
PS: I’m also puzzled why when I set two units to the same task swap group, they don’t get selected together when double clicked. My assumption was that they’d work similarly to villagers.
Instead of using the combat task you should instead try using task type ‘Hunt’ and then assign the type in the allowed targets. I don’t think it works if you also have combat on either unit.
1 Like
to answer your first question:
remove combat task from archer. add individual combat task for specific class except building/towers. the 2nd unit would have combat task against building/towers so it force swap to one with arrow. if you leave the default combat task it’ll always mean it can attack and wont force swap. this is how I do it in my mod currently and its the only way aorund this unless you wish to use switch mode but that will not be automatic.
2nd question on double clicking, strings must be the same ID for double click selection so if you have different name it will simply not select. they use to have it as dead unit to control this but they changed to this new method which can be both good and bad depending on the scenarios.
1 Like