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

    Setting Initial PoliticalRelationship with Trigger Attachment

    Scheduled Pinned Locked Moved Map Making
    triggerrelationship
    4 Posts 2 Posters 608 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.
    • RogerCooperR Offline
      RogerCooper
      last edited by

      I am trying to use a foreach loop to set the initial relationship for each nation. When I try this loop, I get an error "Unexpected Exception while setting values for attachment."

        <attachment foreach="$TriggerPlayer$^$TriggerPlayer2$" name="triggerAttachment@TriggerPlayer@@TriggerPlayer2@ToNeutrality" attachTo="@TriggerPlayer@" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
            <option name="conditions" value="conditionAttachmentTurn1"/>
            <option name="relationshipChange" value="@TriggerPlayer@:@TriggerPlayer2:any:Neutrality"/>
            <option name="uses" value="1"/>
            <option name="when"  value="before:ABidPlace"/>
      	</attachment>
      
      

      When I try testing a single value, I get no error but no change in relationship

        <attachment name="triggerAttachmentEnglandFranceToNeutrality" attachTo="England" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
            <option name="conditions" value="conditionAttachmentTurn1"/>
            <option name="relationshipChange" value="England:France:any:Neutrality"/>
            <option name="uses" value="1"/>
            <option name="when"  value="before:ABidPlace"/>
      	</attachment>
      
      

      Do I have an error in my code or is there a problem with the way TripleA handles TriggerAttachments when the relationship is "DefaultWarRelation"?

      I know I could use Excel and paste text to relationshipInitialize but I am trying to create a generic set of code elements to allow any scenario to have random initial alliances and I would like to avoid using Excel.

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

        @RogerCooper

        If you have the same country in both variableList then you are ending up with a relationship like:

        <attachment name="triggerAttachmentEnglandEnglandToNeutrality" attachTo="England" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
           <option name="conditions" value="conditionAttachmentTurn1"/>
           <option name="relationshipChange" value="England:England:any:Neutrality"/>
           <option name="uses" value="1"/>
           <option name="when"  value="before:ABidPlace"/>
        </attachment>
        

        Which may be the cause of your problem with this type of arrangement.

        Something to look at.

        Cheers...

        RogerCooperR 1 Reply Last reply Reply Quote 0
        • RogerCooperR Offline
          RogerCooper @wc_sumpton
          last edited by

          @wc_sumpton I cut back the variable list so the first list is only England, and the second list is only France and I still get the error.

          I suspect that problem is that "defaultWarRelation" is probably just a null value and I can't change a null relationship value with a trigger. Technically this is a bug, but the better solution is the ability to set an explicit default value for politicalrelationship. I will submit a request.

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

            @RogerCooper

            Are you saying that you don't have a '<relationshipInitialize>' section? It relationship are not initialize then there is nothing to set. That is why the trigger is falling. I have tried to set a tank unit to transport infantry, but if I didn't set "isLandTransport" then the trigger would fire but nothing would happen. But if I set "isLandTransport" to false then the trigger would change it to true.

            Hope this is helpful.

            Cheers...

            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