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

    combined condition attachment for triggers

    Scheduled Pinned Locked Moved Map Making
    31 Posts 5 Posters 6.3k Views 5 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.
    • N Offline
      Numetalfan @Numetalfan
      last edited by

      next one:

      ..
      <relationship type="Neutrality" player1="Germans" player2="Russians" roundValue="1"/>
      <relationship type="Neutrality" player1="Italians" player2="Russians" roundValue="1"/>
      ..

      <attachment name="conditionAttachment_Germans_Not_At_War_With_Russians" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">

      <option name="relationship" value="Germans:Russians:anyWar"/>
      <option name="invert" value="true"/>

      </attachment>

      ...

      and

      ..

      <attachment name="politicalActionAttachment_Germans_To_War_With_Russians" attachTo="Germans" javaClass="games.strategy.triplea.attachments.PoliticalActionAttachment" type="player">

      <option name="conditions" value="conditionAttachment_Germans_Not_At_War_With_Russians"/>

      <option name="relationshipChange" value="Germans:Russians:War"/>

      <option name="relationshipChange" value="Italians:Russians:War"/>

      <option name="text" value="Germany and Italy at war with Russia"/>
      </attachment>

      should change War to both, Germany and Italy at the same time
      possible ?

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

        @numetalfan

        Should, but what is the relationship between Germany and Italy? If the relationship is "Allied" and 'alliancesCanChainTogether' is true then it would be unnecessary to set both players if it is Germany or Italy declaring war. Of course if "War" has 'isDefaultWarPosition' set 'True' and Russia declares war on either Germany or Italy then they will be at war with both players.

        But yes you should be able to change any number of relationships with a single trigger.

        Cheers...

        N 1 Reply Last reply Reply Quote 1
        • N Offline
          Numetalfan @wc_sumpton
          last edited by

          <attachment name="XYZ" attachTo="British" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="when" value="after:britishCombatMove"/>
          <option name="conditions" value="conditionAttachmentABC"/>
          <option name="removeUnits" value="8 Sea Zone:bigdestroyer" count="1"/>
          <option name="placement" value="8 Sea Zone:destroyer" count="1"/>
          </attachment>

          so this trigger works, yet it removes excatly 1 unit and replaces it by excatly 1 unit of the other type

          I want this one to work any time, so 5 bigdestroyers will be replaced by 5 destroyer,
          3 by 3 and so on

          count="1-+"

          does not work

          Any help?

          B 1 Reply Last reply Reply Quote 0
          • B Online
            beelee @Numetalfan
            last edited by

            @numetalfan to remove them you can use "all".

            <option name="removeUnits" value="all:Rail" count="2"/>

            Unfortunately that doesn't really help, as it doesn't know how many to place. The only way I know of, is to make a different condition/trigger for the number of units.

            You don't wanna go too huge or it'll slow the game down. At least it seemed like it to me. But you could try 3 or 5 and then use edit for anything more.

            N 1 Reply Last reply Reply Quote 0
            • N Offline
              Numetalfan @beelee
              last edited by

              @beelee

              thx. So did I, but now the programm is doing stupid things:

              If Germany buy one submarine and places that in SZ5,

              there is a condition
              <attachment name="conditionAttachmentSubGSZ5" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
              <option name="directPresenceTerritories" value="5 Sea Zone"/>
              <option name="players" value="Germans:Italians:Japanese"/>
              <option name="unitPresence" value="submarine" count= "1"/>
              </attachment>

              and a trigger

              <attachment name="G2subSZ5ET" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
              <option name="when" value="after:germanEndTurn"/>
              <option name="conditions" value="conditionAttachment2SubGSZ5:conditionAttachmentAxisholdGermany"/>
              <option name="removeUnits" value="5 Sea Zone:submarine" count="2"/>
              <option name="placement" value="5 Sea Zone:submarine_in_sub_bunker" count="2"/>
              </attachment>

              this one works well, the exchange works

              N 1 Reply Last reply Reply Quote 0
              • N Offline
                Numetalfan @Numetalfan
                last edited by

                oops wrong trigger

                <attachment name="GsubSZ5ET" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                <option name="when" value="after:germanEndTurn"/>
                <option name="conditions" value="conditionAttachmentSubGSZ5:conditionAttachmentAxisholdGermany"/>
                <option name="removeUnits" value="5 Sea Zone:submarine" count="1"/>
                <option name="placement" value="5 Sea Zone:submarine_in_sub_bunker" count="1"/>
                </attachment>

                N 1 Reply Last reply Reply Quote 0
                • N Offline
                  Numetalfan @Numetalfan
                  last edited by

                  but if Germany buys 2 subs

                  there are 2 conditions - one for 1 sub and one for 2 subs

                  <attachment name="conditionAttachmentSubGSZ5" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                  <option name="directPresenceTerritories" value="5 Sea Zone"/>
                  <option name="players" value="Germans:Italians:Japanese"/>
                  <option name="unitPresence" value="submarine" count= "1"/>
                  </attachment>

                  <attachment name="conditionAttachment2SubGSZ5" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                  <option name="directPresenceTerritories" value="5 Sea Zone"/>
                  <option name="players" value="Germans:Italians:Japanese"/>
                  <option name="unitPresence" value="submarine" count= "2"/>
                  </attachment>

                  and 2 triggers

                  <attachment name="GsubSZ5ET" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                  <option name="when" value="after:germanEndTurn"/>
                  <option name="conditions" value="conditionAttachmentSubGSZ5:conditionAttachmentAxisholdGermany"/>
                  <option name="removeUnits" value="5 Sea Zone:submarine" count="1"/>
                  <option name="placement" value="5 Sea Zone:submarine_in_sub_bunker" count="1"/>
                  </attachment>

                  <attachment name="G2subSZ5ET" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                  <option name="when" value="after:germanEndTurn"/>
                  <option name="conditions" value="conditionAttachment2SubGSZ5:conditionAttachmentAxisholdGermany"/>
                  <option name="removeUnits" value="5 Sea Zone:submarine" count="2"/>
                  <option name="placement" value="5 Sea Zone:submarine_in_sub_bunker" count="2"/>
                  </attachment>

                  but instead of using the second trigger, the programming is using both 😞

                  G2subSZ75ET: has removed 2 submarines owned by Germans in 75 Sea Zone
                  G2subSZ75ET: Germans has 2 submarine_in_sub_bunkers placed in 75 Sea Zone
                  GsubSZ75ET: Germans has 1 submarine_in_sub_bunker placed in 75 Sea Zone

                  So: buying 2 subs, means 1+2 = 3 converted units
                  buying 3 subs, means 1+2+3 = 6 converted untis

                  how to avoid that ?

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

                    @Numetalfan

                    'count' when used in a conditionAttachment means equal to or greater then. So both statements are true if "5 Sea Zone" has 2 German subs. The triggerAttachment does not check the 'count' when using removeUnits. So if 1 unit is there and you remove 2, it will remove the 1 with out any errors.

                    To insure that only 1 or 2 units are removed you must check for the presents of just 1 unit. So use a condition that inverts the check for 2 and if true then there must be less then 2 units:

                    <attachment name="conditionAttachmentNo2SubGSZ5" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                       <option name="conditions" value="conditionAttachment2SubGSZ5"/>
                       <option name="players" value="Germans:Italians:Japanese"/>
                       <option name="invert" value="true"/>
                    </attachment>
                    

                    Then add that condition to the deployment of 1 subermarine_in_sub_bunker trigger.

                    Cheers...

                    N 1 Reply Last reply Reply Quote 1
                    • N Offline
                      Numetalfan @wc_sumpton
                      last edited by

                      @wc_sumpton

                      so if you have 3 positive conditions

                      if1,if2,if3

                      and 3 negative one (with invert)

                      ifnot1,ifnot2,ifnot3

                      then the triggers would be:

                      triggerconvert1
                      ...if1:ifnot2:ifnot3

                      triggerconvert2
                      ...if2:ifnot1:ifnot3

                      triggerconvert3
                      ...if3:ifnot1:ifnot2

                      is that the logic for the xml ?
                      the ":" works as "AND" in this case

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

                        @Numetalfan

                        When testing with count the test is for x or more. So if an zone contains 2 units, testing for 1 unit is true, testing for 2 units is true, but testing for 3 units is false. So to test for an exact number of units there needs to be another check. ie: Are there 2 or more units, and less then 3 units?

                        So to test for up to 3 units:
                        1 or more and less then 2
                        2 or more and less then 3
                        3 or more

                        Less then 1 testing is not needed. Also testing for less then three when test for 1.

                        N 1 Reply Last reply Reply Quote 1
                        • N Offline
                          Numetalfan @wc_sumpton
                          last edited by

                          @wc_sumpton

                          thx,

                          I understand your idea,

                          however "count =" is neither <= nor >=

                          so = 2 would count 2, but it could be 3 or 4 there.

                          So how to define "2 or less" or "3 and more"

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

                            @Numetalfan

                            Wrong. "count"="2" is 2 or more. This only means assign the number "2" to the variable "count".

                            When used in conditionAttachment with "requiresUnit" then if there are 2 or more units in the zone, the statement is true.

                            When used in a triggerAttachment with "removesUnit" then it means remove no more then 2 units, but if there are less units that is ok, even if there are no units to remove.

                            It may look exact "count=2" but it is not. "count" is just variable. Like "count"="false".

                            Cheers...

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

                              @Numetalfan

                              Maybe I miss understood your question. You know how to "count" for "2". You want to know how to "count" for less then "3".

                              Simple, use an invert condition on the "count" for "3":

                              <!-- Counting for 3 or more German subs in 5 Sea Zone -->
                              <attachment name="conditionAttachment3SubGSZ5" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                                 <option name="directPresenceTerritories" value="5 Sea Zone"/>
                                 <option name="players" value="Germans:Italians:Japanese"/>
                                 <option name="unitPresence" value="submarine" count= "3"/>
                              </attachment>
                              <!-- Counting for less the 3 (0,1 or 2) German Subs in 5 Sea Zone -->
                              <attachment name="conditionAttachmentNo3SubGSZ5" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                                 <option name="conditions" value="conditionAttachment3SubGSZ5"/>
                                 <option name="players" value="Germans:Italians:Japanese"/>
                                 <option name="invert" value="true"/>
                              </attachment>
                              

                              So if there are 3 German subs in '5 Sea Zone' then "conditionAttachment3SubGSZ5" will be true and "conditionAttachmentNo3SubGSZ5" will be false. If there are less then 3 subs then "conditionAttachment3SubGSZ5" is false witch will make "conditionAttachmentNo3SubGSZ5" true.

                              Cheers...

                              1 Reply Last reply Reply Quote 1
                              • B Online
                                beelee
                                last edited by

                                This isn't exactly what you're doing but just to add another example:

                                <attachment name="conditionAttachment_WolfpackRemove112" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                                <option name="directPresenceTerritories" value="112 Sea Zone" count="1"/>
                                <option name="unitPresence" value="GermanUBoat" count="3"/>
                                <option name="invert" value="true"/>
                                </attachment>

                                <attachment name="triggerAttachment_Germans_RemoveWolfpackSZ112" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                                <option name="conditions" value="conditionAttachment_WolfpackRemove112"/>
                                <option name="removeUnits" value="112 Sea Zone:Wolfpack" count="1"/>
                                <option name="when" value="before:germansNonCombatMove"/>
                                </attachment>

                                So as long as there are less than 3 German Uboat Units in SZ 112, it will remove 1 Wolfpack Unit in SZ 112

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

                                  @beelee

                                  Correct. If there are 0, 1 or 2 'GermanUBoats' then it will attempt to remove 1 Wolfpack. This will be true even with 0 'GermanUBoats'.

                                  Cheers...

                                  B 1 Reply Last reply Reply Quote 1
                                  • B Online
                                    beelee @wc_sumpton
                                    last edited by

                                    @wc_sumpton heh heh you're the one that clued me in on it when I was struggling 🙂

                                    1 Reply Last reply Reply Quote 1

                                    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
                                    • 2
                                    • 2 / 2
                                    • First post
                                      Last post
                                    Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums