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

    How to make captured units controlled by another power

    Scheduled Pinned Locked Moved Map Making
    18 Posts 3 Posters 2.4k 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.
    • W Offline
      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
      • VictoryFirstV Offline
        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
        • VictoryFirstV Offline
          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
          • VictoryFirstV Offline
            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 Offline
              beelee @VictoryFirst
              last edited by

              @victoryfirst

              i think you need "giveUnitControl"

              pact_of_steel_2.xml

              should be explained here

              VictoryFirstV 1 Reply Last reply Reply Quote 1
              • VictoryFirstV Offline
                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 Offline
                  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 Offline
                    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
                    • VictoryFirstV Offline
                      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
                      • VictoryFirstV Offline
                        VictoryFirst
                        last edited by

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

                        1 Reply Last reply Reply Quote 3
                        • VictoryFirstV Offline
                          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
                          • VictoryFirstV Offline
                            VictoryFirst
                            last edited by VictoryFirst

                            this post is deleted

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

                              this post is deleted

                              1 Reply Last reply Reply Quote 0
                              • VictoryFirstV Offline
                                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
                                • VictoryFirstV Offline
                                  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
                                  • VictoryFirstV Offline
                                    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 Offline
                                      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

                                      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