trigger question - unit with hit



  • Hi,

    I plan a trigger that finally let a unit (battleship) with a hit appear

    that's how I wrote that commandos:

    <attachment name="conditionAttachmentPearlHarbour" attachTo="Americans_west" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
    <option name="directPresenceTerritories" value="map"/>
    <option name="unitPresence" value="Americans_west:battleship" count="0"/>
    <option name="rounds" value="1"/>
    <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"/>
    <option name="placement" value="53 Sea Zone:Americans_west:battleship" count="1"/>
    </attachment>

    not necessary to mention - I does not work this way!

    a) it does not even work with
    <option name="placement" value="53 Sea Zone:americans_west:battleship" count="1"/>

    in this case there is no error message, but in the game the trigger is not working - why?

    b) what do I have to type to get a battleship with a hit instead of regular battleship?

    c) I want this unit have a cost, let's say 10 IPC.

    So I need a trigger the reduces the income of tha chosen player by 10
    So I wrote:

    <attachment name="triggerAttachmentBBrefloating_costs" attachTo="Americans_west" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
    <option name="conditions" value="conditionAttachmentPearlHarbour"/>
    <option name="resource" value="PUs"/>
    <option name="resourceCount" value="-10"/>
    <option name="when" value="before:americans_westPlace"/>
    </attachment>

    could this work? or is -10 not possible? If, how else?



  • to help searching typing errors, in the xml

    <unit name="battleship"/>
    
    <player name="Americans_west" optional="false"/>
    

    <!-- Americans_west Game Sequence -->
    <step name="americans_westTech" delegate="tech" player="Americans_west"/>
    <step name="americans_westTechActivation" delegate="tech_activation" player="Americans_west "/>
    <step name="americans_westPurchase" delegate="purchase" player="Americans_west"/>
    <step name="americans_westCombatMove" delegate="move" player="Americans_west"/>
    <step name="americans_westBattle" delegate="battle" player="Americans_west"/>
    <step name="americans_westNonCombatMove" delegate="move" player="Americans_west" display="Non Combat Move"/>
    <step name="americans_westPlace" delegate="place" player="Americans_west"/>
    <step name="americans_westEndTurn" delegate="endTurn" player="Americans_west"/>



  • @Numetalfan if you want to place a damaged Battleship try:

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

    That's for game start placement. If you want in game add the hitsTaken to you Placement trigger. Maybe try this:

    <option name="placement" value="5 Sea Zone:battleship" hitsTaken="1" count="1"/>

    Idk if that'll work but you could try it.

    I assume you want the damaged BB to cost 10 PUs to repair ? I would guess there's a way to do it, but it might be a bit complicated. I guess you'd have to make the BB non repairable by your Harbours and then try having a 10 PU resource and consumesUnits and changesInto.

    Might need a separate unit that is "BattleshipHit" for all that to work. You could look at TotalWorldWar and see how Hepps does it with "Hulls" I think they're called. Not quite what you want but might give you an idea.

    Or we could ask @wc_sumpton if there's an easy way 🙂



  • @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.



  • @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.



  • 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



  • @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.



  • @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?



  • @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...



  • 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?



  • battleship problems are solved - back to the triggers


Log in to reply