How to prevent this cavalry unit to scramble to sea battles
-
This is a roman times cavalry unit called Equites.
All my other cavalry units are like this.<attachment name="unitAttachment" attachTo="Equites" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="attack" value="3"/> <option name="defense" value="3"/> <option name="movement" value="2"/> <option name="airAttack" value="3"/> <option name="airDefense" value="3"/> <option name="transportCost" value="6"/> <option name="canAirBattle" value="true"/> <option name="createsResourcesList" value="-1:PUs"/> <option name="canBlitz" value="true"/> <option name="canEvade" value="true"/> <option name="isAirBase" value="true"/> <option name="canScramble" value="true"/> <option name="maxScrambleDistance" value="1"/> <option name="requiresUnits" value="Metropolis"/> <option name="requiresUnits" value="City"/> </attachment>
It can evade, scramble and participate in air battles which simulates in my game skirmish and ranged combat. To be able to participate in air battles, one should know that it is possible even without being a isAir unit at all. You just set canAirBattle, airAttack and airDefense. Done.
Now to the problem: This unit does scramble from land to a sea battle whenever one occures at the bordering sea territory.
The following options are set like this.
<property name="Scramble To Sea Only" value="false" editable="false"> <property name="Scramble From Island Only" value="false" editable="false"> <property name="Scramble To Any Amphibious Assault" value="false" editable="true"> <property name="Can Scramble Into Air Battles" value="true" editable="true">
What possibilities do i have to prevent the scramble to sea territories?
-
@torpedoa
You will have to use movementCostModifier and territoryEffectAttachment
see here
https://forums.triplea-game.org/topic/2892/how-i-am-using-movementcostmodifierThe sea areas will have a cost to enter of say +5, to prevent the Cavalry from entering the sea area.
Remember you will have to restructure the xml to use territoryEffectAttachment
-
@thedog Just minutes ago i tried this but that doesnt work.
<attachment name="territoryEffectAttachment" attachTo="Ocean"javaClass="games.strategy.triplea.attachments.TerritoryEffectAttachment" type="territoryEffect"> <option name="unitsNotAllowed" value="Equites"/> </attachment>
Now i try with movement modifier.
Thy for help -
Below the cavalry scrambles but cannot move back to the territory which it was before.
<option name="movementCostModifier" value="Equites" count="-5"/>
And here it scrambles and can move back.
<option name="movementCostModifier" value="Equites" count="5"/>
Both options above and unitsNotAllowed are not working for scramble then i have to think.
-
So you have
- setup the effected territory as
<attachment name="territoryAttachment" attachTo="SZ47" javaClass="games.strategy.triplea.attachments.TerritoryAttachment" type="territory">
<option name="territoryEffect" value="Ocean" />
</attachment> - You have moved the unitAttachment and supportAttachment xml block of code after the territoryEffectAttachment block of code?
- setup the effected territory as
-
@thedog I have in order: Unit, Support, Territory, TerritoryEffect
-
@thedog said in How to prevent this cavalry unit not to scramble to sea battles:
You have moved the unitAttachment and supportAttachment xml block of code after the territoryEffectAttachment block of code?
Do you mean that i have to put territoryEffect above unit and support? And where to put territories?
If possible give me the right order of those in question. -
@thedog said in How to prevent this cavalry unit not to scramble to sea battles:
setup the effected territory as
<attachment name="territoryAttachment" attachTo="SZ47" javaClass="games.strategy.triplea.attachments.TerritoryAttachment" type="territory">
<option name="territoryEffect" value="Ocean" />
</attachment>Sure. I just put all sea zones into territoryAttachments right below the other land territoiyAttachments which were already there like you showing here. This was the first thing i did. After that i just put 1 territoryEffect with Ocean below all territoryAttachments.
-
order is
technology
territoryAttachment
territoryEffectAttachment
unitAttachment
supportAttachment -
@thedog thy very much, i try it
-
@thedog The change in order didnt do anything. I am more and more to think that scramble ingores certain restrictions.
-
Scramble is used for "isAir" units so the game logic is not checking if the unit can enter the zone since "isAir" unit can enter both water/land zones. I dough that you will be able to prevent the unit for entering that zone without some modification to the underling code.
Cheers...
-
@wc_sumpton Yes, i think you are right. Even though it is not a isAir unit. You can scramble even if you are not isAir.
-
Understand, but the scramble ability was a feature that was added to TripleA, and the way it was coded works well for 'isAir'.
Cheers...
-
@wc_sumpton I think i have to play around this options then.
canNotTarget
values: colon delimited list of units that this unit can't target in battles, ex. subs not being able to target air units
canNotBeTargetedBy
Eventually there is a chance. But i guess it will not work with airBattle in a scramble situation. But lets see. I try it now. -
@wc_sumpton I dont have a problem of scrambling cavalry units. I only want it to not to be any factor of an outcome if they entere a sea battle by scramble.
-
I really do understand you problem. 'canNotTarget' should work, but it will not stop the unit from entering the zone. You would have to put 'canNotTarget' on both the land and sea units, so that the scrambling units are not taken as casualties. I see 'canEvade' do you have any units with 'isDestroyer' these might also cause problems.
Defensive scrambling/intercepting units should use the same movement logic as regular attacking units.
Cheers...
-
@thedog @wc_sumpton
Thy you both for help.
I have now just set canNotBeTargetedBy and cannotTarget to the cavalry and the sea unit so it doesnt counts towards the outcome of the sea battle in which i cannot prevent the cavalry scrambling into. But it does the job.<attachment name="unitAttachment" attachTo="Equites" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="attack" value="3"/> <option name="defense" value="3"/> <option name="movement" value="2"/> <option name="airAttack" value="3"/> <option name="airDefense" value="3"/> <option name="transportCost" value="6"/> <option name="canAirBattle" value="true"/> <option name="createsResourcesList" value="-1:PUs"/> <option name="canBlitz" value="true"/> <option name="canEvade" value="true"/> <option name="isAirBase" value="true"/> <option name="canScramble" value="true"/> <option name="maxScrambleDistance" value="1"/> <option name="requiresUnits" value="Metropolis"/> <option name="requiresUnits" value="City"/> <option name="canNotTarget" value="Galley"/> <option name="canNotBeTargetedBy" value="Galley"/> </attachment>
-
@wc_sumpton Luckily i dont have or need isDestroyer in my ancient times mod. Thy again for helping me to find a good workaround.