TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    How can I change unit properties with game options?

    Scheduled Pinned Locked Moved Map Making
    13 Posts 4 Posters 2.2k Views 4 Watching
    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.
    • Jason Green-LoweJ Offline
      Jason Green-Lowe
      last edited by

      I'd like to have a game option that players can select at the start of the game, and if the box is checked, then artillery, tanks, and jeeps all get <option name="isMarine" value="-1">. The idea is that players can choose whether or not they want to have amphibious assaults with heavy equipment be penalized, just like they would choose shore bombardment options.

      I was able to create the custom game option in the map options dialog box:

      	<property name="Penalize Heavy Equipment During Amphibious Assault" value="true" editable="true">
      		<boolean/>
      	</property>
      

      And I was able to create a condition that uses gameProperty to check whether the dialog box is marked true...

      <attachment name="Penalize" attachTo="tank" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="unitType">
        <option name="gameProperty" value="Penalize Heavy Equipment During Amphibious Assault"/>
      </attachment>
      

      But I don't know what kind of trigger to use to actually add in the new stats for isMarine. The examples in POS 2 all seem to be geared around player attachments, rather than unit attachments. Any suggestions?

      F 1 Reply Last reply Reply Quote 0
      • F Offline
        ff03k64 @Jason Green-Lowe
        last edited by ff03k64

        @Jason-Green-Lowe

        		<attachment name="triggerAttachmentuniquename" attachTo="nation" javaClass="TriggerAttachment" type="player">
        			<option name="unitType" value="unit"/>
        			<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
        			<option name="unitProperty" value="isMarine" count="-1"/>
        		</attachment>	
        

        You will have to do it for each 'nation' you want it to go on. (player is just saying what kind of attachment it is)
        Value="unit" is the specific unit getting the ability. I think you can do a colon seperated list, or a variable. last two lines should stay the same i think.

        You will need a trigger condition in there too. I assume it will have something to do with the game property, but i am not sure.

        edit: will need a condition, not trigger

        1 Reply Last reply Reply Quote 2
        • B Online
          beelee
          last edited by beelee

          yea this would be the condition

          <option name="conditions" value="tank"/>

          when the option is on it'll fire

          edit oops I mean Penalize not tank 🙂

          1 Reply Last reply Reply Quote 0
          • Jason Green-LoweJ Offline
            Jason Green-Lowe
            last edited by Jason Green-Lowe

            Thanks! Seems like a good start.

            F 1 Reply Last reply Reply Quote 0
            • F Offline
              ff03k64 @Jason Green-Lowe
              last edited by

              @Jason-Green-Lowe I assume the message disappearing means you figured it out?

              1 Reply Last reply Reply Quote 1
              • Jason Green-LoweJ Offline
                Jason Green-Lowe
                last edited by

                I forgot to replace "unit" with "tank," I'm not sure it's working, but at least it's not crashing. Still testing.

                1 Reply Last reply Reply Quote 0
                • Jason Green-LoweJ Offline
                  Jason Green-Lowe
                  last edited by

                  This line is still hard for me to understand:

                  		<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
                  

                  Can you explain what that's doing?

                  1 Reply Last reply Reply Quote 0
                  • Jason Green-LoweJ Offline
                    Jason Green-Lowe
                    last edited by

                    Yeah, the code isn't throwing any errors, but it's also not having any effect -- the tank is still attacking at its normal value on amphibious assault. Not sure what's wrong. I feel like my trigger isn't adequately linked to my condition -- how does the trigger know when to go off?

                    	<attachment name="PenalizeGermanTank" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                    		<option name="gameProperty" value="Penalize Heavy Equipment During Amphibious Assault"/>
                    	</attachment>
                    	<attachment name="triggerAttachmentPenalizeGermanTank" attachTo="Germans" javaClass="TriggerAttachment" type="player">
                    		<option name="unitType" value="tank"/>
                    		<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
                    		<option name="unitProperty" value="isMarine" count="-3"/>
                    	</attachment>
                    
                    1 Reply Last reply Reply Quote 0
                    • Jason Green-LoweJ Offline
                      Jason Green-Lowe
                      last edited by

                      OK, fixed it. Thanks for the help! It's working now. It's a medium-sized pain to have to add a separate condition and trigger for each unit for each country, but I can get it done.

                      	<attachment name="PenalizeGermanTank" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
                      		<option name="gameProperty" value="Penalize Heavy Equipment During Amphibious Assault"/>
                      	</attachment>
                      	<attachment name="triggerAttachmentPenalizeGermanTank" attachTo="Germans" javaClass="TriggerAttachment" type="player">
                      	    <option name="conditions" value="PenalizeGermanTank"/>
                      		<option name="unitType" value="tank"/>
                      		<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
                      		<option name="unitProperty" value="isMarine" count="-3"/>
                      	</attachment>
                      
                      F 1 Reply Last reply Reply Quote 0
                      • F Offline
                        ff03k64 @Jason Green-Lowe
                        last edited by

                        @Jason-Green-Lowe said in How can I change unit properties with game options?:

                        OK, fixed it. Thanks for the help! It's working now. It's a medium-sized pain to have to add a separate condition and trigger for each unit for each country, but I can get it done.

                        I am guessing you will only need to use one condition for everything. And i think it would be worth trying a colon separated list for the unitType. That might help you not have to do as much. Might not either.

                        1 Reply Last reply Reply Quote 1
                        • Jason Green-LoweJ Offline
                          Jason Green-Lowe
                          last edited by

                          Different units have slightly different penalties, because I'm trying to set all the heavy equipment's attack values equal to 1. I was able to double up on the halftrack and jeep, since they both attack at 2, normally. Anyway, done now. Thanks again for the help! 🙂

                          F 1 Reply Last reply Reply Quote 2
                          • F Offline
                            ff03k64 @Jason Green-Lowe
                            last edited by

                            @Jason-Green-Lowe Good luck with the rest of it!

                            1 Reply Last reply Reply Quote 3
                            • LaFayetteL Offline
                              LaFayette Admin
                              last edited by

                              FWIW, being able to specify unit stats at the start of a game is something I've wanted to build in for some time. Having to do triggers to get the same effect is clearly a workaround, so I'm sorry you're having to go through that pain. Hopefully some time in 2021 this will be a built in feature.

                              1 Reply Last reply Reply Quote 3

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              • 1 / 1
                              • First post
                                Last post
                              Powered by NodeBB Forums