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

    Game XML Tips & Examples

    Scheduled Pinned Locked Moved Map Making
    15 Posts 3 Posters 6.3k Views 3 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.
    • B Offline
      beelee
      last edited by beelee

      Here's an example of a "custom gameProperty":

      gameProperty values: can be set equal to the exact string of any boolean game property option, including custom made up ones.

      ( Start of new stuff )
      Here is an example of a custom one:
      <attachment name="HitlerYouth" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
      <option name="gameProperty" value="Hitler Youth Call Up"/>
      </attachment>
      <attachment name="conditionAttachmentGermansRounds3-+" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
      <option name="rounds" value="3-+"/>
      </attachment>
      <attachment name="triggerAttachmentHitlerYouth" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
      <option name="conditions" value="HitlerYouth:conditionAttachmentGermansRounds3-+"/>
      <option name="placement" value="Germany:infantry" count="2"/>
      <option name="when" value="after:germanPlace"/>
      </attachment>

        This will place 2 infantry in Germany at the end of Germany's "germanPlace" phase beginning round 3 and will continue to place each round for the rest of the game.
      

      The "conditions" are placed above the trigger instead of in "Conditions" for simplicity. Not sure if I should point that out or not. I don't want to spam it out. Also, the new conditions and trigger are listed twice in the xml, but it didn't throw a error and works correctly, so I guess that should be ok.

      Here's the xml:

      pact_of_steel_2.xml

      Here's a saved game so you don't have to click through:

      Hitler Youth.tsvg

      Should I try and do a branch on Git so it's easier to see the changes ? Not sure where to do it at. I guess clone it and stick it where it shows up ? Idk, I always struggle with Git. Or is this good enough ?

      Also fixed a minor typo. Hmm...just thought of something, if the wording is deemed offensive, it could be changed to "Conscription". Idk. I'm not easily offended, although some are. Selectively so imo, but whatever, that's neither here nor there.

      At any rate
      Peace Out
      Rock On

      1 Reply Last reply Reply Quote 0
      • redrumR Offline
        redrum Admin
        last edited by

        @beelee Hey you have a lot here. Can you summarize what functionality you are trying to implement? I'm having a little trouble following it.

        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
        • B Offline
          beelee
          last edited by beelee

          @prastle said in Game XML Tips & Examples:

          @beelee Was that the only one?

          The one above the deleted one too. Thanks.

          @redrum yea so two things. The one is a update to POS2 showing how to make a custom gameProperty.

          The other, are two xml questions. How to have a trigger only be checked once. So it won't continue to try and fire every turn until it succeeds. I thought I could do it with "turns" but it didn't work.

          The second is, I want a trigger to activate another trigger that has a notification. I only want that to fire twice ( two turns ), unless the condition is met which would prevent it from firing at all.

          1 Reply Last reply Reply Quote 0
          • B Offline
            beelee
            last edited by

            I have this trigger:

            <attachment name="triggerAttachment_Battleship_Ordered_to_Vichy_Port" attachTo="French" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
            <option name="conditions" value="conditionAttachment_Axis_Conquer_All_France:Vichy_active:conditionAttachmentFrenchBB"/>
            <option name="chance" value="3:6"/>
            <option name="when" value="before:frenchCombatMove"/>
            <option name="uses" value="1"/>

            which if successful tells the BB to head to port. When it is unsuccessful it will try again the next turn. I don't want it to do that. Just a one time shot at success or failure.

            The second part is if it is successful, ordered to port, I want a trigger/notification to fire that reminds it that it has been ordered to port. This would happen at the start of the BBs next two turns. If the BB arrives in port it cancels the notification. If the BB hasn't arrived after two turns the notification cancels as well.

            I used this condition:

            <attachment name="conditionAttachmentFrenchBBAtVichyPort" attachTo="French" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
            <option name="directPresenceTerritories" value="93 Sea Zone" count="1"/>
            <option name="unitPresence" value="battleship" count="1"/>
            <option name="invert" value="true"/>
            </attachment>

            and this trigger to try and achieve it.

            <attachment name="triggerAttachment_Battleship_Must_Sail_to_Vichy_Port_93_Sea_Zone" attachTo="French" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
            <option name="conditions" value="conditionAttachmentFrenchBBAtVichyPort"/>
            <option name="when" value="before:frenchCombatMove"/>
            <option name="uses" value="2"/>
            <option name="notification" value="Battleship_Must_Sail_to_Vichy_Port_93_Sea_Zone"/>
            </attachment>

            The first trigger would have "activateTrigger" for this one.

            redrumR 1 Reply Last reply Reply Quote 0
            • B Offline
              beelee
              last edited by beelee

              I've successfully confused myself once again. "turns" is now working, I think. I'll do so more testing and if continues to work I'll post the "how to have a trigger only fire once" again.

              Idk why I'm struggling so much. I was always good in math. Built multiple million dollar homes for decades, but i can't figure out basic computer stuff. I guess i just need to accept the fact that I'm not that smart 🙂

              Yea we can delete all the non pertinent stuff I posted so as not to spam this out

              1 Reply Last reply Reply Quote 0
              • redrumR Offline
                redrum Admin @beelee
                last edited by

                @beelee So for the first one:

                <attachment name="triggerAttachment_Battleship_Ordered_to_Vichy_Port" attachTo="French" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                  <option name="conditions" value="conditionAttachment_Axis_Conquer_All_France:Vichy_active:conditionAttachmentFrenchBB"/>
                  <option name="chance" value="3:6"/>
                  <option name="when" value="before:frenchCombatMove"/>
                  <option name="uses" value="1"/>
                </attachment>
                

                I believe uses only is used up if it actually fires (you hit the chance) so you can't use that for what you are trying to do. You instead need to have another trigger that does fire after this one (say during after:frenchCombatMove) which sets a condition to false which is used in your trigger. As you also mention, if it only happens on a certain turn(s) then you could use the turns parameter instead.

                The second one looks correct except that if the BB would arrive before the 2 uses, it then fires once the BB leaves. So you would need to set a condition to be false once the BB returns so the notification doesn't show when it leaves.

                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 2
                • prastleP Offline
                  prastle Lobby Moderators Admin
                  last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • prastleP Offline
                    prastle Lobby Moderators Admin
                    last edited by

                    This post is deleted!
                    B 1 Reply Last reply Reply Quote 0
                    • B Offline
                      beelee @prastle
                      last edited by

                      This post is deleted!
                      prastleP 1 Reply Last reply Reply Quote 0
                      • prastleP Offline
                        prastle Lobby Moderators Admin @beelee
                        last edited by

                        This post is deleted!
                        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