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

    trigger question - unit with hit

    Scheduled Pinned Locked Moved Map Making
    36 Posts 4 Posters 6.0k Views 4 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.
    • F Offline
      ff03k64
      last edited by

      @Numetalfan what would this unit be exactly? Depending on exactly what you are trying to accomplish could make a big difference in how you would best go about doing it.

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

        @ff03k64

        there should be a check in the trigger condition
        the check is, if in round 1 the Japanese destroyed all US battleships in Pearl Harbour

        If this occured,
        the trigger should give the US a battleship unit with a hit.
        It should show up in the non-combat phase of round one - and never again in the game

        In a second trigger or in a combined coding there should be a 10 IPC price for that unit.
        So finally, when US is collecting its income, it has to -10 to the sum of all countries plus the national objectives. This again, should only happens once in the game

        a regular cost of 10 IPC for repairing battleships during the game was not intended.

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

          thats the true history of 1941 Pearl Harbour attack, what happens after the attack

          ....
          Recovery work started immediately. Within three months most of the smaller ships and three of the battleships – the USS Pennsylvania, the USS Maryland, and the USS Tennessee – were either returned to service or refloated and steamed to the continental US for final repairs.
          .....

          that was my inspiration for the trigger

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

            @Numetalfan For testing purposes, i would try a condition that is just always true. Use that to get your trigger working correctly to place the Battleship.

            Then i would go with Beelee's idea of making this be a different unit that you can upgrade. And a second battleship unit that you can remove from the purchase screen after you place it once. Or maybe a user action would work well too.

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

              @belee: hitstaken is not accepted

              what property is needed for that coding?

              --

              btw: I use 1.9.0.0.13066

              does that change anything when programming triggers?

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

                @Numetalfan

                Lets take a crack at this. First you want to check for any Americans_west battleship's, and your check looks ok...

                <attachment name="conditionAttachmentPearlHarbour" attachTo="Americans_west" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                   <!-- maybe try 'directExclusionTerritories' -->
                   <option name="directPresenceTerritories" value="map"/>
                   <!-- 'unitPresence' does not take a player so remove 'Americans_west' -->
                   <!-- If you need to reference a different player use <option name="players" ... /> -->
                   <option name="unitPresence" value="battleship" count="0"/>
                   <option name="rounds" value="1"/>
                      <!-- Not needed since attachTo = 'Americans_West' -->
                      <!-- <option name="players" value="Americans_west"/> -->
                </attachment>
                
                <attachment name="triggerAttachmentBBrefloating_PearlHarbour" attachTo="Americans_west" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                   <option name="conditions" value="conditionAttachmentPearlHarbour"/>
                   <option name="when" value="after:americans_westCombatMove"/>
                   <!-- 'placement' does not take a player -->
                   <option name="placement" value="53 Sea Zone:battleship" count="1"/>
                </attachment>
                

                See if that helps. As to placing a damage unit, I don't think there is a way, but I could be wrong. You could request a feature to do so, but it would not be added to 1.9.

                Cheers...

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

                  Hi,

                  I am still working on the trigger problem,

                  however I have another problem with the battleship

                  I reduced the price from 20 to 18.
                  BUT: the programm still shows the price of 20 when starting a new game - why?

                  the codings are:

                  <property name="Two hit battleship" value="true" editable="false">
                    <boolean/>
                  </property>
                  
                  <property name='Two HitPoint Units Require Repair Facilities' value='true' editable='true'>
                  	<boolean/>
                  <unit name="battleship"/>
                  

                  <productionRule name="buyBattleship">
                  <cost resource="PUs" quantity="18"/>
                  <result resourceOrUnit="battleship" quantity="1"/>
                  </productionRule>

                    <frontierRules name="buyBattleship"/>
                  

                  <attachment name="unitAttachment" attachTo="battleship" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                  <option name="movement" value="2"/>
                  <option name="isSea" value="true"/>
                  <option name="attack" value="4"/>
                  <option name="defense" value="4"/>
                  <option name="canBombard" value="true"/>
                  <option name="hitPoints" value="2"/>
                  <option name="requiresUnits" value="factory"/>
                  <option name="requiresUnits" value="Shipyard"/>

                  Anyone an idea what it is?

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

                    battleship problems are solved - back to the triggers

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

                      Hi all, I solved the problems with triggers:

                      a) a new unit
                      <unit name="USS Tennessee"/>

                      b) definition of it with a hit point

                      <attachment name="unitAttachment" attachTo="USS Tennessee" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                      <option name="movement" value="1"/>
                      <option name="isSea" value="true"/>
                      <option name="attack" value="4"/>
                      <option name="defense" value="4"/>
                      <option name="canBombard" value="true"/>
                      <option name="hitPoints" value="1"/>
                      </attachment>

                      c) triggers

                      <attachment name="conditionAttachmentPearlHarbour" attachTo="Americans_west" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                      <option name="directPresenceTerritories" value="map" count="1"/>
                      <option name="unitPresence" value="battleship" count="0"/>
                      <option name="rounds" value="1"/>
                      </attachment>

                      <attachment name="triggerAttachmentBBrefloating_PearlHarbour" attachTo="Americans_west" javaClass="games.strategy.triplea.attachments.TriggerAttachment"

                      type="player">
                      <option name="conditions" value="conditionAttachmentPearlHarbour"/>
                      <option name="when" value="after:americans_westCombatMove"/>
                      <option name="placement" value="53 Sea Zone:USS Tennessee" count="1"/>
                      <option name='uses' value='1'/>
                      </attachment>

                      it works very well !

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

                        @beelee

                        <unitPlacement unitType="battleship" territory="118 Sea Zone" quantity="1" owner="Germans" hitsTaken="1"/>

                        works,

                        but you get a "normal" battleship, not the one with a hit

                        <unitPlacement unitType="battleship_hit" territory="118 Sea Zone" quantity="1" owner="Germans"/>

                        is also wrong

                        I still look for a way to place a BB with a hit by a trigger, without creating special units

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

                          Repair problem:

                          In case of a soultion where you drop a special unit by a trigger and that unit represents a BB with a hit, you have to define in the xml a way how to repair it.

                          so in the trigger you replace that unit with a regular BB and everything is fine.

                          My problem here is the trigger condition,
                          because you never know where the user will move the special unit on the map.

                          E.g. around UK there are already five sea zones connected with the factory. At the start of AA41 the allies have 9 sea zones adjancent to a factory. And each buy of a new factory increases that number.

                          And any sea zone like that would be OK to repair because

                          <property name="Two hit battleship" value="true" editable="false">
                          <boolean/>
                          </property>
                          <property name='Two HitPoint Units Require Repair Facilities' value='true' editable='true'>
                          <boolean/>
                          </property>

                          are both active.

                          So what would be the coding in the condition to "repair"(get replaced) such a special unit if it ends its turn adjacent to an allied factory?

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

                            @numetalfan yea Idk how to do it without a special unit. I did it like hepps in TWW and ended up with

                            <!-- BattleShip-damaged -->
                            <attachment name="unitAttachment" attachTo="battleship-damaged" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                            <option name="movement" value="2"/>
                            <option name="attack" value="4"/>
                            <option name="defense" value="4"/>
                            <option name="isSea" value="true"/>
                            <option name="canBombard" value="true"/>
                            <option name="bombard" value="2"/>
                            <option name="hitPoints" value="2"/>
                            <option name="whenHitPointsRepairedChangesInto" value="0:true:battleship"/>
                            </attachment>

                            Then for your repair unit you could try removing it from repairsUnits in Harbour

                            <option name="repairsUnits" value="battleship:carrier:battleship-damaged"/>

                            and add it to your repair unit which would require a harbour to place. That still would work when harbour was damaged though. You might be able to try and have it place only with undamaged harbour. Idk if you can do that though. If you already had a repair unit placed, it'd still repair as well.

                            Edit
                            Yea actually it does work by not allowing you to place the repair unit in a damaged harbour or factory. That's what I did with "Factory Limited" in Global 40 House Rules.

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

                              @numetalfan said in trigger question - unit with hit:

                              @beelee

                              <unitPlacement unitType="battleship" territory="118 Sea Zone" quantity="1" owner="Germans" hitsTaken="1"/>

                              works,

                              but you get a "normal" battleship, not the one with a hit

                              Idk why that's not working. That's what I used in Oztea 41.

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

                                @beelee

                                thx for the advice, but one difference ist clear.

                                My coding

                                <attachment name="triggerAttachmentBBrefloating_PearlHarbour" attachTo="Americans_west" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                                <option name="when" value="before:americans_westNonCombatMove"/>
                                <option name="conditions" value="conditionAttachmentPearlHarbour"/>
                                <option name="placement" value="56 Sea Zone:battleship" hitsTaken="1" count="1"/>
                                <option name='uses' value='1'/>
                                </attachment>

                                is part of a trigger, while your code

                                <unitPlacement unitType="battleship" territory="95 Sea Zone" quantity="1" owner="Italians" hitsTaken="1"/>

                                is part of the initial setup.

                                ..

                                ★
                                unitPlacement
                                Define initial unit placement
                                An object withinunitInitialize
                                Parameters:
                                unitType: Any unit in the unitList
                                territory: Any territory in map
                                quantity: integer
                                owner: Any player in playerList
                                These units will already be on the map when the game begins.

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

                                  @numetalfan ahh yea that is different. Sadly that doesn't work then. I guess you'll have to use a special unit.

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

                                    @beelee

                                    I am afraid this is the way to go.

                                    Then I need a second trigger, one that is activated when that special unit ends its turn adjacant to a factory. Then I will repair it by exchange it with a normal battleship.

                                    Any idea how to do this?

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

                                      @numetalfan so if i understand right you want a BB with 1 hit placed with your trgger ? If so make a unit such as in the above post "BattleShip-damaged"

                                      I think the Factory will auto repair it but if not add the
                                      <option name="repairsUnits" value="battleship-damaged"/>
                                      to the Factory

                                      so you shouldn't need a second trigger

                                      Edit
                                      yea disregard the stuff about the Harbour. I was confusing it with what I did. You just want the Factory to auto repair same as any damaged BB

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

                                        @beelee not sure what units you're using but I have Global 40 ones in Global 40 House Rules if you want to just copy them

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

                                          @beelee
                                          that's it

                                          <!-- BattleShip-damaged -->

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

                                          <option name="movement" value="2"/>

                                          <option name="attack" value="4"/>

                                          <option name="defense" value="4"/>

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

                                          <option name="canBombard" value="true"/>
                                          <option name="hitPoints" value="2"/>

                                          <option name="whenHitPointsRepairedChangesInto" value="0:true:battleship"/>

                                          </attachment>

                                          My "special unit" was very similar, but the most important coding is:

                                          <option name="whenHitPointsRepairedChangesInto" value="0:true:battleship"/>

                                          that is what I missed
                                          thx

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

                                            @beelee

                                            I still miss something, everythings works fine, but the repairing ist not happening

                                            7bacbcf2-c9d7-46c9-aaf4-07b7c8f68048-grafik.png

                                            here you see the new unit adjacant to a factory, but it was not repaired

                                            the codes are:

                                            1. <property name="Units Repair Hits End Turn" value="true" editable="true">
                                              <boolean/>
                                              </property>

                                            2. <property name="Two hit battleship" value="true" editable="false">
                                              <boolean/>
                                              </property>

                                            3. <property name='Two HitPoint Units Require Repair Facilities' value='true' editable='true'>
                                              <boolean/>
                                              </property>

                                            4. <attachment name="unitAttachment" attachTo="factory" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                              <option name="isFactory" value="true"/>
                                              <option name="isAAforBombingThisUnitOnly" value="true"/>
                                              <option name='repairsUnits' value='battleship:battleship-damaged'/>
                                              </attachment>

                                            5. <attachment name="unitAttachment" attachTo="battleship-damaged" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                              <option name="movement" value="2"/>
                                              <option name="attack" value="4"/>
                                              <option name="defense" value="4"/>
                                              <option name="isSea" value="true"/>
                                              <option name="canBombard" value="true"/>
                                              <option name="hitPoints" value="2"/>
                                              <option name="whenHitPointsRepairedChangesInto" value="0:true:battleship"/>
                                              </attachment>

                                            I wonder what is missing

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