Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    How to make captured units controlled by another power

    Map Making
    3
    18
    719
    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.
    • VictoryFirst
      VictoryFirst last edited by VictoryFirst

      So in this game, when moving a unit to a Friendly Neutral territory (in this case Albania), the units join your side, and the territory is controlled by whoever moved in.

      However, I want the territory and the units to always be controlled by a specific power (Italy), no matter who moves in. If for example the French move in, I want Albania to be controlled by Italy and the units to become Italian, not French.

      4ab73ba4-4655-4493-b0b3-4cb2d4195df0-image.png

      So like this:
      52ab11d9-c0d8-458b-b352-db173e6fda8d-image.png

      Does anybody have an idea how to code do that?

      And to be more precise, all neutrals in this game have a different power they are belligerent to. So when a power moves into e.g. Belgium, the territory is handed over to France, and the units become French. For Romania, this power is Russia, no matter which ally moves in.

      W 1 Reply Last reply Reply Quote 0
      • W
        wc_sumpton @VictoryFirst last edited by

        @victoryfirst

        Please remember that I am looking at the world_war_i_1914.xml, which may not show something that may have been changed.

        There is this:

        <attachment name="playerAttachment" attachTo="Neutral_Allied" javaClass="games.strategy.triplea.attachments.PlayerAttachment" type="player">
        	<option name="captureUnitOnEnteringBy" value="Russians:French:British:Italians:Americans"/>
        </attachment>
        

        This is what is changing the units when the territory is captured. To ensure that Albania is given to the Italians, it would need to be check at the end of every players non-combat movement:

        <!-- Check to see if there any allied units in Albania -->
        <attachment name="conditionAttachmentAlbaniaCaptured" attachTo="Neutral_Allied" javaClass="RulesAttachment" type="player">
          <option name="alliedExclusionTerritories" value="Albania" count="1"/>
           <option name="unitPresence" value="Any" count="1"/>
        </attachment>
        <!-- You may also want to add a check to see if Albania was captured by a Central Power, but I'll leave that up to you. -->
        <!-- Change Albania to Italian control prior to endTurn -->
        <attachment name="triggerAttachmentAlbaniaCaptured" attachTo="Neutral_Allied" javaClass="TriggerAttachment" type="player">
          <option name="conditions" value="conditionAttachmentAlbaniaCaptured"/>
          <option name="changeOwnership" value="Albania:any:Italian:true"/>
          <option name="when" value="before:russiansEndTurn"/>
          <option name="when" value="before:frenchEndTurn"/>
          <option name="when" value="before:britishEndTurn"/>
          <option name="when" value="before:americansEndTurn"/>
        </attachment>
        

        It may need some adjustment, but I hope you get the idea.

        Cheers...

        1 Reply Last reply Reply Quote 3
        • VictoryFirst
          VictoryFirst last edited by VictoryFirst

          @wc_sumpton

          Thank you. So I used your code and it kinda works, although two things went wrong. First of all, Albania switched to Italian control even when no units moved in. I thought this was due to alliedExclusionTerritories which should be alliedPresenceTerritories, but that didn't work. Perhaps because it thinks Friendly Neutrals are also allied or something.

          Second of all, this code does not make sure the units are controlled by Italy as well, they stay neutral. How should I do that? I know there is ChangeUnitOwners, but that would change all the units in that territory to Italians, including the allied infantry that moved in, which should stay the same.

          1 Reply Last reply Reply Quote 0
          • VictoryFirst
            VictoryFirst last edited by

            So this happened at the end of the Russian turn

            434874a9-8fb3-4fd5-9bda-4ce84edd9ad0-image.png

            1 Reply Last reply Reply Quote 0
            • VictoryFirst
              VictoryFirst last edited by

              @wc_sumpton OK small improvement, I got Albania to become under the control of Italy after France moved in, by setting Albania to Neutral_True (Neutral_Allied apparently does count towards alliedPresenceTerritories, a bit annoying).

              However, the units don't change ownership to Italy, not sure how to do that.

              B 1 Reply Last reply Reply Quote 0
              • B
                beelee @VictoryFirst last edited by

                @victoryfirst

                i think you need "giveUnitControl"

                pact_of_steel_2.xml

                should be explained here

                VictoryFirst 1 Reply Last reply Reply Quote 1
                • VictoryFirst
                  VictoryFirst @beelee last edited by VictoryFirst

                  @beelee

                  Yeah so with that one you can change units in a territory to another player I believe, but I only want specific units in a territory to be controlled by another player, not all. And I don't know how to do that.

                  B W 2 Replies Last reply Reply Quote 1
                  • B
                    beelee @VictoryFirst last edited by

                    @victoryfirst said in How to make captured units controlled by another power:

                    And I don't know how to do that.

                    I don't either 🙂

                    1 Reply Last reply Reply Quote 1
                    • W
                      wc_sumpton @VictoryFirst last edited by

                      @victoryfirst. @beelee

                      I'm back again. Your first problem is with Albania, you need to change the territory attachment to reflect that only the Italians can take control of their infantry:

                      <attachment name="territoryAttachment" attachTo="Albania" javaClass="games.strategy.triplea.attachments.TerritoryAttachment" type="territory">
                      	<option name="production" value="2"/>
                      	<option name="captureUnitOnEnteringBy" value="Italians"/>
                      </attachment>
                      

                      Now for the conditions, because the territory's ownership is changing as soon as France enters, ownership of the territory can be checked:

                      <!-- Check to see if Albania is still owned by the Neutral Allies -->
                      <attachment name="conditionAttachmentAlbaniaCaptured" attachTo="Neutral_Allied" javaClass="RulesAttachment" type="player">
                         <option name="directOwnershipTerritories" value="Albania" count="1"/>
                         <option name="invert" value="true"/>
                      </attachment>
                      <!-- You may also want to add a check to see if Albania was captured by a Central Power, but I'll leave that up to you. -->
                      <!-- Change Albania to Italian control prior to endTurn -->
                      <attachment name="triggerAttachmentAlbaniaCaptured" attachTo="Italians" javaClass="TriggerAttachment" type="player">
                        <option name="conditions" value="conditionAttachmentAlbaniaCaptured"/>
                        <option name="changeOwnership" value="Albania:any:Italians:true"/> <!-- Changes the units -->
                        <option name="changeOwnership" value="Albania:any:Italians:false"/> <!-- Changes the territory -->
                        <option name="uses" value="1"/> <!-- Should only be done the first time -->
                        <option name="when" value="before:russiansEndTurn"/>
                        <option name="when" value="before:frenchEndTurn"/>
                        <option name="when" value="before:britishEndTurn"/>
                        <option name="when" value="before:americansEndTurn"/>
                      </attachment>
                      

                      Cheers...

                      1 Reply Last reply Reply Quote 3
                      • VictoryFirst
                        VictoryFirst last edited by VictoryFirst

                        @wc_sumpton

                        2cd36325-c6b9-4259-8fe8-781ee86ecbfe-image.png

                        Man, I am speechless... you are a god who solved all my problems! 🙂 Thank you so much for this!

                        Heh heh I am learning so much just looking at your code. So that's what 'uses' does 🙂 I only still don't know what 'invert' exactly is.

                        This was an awesome start to my day 😁

                        1 Reply Last reply Reply Quote 3
                        • VictoryFirst
                          VictoryFirst last edited by

                          I guess 'invert' inverts the boolean... lol 🙂

                          1 Reply Last reply Reply Quote 2
                          • VictoryFirst
                            VictoryFirst last edited by VictoryFirst

                            bf28c3d6-0519-43af-affa-1df63a000f81-image.png

                            Heh heh I also managed to get it to work after an enemy attacked 🙂

                            1 Reply Last reply Reply Quote 1
                            • VictoryFirst
                              VictoryFirst last edited by VictoryFirst

                              this post is deleted

                              1 Reply Last reply Reply Quote 0
                              • VictoryFirst
                                VictoryFirst last edited by VictoryFirst

                                this post is deleted

                                1 Reply Last reply Reply Quote 0
                                • VictoryFirst
                                  VictoryFirst last edited by VictoryFirst

                                  @wc_sumpton

                                  I need some help again.

                                  	<attachment name="conditionAttachmentAlbaniaCaptured" attachTo="Neutral_Allied" javaClass="RulesAttachment" type="player">
                                  		<option name="enemyExclusionTerritories" value="Albania" count="1"/>
                                  			<option name="directOwnershipTerritories" value="Albania" count="1"/>			
                                  	</attachment>
                                  

                                  I did this to make sure Albania didn't come under Italian control when an enemy captured Albania. However, what's happening now is that AlbaniaCaptured is triggered all the time. I can't figure out how to both trigger the event if an ally moves in, and not trigger if an enemy moves in.

                                  1 Reply Last reply Reply Quote 1
                                  • VictoryFirst
                                    VictoryFirst last edited by

                                    @wc_sumpton

                                    I think I know where the issue lies. "directOwnershipTerritories" will be false when an ally takes over, but also when an enemy takes over. Due to the invert, the result will be true in both situations.

                                    1 Reply Last reply Reply Quote 1
                                    • VictoryFirst
                                      VictoryFirst last edited by VictoryFirst

                                      @wc_sumpton

                                      I got it to work 🙂 I added an original owner to each neutral and then did this:

                                      	<attachment name="conditionAttachmentAlbaniaCaptured" attachTo="Italians" javaClass="RulesAttachment" type="player">
                                      		<option name="directOwnershipTerritories" value="Albania" count="1"/>
                                      	</attachment>
                                      

                                      So when an ally captures Albania, the territory comes under the control of the original owner (Italy). AlbaniaCaptured will only be triggered when the territory is under the control of Italy, and not when an enemy captures the territory

                                      W 1 Reply Last reply Reply Quote 4
                                      • W
                                        wc_sumpton @VictoryFirst last edited by

                                        @victoryfirst said in How to make captured units controlled by another power:

                                        I got it to work I added an original owner to each neutral and then did this:

                                        Nice! 👍 👍

                                        Cheers...

                                        1 Reply Last reply Reply Quote 2
                                        • 1 / 1
                                        • First post
                                          Last post
                                        Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums