Navigation

    TripleA Logo

    TripleA Forum

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

    Setting Initial PoliticalRelationship with Trigger Attachment

    Map Making
    relationship trigger
    2
    4
    69
    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.
    • R
      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
      • W
        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...

        R 1 Reply Last reply Reply Quote 0
        • R
          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
          • W
            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
            • 1 / 1
            • First post
              Last post
            Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums