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

    Open a Dialog Box when event triggers?

    Scheduled Pinned Locked Moved Map Making
    20 Posts 6 Posters 2.7k Views 6 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.
    • alkexrA Offline
      alkexr @Jason Green-Lowe
      last edited by

      @Jason-Green-Lowe Do you have this?

      <property name="Use Triggers" value="true" editable="false">
            <boolean/>
      </property>
      

      "For the world is changing: I feel it in the water, I feel it in the earth, and I smell it in the air."

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

        Yup! Made that mistake (and fixed it) two features ago. Thanks, though.

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

          @Jason-Green-Lowe said in Open a Dialog Box when event triggers?:

          More importantly, no dialog box is popping up at all -- so it's not just that there is no effect when the user chooses option A, it's also that the user is not even being presented with a choice to make.

          Do you have the dialog in notifications.properties as well ?

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

            Yes, I've got the dialog in notifications.properties.

            1 Reply Last reply Reply Quote 0
            • wc_sumptonW Offline
              wc_sumpton
              last edited by

              @Jason-Green-Lowe

              Just guessing here but one of the problems might be in when the 'userActionAttachment' trigger are fires. The 'germanUserActions' delegate should be just before 'germanEndTurn' because the endTurn delegate might be clearing the 'battle' flag.

              Also if German, Italian relationship changes is set to 'Allied' with 'givesBackOriginalTerritories' equals 'true' then German never control Rome because once the territory is liberated, Italy will assume control of the territory.

              How to test what is happening. Run you map, and give Rome control to an enemy of Italy. On Germany's turn stage the battle so that German will win. If the color changes to Italy then condition 'German have 'directOwnershipTerritories' of Rome' will be false and the userAction will not fire.

              Hope this explains what is happening, and give you some ideas on how you might fix them.

              Cheers...

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

                @wc_sumpton I think you've identified a key part of the problem; Italy returns to Italian control immediately before the userAction has a chance to trigger. My UserActions delegate is in a good place, but it's never true that Germans have direct ownership of Rome, so the condition is never passed.

                I've re-written the condition to be based on the presence of units during the combatMove, but I'm getting an error message and I'm not sure why.

                	<attachment name="conditionAttachment_Rome_Occupied_By_Enemy" attachTo="Germans" javaClass='RulesAttachment' type='player'>
                		<option name="alliedOwnershipTerritories" value="Rome" count="1"/>
                		<option name="invert" value="true"/>
                	</attachment>
                	
                	<attachment name="conditionAttachment_Germans_Liberate_Rome" attachTo="Germans" javaClass='RulesAttachment' type='player'>
                		<option name="conditions" value="conditionAttachment_Rome_Occupied_By_Enemy"/>
                		<option name="directPresenceTerritories" value="Rome"/>
                		<option name="unitPresence" value="infantry:commando:artillery:tank:jeep:halftrack:flak"/>
                	</attachment>
                	
                	<attachment name="conditionAttachment_Germans_Keep_Italian_Territories" attachTo="Germans" javaClass='RulesAttachment' type='player'>
                		<option name='switch' value='true'/>
                	</attachment>
                	
                	<attachment name='triggerAttachment_Germans_Keep_Italian_Territories' attachTo='Germans' javaClass='TriggerAttachment' type='player'>
                		<option name='conditions' value='conditionAttachment_Germans_Liberate_Rome'/>
                		<option name='relationshipChange' value='Germans:Italians:any:Stingy'/>
                		<option name="when" value="after:germanBattle"/>
                	</attachment>
                
                	<attachment name='userActionAttachment_Germans_Get_Choice_About_Rome' attachTo='Germans' javaClass='UserActionAttachment' type='player'>
                		<option name='conditions' value='conditionAttachment_Germans_Liberate_Rome'/>
                		<option name='activateTrigger' value='triggerAttachment_Germans_Keep_Italian_Territories:1:false:false:false:false'/>
                		<option name='text' value='LIBERATE_ROME'/>
                		<option name='actionAccept' value='Germans'/>	
                	</attachment>
                

                GameParseException: map name: 'file:/C:/Users/jason/triplea/downloadedMaps/argo/games/argo1939.xml', game name: 'argo1939', Unexpected Exception while setting values for attachment: RulesAttachment attached to: PlayerId named:Germans with name: conditionAttachment_Germans_Liberate_Rome

                1 Reply Last reply Reply Quote 0
                • wc_sumptonW Offline
                  wc_sumpton
                  last edited by

                  @Jason-Green-Lowe

                  It hard to find the error with the information posted. I'm thinking that you don't have the console turn on. To show the console select 'Engine Preferences' from the main menu. Then the 'Game' tab.

                  As to you idea, once Rome is liberated, Italy will gain control of that territory. And since that is the Capital for the Italian player, all liberated territories will return to the Italian player.

                  The way I read this, the change of relationship happens after so 'givesBackOriginalTerritories' will have no effect until the next time Rome is captured. For this to work I think you are going to have to set the relationship to 'stingy' at the beginning of the game, then check if Germany wants to give back control of the liberated territories.

                  Hope this is helpful.

                  Cheers...

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

                    OK, I reworked the conditions as you suggested so that players on the same team start with the 'stingy' relationship and the trigger changes that to an 'allied' relationship, but I'm still not seeing any dialog box -- nothing seems to be triggering at all. I turned on the console as you suggested, and enabled verbose logging (debug mode), and got no messages at all.

                    I respectfully suggest that the problem here isn't the specific way I'm defining the liberation event -- I'm failing to invoke the idea of a dialog box at all. Can anyone help me with an example of code where they've successfully generated a dialog box in the middle of a game?

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

                      Here is the new code I was working with, and I'm also attaching the entire XML file in case anyone wants to review that.

                      <!--Liberation Conditions and Triggers-->		
                      	<attachment name="conditionAttachment_Germans_Liberate_Rome" attachTo="Germans" javaClass='RulesAttachment' type='player'>
                      		<option name="directOwnershipTerritories" value="Rome"/>
                      		<option name="players" value="British:French:Russians:Chinese:Americans"/>
                      		<option name="battle" value="Germans:any:any:currentRound:Rome"/>			
                      	</attachment>
                      	
                      	<attachment name="conditionAttachment_Germans_Keep_Italian_Territories" attachTo="Germans" javaClass='RulesAttachment' type='player'>
                      		<option name='switch' value='true'/>
                      	</attachment>
                      	
                      	<attachment name='triggerAttachment_Germans_Keep_Italian_Territories' attachTo='Germans' javaClass='TriggerAttachment' type='player'>
                      		<option name='conditions' value='conditionAttachment_Germans_Liberate_Rome'/>
                      		<option name='relationshipChange' value='Germans:Italians:any:Allied'/>
                      		<option name="when" value="after:germanBattle"/>
                      	</attachment>
                      
                      	<attachment name='userActionAttachment_Germans_Get_Choice_About_Rome' attachTo='Germans' javaClass='UserActionAttachment' type='player'>
                      		<option name='conditions' value='conditionAttachment_Germans_Liberate_Rome'/>
                      		<option name='activateTrigger' value='triggerAttachment_Germans_Keep_Italian_Territories:1:false:false:false:false'/>
                      		<option name='text' value='LIBERATE_ROME'/>
                      		<option name='actionAccept' value='Germans'/>	
                      	</attachment>
                      

                      argo1939.xml

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

                        @Jason-Green-Lowe

                        Sorry for the amount of time it has taken me to reply. Using conditions that test for 'battle', the presents of Italian troops and the presents of enemy troops. I have been able to trigger messages using both 'politics' and 'userActions'. But I have been unable to get Germany to retain control of Rome.

                        This maybe a bug. Sorry I was unable to help.

                        Cheers...

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

                          Thank you. I think it's not so much a bug as just a hardwired behavior that has unfortunate consequences for some games.

                          Like, the choice seems to be:
                          givesBackOriginalTerrritories = True: territories will always return to the original owner at the end of each politics step
                          givesBackOriginalTerritories = False: territories will only return to the original owner when the original owner's capital is liberated

                          What I want is an option that says "territories will never return to the original owner," but there doesn't seem to be a way to do that right now.

                          I'm not sure what my second-best option is. I could just make most of the territories non-original, but then it feels awkward if you liberate an ally's territory while they're still alive and kicking and you keep it. Right, like if on turn 1 Germany captures Normandy, and on turn 2 Britain liberates Normandy, and the French still own Paris, Marseilles, Algeria, etc., and the British wind up with control of Normandy that seems really weird; that's not what would happen.

                          So how do I make it so that you give back territories before a capital falls, but keep territories after a capital falls? I could maybe try to alter the status of the territories so they lose their 'original territory' status after the capital falls, but what do I alter the status to? Is there a clean way to set the originalTerritory value to "none"?

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

                            Actually, one option I might consider is allowing players to build a special 'flag' unit that permanently annexes the territory by setting the original owner to the player building the flag. Can I do that with triggers and territory attachments? Anything to watch out for?

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

                              @Jason-Green-Lowe

                              '<originalOwner' can not be set to 'None' unless you create a player as 'None'. But it can set it to 'Natural'. So that is something to think about. 🙂

                              Cheers...

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

                                @Jason-Green-Lowe You can use a "changeOwnership" trigger with suitable conditions to change territories as you see fit.

                                1 Reply Last reply Reply Quote 0

                                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
                                Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums