Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    new unit with special rules - is it possible?

    Map Making
    7
    29
    238
    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.
    • N
      Numetalfan last edited by

      I am planning to introduce a new unit into my game,
      the anti-tank-gun, ATG.

      the unit is similar to an infantry:
      1 movement, 4 IPC costs, attack 1, defense 2. transportable with an infantry like a tank.

      the more complicated issue is its special attack/defense against tanks.
      in an 1:1 duell with a tank its defense and attack is increased by one

      example:

      1 infantry and 1 tank attack 2 ATGs
      in this case 1 ATG still has defense 2 as it fights with an infantry, but the other ATG gets defense 3 because there is an 1:1 duell with a tank

      vice versa, when the 2 ATGs would attack, one would attack with 1 against the infantry, but the second one with a 2 against the tank.

      yet, the 1:1 relation will never break.
      3 ATGS attack 1 infantry and 1 tank, here 2 ATGs attack with 1 and one with a 2, this one has the 1:1 relation.

      how to programm such special rules for ATG? - if this is possible at all.

      1 Reply Last reply Reply Quote 0
      • Z
        Zaroph last edited by

        This would be achievable by using support attachments but I dont think theirs an easy way of doing this for 2 problems:

        • Support attachments have no option to limit stacking. So, suppose that youve made a support attachment that does what you want it to do, if in a battle you have 10 "ATGs" and 1 "tank", every single one of the "ATG" will have their support attachment active instead of just 1.
        • I dont think support attachments can have a IF condition in them (But I suppose they already have a intrinsic IF condition because they only apply IF the required unit is present) By this I mean in your case, you cant make a support attachment that is "1 ATG gives 1 ally (or self) ATG support IF 1 enemy tank in battle", it could only do "1 ATG gives 1 ally (or self) ATG support" or "1 ATG gives 1 enemy tank -support"

        Perhaps triggers can do this but I cant give advice on that and its more complicated anyway.

        The closest way I can see what you want being achieved is by making the "ATG" give negative support to a enemy tank, but again this would have issues with stacking and with enough "ATG" you would be able to give tanks 0 strength.

        Brent Stoudt 1 Reply Last reply Reply Quote 0
        • W
          wc_sumpton last edited by

          @Numetalfan

          @Zaroph is almost right. A tank would give a bonus to 1 enemy ATG:

          <attachment name="supportAttachmentTankATG" attachTo="armour" 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"/>
             <option name="bonusType" value="AntiTankSupport"/>
          </attachment>
          

          Cheers...

          TorpedoA 2 Replies Last reply Reply Quote 1
          • TorpedoA
            TorpedoA @wc_sumpton last edited by

            @wc_sumpton
            i made exessive use of the supportAttachment options
            just if you are curious look here
            https://forums.triplea-game.org/topic/2153/i-like-to-share-a-nwo-mod-of-mine-in-a-fast-simple-way-but-how/12
            i actually try to upload this experimental mod around NWO map which i want to share where i really heavy going with alot of supportAttachments, up to 3 for one unit.
            My main aim was to get something like the famous scissor stone paper game element into TripleA. Because without it its most of the time a HP/cost thing and doesnt allow to build a variety of unit types which would be efficient. So most of the units have kinda counterpart.
            To evade a problem concerning a units Attack or Defense value droppin to 0, i just turn it around and let the unit with low value give more power to the opponent instead.

            1 Reply Last reply Reply Quote 0
            • TorpedoA
              TorpedoA @wc_sumpton last edited by

              @wc_sumpton sorry, was not meant to reply to u actually

              1 Reply Last reply Reply Quote 0
              • Z
                Zaroph last edited by

                Thats interesting I never even considered the use a unit increasing enemy strength as a way of making it work in this type of scenario. The only issue I see is that is the over stacking issue still, but in this case since ATG are cheaper and presumably more abundent then tanks, then it will be rare for them to be out numbered making this an issue in fringe cases.

                1 Reply Last reply Reply Quote 0
                • W
                  wc_sumpton last edited by wc_sumpton

                  @Zaroph

                  I don't understand your stacking issue. If there is 3 ATG vs 1 Tanks, then the Tank will only increase the value of 1 ATG ("number" value="1"), the rest will attack at their base value. If its 1 ATG vs 3 Tanks then the ATG will receive an increase from only 1 tank ("bonusType" value="AntiTankSupport"), since bonusType's do not stack unless count is added:

                     <option name="bounsType" value="AntiTankSupport" count="2"/>
                  

                  Then 1 ATG vs 3 Tanks would receive the bonus from 2 Tanks. Now if 3 ATGs vs 3 Tanks 1 ATG could receive the bonus for 2 Tanks, 1 ATG would receive the last Tank bonus, and the last ATG would attack at base value.

                  @TorpedoA

                  Rocks vs Scissors, to increase the value of Rock, then replace armour with Scissors and antiTankGun with Rock. To decrease the value of Scissors, replace armour with Rock and antiTankGun with Scissors then change "bonus" value="-1". As long as you have a "bonusType" then the supports will not stack and the units base value should never increase/ decrease more then 1 no matter how many Rocks are beating up on the Scissors.

                  Hopefully Helpful.

                  Cheers...

                  Z 1 Reply Last reply Reply Quote 0
                  • Z
                    Zaroph @wc_sumpton last edited by

                    @wc_sumpton

                    I don't understand your stacking issue. If there is 3 ATG vs 1 Tanks, then the Tank will only increase the value of 1 ATG ("number" value="1"), the rest will attack at their base value. If its 1 ATG vs 3 Tanks then the ATG will receive an increase from only 1 tank ("bonusType" value="AntiTankSupport"), since bonusType's do not stack unless count is added:

                       <option name="bounsType" value="AntiTankSupport" count="2"/>
                    

                    I was unaware of the count=x option as its not on the starlords xml option browser site. As I havent experimented around, I just assumed that with no option related to stacking, multiple copies of it would stack together, i.e with 5 tanks vs 1 ATG. the 5 tanks would give a bonus of +5 to the 1 ATG. Thank you for correcting me and making me aware of that.

                    1 Reply Last reply Reply Quote 1
                    • W
                      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
                        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
                          Numetalfan last edited by

                          WW2v4-1941.xml

                          is the xml file that causes that error

                          B 1 Reply Last reply Reply Quote 0
                          • B
                            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
                            • W
                              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
                                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
                                  Numetalfan last edited by

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

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