Make submarines pass through destroyers?
-
I'm trying to allow submarines to move through destroyers. I've set the sub to have option="canMoveThroughEnemies" value=true", I've set the destroyer to have option="canBeMovedThroughByEnemies" value="true", I've set the Submersible Subs game option to "true", but the destroyers are still blocking sub movement.
I assume that it's becuase isSub and isDestroyer are overriding these options, but I like having isSub and isDestroyer set to true, because that causes them to behave appropriately around things like air strikes, economic losses for blockades, first strikes, and so on.
Is there a way I can selectively override the properties of isDestroyer?
Or, failing that, does anyone have code I can use that would manually reestablish all the properties of isDestroyer and isSub from Global-style games, except that subs are now allowed to move freely through destroyers?
-
As an alternative might this be suitable?
Remove isDestroyer and replace with a AA targeted attack v Submarines? -
Thanks for the creative suggestion, but that wouldn't meet my needs. I'm not just trying to create a general sort of balance between subs and destroyers -- I'm trying to faithfully replicate all of the standard behaviors of subs and destroyers. The only desired change would be that subs can now move through destroyers. Giving destroyers a targeted AA shot against subs would not stop the subs from having first strike, evasion, immunity to aircraft, and so on.
I am running out of ideas, here. I tried changing the unitAttachment properties to temporarily remove the canEvade and isFirstStrike abilities of subs when they are in the same sea zone as a destroyer, but this affects all subs for the rest of the turn, even subs in sea zones with no destroyers.
I tried replacing subs with a new unit called "exposed_sub" that wouldn't have the usual submarine abilities when they are in the same sea zone as a destroyer, but I don't see any way to replace a unit before the start of combat -- only after combat is over, when you capture it, or if you damage the unit (but subs are not two-hit units, so this would not be suitable). Manually replacing a unit with removeUnit and placement is not useful because there is no good way to count how many subs are in each sea zone that need to be replaced by exposed_sub.
Finally, I tried creating a new unit called "aaSea" that has no combat abilities and has isDestroyer set to true. The idea is that after the combat move, I can have the unit appear in each sea zone that contains both a friendly destroyer and an enemy sub -- that way subs can move through destroyers (which have isDestroyer=false), but still get nerfed by aaSea during combat (which have isDestroyer=true). I originally also made the aaSea unit have isSuicideOnDefense=true, but I removed that line just in case it was the cause of my problems. That didn't help.
<attachment name="unitAttachment" attachTo="aaSea" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="movement" value="0"/> <option name="attack" value="0"/> <option name="defense" value="0"/> <option name="isSea" value="true"/> <option name="isDestroyer" value="true"/> <option name="canNotBeTargetedBy" value="destroyer:submarine:cruiser:carrier:battleship:fighter:tactical_bomber:bomber"/> </attachment>
The problem is that my code is just totally failing to actually place the aaSea units, and I don't know why. The code does not seem to have any effect at all. Can anyone help me?
<attachment foreach="$AlliedPlayers$^$SeaZones$" name="conditionAttachment_@AlliedPlayers@_Enemy_Submarine_In_@SeaZones@" attachTo="@AlliedPlayers@" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="enemyPresenceTerritories" value="@SeaZones@" count="1"/> <option name="unitPresence" value="submarine" count="1"/> </attachment> <attachment foreach="$AlliedPlayers$^$SeaZones$" name="conditionAttachment_@AlliedPlayers@_Own_Destroyer_In_@SeaZones@" attachTo="@AlliedPlayers@" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="@SeaZones@" count="1"/> <option name="unitPresence" value="destroyer" count="1"/> </attachment> <attachment foreach="$SeaZones$^$AlliedPlayers$" name="triggerAttachment_1_Nerf_Subs_In_@SeaZones@" attachTo="British" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_@AlliedPlayers@_Enemy_Submarine_In_@SeaZones@:conditionAttachment_@AlliedPlayers@_Own_Destroyer_In_@SeaZones@"/> <option name="when" value="after:GermansCombatMove"/> <option name="placement" value="@SeaZones@:aaSea" count="1"/> </attachment>
-
One thought, the submarine is the moving unit, and belongs to the player that is attacking, so 'enemyPresenceTerritories' cannot be the unit that moved. Try switching 'enemyPresenceTerritories' to 'destroyer' and 'directPresenceTerritories' to submarine.
Don't know if this will help much.
Cheers...
-
I'm very confused, it does happen quite often ask @beelee. For clarification, you want the submarines, during their movement to be able to pass through sea zones with enemy destroyers. But if the submarine chooses to stop in the destroyer occupied sea zone, then isDestroyer rules, canEvade no, isFirstStrike no and canNoBeTargetedBy null, are in effect?
If that is what is wanted then set isDestroyer to true prior to combat, and then back to false after combat. If this is what is wanted then insure the 'isDestroyer' is set to 'false' in the destroyer's unitAttachment, something setting like this do not take with trigger actions, it the value is not set first.
Cheers...
-
@wc_sumpton Oh, duh. Thank you; that works just fine. Can't believe I didn't think of it.
-
So the submarine movement problem is solved, but I'm still struggling to understand the enemyPresence and unitPresence rules, I guess.
My next goal is to make the "transEscort" unit appear when there are 2 or more friendly transports in a sea zone with any enemy units. The idea is that the transEscort unit will automatically protect the transports. However, my code does nothing and units never appear.
Any thoughts?
<attachment foreach="$SeaZones$" name="conditionAttachment_Axis_Threat_In_@SeaZones@" attachTo="British" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="enemyPresenceTerritories" value="@SeaZones@" count="1"/> </attachment> <attachment foreach="$SeaZones$" name="conditionAttachment_Two_Allied_Transports_In_@SeaZones@" attachTo="British" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="alliedPresenceTerritories" value="@SeaZones@" count="1"/> <option name="unitPresence" value="destroyer" count="2"/> </attachment> <attachment foreach="$SeaZones$^$LCAxisPlayers$" name="triggerAttachment_Create_Allied_Escort_In_@SeaZones@" attachTo="British" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Axis_Threat_In_@SeaZones@:conditionAttachment_Two_Allied_Transports_In_@SeaZones@"/> <option name="when" value="after:@LCAxisPlayers@CombatMove"/> <option name="placement" value="@SeaZones@:transEscort" count="1"/> </attachment>
-
If it ends in "xxx...Territories" that is where to look, and count equal to or greater than the number of territories listed to be true.
'direct...Territories', 'allies...Territories' and 'enemy...Territories' take their cues from the 'players' option or 'attachTo' if 'players' is missing (If you use 'players' it is best to add the 'attachTo' player to the list. Some conditions will add 'attachTo', some do not, and those that do clear it out so that there will not be any duplication.)."unitPresence" is what "xxx...Territories" is looking for in each territory listed in "xxx...Territories" value list. The key word here is each, not the group as a whole. PoS2 states that units listed together separated by a colon means "OR", this is incorrect. Colon separated list means cumulative.
So in your example you have:
<option name="enemyPresenceTerritories" value="@SeaZones@" count="1"/>
But there is no "unitPresence" telling "enemyPresenceTerritories" what to look for.
PoS2 states: "If missing, then presence needs only 1 of any unit, and excluded needs to be completely devoid of units" Well... I treat "xxx...Territories" like I treat triggers, always have "conditions" and "when". It's not always necessary, but the TripleA engine is very old, and there have been may contributors to the code, that assumptions may not work as desired.So add:
<option name="unitPresence" value="ANY" count="1"/> <!-- If you want zero units add invert --> <!-- <option name="invert" value="true"/> -->
Hope this helps.
Cheers...