Subcategories

Recent Posts

  • @wc_sumpton said in Problem with foreach:

    @rogercooper

    variableList section is within attachmentList section. variableList needs its own section like resourceList, playerList, unitList.
    Most xml's have variableList section at the top prior to the map section.

    Cheers...

    Thank you for your help. That fixed it.

    read more
  • W

    @rogercooper

    variableList section is within attachmentList section. variableList needs its own section like resourceList, playerList, unitList.
    Most xml's have variableList section at the top prior to the map section.

    Cheers...

    read more
  • I am receiving the error

    GameParseException: Attachment has invalid variables in foreach: $NeutralArea$

    Does anyone see an error?

    <variableList> <variable name="MajorPower"> <element name="Britain"/> <element name="Soviet_Union"/> <element name="United_States"/> <element name="Western_Europe"/> </variable> <variable name="NewUnit"> <element name="aaGun1"/> <element name="APC"/> <element name="bomber_lr"/> <element name="fighter_jp"/> <element name="fighter_lr"/> <element name="fission_bomb"/> <element name="fusion_bomb"/> <element name="heavy_armor"/> <element name="heavy_transport"/> <element name="marine"/> <element name="nuclear_carrier"/> <element name="radar_cruiser"/> <element name="self-propelled_artillery"/> <element name="special_forces"/> <element name="submarine1"/> <element name="submarine2"/> <element name="submarine3"/> </variable> <variable name="NeutralArea"> <element name="Afghanistan"/> <element name="Borneo/Celebes"/> <element name="Ethiopia"/> <element name="Finland"/> <element name="Iran"/> <element name="Ireland"/> <element name="Java"/> <element name="Rio de Oro"/> <element name="Spain"/> <element name="Sumatra"/> <element name="Sweden"/> <element name="Switzerland"/> <element name="Thailand"/> <element name="Tibet"/> </variable> </variableList> <!-- <attachment name="conditionAttachmentIrelandNon_Aligned" attachTo="Non_Aligned" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directOwnershipTerritories" value="Ireland" count="1"/> </attachment> --> <attachment foreach="$NeutralArea$" name="conditionAttachment@NeutralArea@Non_Aligned" attachTo="Non_Aligned" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directOwnershipTerritories" value="@NeutralArea@" count="1"/> </attachment> Note that commented out code works.

    read more
  • W

    @RogerCooper

    The second method is to take control of another players units.
    Screenshot 2026-03-06 153311.png
    To let Germany take control of the 4 units in Bulgaria and the one unit in Varna.
    In the unitAttachment for infantry add <option name="canBeCapturedOnEnteringBy" value="Germans"/>.
    In the territoryAttachment for Bulgaria and Varna add <option name="captureUnitOnEnteringBy" value="Germans"/>.
    In the playerAttachment for Neutral_Player add <option name="captureUnitOnEnteringBy" value="Germans"/>.
    And set <property name="Capture Units On Entering Territory" value="true"/>.
    Then this <option name="changeOwnership" value="Bulgaria:any:Germans:true"/> in a trigger, the 'when' can be any step.
    After Germany's noncombat move.
    Screenshot 2026-03-06 171112.png
    The 4 units changed, but not factory or the Territory and because Germany moved into Varna during noncombat the unit and territory does not change.
    Adding <option name="canTakeOverOwnedTerritory" value="true"/> to the relationshipTypeAttachment between Germany and Neutral_Player to get this.
    Screenshot 2026-03-06 154000.png
    Control of the units happens on the 'true' setting of 'changeOwnership' and changes at the 'when'.

    Cheers...

    read more