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

    Chance in triggers

    Scheduled Pinned Locked Moved Map Making
    18 Posts 4 Posters 2.9k 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.
    • RogerCooperR Offline
      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
      • FrostionF Offline
        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"/>

        Map maker of: Star Wars: Galactic War + Star Wars: Tatooine War + Caribbean Trade War + Dragon War + Age of Tribes + Star Trek: Dilithium War + Iron War + Iron War: Europe + Warcraft: War Heroes

        RogerCooperR 1 Reply Last reply Reply Quote 1
        • RogerCooperR Offline
          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.

          redrumR 1 Reply Last reply Reply Quote 0
          • redrumR Offline
            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.

            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 1
            • C Offline
              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?

              redrumR RogerCooperR 2 Replies Last reply Reply Quote 0
              • redrumR Offline
                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.
                

                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 0
                • RogerCooperR Offline
                  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 Offline
                    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.

                    redrumR 1 Reply Last reply Reply Quote 0
                    • redrumR Offline
                      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.

                      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 0
                      • C Offline
                        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
                        • FrostionF Offline
                          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.

                          Map maker of: Star Wars: Galactic War + Star Wars: Tatooine War + Caribbean Trade War + Dragon War + Age of Tribes + Star Trek: Dilithium War + Iron War + Iron War: Europe + Warcraft: War Heroes

                          1 Reply Last reply Reply Quote 2
                          • redrumR Offline
                            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.

                            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 1
                            • RogerCooperR Offline
                              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?

                              redrumR C 2 Replies Last reply Reply Quote 0
                              • redrumR Offline
                                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?

                                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
                                • RogerCooperR Offline
                                  RogerCooper @redrum
                                  last edited by

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

                                  1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    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).

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

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

                                      redrumR 1 Reply Last reply Reply Quote 0
                                      • redrumR Offline
                                        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"/>
                                        

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