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

    new production unit - barracks

    Scheduled Pinned Locked Moved Map Making
    84 Posts 6 Posters 31.5k Views 6 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 Online
      beelee @ff03k64
      last edited by

      @ff03k64 yea if you don't have the image it'll keep throwing the error but yea units folder should be all that's really needed. Can ignore the other stuff

      1 Reply Last reply Reply Quote 0
      • B Online
        beelee @Numetalfan
        last edited by

        @Numetalfan this will take a bit to go through but one thing is when you do your unitAttachment do them all at once. So instead of this:

        <!-- Barracks -->

        <attachment name="unitAttachment" attachTo="barracks" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">

        <option name="isFactory" value="true"/>

        </attachment>

        <attachment name='unitAttachment' attachTo='barracks' javaClass='UnitAttachment' type='unitType'>

        <option name='canProduceXUnits' value='2'/>

        </attachment>

        it'd be:

        <!-- Barracks -->
        <attachment name="unitAttachment" attachTo="barracks" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
        <option name="isFactory" value="true"/>
        <option name='canProduceXUnits' value='2'/>
        </attachment>

        we probably don't want barracks as a factory as mentioned previously but will get to that 🙂

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

          @ff03k64

          You want to require different production facilities to produce different units. You have that worked out. But you also want China to be able to place units without production facilities. Triggers will need to be created that '-reset-' the 'requiresUnits' values prior to China's placement, and then reassign those values. Or China will need a different set of units.

          Cheers...

          1 Reply Last reply Reply Quote 1
          • N Offline
            Numetalfan
            last edited by

            the online help has an example

            <attachment name='conditionAttachment_Americans_Aid_UK' attachTo='Americans' javaClass='RulesAttachment' type='player'>
            <option name='switch' value='true'/>
            </attachment>
            <attachment name='triggerAttachment_Americans_Aid_UK' attachTo='Americans' javaClass='TriggerAttachment' type='player'>
            <option name='resource' value='PUs'/>
            <option name='resourceCount' value='6'/>
            <option name='players' value='British'/>
            </attachment>
            <attachment name='userActionAttachment_Americans_Aid_UK' attachTo='Americans' javaClass='UserActionAttachment' type='player'>
            <option name='conditions' value='conditionAttachment_Americans_Aid_UK'/>
            <option name='activateTrigger' value='triggerAttachment_Americans_Aid_UK:1:false:false:false:false'/>
            <option name='text' value='AMERICANS_AID_UK'/>
            <option name='chance' value='6:6'/>
            <option name='costPU' value='10'/>
            <option name='attemptsPerTurn' value='1'/>
            <option name='actionAccept' value='Americans'/>
            </attachment>

            1 Reply Last reply Reply Quote 0
            • N Offline
              Numetalfan
              last edited by

              OK, I need help doing that.

              first I added triggers to my properties:

              <property name='Use Triggers' value='true' editable='false'>
              <boolean/>
              </property>

              now in the attachment section I need the correct coding. the trigger should be activated when it is the Chinese to play and the trigger has to be switched back when the Germans start at the latest, even better when the Chinese end their turn.

              my first code lines are

              <attachment name='conditionAttachment_Chinese_Infantry_placement' attachTo='Chinese' javaClass='RulesAttachment' type='player'>
              <property name="Unit Placement Restrictions" value='true'/>
              </attachment>

              <attachment name='triggerAttachment_Chinese_Infantry_placement' attachTo='Chinese' javaClass='triggerAttachment' type='player'>
              <option name='switch' value='true'/>
              </attachment>

              but I know this is just crap - I have no idea how to program such a trigger - please help

              F 1 Reply Last reply Reply Quote 0
              • F Offline
                ff03k64 @Numetalfan
                last edited by

                @Numetalfan There is probably a game property that you need to set as well but i think you need some rulesattachments as well. Maybe not all of these, but some depending on exactly what you are trying.

                    <attachment name="rulesAttachment" attachTo="Chinese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                      <option name="movementRestrictionTerritories" value="Chinghai:Ningxia:Sikang:Yunnan:Hupeh:Fukien:Suiyuan:Manchuria:Kiangsu:Kwangtung"/>
                      <option name="movementRestrictionType" value="allowed"/>
                      <option name="productionPerXTerritories" value="2"/>
                      <option name="placementAnyTerritory" value="true"/>
                      <option name="placementCapturedTerritory" value="true"/>
                      <option name="placementPerTerritory" value="3"/>
                    </attachment>
                
                1 Reply Last reply Reply Quote 0
                • N Offline
                  Numetalfan
                  last edited by

                  @ff03k64

                  I have all this already, as my game is a derivate of the wwii v3-41 where the chinese are part of

                  the problem is:

                  with my

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

                  the Chinese functions are blocked, especially

                  <option name="placementAnyTerritory" value="true"/>

                  now Infantry require a factory or SmallFactory or barracks and the Chinese have none of it

                  thats why I need a trigger for the Chinese to deactivate the placment restrection for them, the reactivate that

                  F 1 Reply Last reply Reply Quote 0
                  • F Offline
                    ff03k64 @Numetalfan
                    last edited by ff03k64

                    @Numetalfan edit: deleted a bunch of stuff.

                    I would make a new unit for chinese infantry

                    B 1 Reply Last reply Reply Quote 1
                    • B Online
                      beelee @ff03k64
                      last edited by

                      @ff03k64 yea a separate chinese unit would be the way to go imo. Probably similar amount of work and will give more flexibility. Will have fewer triggers firing as well, which should help game speed. Maybe not a lot but ...

                      1 Reply Last reply Reply Quote 0
                      • N Offline
                        Numetalfan
                        last edited by

                        sounds like a plan, indeed:

                        <unit name="Chinese_infantry"/>
                        </unitList>

                        <!-- Chinese Infantry -->

                        <attachment name="unitAttachment" attachTo="Chinese_infantry" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                        <option name="movement" value="1"/>
                        <option name="transportCost" value="2"/>
                        <option name="isInfantry" value="true"/>
                        <option name="isAirTransportable" value="false"/>
                        <option name="attack" value="1"/>
                        <option name="defense" value="2"/>
                        <option name="artillerySupportable" value="false"/>
                        </attachment>

                        next:

                          <!-- US Chinese Placements -->
                        
                          <unitPlacement unitType="Chinese_infantry" territory="Fukien" quantity="1" owner="Chinese"/>
                          <unitPlacement unitType="Chinese_infantry" territory="Hupeh" quantity="1" owner="Chinese"/>
                          <unitPlacement unitType="Chinese_infantry" territory="Suiyuan" quantity="1" owner="Chinese"/>
                          <unitPlacement unitType="Chinese_infantry" territory="Yunnan" quantity="1" owner="Chinese"/>
                          <unitPlacement unitType="fighter" territory="Sikang" quantity="1" owner="Chinese"/>
                          <unitPlacement unitType="Chinese_infantry" territory="Sikang" quantity="1" owner="Chinese"/>
                          <unitPlacement unitType="Chinese_infantry" territory="Ningxia" quantity="1" owner="Chinese"/>
                        

                        so far so good.
                        where is the coding that the Chinese get one -new- Chinese_infantry instead of the normal infantry? Have not found that in the xml.

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

                          @ff03k64

                          Let's change the infantry for the Chinese:

                          <!-- Always True condition first -->
                          <attachment name="conditionAttachmentAlwaysTrue" attachTo="Chinese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                             <option name="switch" value="true"/>
                          </attachment>
                          
                          <!-- Now the triggers -->
                          <!-- Reset requiresUnits to be empty -->
                          <attachment name="triggerAttachmentResetInfantry" attachTo="Chinese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                             <option name="conditons" value="conditionAttachmentAlwaysTrue"/>
                             <option name="unitType" value="infantry"/>
                             <option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
                             <option name="unitProperty" value="requiresUnits" count="-reset-"/>
                             <option name="when" value="before:chinesePlace"/>
                          </attachment>
                          
                          <!-- Add values to requiresUnits -->
                          <attachment name="triggerAttachmentSetInfantry" attachTo="Chinese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                             <option name="conditons" value="conditionAttachmentAlwaysTrue"/>
                             <option name="unitType" value="infantry"/>
                             <option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
                             <option name="unitProperty" value="requiresUnits" count="-reset-barracks"/>
                             <option name="unitProperty" value="requiresUnits" count="factory"/>
                             <option name="unitProperty" value="requiresUnits" count="SmallFactory"/>
                             <option name="when" value="after:chinesePlace"/>
                          </attachment>
                          

                          The above is untested but should work.

                          Cheers...

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

                            @Numetalfan

                            To use the Chinese_infantry for China, because it has 'purchaseNoPUs', you need to add into the rules for China:

                            			<!-- Chinese Rules -->
                            <attachment name="rulesAttachment" attachTo="Chinese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                               <option name="movementRestrictionTerritories" value="Chinghai:Ningxia:Sikang:Yunnan:Hupeh:Fukien:Suiyuan:Manchuria:Kiangsu:Kwangtung:Xinjiang"/>
                               <option name="movementRestrictionType" value="allowed"/>
                               <option name="productionPerXTerritories" value="2:Chinese_infantry"/> <!-- Add 'Chinese_infantry' here -->
                               <option name="placementAnyTerritory" value="true"/>
                               <option name="placementCapturedTerritory" value="true"/>
                               <option name="placementPerTerritory" value="3"/>
                            </attachment>
                            

                            That's it.

                            Cheers...

                            1 Reply Last reply Reply Quote 0
                            • N Offline
                              Numetalfan
                              last edited by

                              @wc_sumpton said in new production unit - barracks:

                              <option name="productionPerXTerritories" value="2:Chinese_infantry"/>

                              perfect, it worked!
                              yet, I could place 4 Inf in a territory, which means

                              <option name="placementPerTerritory" value="3"/>

                              got disabled

                              WW2v4-1941.xml

                              1 Reply Last reply Reply Quote 0
                              • N Offline
                                Numetalfan
                                last edited by

                                the barracks can now - I don't know why- only be build in a country already containing a factory.

                                can you take a look why. thx

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

                                  @Numetalfan yea I can't get your game to load. Can you upload the whole thing with sendspace or something similar ? I can't really test anything

                                  ahh...looks as if you are making progress 🙂

                                  1 Reply Last reply Reply Quote 0
                                  • N Offline
                                    Numetalfan
                                    last edited by

                                    https://storage.driveonweb.de/dowdoc/c84fc4098f53f8a8faed5e681e23787fea1923313e3590c5

                                    password: TripleAAA

                                    tell me, if it's downloadable

                                    B 1 Reply Last reply Reply Quote 1
                                    • B Online
                                      beelee @Numetalfan
                                      last edited by

                                      @Numetalfan yea I was able to DL it but when I added it to triplea I get a polygon error. Anyway, I just redid the Military Base on a mod I was working on and made it Infantry only, but I'm not sure if it'll work with what you want.

                                      Factories and Bases can't be built in the same TTy but in this mod they can. So that screws up how I was gonna do it. It looks as if you and wc made some progress though.

                                      What's the current status ? Everything ok except for Barracks building 4 ? If still having trouble, I'd look at Cernel's 270 BC again. I'm gonna take a look myself

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

                                        @wc_sumpton said in new production unit - barracks:

                                        because it has 'purchaseNoPUs

                                        ahh...yea that makes things a bit different 🙂 Guess I need to pay more attention before commenting.

                                        I'm not sure how you can get China to buy and place a barracks. It might be easier to just give China a regular purchase phase. Idk

                                        1 Reply Last reply Reply Quote 0
                                        • N Offline
                                          Numetalfan
                                          last edited by

                                          @belee

                                          Chinese are no longer a problem, it works as usual, the program counts their countries and they get their infantry units.

                                          the thing that does not work ist to place the barracks production unit in a country of my choice.
                                          tripleA forces me to build the newly bought barracks in a country, where a factory already exist.

                                          And this is very strange, because the other production units, the small factory and the shipyard, they can be build in any country.

                                          But I will test what happens, if I reduce the maxFactory per territory back to 1.
                                          I will report.

                                          1 Reply Last reply Reply Quote 2
                                          • N Offline
                                            Numetalfan
                                            last edited by

                                            problem solved!

                                            it was the maxFactory per territory set to 1.

                                            everything works now

                                            B 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
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 4 / 5
                                            • First post
                                              Last post
                                            Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums