Buying Tech as Units
-
I'm cleaning up and advancing Jurassic. Evolution seems more appropriate for dinosaurs than Technology Development. It controls the order of advancement. I'm very close to making it happen through productionFrontiers but have a couple glitches that need your guidance. The evolution will show up as a Unit for purchase but it cannot be placed and must disappear.
One productionFrontier for all is preferred, but can make one for each player if necessary.
<productionFrontier name="production"> <frontierRules name="buyPterodactylus"/> ... <frontierRules name="buyFeathers"/> </productionFrontier> <productionFrontier name="productionFeathered"> <frontierRules name="buyPterodactylusFeathered"/> ... </productionFrontier>This is my first attempt writing a trigger. The complication is the unit count potentially messing up other game features. Can the conditionAttachment be ignored and the triggerAttachment activated from the purchase? If not, can the unit count be set to zero by the trigger? Thus, making the phantom unit vanish, while the productionFrontier gets changed.
<attachment name="conditionAttachmentCallovianFeathers" attachTo="Callovian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="unit" value="feathers" count="1"/> </attachment> <attachment name="triggerAttachmentCallovianFeathers" attachTo="Callovian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentCallovianFeathers"/> <option name="frontier" value="productionFeathered"/> <option name="unit" value="feathers" count="0"/> </attachment>The productionRule only reports a Result parameter in POS2.
<productionRule name="buyFeathers"> <cost resource="PUs" quantity="100"/> <result resourceOrUnit="feathers" quantity="1"/> <option name="maxBuiltPerPlayer" value="1"/> </productionRule>That should satisfy the Callovian Evolution condition and activate the trigger, but it needs to delete the feathers-unit purchased. OR, launch the trigger directly at time of purchase.
<productionRule name="buyCallovianFeathers"> <cost resource="PUs" quantity="100"/> <option name="activateTrigger" value="triggerAttachmentCallovianFeathers"/> </productionRule>This has to be close. It bypasses the rigid built-in tech advancements, and allows for orderly evolution if so desired. Note the old entities (unfeathered air units) still exist, but can no longer be purchased with the new productionFrontier; nor can feathers, a different purchasable evolution will take it's place.
-
@gregorek said in Buying Tech as Units:
It controls the order of advancement. I'm very close to making it happen through productionFrontiers but have a couple glitches that need your guidance.
Check "Age of Tribes" developed by @Frostion. Tech is done through purchasing and should have most of what you are looking for.
I would suggest reviewing that xml. Questions are always welcome.
Cheers...
-
@GREGOREK
1888A Steal & Steam builds on Age of Tribes to show
+Tech uses isSea & isAir so AI will target its Tech advances if it needs Sea or Air
+Tech advances are shown on Tech grid on Players tab
+Display grouping, Tech is prefixed with _DevL, _DevA, _DevS (Land, Air, Sea)Tech Tree shows the dependencies

