Condition counting the exact number of units in a territory?
-
Second question (I thought it is better to open another post, please let me know if I am wrong)
I use many occurences of conditions testing the exact number of units. But I had to write a lot of conditions to have it working. Example:
<attachment foreach="$Integer$" name="conditionAttachment_Player_Has_@Integer@_Unit" attachTo="Player" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="Territory"/> <option name="unitPresence" value="unit" count="@Integer@"/> </attachment> ... <attachment foreach="$Integer$" name="conditionAttachment_Player_Does_Not_Have_@Integer@_Unit" attachTo="Player" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="conditions" value="conditionAttachment_Player_Has_@Integer@_Unit"/> <option name="invert" value="true"/> </attachment>
Which seemed necessary to test then:
<attachment name="conditionAttachment_Player_Has_Exactly_5_Unit" attachTo="Player" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="conditions" value="conditionAttachment_Player_Has_5_Unit:conditionAttachment_Player_Does_Not_Have_6_Unit"/> </attachment>
Do you see another (lighter) way?
Thanks!
-
@azimuth
Download this map, it might have something of interest, it is by one of Devs.
imperialism_1974_board_gameSearch for ^ = Nesting to produce an array amongst other things
-
@thedog Thank you, interesting features.
But no, unfortunately, doesn't solve my question.
-
this topic was helpful to me in sorting out an objective i had in mind albeit in a different way... so thanks!
what i wanted was an objective that gave +X PUs / Y units. instead i went with +1PU for each territory with at least 4 of a specific unit:
<!-- Martians Objectives --> <!-- Marsforming: +1PU for each territory with at least 4 redweed --> <attachment name="objectiveAttachmentMarsforming" attachTo="Martians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="objectiveValue" value="1"/> <option name="directPresenceTerritories" value="map" count="each"/> <option name="unitPresence" value="redweed" count="4"/> </attachment>
so what i'd like to know is could i have done it as i'd originally intended? ie can i get the game to count all of a specific unit type controlled by a player on the map and do something with it?
in particular i was thinking of a Martian Victory Condition that triggers if they have 50 (or probably more?) redweed units on the map...
btw redweed is just a martian land version of Nemo Pirates' kelp farms - A0/D0/M0 unit that free spawns (1/turn) from another unit. (yeah, i'm still messing about with the Steampunk map)sorry for the babble; i was hoping that context might make things clearer; but probably did the opposite...
-
@cameron said in Condition counting the exact number of units in a territory?:
so what i'd like to know is could i have done it as i'd originally intended? ie can i get the game to count all of a specific unit type controlled by a player on the map and do something with it?
Sorry, this has been asked many times. You can count the territories, ie; directPresenceTerritories=map=50, unitPresence=any=1 would tell you if there were 50 territories with units, but you can't count for 50 units on the map.
Again sorry.
Cheers...
-
bah. oh well. thanks for the reply.
-
@cameron As I stated in my opening post, I was looking for a lighter way. But I think you can achieve what you want, but with a lot of variables and triggers.
- You need $Territories$ with the list of territories where your redweed can appear (hopefully not all map territories, hence it is possible)
- You need $Integer$ with the list of integers (from 1 to... the max build cap - mandatory to have one)
- You need a specific territory (can be out of the map) where to pile, let's say, Victory Points (VPs) a specific unit.
Then you need conditions checking for each integer and each territory (see my examples above) the number of redweed per territory.
Then you need triggers that place VPs into the selected territory.
And finally you make an objective checking the number of VPs in the selected territory.
Not sure it is worth it. But theoretically possible.
-
@azimuth
[[laughs]] that sounds like a nightmare. i feel like the objective for it would end up being 80+% of the xml file... (not ALL the territories - just the land ones...)
i'll most likely be the only person who ever plays this mod and i tend to ignore victory triggers anyway - i'm a conquer the whole world kinda player.