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

    Restricting unit builds

    Scheduled Pinned Locked Moved Map Making
    4 Posts 3 Posters 163 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.
    • RogerCooperR Offline
      RogerCooper
      last edited by

      In a mod I am working on units can be built at either a factory(anything) or recruitmentCenter (infantry only).

      The code is

      <attachment name="unitAttachment" attachTo="factory" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="isFactory" value="true"/>
      </attachment>
      
      <attachment name="unitAttachment" attachTo="recruitmentCenter" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
       <option name="isFactory" value="true" />
       <option name="canBeDamaged" value="false" />
      </attachment>
      
      <attachment name="unitAttachment" attachTo="infantry" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="movement" value="1"/>
      <option name="transportCost" value="1"/>
      <option name="attack" value="1"/>
      <option name="defense" value="2"/>
      <option name="isLandTransportable" value="true"/>
      <option name="artillerySupportable" value="true"/>
      <option name="requiresUnits" value="recruitmentCenter" />
      <option name="requiresUnits" value="factory" />
      </attachment>
      
      <attachment name="unitAttachment" attachTo="armor" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
      <option name="movement" value="2"/>
      <option name="transportCost" value="2"/>
      <option name="canBlitz" value="true"/>
      <option name="attack" value="3"/>
      <option name="defense" value="2"/>
      <option name="requiresUnits" value="factory" />
      </attachment>
      

      However armor can be placed at a recruitmentCenter. I have done this before in another mod without a problem (WW2-Zombies). I have attached the full xml file. East_and_West-Manual.xml

      Does anyone have any idea what the problem is? Is there another way of creating infantry-only production?

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

        hmm maybe the "isFactory" is allowing it ?

        This is sloppy and from years ago but the "MiltaryBase" only allows infantry builds

        Screenshot from 2026-04-07 16-58-45.png

        The Infantry are the only ones that require the MB. The Armour doesn't e.g.

        Screenshot from 2026-04-07 16-59-07.png

        98c84541-a0b5-42a0-a4c0-b352c4c6ece3-image.png

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

          @RogerCooper

          Did a quick scan did not see;

          <property name="Unit Placement Restrictions" value="true" editable="false">
                <boolean/>
              </property>
          

          Which I think requiresUnit to work.

          Cheers

          RogerCooperR 1 Reply Last reply Reply Quote 3
          • RogerCooperR Offline
            RogerCooper @wc_sumpton
            last edited by

            @wc_sumpton said in Restricting unit builds:

            <property name="Unit Placement Restrictions" value="true" editable="false">
            <boolean/>
            </property>

            That was it. Thank you for the help.

            1 Reply Last reply Reply Quote 2

            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