Artillery that fires at Aircraft


  • Donators

    I am trying to create a unit that is artillery but can also fire at 1 against 1 aircraft. I tried this:

    <attachment name="unitAttachment" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="movement" value="1"/>
      <option name="attack" value="2"/>
      <option name="defense" value="2"/>
      <option name="artillery" value="true"/>
      <option name="attackAA" value="1"/>
    </attachment>
    

    But no AA fire takes place.

    I looked at the Global game where aaGun is defined as this

    <attachment name="unitAttachment" attachTo="aaGun" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="isAAforCombatOnly" value="true"/>
      <option name="isRocket" value="true"/>
      <option name="canNotMoveDuringCombatMove" value="true"/>
      <option name="isInfrastructure" value="true"/>
      <option name="canBeDamaged" value="false"/>
      <option name="movement" value="1"/>
      <option name="transportCost" value="3"/>
      <option name="canBeGivenByTerritoryTo" value="British"/>
    </attachment>
    

    And I am bit mystified. Where does is designate the the AA fires at 1, against up to 3 units and can be taken as a hit? How can I create a dual use unit?


  • Donators Moderators Admin

    @RogerCooper Your AA attack needs a list of targets.


  • Admin

    @RogerCooper I believe attackAA defaults to 1 if any of the isAAXXX options are set to true.


  • Donators

    @Hepps said in Artillery that fires at Aircraft:

    @RogerCooper Your AA attack needs a list of targets.

    It does not work even with a target list.<option name="targetsAA" value="fighter:bomber"/>

    It should not be necessary, according to the object browser, "This option is not required, defaults to 'all isAir units' if not set."


  • Donators Moderators Admin

    @RogerCooper You also need the typeAA defined


  • Admin

    Also, there is one setting defining defensive AA shot strength and another defining AA shot strength when your unit is joining in on an attack.
    So if your tests are with the unit attacking, then you might not have any shots?


  • Admin

    Actually, most likely you are missing <option name="isAAforCombatOnly" value="true"/> (assuming you want the attack during combat not fly over or SBR). Essentially you need to let the engine know when you want the AA gun to be able to fire (combat vs fly over vs SBR).


  • Donators

    @redrum said in Artillery that fires at Aircraft:

    <option name="isAAforCombatOnly" value="true"/>

    That worked.


  • Donators

    I have made some progress here but I am not getting the behavior I want.

    <attachment name="unitAttachment" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="movement" value="1"/>
      <option name="attack" value="2"/>
      <option name="defense" value="2"/>
      <option name="artillery" value="true"/>
      <option name="attackAA" value="1"/>
      <option name="targetsAA" value="fighter:bomber"/>
      <option name="isAAforCombatOnly" value="true"/>
    </attachment>
    <attachment name="unitAttachment" attachTo="fighter" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="movement" value="20"/>
      <option name="isAir" value="true"/>
      <option name="defense" value="0"/>
      <option name="offensiveAttackAA" value="1"/>
      <option name="offensiveAttackAAmaxDieSides" value="12"/>
      <option name="targetsAA" value="infantry:artillery:armour_ge"/>
      <option name="isAAforCombatOnly" value="true"/>
    </attachment>
    

    I would like artillery to be limited to 1 shot regardless of how many aircraft there are. Is this possible? In the Global game, AA is limited to 3 shots each, but I don't see how that is achieved.

    On the other hand, I would like each fighter to shoot at every possible target. Instead, it seems that the maximum number of shots is the number of enemy targets. Can this be changed?


  • Admin

    @RogerCooper To limit the number of AA atttacks to 1, you need to set maxAAattacks to 1:

    maxAAattacks				values: sets how many times this unit may fire its AA guns. Defaults to -1, which means infinite. If not infinite, then aa guns can stack.
    		
    

    To be able to have more shots than number of targets you need to set mayOverStackAA to true:

    mayOverStackAA				values: sets if this unit may fire aa more times than there are aircraft (default = false).
    		
    

    I'm not sure whether having infinite target AA and using mayOverStackAA work together. You'll need to test that.


  • Donators

    @redrum said in Artillery that fires at Aircraft:
    The artillery is working. However I have some issues with the fighter. Using the following code

      <option name="mayOverStackAA" value="true"/>
      <option name="maxAAattacks" value="8"/>
    

    With 2 fighters, 16 rolls are made regardless of enemy units.

    With just maxAAttacks, 1 roll is made per enemy unit
    With just mayOverStackAA, 1 roll is made per enemy unit

    It seems that mayOverStackAA is not working correctly. If maxAAattacks is infinite, the overstack is ignored, if maxAAattacks is finite, the maximum number of rolls always applies regardless of the number enemy units.

    One could reasonably differ on how maxAAttacks & maxOverstackAA should interact. If you wanted to use them to indicate a cavalry charge, it would reasonable to always give it maximum effect. However, for most purposes it would make sense to limit the number to the number of AA attackers * the number of targets.


  • Admin

    @RogerCooper Correct. That is currently how those 2 parameters are intended to work. If you use them together then the AA units essentially always use all of their maxAAattacks regardless if there is 1 or 100 enemy targets (that's essentially what mayOverStackAA controls whether number of enemy units restricts number of shots). If maxAAattacks is infinite then mayOverStackAA doesn't really make sense since you would then have infinite attacks but you can always just set maxAAattacks to like 999 if you really want it to essentially auto kill any units it can target.

    Limiting to the number of targets happens when you set mayOverStackAA to false.

    Reading between the lines, I'm guessing what you are trying to get at is this scenario for your fighters. So using your fighter attachment, let's say you have 2 fighters and 3 enemy targets then you want to have 6 AA rolls instead of 16 AA rolls (with mayOverStackAA=true) or 3 AA rolls (with mayOverStackAA=false). Essentially a kind of in between behavior of mayOverStackAA where they can stack but only up to the number of targets. Maybe called something like mayStackAAButNotOverStack 🙂


  • Donators

    @redrum Too bad, that I can achieve the desired effect of stacking up aircraft for more firepower. I will compensate by making aircraft more effective overall. Thanks for the help.


  • Moderators

    I'd love to see the map when it's done. Had a lot of fun trying to implement all the weird rules though it resulted in hardly a playable map. Should be a lot more possible at this point!


  • Donators

    @Zjelcop It is almost done. However, although I was able to get aircraft-only attacks to work, the AI did not handle it properly, so I implemented more conventional aircraft rules. Similarly, I dropped the stacking limits because they confused the AI.Dual-role artillery works.


  • Moderators

    Yeah, getting those rules implemented is one thing, getting the AI to play with that properly makes it even harder.


  • Donators

    @Zjelcop I made the objective cities German capitals, which focused the AI on taking and defending them.


Log in to reply
 

28364
1466
1703
Who's Online
Visitors Today