AA gun only attacking once on offence … Help!
I am messing around with an AA unit. I have a question. This is the unit:
<attachment name="unitAttachment" attachTo="Anti-Air" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isInfrastructure" value="true"/> <option name="attackAA" value="1"/> <option name="offensiveAttackAA" value="1"/> <option name="attackAAmaxDieSides" value="10"/> <option name="offensiveAttackAAmaxDieSides" value="10"/> <option name="maxAAattacks" value="1"/> <option name="maxRoundsAA" value="-1"/> <option name="isAAforCombatOnly" value="true"/> <option name="isAAforBombingThisUnitOnly" value="false"/> <option name="isAAforFlyOverOnly" value="true"/> <option name="mayOverStackAA" value="true"/> <option name="transportCost" value="1"/> <option name="movement" value="1"/> </attachment>
The configuration seems to let the AA unit help protect a territory alongside other units, like infantry. It will attack with one shot against planes every single round.
But when the AA is joining other attacking units, and moves to attack a territory with defending planes, is attacks only in the first round. Why is that? I don’t have this problem with sea units, so I thought it might be a limitation with isInfrastructure.
@Frostion Have you tried renaming the unit I seem to remember that if you call a unit "Anti-Air" some behaviors can be affected because of the things in the code.
Just a quick guess. I'd have to look closer.
I think the naming issue is in regards to units called “aaGun”, and that this unit name is required for some rocket tech reason. I have not had this problem with non-isInfrastructure units, like the Anti-Air units in Age of Tribes. But that unit type also has normal attack and defense stats besides AA. Strange that there is a problem when attacking, but it works fine (and differently) when the same unit with same stats is defending.
I have tried messing around with "isRocket", "typeAA" and "targetsAA", but have had no luck getting the offensive AA to work. :-(
if the unit is called "aaGun" then you need units called "rockets", "rockets_r", and "aaGun_r"
if the unit has "isAA", but is not exactly named "aaGun", then you need units called "_rockets" and "_r" and "_rockets_r"
isRocket values: allows this unit to become a rocket if the player has the rocket technology. If the unit is named exactly "aaGun" then it will require an image called "rockets". If the unit is named anything else, then it will require an image with "_rockets" appended to its original name
@Frostion I'd have to look at it more deeply.
You've found a bug, quite clearly.
I agree that the behaviour should be expanded as to keep the infrastructure in combat also if it has "offensiveAttackAA" and for as long as specified in "maxRoundsAA", where "-1" means infinite. I encourage you opening an issue in GitHub, about that.
I've tested that it works fine when the AA gun is in defence, thus this behaviour is surely meant to be supported, and this limit must really be a bug (so, it should be reported).
Meanwhile, until a developer will eventually allow it to work properly, you can hack your way through by using a support 0 to itself; that will keep the unit in combat. For example:
<attachment name="supportAttachmentAnti-AirOffend" attachTo="Anti-Air" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType"> <option name="unitType" value="Anti-Air"/> <option name="faction" value="allied"/> <option name="side" value="offence"/> <option name="dice" value="strength"/> <option name="bonus" value="0"/> <option name="number" value="0"/> <option name="bonusType" value="Anti-AirOffend"/> <option name="impArtTech" value="false"/> <option name="players" value="Russians:Germans:British:Japanese:Americans"/> </attachment>
But, especially if that "Anti-Air" is representing stuff like the German 88 mm or the Italian 90 mm etc., then I strongly suggest you having actual attack and defence powers (more defence than attack) for it, and it being a true combat unit, not an infrastructure, as such guns were really fully able to work very well both as field artilleries (with regular HE shells) and as anti-armour guns (with AP shells); you can really think to such kind of guns as to anti-armour guns, having all the abilities of dedicated anti-armours, as well as field artilleries, but costing a little more and being also able to target aircrafts, as an additional ability.
If the "Anti-Air", instead, is representing fast-firing 12 to 40 mm guns, those are more specialised for the role, but they have still a good value against land targets, basically working as very heavy machine guns, and very powerful in taking out lightly armoured vehicles, like armoured personnel carriers or armoured scout cars.
Also, I really don't like the name. "Anti-Air" what? I would end it in "weapon", "gun", "cannon", "autocannon" or something, mainly depending if it is representing the medium (like the 88 mm) or the small (like the 40 mm) AA cannons. Just a suggestion. Or maybe it is called just "Anti-Air" because it is representing whatever AA stuff, like also barrage balloons?
Thanks for verifying the behaviour. I will open an issue and link to this thread, unless someone beats me to it. I have tried out a lot of AA stat configurations but have not made up my mind about the final configuration of the unit. If I was to rename the unit, it would probably be Anti-Air Unit, not canon or gun, just to keep it as a generic unit with lots of possible weapons. But I would like to keep names as short as possible, so I kind of like Anti-Air.
@Frostion Maybe call it Ack-Ack, then; but if you are using American English (idk) check if that is a thing there too (idk).
Zim Xero last edited by
@Cernel or Redrum: Units with AA shots (not AAgun), used to be moved by the AI as a normal attack unit until after version 18.104.22.168 Has this been resolved? I had a number of games I was working on where (as a PvE game maker), this became a huge constraint. The ability to add AA first shots to select unit types added a huge factor to TripleA, but not if the AI wont move those units in attack movement.
An example would be an archer unit that has a small AA capability versus air units. There is no reason an archer unit would not move with a combat unit on offense and also contribute.
Zim Xero last edited by
Not sure how to edit posts in this new forum, so sorry for the double post. Just wanted to add that I "was" an avid mod maker for TripleA: Made Stellar Forces, Pacific Solo Challenge, Fantastic Forces, and a few other mods that I wanted to perfect. The AA change, along with the slow-down of AI wait time is specifically why I abandoned my projects. I do love TripleA, however, and will probably always follow it.
@Zim-Xero AA offensive attacks are surely a must, in my mind, also in the standard WWII scenarios, because, in the moment in which you invade a territory, and in that territory there are defending aircrafts, of course you bring your AA guns and use them to fire on the defending aircrafts that are defensively attacking you (besides, medium AA guns, like the German 88 mm, are very good guns, that you want to use as anti-armour or field artillery, as well). AA guns able to AA attack both offensively and defensively makes the only sense. Plus, of course, whatever other stuff that can AA shot in defence and can move (like the archer you mention).
Actually, a thing that really bothers me is that AA guns are not supported in casualties selection; so units AA strong but otherwise weak are selected first as casualties, and it is quite annoying to remanage the autoselection each time; if it is not going to be supported, it would be good if there would be at least an option for not having any autoselection of casualties at all, for maps making extensive use of AA attacks for combat.
@Zim-Xero To my knowledge, the AI handles units with AA shots targeting particular unit types just fine. Frostion's latest map "Iron War" uses these pretty extensively. I haven't really been around long enough to comment on before/after 22.214.171.124. My suggestion would be to fire up some of you maps and play against the Hard AI (or Fast AI if you don't like waiting or have a very large map). It should handle a much larger portion of the game features and be much more competitive than the old "Moore N Able AI".
@Cernel Optimal casualty selection with some of the advanced TripleA features is an extremely difficult problem to solve quickly. If you have certain maps that handle casualty selection particularly poor and have ideas on how to improve it then I'm open to updating that logic.
@Cernel said "Actually, a thing that really bothers me is that AA guns are not supported in casualties selection; so units AA strong but otherwise weak are selected first as casualties, and it is quite annoying to remanage the autoselection each time"
This is one of the reasons why I would like AA guns in Iron War to be isInfrastructure, so auto select does not kill them instantly.
@Zim-Xero In Iron War (BETA and found in Experimental maps) the unit "Tank-Destroyer" is attacking just fine with the AI. It has an AA shot called "anti vehicle canon" and gets a bonus attack every round. So guess that old problem with AI not moving AA into combat is no more. This here problem in this thread concerns if the unit is also isInfrastructure, as I understand it.
Sadly attacking units that are isInfrastructure + AA do not seem to stay in the battle for more that 1 round, unlike if they are defending, which let's them stay.
I have not have time yet to make a Github post concerning my original problem. Hope to do it soon.
Please test it out on various maps to ensure it functions properly and has no unintended side effects.
beelee last edited by
in case you're not aware of how to edit your posts yet Zim, it's the 3 vertical dots to the right of the reply quote thing. I had a hard time figuring it out and then forgot how I did it : )
I have been testing the latest TripleA version .5470 and its AA infrastructure ability to attack every round, and it seems to work. I tested several instances with one or more AA guns as attacker and defender. Also tested if it had any unfortunate side effect on the AA cruiser at sea. Everything seems to work fine =)
I don’t think the following has to do with the new changes, but it seems that the AI does not really buy AA units like the one I use in Iron War currently. Is there a difference, in the eyes of the AI, if the unit has isAA and a unit that has the following without isAA?:
<attachment name="unitAttachment" attachTo="Anti-Air" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isInfrastructure" value="true"/> <option name="attackAA" value="1"/> <option name="offensiveAttackAA" value="1"/> <option name="attackAAmaxDieSides" value="10"/> <option name="offensiveAttackAAmaxDieSides" value="10"/> <option name="maxAAattacks" value="1"/> <option name="maxRoundsAA" value="-1"/> <option name="isAAforCombatOnly" value="true"/> <option name="isAAforBombingThisUnitOnly" value="false"/> <option name="isAAforFlyOverOnly" value="true"/> <option name="mayOverStackAA" value="true"/> <option name="isAAmovement" value="false"/> <option name="isRocket" value="false"/> <option name="destroyedWhenCapturedFrom" value="Germany:Balkan:USSR:Finland:France:French-Colonies:Italy:Britain:British-Colonies:South-Africa:British-India:Iraq:Iran:ANZAC:KNIL:China:Japan:Thailand:USA:Brazil:Neutral:True-Neutral:Pro-Axis-Neutral:Pro-Allies-Neutral"/> <option name="transportCost" value="1"/> <option name="movement" value="1"/> </attachment>
The above unit only cost 3 PUs, and that is very little in Iron War. If the unit gets a 1 in defence at cost 5 PUs, then the AI seems to buy it. But I kind of like the unit as an anti-air only unit.
@Frostion The AI doesn't really value AA attributes and only buys them to guard factories. So it looks at HP/attack/defense for choosing what units to buy.