TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    AI, non-combatmove units, amphibious assaults

    Scheduled Pinned Locked Moved Map Making
    9 Posts 3 Posters 1.2k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • TorpedoAT Offline
      TorpedoA
      last edited by TorpedoA

      I did ask this question some time ago but there was no respond.
      Eventually i can get another chance to get help at this problem.

      I have a unit called TrenchInf, its like a infantry/construction hybrid but it cannot combat move because its totally digged in and is only ready for defending and cannot attack.
      They are able to move only in noncombat to an already conquered territory to strengthen it by dig in again and give defense power to all units like infantry and tanks etc while behaving like a normal unit.

      BUT the AI doesnt move/load them onto sea transports ever. They just move them by land, which is bad for balance vs player. Because they are cheaper and are a great way to defend. If the British for example take Normandy by amphibious assault, they never do a noncombat sea transport to move such unit from England to France. Never.
      This is the unit.

      <attachment name="unitAttachment" attachTo="TrenchInf" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="attack" value="0"/>
      <option name="defense" value="2"/>
      <option name="movement" value="1"/>
      <option name="transportCost" value="3"/>
      <option name="isConstruction" value="true"/>
      <option name="constructionType" value="Trench"/>
      <option name="isLandTransportable" value="true"/>
      <option name="canNotMoveDuringCombatMove" value="true"/>
      <option name="maxConstructionsPerTypePerTerr" value="20"/>
      <option name="constructionsPerTerrPerTypePerTurn" value="1"/>
      </attachment>
      

      I can say for sure that the isConstruction aspect is not responsible for the AI behavior to not use it in amphibious noncombat.
      The only thing left is the AA option canNotMoveDuringCombatMove to be responsible for that behavior.

      After some time i did try a workaround and took away the canNotMoveDuringCombatMove and gave it the restrictions from another AA options, attackingLimit and movmentLimit.

      <attachment name="unitAttachment" attachTo="TrenchInf" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="attack" value="0"/>
      <option name="defense" value="2"/>
      <option name="movement" value="1"/>
      <option name="transportCost" value="3"/>
      <option name="attackingLimit" value="allied" count="0"/>
      <option name="movementLimit" value="allied" count="999"/>
      <option name="isConstruction" value="true"/>
      <option name="constructionType" value="Trench"/>
      <option name="isLandTransportable" value="true"/>
      <option name="maxConstructionsPerTypePerTerr" value="20"/>
      <option name="constructionsPerTerrPerTypePerTurn" value="1"/>
      </attachment>
      

      As you can see, i set the attackinLimit to 0 while keeping movement even in combat move phase possible. You just cannot attack with it.

      And now the AI does indeed load it on sea transports and sometimes it unloads them into territories. I thought i got it right there.
      But there was a new problem where the AI seemed to made very poor amphibious assaults. And i am not sure about what the problem is now. For now it seems that the AI cannot handle amphibious assaults properly if they have loaded normal units with other units mixed in like i described above. Eventually the AI counts on this unit on a amphibious attack but it shouldnt? Because it cannot attackmove?

      Any ideas ?

      1 Reply Last reply Reply Quote 0
      • RogerCooperR Offline
        RogerCooper
        last edited by

        Why have a TrenchInf unit at all? There is no historical basis for it. Any military unit would entrench and fortify itself if not engaged in combat operations.

        You could have infantry just entrench using "createsUnitList" to build trenches. You could use events to limit the number of trenches or instead use events to create trenches in a controlled way.

        1 Reply Last reply Reply Quote 1
        • TorpedoAT Offline
          TorpedoA
          last edited by

          You are right about the historical side. That is then the reason why infantry is at 1/2 att/def i guess, as i did it too all my different inf units because of that. They are all def specialists. For example my Elite is 1/3 instead of 2/2 like i have seen on another map.
          So i get you there.
          I even got rid of it some days ago, but wanted to ask about the AI behavior nevertheless.

          1 Reply Last reply Reply Quote 0
          • djabwanaD Offline
            djabwana
            last edited by

            @TorpedoA We added trenches to our map by having a 2 hit point unit with zero attack or defense AND could be captured if left undefended. This is nice because a) you have to own the territory one turn before you can start "digging in" b) trenches by themselves don't have any defense c) damaged trenches can be repaired if you don't "break through" the stack

            To achieve this, they are isInfrastructure during combat move but then not during combat so they can participate in battle.

            Just throwing it out there as an idea for your map...

            <attachment attachTo="Trenches" javaClass="games.strategy.triplea.attachments.UnitAttachment" name="unitAttachment" type="unitType">
                <option count="" name="movement" value="0"/>
                <option count="" name="attack" value="0"/>
                <option count="" name="defense" value="0"/>
                <option count="" name="hitPoints" value="2"/>
                <option count="" name="isConstruction" value="true"/>
                <option count="" name="constructionType" value="Trenches"/>
                <option count="" name="constructionsPerTerrPerTypePerTurn" value="2"/>
                <option count="" name="maxConstructionsPerTypePerTerr" value="8"/>
            </attachment>
            
            <!-- Set up trenches for Germans so that undefended trenches are capturable during combat but can take hits during battle -->
            <attachment attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" name="triggerAttachment-infraDuringCombatMove-Germans-1" type="player">
                <option count="" name="conditions" value="conditionAttachment-Germans-AlwaysTrue"/>
                <option count="" name="when" value="before:Germans-CombatMove"/>
                <option count="" name="unitType" value="Trenches"/>
                <option count="true" name="unitProperty" value="isInfrastructure"/>
            </attachment>
            <attachment attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" name="triggerAttachment-infraDuringCombatMove-Germans-2" type="player">
                <option count="" name="conditions" value="conditionAttachment-Germans-AlwaysTrue"/>
                <option count="" name="when" value="before:Germans-Battle"/>
                <option count="" name="unitType" value="Trenches"/>
                <option count="false" name="unitProperty" value="isInfrastructure"/>
            </attachment>
            
            TorpedoAT 1 Reply Last reply Reply Quote 1
            • TorpedoAT Offline
              TorpedoA
              last edited by

              Thy very much. Thats a nice idea. Especially the triggers are making me curious.

              1 Reply Last reply Reply Quote 0
              • TorpedoAT Offline
                TorpedoA @djabwana
                last edited by

                @djabwana
                Hey, could you show me your condition attachment which your trigger is refering to?

                <option count="" name="conditions" value="conditionAttachment-Germans-AlwaysTrue"/>
                
                1 Reply Last reply Reply Quote 0
                • djabwanaD Offline
                  djabwana
                  last edited by

                  @TorpedoA In my game, tech works differently where you "buy" a unit and unlock it on the production frontier rather than rolling dice to research it. So every power has mech inf at the start of the game. The point is you find or define a condition that is always true so you can put it in the conditions. Maybe you can omit the condition if you don't need to use it for a trigger and just need to use the when? not sure.

                  <!-- Give mech inf to Germans so land transport works and define an "always true" condition for other triggers that should always fire -->
                  <attachment attachTo="Germans" javaClass="games.strategy.triplea.attachments.TechAttachment" name="techAttachment" type="player">
                      <option count="" name="mechanizedInfantry" value="true"/>
                  </attachment>
                  <attachment attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" name="conditionAttachment-Germans-AlwaysTrue" type="player">
                      <option count="1" name="techs" value="mechanizedInfantry"/>
                  </attachment>
                  
                  TorpedoAT 1 Reply Last reply Reply Quote 0
                  • TorpedoAT Offline
                    TorpedoA @djabwana
                    last edited by

                    @djabwana
                    Thank you very much. I am modding this game for years, but working with triggers is rather a thing i did not dig in too much.
                    Btw i find your approach to unlock units very interesting.
                    Nice idea.

                    1 Reply Last reply Reply Quote 1
                    • djabwanaD Offline
                      djabwana
                      last edited by

                      Our tech ideas came from Age of Tribe's tech tree!

                      1 Reply Last reply Reply Quote 0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      • 1 / 1
                      • First post
                        Last post
                      Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums