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

    Trigger when units are present on map?

    Scheduled Pinned Locked Moved Map Making
    6 Posts 3 Posters 1.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.
    • FrostionF Offline
      Frostion Admin
      last edited by

      I have a question about how to set off a trigger when a player own 5 units of a specific type.

      I can’t get the condition to work. If it was only 1 unit allowed, it works well, but how should the condition look like if it is 5 units are on the map?

      Player is “Humans” must have the ability to buy “Workboat” removed when Humans have 5 units of “Workboat”. The Workboats can sail around and can be anywhere on the map.

      This is my not working trigger that is not triggering:

          <attachment name="conditionAttachment_Humans_have_5_Workboats" attachTo="Humans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
              <option name="directPresenceTerritories" value="map" count="5"/>
              <option name="unitPresence" value="Workboat" count="1"/>
          </attachment>
      
          <attachment name="triggerAttachment_Humans_can_no_longer_buy_Workboats" attachTo="Humans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
              <option name="conditions" value="conditionAttachment_Humans_have_5_Workboats"/>
              <option name="productionRule" value="production_Humans:-buyWorkboat"/>
              <option name="when" value="before:HumansPurchase"/>
          </attachment>
      

      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

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

        @Frostion You may want to make a feature request out of this, because it is simply not possible to look at units in the whole map, only per territory.

        What that condition is doing, is that you have at least 5 territories with at least 1 "Workboat" each.

        Theorically, you could hack it by making a complex set o triggers in which you test all the possible combinations of 1 to 5 units per territory so to assure you have at least 5 units in total. Basically, an OR codition related to have 5+ territories with 1 each, or 1+ territories with 5 each, and so on all possible combinations in between.

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

          Or you are ok with forcing only 1 workboat per territory (like classic AA guns) and then just count the territories like you are.

          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
          • FrostionF Offline
            Frostion Admin
            last edited by

            Hmmm disappointing. I will have to rethink this concept 🙂

            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

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

              @Frostion Yeah, as @Cernel pointed out not a bad feature request.

              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 Online
                Cernel Moderators @redrum
                last edited by Cernel

                @redrum said in Trigger when units are present on map?:

                @Frostion Yeah, as @Cernel pointed out not a bad feature request.

                @Frostion Not a wonderful solution but, for now, one might do this with a limited amount of coding by using "eaches" on the conditions, then having as many same conditions assigned to the trigger as the number of units specified in the conditions themselves, then a condition type equal to the minimum number you want (in your case, 5), if you are following me. However, I'm not sure if it would work, as eaches are normally used to make the trigger firing that many times.

                EDIT: Nevermind, checked pos2 it says that eaches are just 1s, condition wise.

                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