Remove Units
-
I'm trying to remove a unit when only 1 or 2 of the same unit are present. I made these two conditions:
<attachment name="conditionAttachment_WolfpackRemove2" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="unitPresence" value="GermanUBoat" count="2"/>
</attachment><attachment name="conditionAttachment_WolfpackRemove1" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="unitPresence" value="GermanUBoat" count="1"/>
</attachment><attachment name="conditionAttachment_WolfpackRemove1And2" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="conditions" value="conditionAttachment_WolfpackRemove2:conditionAttachment_WolfpackRemove1"/> <option name="conditionType" value="OR"/> </attachment>
That removes the unit but also when there are 3 or more of the units present. Then I added this, so it wouldn't remove it, when 3 of them were present but now it won't remove it at all, even with only 1 or 2 present.
<attachment name="conditionAttachment_WolfpackStay" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="unitPresence" value="GermanUBoat" count="3"/> <option name="invert" value="true"/> </attachment>
<attachment name="conditionAttachment_WolfpackRemove" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="conditions" value="conditionAttachment_WolfpackRemove1And2:conditionAttachment_WolfpackStay"/>
<option name="conditionType" value="AND"/>
</attachment>Here's the trigger:
<attachment name="triggerAttachment_Germans_RemoveWolfpackSZ112" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachment_WolfpackRemove"/>
<option name="removeUnits" value="112 Sea Zone:Wolfpack" count="1"/>
<option name="when" value="before:germansNonCombatMove"/>
</attachment>Anyone know of a way to do this ?
Thanks
-
Why so many conditions? From what I summarize, the only condition to check for is less then 3, the last condition. If there is 0, 1 or 2 subs remove 1.
Let me know what I am missing.
Cheers...
-
-
@wc_sumpton well bummer. That didn't work. Doesn't remove anything. Seems that it should. The only time it removed anything was when I didn't use the invert condition and then it removed all the time.
-
yay success
I added a "directPresenceTerritories" to the condition
<attachment name="conditionAttachment_WolfpackRemove" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="directPresenceTerritories" value="112 Sea Zone" count="1"/>
<option name="unitPresence" value="GermanUBoat" count="3"/>
<option name="invert" value="true"/>
</attachment> -
Yea!!! I was wondering about 'directPresenceTerritories' also. Was hoping that using just one condition would be easer to debug.
So happy you got there without any help!!
Cheers...
-
@wc_sumpton oh not having 4 conditions was definitely help