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

    Can't get changeOwnership to work.

    Scheduled Pinned Locked Moved Map Making
    6 Posts 2 Posters 911 Views 2 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.
    • VictoryFirstV Offline
      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
      • VictoryFirstV Offline
        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
        • VictoryFirstV Offline
          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>
          
          wc_sumptonW 1 Reply Last reply Reply Quote 1
          • wc_sumptonW Offline
            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...

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

              @wc_sumpton

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

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

                @victoryfirst

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

                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