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.
    • 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
                                  • B Offline
                                    beelee @Numetalfan
                                    last edited by

                                    @numetalfan yea so unfortunately, that's not gonna work. If i edit the damaged BB to have 1 hit point of damage, then it does. But if we could do that we wouldn't need it anyway. So back to the same issue.

                                    I suggest looking at how "Hulls" work in Total World War. I'm gonna take a look at it myself. It seems as if you ought to be able to make something work with the Hulls. I'm not real familiar with them but think you place them and make it turn into a BB by using "consumesUnits" somehow.

                                    Here's what he has

                                    <attachment name="unitAttachment" attachTo="germanBattleship" javaClass="UnitAttachment" type="unitType">
                                    <option name="movement" value="2"/>
                                    <option name="attack" value="6"/>
                                    <option name="defense" value="5"/>
                                    <option name="attackRolls" value="2"/>
                                    <option name="defenseRolls" value="2"/>
                                    <option name="canBombard" value="true"/>
                                    <option name="isSea" value="true"/>
                                    <option name="hitPoints" value="2"/>
                                    <option name="bombard" value="5"/>
                                    <option name="requiresUnits" value="germanDocks:germanFactory"/>
                                    <option name="consumesUnits" value="1:germanHull"/>
                                    <option name="whenHitPointsDamagedChangesInto" value="1:true:germanBattleship-damaged"/>
                                    </attachment>

                                    I'm not sure how it changes. I'm gonna read up on it

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

                                      @beelee Still not quite sure how it works

                                      consumesUnits
                                      values: requires that a unit be present in a territory, then when this unit is placed the other units are destroyed / upgraded into this unit. Can have multiple instances of this, which means it consumes multiple types of units.

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

                                        @beelee hmm...yea I don't think that's gonna work either. Because you can't place your BB then w/out a Damaged one. What is the exact scenario again ? Is this for the PH attack ? Or you want to be able to do this anywhere ?

                                        Edit
                                        Ok I just went through th thread again and I think WC is right, you can't place a damaged unit in game. Might be able to figure out away to make your scenario still work though. I'm gonna think on it some more

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

                                          Ok so have the DamagedBB placed when your trigger sees all the BBs sunk. Might as well make it a A0 D0 M0 since it's not going anywhere. Then your -10 PU trigger fires when he sees it's there. Then at the start of JPNs turn have a trigger remove it. That way if JPN attacks again it won't be there to soak a hit.

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

                                            @beelee

                                            that was excatly my first programming, but this way of doing it restricts the game. I want the user to decide what he does.

                                            If he decides to move the damaged BB to a shore next to factory it should be repaired, if the player decides to attack with it, it should be possible too.

                                            I think the programmers should enlarge the "placement" function by the battleship_hit.

                                            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