issue with upgrading units (consumesUnit & name="constructionType"
-
dear map makers....
finally , the last challenge before finishing this project:In this game certain buildings can be upgraded:
like a harbour can be upgraded into a big harbour:
it uses <option name="consumesUnits" value="1:Tsu_(Harbour)"/>
and <option name="constructionType" value="Big-Harbour_structure"/>
to replace it.Problem:
After upgrading it is still possible to place a small harbour next to a big harbour later in the game, which is unwanted.If I use the same "constructionType" value= names for both small and big harbour an upgrade is no longer possible, a even bigger unwanted consequence
I think it cannot be solved within : <option name="maxConstructionsPerTypePerTerr" value="1"/><option name="constructionsPerTerrPerTypePerTurn" value="1"/>
either...Solving this with: unit can only be placed in , is no option here as they are randomly placed at game start....
The only solution I see is making a new unit that needs to be replaced to be able to build a harbour..... in every territory not allready containing a harbour... but this is a undesirable workaround for me....does anyone knows a possible solutionfor this or a example from a certain map?
bolded text
I would appreciate a lot !!!!!
thanks... and on to a new project after summer break -
This might help?
Replace the Industry's with your Harbour and Big-Harbour
It might also block upgrading I cannot remember
But it does stop Harbour being placed with a Big-Harbour.<attachment foreach="$AllPlayers$" name="playerAttachment" attachTo="@AllPlayers@" javaClass="PlayerAttachment" type="player"> <option name="retainCapitalNumber" value="0"/> <option name="retainCapitalProduceNumber" value="0"/> <option name="placementLimit" value="allied:Industry-Hvy:Industry-Med:Industry-Lgt:Base-Camp" count="1"/> </attachment>
-
@thedog said in issue with upgrading units (consumesUnit & name="constructionType":
<option name="placementLimit" value="allied:Industry-Hvy:Industry-Med:Industry-Lgt:Base-Camp" count="1"/>
That was definately a very good & working solution!!!! great!!!
thanks again for sharing and caring!
few more test rounds, finishing game notes and project finally finished! -
sometimes one wishes too much to have ones final issue from the "eternal-to-do-list" to be solved... that an final test is not well done..
so: @TheDog : unfortunately indeed: it works for the avoiding placing extra units, but it blocks the upgrading..
( which is weird as actually there are no 2 same of the unit types around as it is "consumed" ) so: the question remains
In this game certain buildings can be upgraded:
like a harbour can be upgraded into a big harbour:
and <option name="constructionType" value="Big-Harbour_structure"/>
to replace it.Problem:
After upgrading it is still possible to place a small harbour next to a big harbour later in the game, which is unwanted.If I use the same "constructionType" value= names for both small and big harbour an upgrade is no longer possible, a even bigger unwanted consequence
Solving this with:
-unit can only be placed in , is no option here as they are randomly placed at game start....
The only solution I see is making a new unit that needs to be replaced to be able to build a harbour..... in every territory not allready containing a harbour... but this is a undesirable workaround for me....-the proposed solution with: placement limit works, but blocks upgrading
<attachment foreach="$AllPlayers$" name="playerAttachment" attachTo="@AllPlayers@" javaClass="PlayerAttachment" type="player"> <option name="placementLimit" value="allied:Tsu_(Harbour):Shuyo-Tsu_(Big-Harbour):Ichiba_(Mart):Shuyo-Ichiba_(Big-Mart):Tsu_(Harbour)_:Shuyo-Tsu_(Big-Harbour)_:Ichiba_(Mart)_:Shuyo-Ichiba_(Big-Mart)_" count="1"/> </attachment>
does anyone knows another possible solution for this or a example from a certain map?
I would appreciate a lot !!!!!
-
"Oztea 1939 Global" (a map by @beelee I think) has a working upgrade system for the "factory_minor" to "factory_major":
<attachment name="unitAttachment" attachTo="factory_minor" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isFactory" value="true"/> <option name="unitPlacementRestrictions" value="Ceylon:Sumatra:Java:Borneo:Hainan:Philippines:Celebes:Dutch New Guinea:Paulau Island:New Guinea:New Britain:Solomon Islands:New Hebrides:New Zealand:Fiji:Samoa:Line Islands:Johnston Island:Hawaiian Islands:Midway:Iwo Jima:Aleutian Islands:Gilbert Islands:Marshall Islands:Caroline Islands:Wake Island:Marianas:Guam:Formosa:Okinawa:West Indies:Greenland:Iceland:Sardinia:Sicily:French Madagascar:Crete:Cyprus"/> <option name="canOnlyBePlacedInTerritoryValuedAtX" value="2"/> <!--<option name="destroyedWhenCapturedBy" value="Chinese"/>--> <option name="isAAforBombingThisUnitOnly" value="true"/> <option name="canProduceXUnits" value="3"/> <option name="maxDamage" value="6"/> </attachment> <!-- Factory Major --> <attachment name="unitAttachment" attachTo="factory_major" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isFactory" value="true"/> <option name="unitPlacementRestrictions" value="Ceylon:Sumatra:Java:Borneo:Hainan:Philippines:Celebes:Dutch New Guinea:Paulau Island:New Guinea:New Britain:Solomon Islands:New Hebrides:New Zealand:Fiji:Samoa:Line Islands:Johnston Island:Hawaiian Islands:Midway:Iwo Jima:Aleutian Islands:Gilbert Islands:Marshall Islands:Caroline Islands:Wake Island:Marianas:Guam:Formosa:Okinawa:West Indies:Greenland:Iceland:Sardinia:Sicily:French Madagascar:Crete:Cyprus"/> <option name="canOnlyBePlacedInTerritoryValuedAtX" value="3"/> <!--<option name="destroyedWhenCapturedBy" value="Chinese"/>--> <option name="isAAforBombingThisUnitOnly" value="true"/> <option name="canProduceXUnits" value="10"/> <option name="maxDamage" value="20"/> <option name="whenCapturedChangesInto" value="any:any:true:factory_minor:1"/> <option name="special" value="canOnlyPlaceInOriginalTerritories"/> </attachment> <!-- Factory Upgrade --> <attachment name="unitAttachment" attachTo="factory_upgrade" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isFactory" value="true"/> <option name="unitPlacementRestrictions" value="Ceylon:Sumatra:Java:Borneo:Hainan:Philippines:Celebes:Dutch New Guinea:Paulau Island:New Guinea:New Britain:Solomon Islands:New Hebrides:New Zealand:Fiji:Samoa:Line Islands:Johnston Island:Hawaiian Islands:Midway:Iwo Jima:Aleutian Islands:Gilbert Islands:Marshall Islands:Caroline Islands:Wake Island:Marianas:Guam:Formosa:Okinawa:West Indies:Greenland:Iceland:Sardinia:Sicily:French Madagascar:Crete:Cyprus"/> <option name="canOnlyBePlacedInTerritoryValuedAtX" value="3"/> <!--<option name="destroyedWhenCapturedBy" value="Chinese"/>--> <option name="isAAforBombingThisUnitOnly" value="true"/> <option name="canProduceXUnits" value="10"/> <option name="maxDamage" value="20"/> <option name="consumesUnits" value="1:factory_minor"/> <option name="whenCapturedChangesInto" value="any:any:true:factory_minor:1"/> <option name="special" value="canOnlyPlaceInOriginalTerritories"/> </attachment>
Tested in both 2.5 current and 2.6+
Cheers...
-
@wc_sumpton
unfortunately no progress in trying to solve this with all good suggestions:trying to fix a workaround now:
but as coded now it adds a harbour to ALL of the $CoastalCities$ ...of every player
not (as I hoped for) ONLY in the specific Coastal Cities that
have a Harbour unit presence (and in this case Otomo -ownership) ; anyone knows what I should change in the condition?<attachment foreach="$CoastalCities$" name="conditionAttachment_Swap_Harbour_Otomo_@CoastalCities@" attachTo="Otomo" javaClass="RulesAttachment" type="player"> <option name="directOwnershipTerritories" value="@CoastalCities@"/> <option name="unitPresence" value="Harbour" count="1"/> </attachment>
sorry to bother once more....
-
You are using "directOwnershipTerritories" when you should be using "directPresenceTerritories". You are checking to see if 'Otomo' owns a 'harbor' in '$CoastalCities$', ownership of the territory is implied by owning the 'harbor'.
Cheers...
-
@wc_sumpton said in issue with upgrading units (consumesUnit & name="constructionType":
directPresenceTerritories
That was the solution!!!!
thank you all for thinking along
-
Hay @ebbe
Still trying to upgrade units, try this:
You already have harbour and big harbour (remove "consumesUnit" from big harbour) units. You will need a third unit, upgrade harbour, which will be the same as big harbour but add "consumesUnit" to replace harbour, and "createsUnitsList" to add big harbour. You will still need @TheDog playerAttachment idea. Update harbour will create big harbour during the endTurn phase, so create a trigger to remove all update harbours after the endTurn phase to clean out the extra unit.
Hope this helps!
Cheers...
-
Thanks... I checked the Ozteal 1939 game allready for this... this solution brings another unit in the purchase panel though, which I try to avoid
I choose a trigger to change the unit type's name after placement , so it can be upgraded now, and after place plase it receives same name as the unit it should consume...
bit of a workaround but it worksby the way; a final question: connected to directPresenceTerritories
How to get it working when you want no units of a specific unit type to be present (anywhere) in order to get a trigger started?
(in order to have an automatic replacement )============== AUTOMATIC DAIMYO SUCCESSION ========= <attachment name="conditionAttachmentDaimyo_Otomo" attachTo="Otomo" javaClass="RulesAttachment" type="player"> <option name="unitPresence" value="Daimyo" count="0"/> <option name="directPresenceTerritories" value="all" count="0"/> </attachment> <attachment name="triggerAttachmentOtomoDaimyo" attachTo="Otomo" javaClass="TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentDaimyo_Otomo"/> <option name="purchase" value="Daimyo" count="1"/> <option name="players" value="Otomo"/> <option name="when" value="before:otomoPurchase"/> </attachment>
-
Simple, add "invert" to a count of 1:
<attachment name="conditionAttachmentDaimyo_Otomo" attachTo="Otomo" javaClass="RulesAttachment" type="player"> <!-- Change count to 1 --> <option name="directPresenceTerritories" value="all" count="1"/> <!-- Change count to 1 --> <option name="unitPresence" value="Daimyo" count="1"/> <!-- Add invert --> <option name="invert" value="true"/> </attachment>
If there are no "Daimyo", statement will be false, invert makes it true.
Cheers...
-
@wc_sumpton great , it works, (tested well
) yes you mentioned it once before , it was another element that interfered and made it look like not working! solved!
thanks again!