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

    Problem with TriggerAttachment using placement option

    Scheduled Pinned Locked Moved Map Making
    trigger
    12 Posts 4 Posters 1.6k Views 4 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.
    • redrumR Offline
      redrum Admin @RogerCooper
      last edited by

      @RogerCooper can you post the error message?

      TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

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

        games.strategy.engine.data.GameParseException: map name: 'file:/C:/Users/Roger/triplea/downloadedMaps/Guadacanal/games/Guadacanal.xml', game name: 'Guadacanal', Unexpected Exception while setting values for attachment: TriggerAttachment attached to: PlayerId named:Americans with name: triggerAttachmentAmericansBuildAirfieldAtGuadacanal

        redrumR 2 Replies Last reply Reply Quote 0
        • redrumR Offline
          redrum Admin @RogerCooper
          last edited by

          @RogerCooper any additional details? Otherwise I'd need to see the XML file.

          TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

          RogerCooperR 1 Reply Last reply Reply Quote 0
          • C Offline
            Cernel Moderators Lobby Moderators @RogerCooper
            last edited by

            @RogerCooper said in Problem with TriggerAttachment using placement option:

            I am receiving the error "Unexpected error while setting values for attachment..." The error disappears when I remove the placement option. The values reference are valid "<player name="Americans" optional="false"/>" & "<unit name="airfield"/>". What am I doing wrong?

            <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                  <option name="trigger" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
                  <option name="when" value="after:americansPlace"/>
                  <option name="placement" value="Americans:airfield"/>
            </attachment>
            
            

            I'm almost sure "trigger", if still working, is a very long time deprecated option, in favour of same-behaving "conditions".

            @redrum @LaFayette @RoiEX Is there a place were deprecated items are kept track of? Did veqryn let you know about any list he made. I know since @redrum deprecates, they are kept track of in pos2, until removed, but, before redrum, deprecates were not kept in there (quite reasonable, as that is a guide, so no need telling people any deprecated elements they should never use anyways), so I assume veqryn and whoever else before were tracking them somewhere else.

            ?

            Captain CrunchC redrumR 2 Replies Last reply Reply Quote 0
            • Captain CrunchC Offline
              Captain Crunch Banned @Cernel
              last edited by Captain Crunch

              @Cernel I'm seriously giving Dislikes for blatant overuse of commas now 😜

              Cernel put 8 commas in 1 sentence rooofl

              1 Reply Last reply Reply Quote -1
              • redrumR Offline
                redrum Admin @Cernel
                last edited by

                @Cernel POS2 is where they are tracked but for anything done before my involvement, they might not be included.

                TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                1 Reply Last reply Reply Quote 0
                • C Offline
                  Cernel Moderators Lobby Moderators @RogerCooper
                  last edited by

                  @RogerCooper Anyways, what that option is doing is trying to place 1 (default count) unit called "airfield" in a zone called "Americans". The only way it can not work is that you don't have one of these.

                  1 Reply Last reply Reply Quote 2
                  • redrumR Offline
                    redrum Admin @RogerCooper
                    last edited by

                    @RogerCooper As @Cernel points out, I believe the issue is you need to specify the territory not player in the "placement" option like this:

                    <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                          <option name="trigger" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
                          <option name="when" value="after:americansPlace"/>
                          <option name="placement" value="Guadacanal:airfield"/>
                    </attachment>
                    

                    TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                    C 1 Reply Last reply Reply Quote 2
                    • C Offline
                      Cernel Moderators Lobby Moderators @redrum
                      last edited by

                      @redrum said in Problem with TriggerAttachment using placement option:

                      @RogerCooper As @Cernel points out, I believe the issue is you need to specify the territory not player in the "placement" option like this:

                      <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                            <option name="trigger" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
                            <option name="when" value="after:americansPlace"/>
                            <option name="placement" value="Guadacanal:airfield"/>
                      </attachment>
                      

                      And, if I'm right that the option "trigger" was deprecated ages ago, it would rather be this:

                      <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                            <option name="conditions" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
                            <option name="when" value="after:americansPlace"/>
                            <option name="placement" value="Guadacanal:airfield"/>
                      </attachment>
                      

                      I personally also specify a count, in these cases, despite the default being 1 (not sure if this is a good or bad practice, writing useless counts equal to default?).

                      RogerCooperR 1 Reply Last reply Reply Quote 2
                      • RogerCooperR Offline
                        RogerCooper @redrum
                        last edited by

                        @redrum Guadacanal.xml

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

                          @Cernel Thank you, I will fix it.

                          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