Navigation

    TripleA Logo

    TripleA Forum

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

    Can't get changeOwnership to work.

    Map Making
    2
    6
    284
    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

      <attachment name="triggerAttachmentAnschluss" attachTo="Germans" javaClass="TriggerAttachment" type="player">
      	<option name="changeOwnership" value="Bregenz:Austrians:Germans:true"/> <!-- Changes the units -->
      	<option name="changeOwnership" value="Bregenz:Austrians:Germans:false"/> <!-- Changes the territory -->
      	<option name="when" value="after:germansCombatMove"/>
      	<option name="uses" value="1"/>
      </attachment>
      <!-- User Actions -->
      <attachment name="userActionAttachmentAnschluss" attachTo="Germans" javaClass="UserActionAttachment" type="player">
      	<option name="text" value="Anschluss"/>
      	<option name="chance" value="6:6"/>
      	<option name="activateTrigger" value="triggerAttachmentAnschluss:1:true:false:false:false"/>
      </attachment>
      

      As the trigger name suggests, I want to create the possiblity for Germany to "anschluss" Austria, where all Austrian territories and units become controlled by Germany, however I can't get the units to change ownership as well.

      I have added "captureUnitOnEnteringBy" to the relevant territory attachments as well as "canBeCapturedOnEnteringBy" for the land units, and the property "Capture Units On Entering Territory". Not sure if that is necessary?

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

        Lol it happened yet again, I found the solution just after I posted. I had to include a player attachment for Austria...

        <attachment name="playerAttachment" attachTo="Austrians" javaClass="games.strategy.triplea.attachments.PlayerAttachment" type="player">
        	<option name="captureUnitOnEnteringBy" value="Germans"/>
        </attachment>
        

        I was spending hours on this and couldn't figure it out, but I realize it 5 minutes later after I asked it here xD

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

          Anyway, I have a follow-up question so this thread might be not completely useless 🙂

          	<option name="changeOwnership" value="Bregenz:Austrians:Germans:true"/> <!-- Changes the units -->
          	<option name="changeOwnership" value="Central Austria:Austrians:Germans:true"/> <!-- Changes the units -->
          	<option name="changeOwnership" value="Graz:Austrians:Germans:true"/> <!-- Changes the units -->
                  ...                                            
          

          I am currently having a line for changeOwnership for every single Austrian territory. Is there a way to make this a little bit cleaned up using foreach? I tried using foreach with a variable list containing all Austrian territories but then the trigger only works for the very last territory, not for the other ones.

          <attachment foreach="$Austria$" name="triggerAttachmentAnschluss" attachTo="Germans" javaClass="TriggerAttachment" type="player">
          	<option name="changeOwnership" value="@Austria@:Austrians:Germans:true"/> <!-- Changes the units -->
          	<option name="changeOwnership" value="@Austria@:Austrians:Germans:false"/> <!-- Changes the territory -->
          	<option name="when" value="after:germansCombatMove"/>
          	<option name="uses" value="1"/>
          </attachment>
          W 1 Reply Last reply Reply Quote 1
          • W
            wc_sumpton @VictoryFirst last edited by

            @victoryfirst

            If I am reading your coding correctly, then each trigger is being named the same; "triggerAttachmentAnschluss". Because of this only one trigger will fire, all the others are over written. Include the variable name in the trigger name so that each trigger will have a unique name.

            Cheers...

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

              @wc_sumpton

              Ah OK, so you have to make it "triggerAttachmentAnschluss@Austria@"?

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

                @victoryfirst

                Yes. Triggers, like conditions, need to have unique names.

                Cheers...

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