Can't get changeOwnership to work.
-
<attachment name="triggerAttachmentAnschluss" attachTo="Germans" javaClass="TriggerAttachment" type="player"> <option name="changeOwnership" value="Bregenz:Austrians:Germans:true"/> <!-- Changes the units --> <option name="changeOwnership" value="Bregenz:Austrians:Germans:false"/> <!-- Changes the territory --> <option name="when" value="after:germansCombatMove"/> <option name="uses" value="1"/> </attachment> <!-- User Actions --> <attachment name="userActionAttachmentAnschluss" attachTo="Germans" javaClass="UserActionAttachment" type="player"> <option name="text" value="Anschluss"/> <option name="chance" value="6:6"/> <option name="activateTrigger" value="triggerAttachmentAnschluss:1:true:false:false:false"/> </attachment>
As the trigger name suggests, I want to create the possiblity for Germany to "anschluss" Austria, where all Austrian territories and units become controlled by Germany, however I can't get the units to change ownership as well.
I have added "captureUnitOnEnteringBy" to the relevant territory attachments as well as "canBeCapturedOnEnteringBy" for the land units, and the property "Capture Units On Entering Territory". Not sure if that is necessary?
-
Lol it happened yet again, I found the solution just after I posted. I had to include a player attachment for Austria...
<attachment name="playerAttachment" attachTo="Austrians" javaClass="games.strategy.triplea.attachments.PlayerAttachment" type="player"> <option name="captureUnitOnEnteringBy" value="Germans"/> </attachment>
I was spending hours on this and couldn't figure it out, but I realize it 5 minutes later after I asked it here xD
-
Anyway, I have a follow-up question so this thread might be not completely useless
<option name="changeOwnership" value="Bregenz:Austrians:Germans:true"/> <!-- Changes the units --> <option name="changeOwnership" value="Central Austria:Austrians:Germans:true"/> <!-- Changes the units --> <option name="changeOwnership" value="Graz:Austrians:Germans:true"/> <!-- Changes the units --> ...
I am currently having a line for changeOwnership for every single Austrian territory. Is there a way to make this a little bit cleaned up using foreach? I tried using foreach with a variable list containing all Austrian territories but then the trigger only works for the very last territory, not for the other ones.
<attachment foreach="$Austria$" name="triggerAttachmentAnschluss" attachTo="Germans" javaClass="TriggerAttachment" type="player"> <option name="changeOwnership" value="@Austria@:Austrians:Germans:true"/> <!-- Changes the units --> <option name="changeOwnership" value="@Austria@:Austrians:Germans:false"/> <!-- Changes the territory --> <option name="when" value="after:germansCombatMove"/> <option name="uses" value="1"/> </attachment>
-
If I am reading your coding correctly, then each trigger is being named the same; "triggerAttachmentAnschluss". Because of this only one trigger will fire, all the others are over written. Include the variable name in the trigger name so that each trigger will have a unique name.
Cheers...
-
Ah OK, so you have to make it "triggerAttachmentAnschluss@Austria@"?
-