Heya so I was thinking of making some single player scenario and want certain towns to field certain unit comps. But will the AI know that it has to use this comp and that other units are banned, or if for example the player makes archers will it make nothing because it cant make skirms? Or will it make the next best thing eg knights or its own archers?
I think if you can find the AI files for the official campaigns you can take inspiration from them since in most scenarios the AI sticks to its composition even if you hard counter them.
AI scripts usually specify what kind of armies the AI can field. E.g. if the AI decides to go for a stable it will know not to try to make non-stable units. With archery range, it seems to like mixing skirms and archers so if you want it to only make either one the easiest fix is to go to the technology header in de scenario editor and simply ban the units which you do not want the AI to make.
This sounds like something you can test. Make a scenario, quickly randomly generate a map, plop down an archer civ with access only to pikemen, longswordsmen and knights, start the game and attack with crossbows. (To use your own example, it’s a good example.)
I think they are reasonably flexible with units being blocked, but I don’t think the standard (skirmish) AI will ever spontaneously make a unit line its civ does not by default have access too (like say you give Franks access to camels). Maybe if it’s their only option?