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

    capturing munitions from an enemy

    Scheduled Pinned Locked Moved Map Making
    8 Posts 3 Posters 2.0k 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.
    • ElreighE Offline
      Elreigh
      last edited by

      I am trying to add a capturable munition/suicide-unit to my game, (specifically, a nuclear bomb) but I haven't found any methods that work. isInfrastructure results in the munition being captured even when used offensively (for instance, a "nuke" munition dropped on enemy territory is instead given to that enemy) and canBeCapturedOnEnteringBy seems to be intended for use in "lend lease" style exchanges of units, and not for hostile takeovers.

      I also tried to use whenHitPointsDamagedChangesInto and gave the munition 2 hit points, so that it could change into a dummy unit after the battle that I could then transform back into a munition via a trigger. However, the unit does not survive the battle anyway, and never has a chance to change into the dummy.

      It might be possible to create a trigger to handle the entire exchange, but I cannot find a way to do it without making a separate condition/trigger for every single province on the map where the munition capture might happen.

      Any ideas on how I could make this work?

      redrumR 1 Reply Last reply Reply Quote 0
      • redrumR Offline
        redrum Admin @Elreigh
        last edited by redrum

        @elreigh I'm assuming you want to be able to attack with nukes but if the enemy conquers the territory the nuke is sitting in then its captured? Did you try using isSuicideOnHit and isInfrastructure with 6 attack and 0 defense. That way the nuke always hits on attack and blows up but doesn't do anything on defense and should then be captured.

        You should also be able to use isSuicide and set the property where suicide units don't actively defend so it should then be captured.

        TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

        1 Reply Last reply Reply Quote 0
        • ElreighE Offline
          Elreigh
          last edited by

          @redrum Yes, that's what I'd like to happen, ideally. I already did what you suggested, but I tried it again just now to make sure. The result is that the enemy being attacked by the nuke captures it instead of being attacked. For instance, Americans dropping a nuke on Japan results in zero Japanese casualties, no battle occurs during the combat phase, and at the end of America's turn the bomb stays in Japan and is transferred to Japanese ownership.

          I also have "Defending Suicide and Munition Units Do Not Fire" set to "true" but defenders can still select nukes and other suicide units as casualties. Is that intended behavior? Is there any way to make it so that a munition unit cannot be selected as a defensive casualty? I would prefer it if munitions were either destroyed or captured in a bunch at the end of combat, rather than acting as shields for infantry et al to hide behind.

          1 Reply Last reply Reply Quote 0
          • ElreighE Offline
            Elreigh
            last edited by

            Here is the code I am presently using. This variant of the bomb cannot be captured, and can be selected as a casualty while defending. I would like to make it so that it can be captured, and cannot be a defending casualty.

                            <attachment name="unitAttachment" attachTo="nuke" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                 <option name="movement" value="0"/> <!-- Receives movement from bombers(3) and carriers(2) -->
                                 <option name="attack" value="0"/>
                                 <option name="defense" value="0"/>
                                 <option name="offensiveAttackAA" value="4"/>
                                 <option name="maxAAattacks" value="8"/>
                                 <option name="isAAforCombatOnly" value="true"/>
                                 <option name="typeAA" value="nukeAA"/>
                                 <option name="targetsAA" value="infantry:artillery:tank:fighter:bomber:transport:destroyer:submarine:carrier:battleship:rocket:holdout:cargo_plane:heavyTank:zealot:tankHunter:katyusha:conscript:marine"/>
                                 <option name="isStrategicBomber" value="true"/>
            		 <option name="bombingBonus" value="10"/>
                                 <option name="carrierCost" value="1"/>
                                 <option name="isAir" value="true"/>
                                 <option name="isKamikaze" value="true"/>
                                 <option name="isSuicide" value="true"/>
                            </attachment>
            
            redrumR 1 Reply Last reply Reply Quote 0
            • redrumR Offline
              redrum Admin @Elreigh
              last edited by

              @elreigh So probably the only way to make that work is have a trigger that changes nuke to "isInfra=true" after battle phase then turns it back to "isInfra=false" at the start of the player's next turn. As you need it to have HP and not be isInfra in order to attack by itself but then to allow it to be captured you need it to be isInfra.

              TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

              1 Reply Last reply Reply Quote 0
              • ElreighE Offline
                Elreigh
                last edited by

                @redrum But then the isInfra change would only occur after the battle, after the nuke is killed on defense. That could work if I had a different nuke unit for every player... which means means ten extra units to the roster. That feels like a very inefficient code, but I'll work with what I've got.

                HeppsH redrumR 2 Replies Last reply Reply Quote 0
                • HeppsH Offline
                  Hepps Moderators @Elreigh
                  last edited by

                  @elreigh That does work. It's a bit of work up front, but once its set up you fine.

                  "A joyous heart sours with the burden of expectation"
                  Hepster

                  1 Reply Last reply Reply Quote 0
                  • redrumR Offline
                    redrum Admin @Elreigh
                    last edited by

                    @elreigh Yeah. I'd recommend checking out Total World War XML as it already does some similar things for making air transports isInfra true then false.

                    TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                    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