Navigation

    TripleA Logo

    TripleA Forum

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

    Chance in triggers

    Map Making
    4
    18
    1548
    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.
    • RogerCooper
      RogerCooper last edited by

      When I add chance to a trigger, not only does it not work, but the other triggers stop working. See below. I am doing something wrong?

      <attachment name="triggerAttachmentUtahBeachInfantry" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
      <option name="placement" value="Utah Beach:infantry" count="2"/>
      <option name="players" value="Americans"/>
      </attachment>
      <attachment name="triggerAttachmentUtahBeachArtillery" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
      <option name="placement" value="Utah Beach:artillery" count="1"/>
      <option name="players" value="Americans"/>
      </attachment>
      <attachment name="triggerAttachmentUtahBeachArmor" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
      <option name="placement" value="Utah Beach:armour" count="1"/>
      <option name="players" value="Americans"/>
      <option name="chance" value="3:6"/>
      </attachment>

      1 Reply Last reply Reply Quote 0
      • Frostion
        Frostion Admin last edited by

        @RogerCooper Have you tried using/adding "when" and "uses"? I don’t know if it will make the triggers work, but its maybe worth a try. Like…
        <option name="when" value="before:AmericansEndTurn"/>
        <option name="chance" value="3:6"/>
        <option name="uses" value="1"/>

        RogerCooper 1 Reply Last reply Reply Quote 1
        • RogerCooper
          RogerCooper @Frostion last edited by

          Adding the "when" option didn't help. "uses" is inappropriate as I want the event to keep firing each turn.

          I checked that Grayhawk Wars is working using triggers like:

          		<attachment name="triggerAttachmentIuz_Mercenaries_Grandwood_Forest" attachTo="Iuz" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          				<option name="conditions" value="conditionAttachmentIuz_Mercenaries_Grandwood_Forest"/>
          				<option name="when" value="after:IuzNonCombatMove"/>
          				<option name="chance" value="3:6"/>
          				<option name="chanceIncrementOnFailure" value="1"/>
          				<option name="chanceDecrementOnSuccess" value="1"/>
          				<option name="placement" value="Grandwood Forest:bugbear:sellsword" count="1"/>
          				<option name="notification" value="HeroActionMercenaries"/>
          		</attachment>
          

          Maybe I need to put a condition in, even though the trigger is unconditional.

          redrum 1 Reply Last reply Reply Quote 0
          • redrum
            redrum Admin @RogerCooper last edited by redrum

            @RogerCooper Yes. You always need a condition for triggers otherwise they default to false and never fire. The only exception I think is if you chain triggers together and use activateTrigger on another trigger.

            As @Frostion mentioned, you should pretty much always use 'when' as well.

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

              @redrum On this point, I don't believe the default "when" are documented anywhere. They should; tho I would prefer the behaviour being changed to never firing if the when is missing, but this would likely cause map bugs (no idea how widespread). Thoughts?

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

                @Cernel It would impact a lot of maps as almost all the A&A maps and many of the older maps don't use when. Here is I think the only POS2 explanation which mentions it firing at the 'default' time but not really what that means:

                when		values: this is a value of when the trigger should fire. it is optional, and if left out the trigger will fire at its default time. "before/after:name-of-step" (example: value="after:chineseEndTurn").  'when' can be set multiple times if you want a trigger to fire in multiple spots.
                FYI: if your triggers are displaying odd behavior, MAKE SURE WHEN IS SET. complex triggers can experience unexpected behavior if 'when' is not set.
                
                C 1 Reply Last reply Reply Quote 0
                • RogerCooper
                  RogerCooper @Cernel last edited by

                  @Cernel
                  when values: this is a value of when the trigger should fire. it is optional, and if left out the trigger will fire at its default time. "before/after:name-of-step" (example: value="after:chineseEndTurn"). 'when' can be set multiple times if you want a trigger to fire in multiple spots.
                  FYI: if your triggers are displaying odd behavior, MAKE SURE WHEN IS SET. complex triggers can experience unexpected behavior if 'when' is not set.

                  I was able to not use a "condition" or "when", with deterministic triggers.

                  1 Reply Last reply Reply Quote 0
                  • C
                    Cernel Moderators @redrum last edited by

                    @redrum Yes, what I was saying is that the "default time" should be documented, obviously.

                    Moreover, having this default time, missing the when, is quite the dumb liability in the making of activated triggers testing conditions, as those triggers would also fire on their own, so you need to set a "when" that will never happen (like referring to a non-existent phase), that is a huge and mandatory hack. Very bad process here.

                    redrum 1 Reply Last reply Reply Quote 0
                    • redrum
                      redrum Admin @Cernel last edited by

                      @Cernel Agree on both points. The first we can probably address. The second would require a lot of effort.

                      C 1 Reply Last reply Reply Quote 0
                      • C
                        Cernel Moderators @redrum last edited by

                        @redrum If the default when are staying, it would be good to have a way to specify a "never" for the when option. Maybe something like:

                        <option name="when" value="null"/>

                        That is understood by the program as the trigger never firing (unless activated).

                        1 Reply Last reply Reply Quote 1
                        • Frostion
                          Frostion Admin last edited by Frostion

                          In that case why not...
                          <option name="when" value="activation"/>
                          ... instead of "null"? Or maybe "triggered"??
                          When making xml code, I think the terms and wording should support understanding and intuition, so cryptic language should be kept to a minimum.

                          1 Reply Last reply Reply Quote 2
                          • redrum
                            redrum Admin last edited by

                            @Cernel Good suggestion and probably should be a feature request.

                            @Frostion Agree that "activation", "activated", or "never" is probably better than "null" as that tends to be a technical term.

                            1 Reply Last reply Reply Quote 1
                            • RogerCooper
                              RogerCooper last edited by

                              I tried this code:

                              <attachment name="conditionAttachmentUtahBeach" attachTo="Americans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                              <option name="alliedOwnershipTerritories" value="Utah Beach" count="1"/>
                              </attachment>
                              <attachment name="triggerAttachmentUtahBeachInfantry" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                              <option name="conditions" value="conditionAttachmentUtahBeach"/>
                              <option name="placement" value="Utah Beach:infantry" count="2"/>
                              <option name="players" value="Americans"/>
                              <option name="when" value="before:AmericansEndTurn"/>
                              </attachment>
                              <attachment name="triggerAttachmentUtahBeachArtillery" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                              <option name="conditions" value="conditionAttachmentUtahBeach"/>
                              <option name="placement" value="Utah Beach:artillery" count="1"/>
                              <option name="players" value="Americans"/>
                              <option name="when" value="before:AmericansEndTurn"/>
                              </attachment>
                              <attachment name="triggerAttachmentUtahBeachArmor" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                              <option name="conditions" value="conditionAttachmentUtahBeach"/>
                              <option name="placement" value="Utah Beach:armour" count="1"/>
                              <option name="players" value="Americans"/>
                              <option name="chance" value="3:6"/>
                              <option name="when" value="before:AmericansEndTurn"/>
                              </attachment>

                              Still does not work. Does anyone see what is wrong?

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

                                @RogerCooper What do you mean by doesn't work? You get an error? None of them fire? Only the non-chance ones fire?

                                RogerCooper 1 Reply Last reply Reply Quote 0
                                • RogerCooper
                                  RogerCooper @redrum last edited by

                                  @redrum The triggers do not fire. There is no error message.

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

                                    @RogerCooper Since you say that it does not work and you are receiving no error message, either, first thing I would guess is that the "when" is wrong, as that is not validated.
                                    Be sure that corresponds exactly to the phase you are looking for.
                                    Also, probably you should link here to the xml you are working on, or at least tell what game is that, if possible (that way I could have seen myself if this guess of mine is on spot).

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

                                      @Cernel Here is the D-Day_3.xml. This is mod of the existing D-Day map.

                                      redrum 1 Reply Last reply Reply Quote 0
                                      • redrum
                                        redrum Admin @RogerCooper last edited by

                                        @RogerCooper You have the wrong phase name in the "when" condition. Replace the when condition in all the triggers with this:

                                        <option name="when" value="before:americanEndTurn"/>
                                        
                                        1 Reply Last reply Reply Quote 1
                                        • 1 / 1
                                        • First post
                                          Last post
                                        Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums