Upgrading Factories
-
In 1888 SAS (Steam & Steel) you can upgrade Factories
Barracks to Industry to Industry-HvyBut I only want 1 factory per TT
To allow a factory upgrade this maxFactoriesPerTerritory property must be set to 2
But this also allows an unwanted Barracks to be placed, as below;
Checking TripleA-2.5.22294 the same thing happens.
So any help/suggestions would be appreciated to resolve this.
-
Yes, but the upgrade unit does not have to be called "factory".
Use a dummy to upgrade, have the upgrade "spawn" the real unit, then remove the upgrade after endTurn. endTurn is where "createsUnitsList" happens.
Use playerAttachment/placementLimit to insure that the dummy upgrade and lesser unit cannot be placed at the same time.
Lesser unit "Barracks"/"factory" is ungraded by "Industry-Upgrade"/"Upgrade" which create "Industry"/"factory" which can be upgraded by "Industry-Heavy-Upgrade"/"Upgrade" which in turn creates "Industry-Heavy"/"factory".
And "maxFactoriesPerTerritory" can be left at 1, because the upgrade unit is there only as a placeholder for the final unit.
Tried to do this with GCD '41 and Shogun Advanced, so it does work.
Cheers...
-
Wow, so quick, thanks!
I guess its always been like that.
-
And so, I got some things a little mixed up there, sorry.
The Barracks, Industry, Industry_Upgrade, Industry-Hvy, Industry-Hvy_Upgrade should all be called "factory" and look like this:
<option name="constructionType" value="factory"/> <option name="maxConstructionsPerTypePerTerr" value="2"/> <!-- This will allow 2 of the same type to occupy the territory at once --> <!-- This will allow the upgrade unit to be placed --> <option name="constructionsPerTerrPerTypePerTurn" value="1"/> <!-- Only 1 per turn, will prevent a upgrade and other to be placed during the same turn -->
The upgrades will still need to replace/create. In the playerAttachment:
<option name="placementLimit" value="owned:Barracks:Industry:Industry-Hvy" count="1"/> <!-- Note no upgrade units, and this should stop the second placement of a production unit -->
Then the cleanup, but I see that you have only an endTurn at the beginning of the round. This is what is used to spawn the upgraded unit prior to removal, but I sure you can handle this.
Again, sorry for the mix up.
Cheers...
-
As always very helpful, thanks!
-
@wc_sumpton Thanks, this was helpful! I'm using a similar mechanic in my Deluxe Anniversary map, and it's working well; the upgrades are functioning as intended; they consume a barracks when placed, and no double-stacking of any kind is allowed.
However, I don't know how to quickly clean up the "factory_upgrade" units and replace them with "factory" units at the end of the turn. Can you help me with that?
-
Sure, for the factory_upgrade to create the factory this will need to be added to the unitAttachment:
<option name="createsUnitsList" value="1:factory"/>
This will create the "factory" during the endTurn. Then create a trigger to remove those upgrades, it would look something like:
<attachment name="triggerAttachmentRemoveUpgrade" attachTo="British" javaClass="TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentAlwaysTrue"/> <option name="removeUnits" value="all:factory_upgrade" count="999"/> <option name="when" value="after:britishEndTurn"/> <!-- Needs to happen "after" --> </attachment>
Hope the is helpful.
Cheers...
-
@wc_sumpton Worked perfectly first time, thanks! And I think this is also the solution I need for my old project from 2023 to code up SiredBlood's BBR map. I was bogging down hard on the custom tech tree, which needs to be able to replace units with other units...but this should work just fine for that!
-
I remember something about you working on that map. Hopefully it is coming along ok, and we will get to see it soon!
Good luck on your projects!
Cheers...