Change maxBuiltPerPlayer by a trigger
-
At the start of the game, the Axis powers have only one truck available to them (reflected by <option name="maxBuiltPerPlayer" value="1"/>)
<attachment name="unitAttachment" attachTo="axis-truck" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="movement" value="2"/> <option name="attack" value="0"/> <option name="defense" value="0"/> <!-- <option name="canBeDamaged" value="true"/> --> <!-- <option name="maxDamage" value="1"/> --> <!-- <option name="canDieFromReachingMaxDamage" value="true"/> --> <option name="isLandTransport" value="true"/> <option name="transportCapacity" value="6"/> <option name="isLandTransportable" value="false"/> <option name="isInfrastructure" value="true"/> <option name="isAAmovement" value="true"/> <option name="destroyedWhenCapturedBy" value="British:Americans"/> <option name="isConstruction" value="true"/> <option name="constructionsPerTerrPerTypePerTurn" value="1"/> <option name="maxConstructionsPerTypePerTerr" value="1"/> <option name="maxBuiltPerPlayer" value="1"/> <option name="constructionType" value="axis-truck"/> </attachment>At the start of round 7, the axis power should have an extra truck available. So the value needs to change to 2. Is it possible to do so via a trigger?
-
@victoryfirst
Maybe, try the following in a trigger with a condition<option name="unitType" value="axis-truck"/> <option name="unitProperty" value="maxBuiltPerPlayer" count="2"/> <option name="uses" value="1"/> -
Hi Victory
If what the Dog suggested doesn't work try adding "UnitAttachmentName" to the trigger. Idk if it's needed but that's always the way I have done it.

So the above takes a defend zero Transport and makes it defend at 1. Should just be able to swap in the max built unitAttachment. And have a condition for whatever rd you want it to fire.
You might want to set it to rd 2 for testing

-
@beelee It worked!!
<attachment name="triggerAttachmentAxisTruckLateWar" attachTo="Germans" javaClass="TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentRound7"/> <option name="unitType" value="axis-truck"/> <option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/> <option name="unitProperty" value="maxBuiltPerPlayer" count="2"/> <option name="uses" value="1"/> <option name="when" value="before:americansPurchase"/> </attachment>
-
@victoryfirst Could this be used to change any value on an unit attachment? Potentially very useful.
For example, in Axis & Allies: Pacific, Commonwealth and American units have a defense strength of one on the first turn. They could start 1 and then be upgraded to their regular values at the end of the Japanese turn.
-
@rogercooper said in Change maxBuiltPerPlayer by a trigger:
Could this be used to change any value on an unit attachment?
I believe so. I have used it for many different changes. It's in POS2

Not very detailed but redrum and hepps helped me figure it out and I just copied hepps stuff.

Veqryn really did an amazing job with POS2.
-
@rogercooper said in Change maxBuiltPerPlayer by a trigger:
Could this be used to change any value on an unit attachment?
I believe so. I have used it for many different changes. It's in POS2

Not very detailed but redrum and hepps helped me figure it out and I just copied hepps stuff.
Veqryn really did an amazing job with POS2.
Edit
lol double post. Wouldn't let me delete.Well veqryn deserves double recognition lol
-
@beelee You can edit your post and delete everything and then type "this post is deleted". That's what I always do

-
<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>Btw I must say that I love this line. It makes no sense at all lol
-
@rogercooper I was planning to work on an improved module for A&A Pacific. The_Good_Captain made a detailed bug report for that game. Were you planning to work on it as well or did you already start working on it? Perhaps we could do it together.
-
@victoryfirst said in Change maxBuiltPerPlayer by a trigger:
@rogercooper I was planning to work on an improved module for A&A Pacific. The_Good_Captain made a detailed bug report for that game. Were you planning to work on it as well or did you already start working on it? Perhaps we could do it together.
Go ahead on that mod. I am working on a different project East & West. Of course, I will be happy to help if you run into any problems.
One thing I am planning on doing with future mods is to include a standardized version using the v3 or v5 rules to make the game easier for casual players.