Neutral joins opposing alliance
-
I'm modifying NWO, trying to find a way to get a neutral country (for example Greece and S.Greece make up the country of 'Greece', all the territories that made up pre-war Yugoslavia would make up the country of 'Yugoslavia'), if attacked by one alliance, to join the opposing alliance. Basically for example, if italians captured Kroatia, then Bosnia, Serbia and Macedonia would switch from Neutral to British control and the neutral infantry would be removed and an equivalent number of British infantry would be placed. On the other hand if Allies attacked first, the German player would get the other territories/units. I want to make it less attractive to attack neutral countries, at least unless the attacker is willing to come with overwhelming strength.
This is the XML:
<attachment name="conditionAttachmentGreeceWillJoinAxis" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directExclusionTerritories" value="Greece" count="1"/> <option name="alliedExclusionTerritories" value="Greece" count="1"/> <option name="enemyExclusionTerritories" value="Greece" count="1"/> <option name="enemyPresenceTerritories" value="S.Greece" count="1"/> </attachment> <attachment name="conditionAttachmentGreeceWillJoinAllies" attachTo="British" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directExclusionTerritories" value="Greece" count="1"/> <option name="alliedExclusionTerritories" value="Greece" count="1"/> <option name="enemyExclusionTerritories" value="Greece" count="1"/> <option name="enemyPresenceTerritories" value="S.Greece" count="1"/> </attachment> <attachment name="conditionAttachmentS.GreeceWillJoinAxis" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directExclusionTerritories" value="S.Greece" count="1"/> <option name="alliedExclusionTerritories" value="S.Greece" count="1"/> <option name="enemyExclusionTerritories" value="S.Greece" count="1"/> <option name="enemyPresenceTerritories" value="Greece" count="1"/> </attachment> <attachment name="conditionAttachmentS.GreeceWillJoinAllies" attachTo="British" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directExclusionTerritories" value="S.Greece" count="1"/> <option name="alliedExclusionTerritories" value="S.Greece" count="1"/> <option name="enemyExclusionTerritories" value="S.Greece" count="1"/> <option name="enemyPresenceTerritories" value="Greece" count="1"/> </attachment> <attachment name="triggerAttachmentGermansGreeceJoinsAxis" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="trigger" value="conditionAttachmentGreeceWillJoinAxis"/> <option name='changeOwnership' value="Greece:Neutral:Germans:false"/> <option name="removeUnits" value="Greece:all"/> <option name="placement" value="Greece:Infantry:8"/> </attachment> <attachment name="triggerAttachmentBritishGreeceJoinsAllies" attachTo="British" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="trigger" value="conditionAttachmentGreeceWillJoinAllies"/> <option name='changeOwnership' value='Greece:Neutral:British:false'/> <option name="removeUnits" value="Greece:all"/> <option name="placement" value="Greece:Infantry:8"/> </attachment> <attachment name="triggerAttachmentGermansS.GreeceJoinsAxis" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="trigger" value="conditionAttachmentS.GreeceWillJoinAxis"/> <option name='changeOwnership' value="S.Greece:Neutral:Germans:false"/> <option name="removeUnits" value="S.Greece:all"/> <option name="placement" value="S.Greece:Infantry:1"/> </attachment> <attachment name="triggerAttachmentBritishS.GreeceJoinsAllies" attachTo="British" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="trigger" value="conditionAttachmentS.GreeceWillJoinAllies"/> <option name='changeOwnership' value='S.Greece:Neutral:British:false'/> <option name="removeUnits" value="S.Greece:all"/> <option name="placement" value="S.Greece:Infantry:1"/> </attachment>
When I try to run the mod I get the following error:
GameParseException: map name: 'file:/C:/Users/Linda/triplea/downloadedMaps/nwo_one_round_combat/map/games/nwo_one_round_combat.xml', game name: 'nwo_one_round_combat', Unexpected Exception while setting values for attachment: TriggerAttachment attached to: PlayerId named:Germans with name: triggerAttachment_GermansGreeceJoinsAxis
I have no other conditions or triggers named the same as these. I have Use Triggers set to "true".
There is probably something with politics I am supposed to do but I don't yet understand politics very well and I thought I could just do something simple where if any one of a colon-delineated list becomes conquered by one side and a given territory is still neutral it would be transfered to the control of the other side.
Thanks for any help
-
Hi @andrewthree
This is from World War II Global 1940 2nd Edition
<attachment name="conditionAttachment_False" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="switch" value="false"/>
</attachment>This still a little confusing to me how it all works but basically the "conditionAttachmentFalse" acts as an on/off switch. It's attached to the "Germans" who go first, so I guess try attaching it to the first player in WAW for starters.
<attachment name="conditionAttachment_Mongolia_May_Change_To_Russians_Control_Switch" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="conditions" value="conditionAttachment_Mongolia_Not_At_War_With_Allies"/>
<option name="switch" value="true"/>
</attachment>I didn't list the condition for this one but "conditionAttachment_Mongolia_May_Change_To_Russians_Control_Switch" means if the Allies aren't at war with Mongolia it can be activated when it's conditions are met.
<attachment name="conditionAttachment_Russians_Conquer_Japanese_Territory_By_Mongolia" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="battle" value="Russians:Japanese:any:currentRound:Manchuria:Jehol:Chahar:Suiyuyan:Kansu:Korea"/>
</attachment>This does it a little different than what you have. "battle" means those territories just need to be attacked. Doesn't need to be conquered.
<attachment name="triggerAttachment_Russians_Conquer_Japanese_Territory_By_Mongolia" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachment_Russians_Conquer_Japanese_Territory_By_Mongolia"/>
<option name="when" value="after:russiansBattle"/>
<option name="uses" value="1"/>
<option name="players" value="Russians"/>
<option name="playerAttachmentName" value="RulesAttachment" count="conditionAttachment_Mongolia_May_Change_To_Russians_Control_Switch"/>
<option name="playerProperty" value="switch" count="false"/>
</attachment>This part is still a bit confusing as well for me but I think <option name="playerAttachmentName" value="RulesAttachment" activates the first switch "conditionAttachment_False" if conditionAttachment_Russians_Conquer_Japanese_Territory_By_Mongolia" is true.
<attachment name="triggerAttachment_Japanese_Conquer_Russians_Territory_By_Mongolia_2" attachTo="Japanese" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_False"/> <option name="when" value="before:japaneseNonCombatMove"/> <option name="uses" value="1"/> <option name="changeOwnership" value="Olgiy:Mongolians:Russians:true"/> <option name="changeOwnership" value="Dzavhan:Mongolians:Russians:true"/> <option name="changeOwnership" value="Tsagaan Olom:Mongolians:Russians:true"/> <option name="changeOwnership" value="Central Mongolia:Mongolians:Russians:true"/> <option name="changeOwnership" value="Buyant-Uhaa:Mongolians:Russians:true"/> <option name="changeOwnership" value="Ulaanbaatar:Mongolians:Russians:true"/> </attachment>
So now that "conditionAttachment_False" is activated, the trigger changes Ownership.
<attachment name="triggerAttachment_Japanese_Conquer_Russians_Territory_By_Mongolia_3" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachment_Japanese_Conquer_Russians_Territory_By_Mongolia"/>
<option name="when" value="after:japaneseNonCombatMove"/>
<option name="uses" value="1"/>
<option name="removeUnits" value="Ulaanbaatar:infantry" count="1"/>
<option name="removeUnits" value="Buyant-Uhaa:infantry" count="2"/>
<option name="removeUnits" value="Olgiy:infantry" count="2"/>
<option name="removeUnits" value="Dzavhan:infantry" count="1"/>
<option name="placement" value="Ulaanbaatar:Russian_infantry" count="1"/>
<option name="placement" value="Buyant-Uhaa:Russian_infantry" count="2"/>
<option name="placement" value="Olgiy:Russian_infantry" count="2"/>
<option name="placement" value="Dzavhan:Russian_infantry" count="1"/>
</attachment>And now they change units. Also you want to use "conditions" not "trigger" for <option name="trigger"
At any rate, what this all means is, if Mongolia is not at war with the Allies and Japan attacks one of the listed Territories, Mongolia will turn into Russian Territories and units.
Hope it's not oo confusing. I think I confused myself already