Adding triggers to a Map that doesn't have them
-
Map is "World War II v5 1942 Second Edition"
I added <property name="Use Triggers" value="true" editable="true">
and made a custom one to turn it on/off.
<attachment name="TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="gameProperty" value="Transport A0 D1"/>
</attachment>Then the trigger:
<attachment name="triggerAttachment_TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="trigger" value="TransportD1"/> <option name="unitType" value="transport"/> <option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/> <option name="unitProperty" value="defense" count="1"/> <option name="when" value="before:russiansPurchase"/> <option name="uses" value="1"/> </attachment>
I also tried -reset-
<attachment name="triggerAttachment_TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="trigger" value="TransportD1"/>
<option name="unitType" value="transport"/>
<option name="unitProperty" value="defense" count="-reset-"/>
<option name="unitProperty" value="defense" count="1"/>
<option name="when" value="before:russiansPurchase"/>
<option name="uses" value="1"/>
</attachment>I could make it buy an entirely new unit in the "productionFrontier" but that seems like a lot of work when this should do it.
Anyway, I'm obviously missing something. Would someone clue me in please ?
Thanks
-
@beelee said in Adding triggers to a Map that doesn't have them:
Map is "World War II v5 1942 Second Edition"
I added <property name="Use Triggers" value="true" editable="true">
and made a custom one to turn it on/off.
<attachment name="TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="gameProperty" value="Transport A0 D1"/>
</attachment>Assuming you made the custom property (named "Transport A0 D1") correctly and the one you have there is, instead, supposed to be the condition referencing it, it should be:
<attachment name="conditionAttachmentTransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="gameProperty" value="Transport A0 D1"/> </attachment>
Then the trigger:
<attachment name="triggerAttachment_TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="trigger" value="TransportD1"/> <option name="unitType" value="transport"/> <option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/> <option name="unitProperty" value="defense" count="1"/> <option name="when" value="before:russiansPurchase"/> <option name="uses" value="1"/> </attachment>
You cannot call directly the property with the trigger. You have to call a condition that is testing the state of the property. Also, assuming "trigger" is a deprecated option, use "conditions", instead, substituting:
<option name="trigger" value="TransportD1"/>
with:
<option name="conditions" value="conditionAttachmentTransportD1"/>
I also tried -reset-
<attachment name="triggerAttachment_TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="trigger" value="TransportD1"/>
<option name="unitType" value="transport"/>
<option name="unitProperty" value="defense" count="-reset-"/>
<option name="unitProperty" value="defense" count="1"/>
<option name="when" value="before:russiansPurchase"/>
<option name="uses" value="1"/>
</attachment>This is wrongly coded but, anyway, since a unit can have only one "defense" value, there is no need to use "reset", as changing such value will overwrite the existent one.
At the end, your trigger should be something like this:
<attachment name="triggerAttachment_TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentTransportD1"/> <option name="when" value="before:russiansPurchase"/> <option name="unitType" value="transport"/> <option name="unitProperty" value="defense" count="1"/> <option name="uses" value="1"/> </attachment>
-
Well unfortunately I still can't get it to work. I tried your advice and variations of it as well but ....
This is what I did in Global 40 House Rules and it works there.
This is the custom game property that shows up in map options:
<attachment name="TrprtC8" attachTo="Changer" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="gameProperty" value="Transport Cost 8"/>
</attachment>It's added into this conditionAttachment:
<attachment name="conditionAttachmentTransportCost8Changer" attachTo="Changer" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="conditions" value="conditionAttachmentTransportCost8ChangerOption:TrprtC8"/>
<option name="conditionType" value="OR"/>
</attachment>as you can see it's with another condition and they are a "OR" condition but it's just called "TrprtC8". That's the way all of the gameProperty ones I've made work. If I add "conditionAttachment" they won't work.
And then here's the trigger"
<attachment name="triggerAttachmentTransportCost8Changer" attachTo="Changer" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="trigger" value="conditionAttachmentTransportCost8Changer"/>
<option name="unitType" value="transport"/>
<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
<option name="unitProperty" value="attack" count="0"/>
<option name="unitProperty" value="defense" count="1"/>
<option name="unitProperty" value="isCombatTransport" count="true"/>
<option name="when" value="after:changerCombatMove"/>
<option name="uses" value="1"/>
</attachment>I understand I can change trigger to conditions and have a few times but it works. Is there any other property that needs turned on or something ? I went through every one in both maps and couldn't find anything.
This the latest:
<attachment name="TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="gameProperty" value="Transport A0 D1"/>
</attachment>
<attachment name="conditionAttachmentTransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="conditions" value="TransportD1"/>
</attachment>
<attachment name="triggerAttachment_TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachmentTransportD1"/>
<option name="unitType" value="transport"/>
<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
<option name="unitProperty" value="defense" count="1"/>
<option name="unitProperty" value="isCombatTransport" count="true"/>
<option name="when" value="before:russiansPurchase"/>
<option name="uses" value="1"/>
</attachment>At any rate appreciate your time, but I'm still off here somewhere.
-
@beelee said in Adding triggers to a Map that doesn't have them:
Well unfortunately I still can't get it to work. I tried your advice and variations of it as well but ....
This is what I did in Global 40 House Rules and it works there.
This is the custom game property that shows up in map options:
<attachment name="TrprtC8" attachTo="Changer" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="gameProperty" value="Transport Cost 8"/>
</attachment>It's added into this conditionAttachment:
<attachment name="conditionAttachmentTransportCost8Changer" attachTo="Changer" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="conditions" value="conditionAttachmentTransportCost8ChangerOption:TrprtC8"/>
<option name="conditionType" value="OR"/>
</attachment>as you can see it's with another condition and they are a "OR" condition but it's just called "TrprtC8". That's the way all of the gameProperty ones I've made work. If I add "conditionAttachment" they won't work.
And then here's the trigger"
<attachment name="triggerAttachmentTransportCost8Changer" attachTo="Changer" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="trigger" value="conditionAttachmentTransportCost8Changer"/>
<option name="unitType" value="transport"/>
<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
<option name="unitProperty" value="attack" count="0"/>
<option name="unitProperty" value="defense" count="1"/>
<option name="unitProperty" value="isCombatTransport" count="true"/>
<option name="when" value="after:changerCombatMove"/>
<option name="uses" value="1"/>
</attachment>I understand I can change trigger to conditions and have a few times but it works. Is there any other property that needs turned on or something ? I went through every one in both maps and couldn't find anything.
This the latest:
<attachment name="TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="gameProperty" value="Transport A0 D1"/>
</attachment>
<attachment name="conditionAttachmentTransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="conditions" value="TransportD1"/>
</attachment>
<attachment name="triggerAttachment_TransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachmentTransportD1"/>
<option name="unitType" value="transport"/>
<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
<option name="unitProperty" value="defense" count="1"/>
<option name="unitProperty" value="isCombatTransport" count="true"/>
<option name="when" value="before:russiansPurchase"/>
<option name="uses" value="1"/>
</attachment>At any rate appreciate your time, but I'm still off here somewhere.
Ok. Assuming you don't want anymore the double conditions with the "OR", at this point I'm just giving you the full code...
This is the custom property you want (but I suggest you change this to something easier to understand), assuming this is supposed to be an option off as default:
<property name="Transport A0 D1" value="false" editable="true"> <boolean/> </property>
This is the only condition you want:
<attachment name="conditionAttachmentTransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="gameProperty" value="Transport A0 D1"/> </attachment>
This is the trigger you want:
<attachment name="triggerAttachmentTransportD1" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentTransportD1"/> <option name="unitType" value="transport"/> <option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/> <option name="unitProperty" value="attack" count="0"/> <option name="unitProperty" value="defense" count="1"/> <option name="unitProperty" value="isCombatTransport" count="true"/> <option name="when" value="before:russiansPurchase"/> <option name="uses" value="1"/> </attachment>
Of course, I've not tested it, so there is the risk something is wrong.
I'm also not fond of this kind of things, by the way, since, then, you have this condition that will do nothing if changed after when it should fire and will be editable back, to no effect, after it has fired, but just my opinion here.
Also be sure the phase is exactly called "russiansPurchase" (not validated).
-
right on i'll give it a shot
-
GD it you sure got the eye. "Also be sure the phase is exactly called "russiansPurchase" (not validated)."
It's "russianPurchase" Had me chasing my tail for half a day. Big thanks