Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    limiting production of a unit for the whole game

    Map Making
    2
    2
    188
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      Numetalfan last edited by

      I want a unit to be build only once or a few times in a game, doesn't matter by whom.
      reaching that limit auf builds should end this production option forever for everyone

      an example would be:

      Switzerland is neutral with a factory
      who captures Switzerland will get the mountain troops via a trigger, e.G. for Germany
      ..
      <option name="productionRule" value="productionGermany:mountain troops"/>
      ...
      I want to have a total limit of 3 units of those mountain troops to be build in the whole game.

      let's say Germany captures Switzerland and builds all 3 of them
      later Switzerland captured by UK. How do I prevent that UK also builds those units?

      So any <option name='uses' value='1'/> will not help.
      It limits one nation (e.g. Germany), while another one (Italy) can still use it.

      same with <option name='maxBuiltPerPlayer' value='1'/>
      that will also limits only one nation.

      <option name='unitPresence' value='mountain troops' count='1'/>
      on the whole map is also useless, the 3 build units might have been taken as casualities in a battle, so this would allow to build new ones.

      I need a variable that is 0 at the start of the game and will finally reach 3.
      So I could make a condition out of it.

      Any Idea how to solve this this?

      W 1 Reply Last reply Reply Quote 0
      • W
        wc_sumpton @Numetalfan last edited by

        @numetalfan

        Not to hard. I would use a 'switch' condition to insure that only one player received the captured unit, and a limited 'resource' to build that captured unit.

        <!-- Add to the resourceList -->
        <resourceList>
           ...
           <resource name="CapturedMountainTroops"/>
        </resourceList>
        <!-- Add to production -->
        <production>
           ...
           <productionRule name="buyCapturedMountainTroops">
              <cost resource="PUs" quantity="4" />
              <cost resource="CapturedMountainTroops" quantity="1"/>
              <result resourceOrUnit="Mountain troops" quantity="1"/>
           </productionRule>
           ...
        </production>
        
        <!-- The 'switch' trigger -->
        <attachment name="conditionAttachmentCapturedMountainTroops" attachTo="Switzerland" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
           <option name="switch" value="true"/>
        </attachment>
        
        <!-- If  Germany captures the factory -->
        <attachment name="triggerAttachmentGermanyCapturesSwisFactory"attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
           <!-- Add 'switch' conditions -->
           <option name="conditions" value="...:conditionAttachmentCapturedMountainTroops"/>
           <!-- Give Germany 3 resources -->
           <option name="resource" value="CapturedMountainTroops"/>
           <option name="resourceCount" value="3"/>
           <!-- Change 'switch' to false -->
           <option name="playerAttachmentName" value="RulesAttachment" count="conditionAttachmentCapturedMountainTroops"/>
           <option name="playerProperty" value="switch" count="false"/>
        </attachment>
        

        Because every player should check the same 'switch' once its false it will block all other players and the resource will insure only a certain amount of units will be built.

        Next...

        Cheers...

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums