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

    new unit with special rules - is it possible?

    Scheduled Pinned Locked Moved Map Making
    29 Posts 7 Posters 4.9k Views 7 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.
    • wc_sumptonW Offline
      wc_sumpton
      last edited by wc_sumpton

      @Zaroph
      You are very welcome. The use of "bonusType" is very helpful. Now multiple unit can be used to give support. So if @Numetalfan wanted to add Self-Propelled Artillery and have the ATG treat it like a Tank then using:

      <attachment name="supportAttachmentSPA_ATG" attachTo="selfPropelledArtillery" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
         <option name="unitType" value="antiTankGun"/>
         <option name="faction" value="enemy"/>
         <option name="side" value="offence:defence"/>
         <option name="dice" value="strength"/>
         <option name="bonus" value="1"/>
         <option name="number" value="1"/>
         <!-- If not stated count default value is 1 -->
         <option name="bonusType" value="AntiTankSupport"/>
      </attachment>
      

      Now with both SPA and Tanks having the same "bonusType" the ATG will only receive a bonus from one unit and not one from each.

      Cheers...

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

        The ATG seem to work,

        but If I want to start the game I get an error:

        Jul 29, 2020 8:48:38 PM games.strategy.engine.framework.startup.launcher.LocalLauncher loadGame
        SCHWERWIEGEND: Failed to start game
        java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(Unknown Source)
        at games.strategy.util.PointFileReaderWriter.readMultiple(PointFileReaderWriter.java:244)
        at games.strategy.util.PointFileReaderWriter.lambda$readOneToManyPlacements$6(PointFileReaderWriter.java:199)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
        at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
        at java.util.Iterator.forEachRemaining(Unknown Source)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
        at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
        at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
        at java.util.stream.ReferencePipeline.forEachOrdered(Unknown Source)
        at games.strategy.util.PointFileReaderWriter.readStream(PointFileReaderWriter.java:263)
        at games.strategy.util.PointFileReaderWriter.readOneToManyPlacements(PointFileReaderWriter.java:197)
        at games.strategy.triplea.ui.mapdata.MapData.runWithInputStream(MapData.java:225)
        at games.strategy.triplea.ui.mapdata.MapData.readPlacementsOneToMany(MapData.java:212)
        at games.strategy.triplea.ui.mapdata.MapData.<init>(MapData.java:159)
        at games.strategy.triplea.ui.HeadedUiContext.internalSetMapDir(HeadedUiContext.java:79)
        at games.strategy.triplea.ui.AbstractUiContext.setDefaultMapDir(AbstractUiContext.java:107)
        at games.strategy.triplea.ui.TripleAFrame.create(TripleAFrame.java:232)
        at games.strategy.triplea.TripleA.startGame(TripleA.java:105)
        at games.strategy.engine.framework.startup.launcher.LocalLauncher.loadGame(LocalLauncher.java:60)
        at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInNewThread(LocalLauncher.java:39)
        at games.strategy.engine.framework.startup.launcher.AbstractLauncher.lambda$launch$0(AbstractLauncher.java:51)
        at java.lang.Thread.run(Unknown Source)

        what does that mean?

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

          WW2v4-1941.xml

          is the xml file that causes that error

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

            @Numetalfan seems as if it has something to do with placement. Maybe check and make sure you don't have two of something.

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

              @Numetalfan

              Here I think @beelee is right. You have made a lot of map changes since the last time I looked at the xml. Take things slow. Lots of changes causes errors. I'm the "King of Errors"! I think I have learned more about xml scripting, and coding, by fixing all the errors I have made.

              So lets debug! First run the 'Map Creator' and double check your centers. When checking the with the "Polygons Grabber" insure that the 'old' territories do not include the new. Reselect the old territories, then select the new, to insure each is as you want. Next would be the "Placement Picker". Select the old territories and remove all the placements. Then reset the old territory. After that setup your new territory placements.

              Last is the minimap, or smallMap.jpeg. This needs to be the same as the base map, only smaller. The "Map Creator" can reduce your main map, but for better quality it is better to use a outside editor, the same one that you used to edit the base map. If the smallMap.jpeg does not match, the game can error on overlapping placements.

              I will continue to review you xml.

              Cheers...

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

                @wc_sumpton

                thx. I will do all this later, when back at home

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

                  all problems fixed - the game runs!
                  thanks alot @ all 👍 :beaming_face_with_smiling_eyes:

                  1 Reply Last reply Reply Quote 2
                  • Brent StoudtB Offline
                    Brent Stoudt @Zaroph
                    last edited by

                    @Zaroph

                    I would like to have an new Variant of Global 1940 made.
                    Does anyone hire to do this ....?
                    I have an Excel Spreadsheet of the changes / Variant I would like to make.

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

                      @Brent-Stoudt

                      Welcome. If you would like to make changes to Global 1940 for you own use, then I would suggest that you start a new topic about it. Post some of you ideas so that the board may discuss them. Editing the xml may seem daunting, so we are here to help.

                      Cheers...

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

                        what has to be done, to enable the ATG, the new unit, to give +1 Attack to an infantry
                        like the artillery does? This case will be more complicated than artillery support, as this happens always,
                        but I want to link the ATG-Infantry attack bonus to an event where a tank and an ATG also participate in that batlle

                        where do I find the artillery coding in the xml file?

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

                          Add this in unitAttachment to ATG

                          <!--<option name="artillery" value="true"/>-->

                          Then in "Support Attachments" make an attachment like "artillery" has and give it to ATG. If you don't want inf to get a bonus from artillery at same time as ATG, then "bonusType" has to be the same as the artillery one. I think. I could have that backwards.

                          C 1 Reply Last reply Reply Quote 0
                          • C Offline
                            Cernel Moderators @beelee
                            last edited by

                            @beelee said in new unit with special rules - is it possible?:

                            Add this in unitAttachment to ATG

                            <!--<option name="artillery" value="true"/>-->

                            Then in "Support Attachments" make an attachment like "artillery" has and give it to ATG. If you don't want inf to get a bonus from artillery at same time as ATG, then "bonusType" has to be the same as the artillery one. I think. I could have that backwards.

                            If he gives both the (uncommented) option to the unit and makes a support attachment for the same, then that unit will have two
                            support abilities (and the "artillery" option is deprecated).

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

                              I found out that in an battle 1 Armour attacks 1 ATG
                              the ATG only defends on a "2"

                              that means there must be an error somewhere:

                              <attachment name="supportAttachmentTankATG" attachTo="armour" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                              <option name="unitType" value="ATG"/>
                              <option name="faction" value="enemy"/>
                              <option name="side" value="defence"/>
                              <option name="dice" value="strength"/>
                              <option name="bonus" value="1"/>
                              <option name="number" value="1"/>
                              <option name="bonusType" value="AntiTankSupport"/>
                              </attachment>

                              <!-- ATG-->
                              <attachment name="unitAttachment" attachTo="ATG" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                              <option name="movement" value="1"/>
                              <option name="transportCost" value="3"/>
                              <option name="attack" value="2"/>
                              <option name="defense" value="2"/>
                              <option name="requiresUnits" value="factory"/>
                              </attachment>

                              what can it be?

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

                                @Numetalfan

                                I think "side" refers to the "attachTo" unit which in this case is "armour". Change it to "offense" and see what happens.

                                As to your other question about finding the artillery support information. In your xml the commands used are deprecated and should be removed:

                                <!-- Infantry -->
                                <attachment name="unitAttachment" attachTo="infantry" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                   <option name="movement" value="1"/>
                                   <option name="transportCost" value="2"/>
                                   <!-- <option name="isInfantry" value="true"/> Remove -->
                                   <option name="isLandTransportable" value ="true"/> <!-- Add -->
                                   <option name="isAirTransportable" value="true"/>
                                   <option name="attack" value="1"/>
                                   <option name="defense" value="2"/>
                                   <!-- <option name="artillerySupportable" value="true"/> Remove -->
                                   <!-- <property name="Unit Placement Restrictions" value="true" editable="false"> Remove -->
                                   <!-- <boolean/> Remove -->
                                   <!-- </property> Remove -->
                                   <!-- </attachment> Remove -->
                                </attachment>
                                
                                <!-- Artillery -->
                                <attachment name="unitAttachment" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                   <option name="movement" value="1"/>
                                   <option name="transportCost" value="3"/>
                                   <option name="attack" value="2"/>
                                   <option name="defense" value="2"/>
                                   <!-- <option name="artillery" value="true"/> Remove -->
                                 <option name="requiresUnits" value="factory"/>
                                   <!-- <property name="Unit Placement Restrictions" value="true" editable="false"> Remove -->
                                   <!-- <boolean/> Remove -->
                                   <!-- </property> Remove -->
                                   <!-- </attachment> Remove -->
                                </attachment>
                                

                                Now lets rebuild it:

                                <!-- Artillery support -->
                                <attachment name="supportAttachmentArtillery" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                                   <option name="unitType" value="infantry"/>
                                   <option name="faction" value="allied"/>
                                   <option name="side" value="offence"/>
                                   <option name="dice" value="strength"/>
                                   <option name="bonus" value="1"/>
                                   <option name="number" value="1"/>
                                   <option name="bonusType" value="ArtyOld"/>
                                   <option name="impArtTech" value="true"/>
                                </attachment>-->
                                

                                To allow the ATG to support infantry just create another support attachment for the ATG just like the artillery.

                                What can not be done is to have the ATG's support only be applied when there is an enemy tank present.

                                Cheers...

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

                                  Hi,

                                  I tried, I have no syntax errors - but - my changes have no effects

                                  1. Mortar - the mortar unit works like the old artillery, in offence an infantry gets +1 attack:

                                  the units
                                  <!-- Infantry -->
                                  <attachment name="unitAttachment" attachTo="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="true"/>
                                  <option name="attack" value="1"/>
                                  <option name="defense" value="2"/>
                                  </attachment>

                                  <!-- Mortar  -->
                                  <attachment name="unitAttachment" attachTo="mortar" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                    <option name="movement" value="1"/>
                                    <option name="transportCost" value="3"/>
                                    <option name="attack" value="2"/>
                                    <option name="defense" value="2"/>
                                    <option name="artillery" value="true"/>
                                  

                                  <option name="requiresUnits" value="factory"/>
                                  </attachment>

                                  <attachment name="supportAttachmentMortar" attachTo="mortar" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                                  <option name="unitType" value="infantry"/>
                                  <option name="faction" value="allied"/>
                                  <option name="side" value="offense"/>
                                  <option name="dice" value="strength"/>
                                  <option name="bonus" value="1"/>
                                  <option name="number" value="1"/>
                                  <option name="bonusType" value="MortarInfantrySupport"/>
                                  </attachment>

                                  what might be the problem?

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

                                    secont the "new" artillery

                                    it give +1 def to both, an infantry and an ATG

                                    the units

                                    <!-- Artillery -->
                                    <attachment name="unitAttachment" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                      <option name="movement" value="1"/>
                                      <option name="transportCost" value="3"/>
                                      <option name="attack" value="2"/>
                                      <option name="defense" value="2"/>
                                      <option name="artillery" value="true"/>
                                    

                                    <option name="requiresUnits" value="factory"/>
                                    </attachment>

                                    <!-- ATG-->
                                    <attachment name="unitAttachment" attachTo="ATG" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                    <option name="movement" value="1"/>
                                    <option name="transportCost" value="3"/>
                                    <option name="attack" value="2"/>
                                    <option name="defense" value="2"/>
                                    <option name="requiresUnits" value="factory"/>
                                    </attachment>

                                    und the bonus:

                                    <!-- ArtilleryI support -->
                                    <attachment name="supportAttachmentArtilleryI" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                                    <option name="unitType" value="infantry"/>
                                    <option name="faction" value="allied"/>
                                    <option name="side" value="offence"/>
                                    <option name="dice" value="strength"/>
                                    <option name="bonus" value="1"/>
                                    <option name="number" value="1"/>
                                    <option name="bonusType" value="ArtilleryInfantrySupport"/>
                                    </attachment>

                                    <!-- ArtilleryA support -->
                                    <attachment name="supportAttachmentArtilleryA" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                                    <option name="unitType" value="ATG"/>
                                    <option name="faction" value="allied"/>
                                    <option name="side" value="offence"/>
                                    <option name="dice" value="strength"/>
                                    <option name="bonus" value="1"/>
                                    <option name="number" value="1"/>
                                    <option name="bonusType" value="ArtilleryATGSupport"/>
                                    </attachment>

                                    I tried some battles, but the effects were not visible
                                    what can be the reason?

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

                                      @Numetalfan

                                      There are no players assigned to the supportAttachment's. You need to add:

                                      <option name="players" value="Germans:Russians:Japanese:British:Italians:Chinese:Americans"/>
                                      

                                      This will allow each country to use the support.

                                      Cheers...

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

                                        @wc_sumpton said in new unit with special rules - is it possible?:

                                        <option name="players" value="Germans:Russians:Japanese:British:Italians:Chinese:Americans"/>

                                        thx. I added this, but unfortunately, nothing works:

                                        1. ATG support with:

                                        <!-- ATG support-->
                                        <attachment name="supportAttachmentTankATG" attachTo="armour" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                                        <option name="players" value="Germans:Russians:Japanese:British:Italians:Chinese:Americans_west:USA"/>
                                        <option name="unitType" value="ATG"/>
                                        <option name="faction" value="enemy"/>
                                        <option name="side" value="offence:defence"/>
                                        <option name="dice" value="strength"/>
                                        <option name="bonus" value="1"/>
                                        <option name="number" value="1"/>
                                        <option name="bonusType" value="AntiTankSupport"/>
                                        </attachment>

                                        and

                                        <!-- ATG-->
                                        <attachment name="unitAttachment" attachTo="ATG" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                        <option name="movement" value="1"/>
                                        <option name="transportCost" value="3"/>
                                        <option name="attack" value="2"/>
                                        <option name="defense" value="2"/>
                                        <option name="requiresUnits" value="factory"/>
                                        </attachment>

                                        and

                                        <!-- Armour -->
                                        <attachment name="unitAttachment" attachTo="armour" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                          <option name="movement" value="2"/>
                                          <option name="transportCost" value="3"/>
                                          <option name="canBlitz" value="true"/>
                                          <option name="isLandTransport" value="true"/>
                                          <option name="attack" value="3"/>
                                          <option name="defense" value="3"/>
                                        

                                        <option name="requiresUnits" value="factory"/>
                                        </attachment>

                                        1. Artillery support to Infantry and ATG with

                                          <!-- Artillery -->
                                          <attachment name="unitAttachment" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                          <option name="movement" value="1"/>
                                          <option name="transportCost" value="3"/>
                                          <option name="attack" value="2"/>
                                          <option name="defense" value="2"/>
                                          <option name="requiresUnits" value="factory"/>
                                          </attachment>

                                        and

                                        <!-- ArtilleryI support -->
                                        <attachment name="supportAttachmentArtilleryI" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                                        <option name="players" value="Germans:Russians:Japanese:British:Italians:Chinese:Americans_west:USA"/>
                                        <option name="unitType" value="infantry"/>
                                        <option name="faction" value="allied"/>
                                        <option name="side" value="defence"/>
                                        <option name="dice" value="strength"/>
                                        <option name="bonus" value="1"/>
                                        <option name="number" value="1"/>
                                        <option name="bonusType" value="ArtilleryInfantrySupport"/>
                                        </attachment>

                                        <!-- ArtilleryA support -->
                                        <attachment name="supportAttachmentArtilleryA" attachTo="artillery" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                                        <option name="players" value="Germans:Russians:Japanese:British:Italians:Chinese:Americans_west:USA"/>
                                        <option name="unitType" value="ATG"/>
                                        <option name="faction" value="allied"/>
                                        <option name="side" value="defence"/>
                                        <option name="dice" value="strength"/>
                                        <option name="bonus" value="1"/>
                                        <option name="number" value="1"/>
                                        <option name="bonusType" value="ArtilleryATGSupport"/>
                                        </attachment>

                                        1. Mortar support for an infantry (like original artillery)

                                        <!-- Mortar support -->
                                        <attachment name="supportAttachmentMortar" attachTo="mortar" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType">
                                        <option name="players" value="Germans:Russians:Japanese:British:Italians:Chinese:Americans_west:USA"/>
                                        <option name="unitType" value="infantry"/>
                                        <option name="faction" value="allied"/>
                                        <option name="side" value="offence"/>
                                        <option name="dice" value="strength"/>
                                        <option name="bonus" value="1"/>
                                        <option name="number" value="1"/>
                                        <option name="bonusType" value="MortarInfantrySupport"/>
                                        </attachment>

                                        with

                                        <!-- Mortar  -->
                                        <attachment name="unitAttachment" attachTo="mortar" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                          <option name="movement" value="1"/>
                                          <option name="transportCost" value="3"/>
                                          <option name="attack" value="2"/>
                                          <option name="defense" value="2"/>
                                          <option name="artillery" value="true"/>
                                        

                                        <option name="requiresUnits" value="factory"/>
                                        </attachment>

                                        and

                                           <!-- Infantry -->
                                        

                                        <attachment name="unitAttachment" attachTo="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="true"/>
                                        <option name="attack" value="1"/>
                                        <option name="defense" value="2"/>
                                        </attachment>

                                        why do they all fail?

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

                                          Im not a 100% sure how this works but try adding

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

                                          and see what happens

                                          To your support attachment

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

                                            Hi beelee,

                                            I tried again and everything worked, my saved test game was probably buggy.

                                            Your syntax file does not seem necessary. But thx

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