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.
-
there should be a check in the trigger condition
the check is, if in round 1 the Japanese destroyed all US battleships in Pearl HarbourIf 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 gameIn 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 gamea 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?
-
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
-
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 !
-
<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
-
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?
-
@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. -
@numetalfan said in trigger question - unit with hit:
<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.
-
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. -
@numetalfan ahh yea that is different. Sadly that doesn't work then. I guess you'll have to use a special unit.
-
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?
-
@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 Factoryso 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