-
@wc_sumpton , @TheDog ,
Thank you for the reply. AgeOfTribes was incredibly detailed and on reflection POS2 had everything needed also. Turned out to be very easy: Each player gets it's own production frontier. I chose the replacement path versus adding/removing rules. The trick was placing the tech-object on the map and immediately consuming it after Place step.
<attachment name="conditionAttachmentHettangianE1" attachTo="Hettangian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="map" count="1"/> <option name="unitPresence" value="feathers" count="1"/> </attachment> <attachment name="triggerAttachmentHettangianE1" attachTo="Hettangian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentHettangianE1"/> <option name="when" value="after:HettangianPlace"/> <option name="frontier" value="productionHettangianE1"/> <option name="removeUnits" value="all:feathers" count="1"/> <option name="uses" value="1"/> </attachment> -
Nice, tested and works.
@gregorek said in Buying Tech as Units:
I chose the replacement path versus adding/removing rules.
That's okay if you're only doing a couple of evolutions and each evolution updates most/all units. But doing more than 3 or 4 might make the production harder to manage.
As always, we are to help.
Cheers...
-
How's it going? @TheDog is great at using variables and for each and this process is a good candidate.
<variableList> <!-- This is a list of players minus Tithonian --> <variable name="GamePlayers"> <element name="Kimmeridgian"/> <element name="Oxfordian"/> <element name="Callovian"/> <element name="Bathonian"/> <element name="Bajocian"/> <element name="Aalenian"/> <element name="Toarcian"/> <element name="Pliensbachian"/> <element name="Sinemurian"/> <element name="Hettangian"/> </variable> <!-- A list of evolutions --> <variable name="Evolutions"> <element name="feathers"/> </variable> <!-- The unit effected by the above evolution --> <variable name="RemovedUnit"> <element name="pterodactylus"/> </variable> <!-- Unit created by the above evolution --> <variable name="AddedUnit"> <element name="pterodactylusFeathered"/> </variable> </variableList> <!-- This list is positioned above the <map> section --> <map> <!-- Territory Definitions --> <territory name="Da"/> <territory name="Db"/> <territory name="Dc"/> ... </mapNow some trigger ideas.
<!-- Check the whole map for evolutions by player --> <!-- $GamePlayers$ is the list of players --> <!-- $Evolutions$ is the list of evolutions --> <!-- The joining "^" create statements for each player and each evolution --> <!-- @GamePlayers@ and @Evolutions@ takes the next value from each list --> <attachment foreach="$GamePlayers$^$Evolutions$" name="conditionAttachment_@GamePlayers@_@Evolutions@" attachTo="@GamePlayers@" javaClass="RulesAttachment" type="player"> <option name="directPresenceTerritories" value="map" count="1"/> <option name="unitPresence" value="@Evolutions@" count="1"/> </attachment> <!-- The joining ":" create statements for each evolution with AddedUnit and RemovedUnit --> <!-- So, this will only work as long there is a one to one relationship between values in each list --> <attachment foreach="$GamePlayers$^$Evolutions$:$AddedUnit$:$RemovedUnit$" name="triggerAttachment_@GamePlayers@_@Evolutions@_@AddedUnit@" attachTo="Kimmeridgian" javaClass="TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_@GamePlayers@_@Evolutions@"/> <!-- Adds AddedUnit to production --> <option name="productionRule" value="@GamePlayers@Production:buy@AddedUnit@"/> <!-- Removes RemovedUnit and Evolutions from production --> <option name="productionRule" value="@GamePlayers@Production:-buy@RemovedUnit@"/> <option name="productionRule" value="@GamePlayers@Production:-buy@Evolutions@"/> <!-- Removes Evolutions unit --> <option name="removeUnits" value="all:@Evolutions@" count="1"/> <!-- To be done after the place phase. Maybe? --> <option name="when" value="after:@GamePlayers@Place"/> <option name="uses" value="1"/> </attachment>The above will create the following;
<attachment name="conditionAttachment_Kimmeridgian_feathers" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Oxfordian_feathers" attachTo="Oxfordian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Callovian_feathers" attachTo="Callovian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Bathonian_feathers" attachTo="Bathonian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Bajocian_feathers" attachTo="Bajocian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Aalenian_feathers" attachTo="Aalenian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Toarcian_feathers" attachTo="Toarcian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Pliensbachian_feathers" attachTo="Pliensbachian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Sinemurian_feathers" attachTo="Sinemurian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="conditionAttachment_Hettangian_feathers" attachTo="Hettangian" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="1:map"/> <option name="unitPresence" value="1:feathers"/> </attachment> <attachment name="triggerAttachment_Kimmeridgian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Kimmeridgian_feathers"/> <option name="productionRule" value="KimmeridgianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="KimmeridgianProduction:-buypterodactylus"/> <option name="productionRule" value="KimmeridgianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:KimmeridgianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Oxfordian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Oxfordian_feathers"/> <option name="productionRule" value="OxfordianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="OxfordianProduction:-buypterodactylus"/> <option name="productionRule" value="OxfordianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:OxfordianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Callovian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Callovian_feathers"/> <option name="productionRule" value="CallovianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="CallovianProduction:-buypterodactylus"/> <option name="productionRule" value="CallovianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:CallovianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Bathonian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Bathonian_feathers"/> <option name="productionRule" value="BathonianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="BathonianProduction:-buypterodactylus"/> <option name="productionRule" value="BathonianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:BathonianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Bajocian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Bajocian_feathers"/> <option name="productionRule" value="BajocianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="BajocianProduction:-buypterodactylus"/> <option name="productionRule" value="BajocianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:BajocianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Aalenian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Aalenian_feathers"/> <option name="productionRule" value="AalenianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="AalenianProduction:-buypterodactylus"/> <option name="productionRule" value="AalenianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:AalenianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Toarcian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Toarcian_feathers"/> <option name="productionRule" value="ToarcianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="ToarcianProduction:-buypterodactylus"/> <option name="productionRule" value="ToarcianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:ToarcianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Pliensbachian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Pliensbachian_feathers"/> <option name="productionRule" value="PliensbachianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="PliensbachianProduction:-buypterodactylus"/> <option name="productionRule" value="PliensbachianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:PliensbachianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Sinemurian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Sinemurian_feathers"/> <option name="productionRule" value="SinemurianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="SinemurianProduction:-buypterodactylus"/> <option name="productionRule" value="SinemurianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:SinemurianPlace"/> <option name="uses" value="1"/> </attachment> <attachment name="triggerAttachment_Hettangian_feathers_pterodactylusFeathered" attachTo="Kimmeridgian" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Hettangian_feathers"/> <option name="productionRule" value="HettangianProduction:buypterodactylusFeathered"/> <option name="productionRule" value="HettangianProduction:-buypterodactylus"/> <option name="productionRule" value="HettangianProduction:-buyfeathers"/> <option name="removeUnits" value="1:all:feathers"/> <option name="when" value="after:HettangianPlace"/> <option name="uses" value="1"/> </attachment>To add another Evolution, "spike_tail" for ankylosaurus to create ankylosaurusSpikedTail, spike_tail would be added to Evolutions and ankylosaurus added to RemovedUnit and ankylosaurusSpikedTail to AddUnit.
Of course, "spike_tail" and ankylosaurusSpikedTail would need to be added to units, production and attachments.Hope this is helpful.
Cheers...
P.S. foreach can only be used in the <attachmentList> section. In "mega_new_elk" I use foreach to create the territoryAttachment. This can also be done with unitAttachment and Evolutions.
<attachment foreach="$Evolutions$" name="unitAttachment" attachTo="@Evolutions@" javaClass="UnitAttachment" type="unitType"> <option name="maxBuiltPerPlayer" value="1"/> </attachment>Cheers...
-
@wc_sumpton said in Buying Tech as Units:
How's it going? @TheDog is great at using variables and for each and this process is a good candidate.
It certainly is!.
My use of foreach all stemmed from Shogun Advanced politics, it started out with 8 players then expanded piecemeal to a final 15 players. Along the way I learnt how to use Foreach and cut thousands of line of code to hundreds.
. Adding the 10th or 11th+ player was not a chore any more. 
-
@thedog said in Buying Tech as Units:
Adding the 10th or 11th+ player was not a chore any more.
This is why I pointed to you. I've learned a lot just by reading your xmls.
@gregorek said in Buying Tech as Units:
I chose the replacement path versus adding/removing rules.
If you still want to do it this way, then create a frontier for each evolution:
<productionFrontier name="production"> <frontierRules name="buytyrannosaurus"/> <frontierRules name="buystegosaurus"/> <frontierRules name="buytriceratops"/> <frontierRules name="buyankylosaurus"/> <frontierRules name="buycoelophysis"/> <frontierRules name="buyiguanodon"/> <frontierRules name="buypachycephalosaurus"/> <frontierRules name="buyornithomimus"/> <frontierRules name="buyplateosaurus"/> <frontierRules name="buyparasaurolophus"/> <frontierRules name="buypterodactylus"/> <frontierRules name="buysharovipteryx"/> <frontierRules name="buytylosaurus"/> <frontierRules name="buyliopleurodon"/> <frontierRules name="buydiplodocus"/> </productionFrontier> <productionFrontier name="feathersProduction"> <frontierRules name="buytyrannosaurus"/> <frontierRules name="buystegosaurus"/> <frontierRules name="buytriceratops"/> <frontierRules name="buyankylosaurus"/> <frontierRules name="buycoelophysis"/> <frontierRules name="buyiguanodon"/> <frontierRules name="buypachycephalosaurus"/> <frontierRules name="buyornithomimus"/> <frontierRules name="buyplateosaurus"/> <!-- <frontierRules name="buyparasaurolophus"/> Removed for feathers evolution --> <frontierRules name="buypterodactylusFeathered"/> <!-- added for feathers evolution --> <frontierRules name="buypterodactylus"/> <frontierRules name="buysharovipteryx"/> <frontierRules name="buytylosaurus"/> <frontierRules name="buyliopleurodon"/> <frontierRules name="buydiplodocus"/> </productionFrontier>Now change the trigger to swap frontiers:
<attachment foreach="$GamePlayers$^$Evolutions$" name="triggerAttachment_@GamePlayers@_@Evolutions@" attachTo="Kimmeridgian" javaClass="TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_@GamePlayers@_@Evolutions@"/> <!--Change to Evolutions frontier --> <option name="frontier" value="@Evolutions@Production"/> <!-- Removes Evolutions unit --> <option name="removeUnits" value="all:@Evolutions@" count="1"/> <!-- To be done after the place phase. Maybe? --> <option name="when" value="after:@GamePlayers@Place"/> <option name="uses" value="1"/> </attachment>And there you go. You would still need GamePLayers and Evolutions but not AddUnit and RemoveUnit.
Cheers...