Simple Trigger Help


  • Moderators Admin

    @Name 30 players is certainly an ambitious plan. I can't even fathom what the XML would even look like with that kind of political landscape... let alone how to make it AI compatible.

    Just the Garrison unit alone with it max units per territory is likely already beyond its comprehension level.



  • @Hepps said in Simple Trigger Help:

    @Name 30 players is certainly an ambitious plan. I can't even fathom what the XML would even look like with that kind of political landscape... let alone how to make it AI compatible.

    That's why I'm leaning towards fixed alliances, but I prefer adding some triggered changes to better represent the era (see previous post). The AI won't handle it perfectly, it might invade triggering territories at times it won't have the strength to deal with an additional enemy or two. But I think it's an acceptable middle ground solution. And those territories won't be too many so no extensive coding added to the large task (many factions and total territories).

    Just the Garrison unit alone with it max units per territory is likely already beyond its comprehension level.

    Even with overpurchasing garrisons the hard AI isn't a pushover so far. It can even use them later to quickly replentish it's defenses. But I'm interested in an alternative defense system. The first idea I was using was "factories" having some defense, which has impact (but only if friendly troops are present). Could consider falling back to that or use some new suggestion.


  • Moderators

    @Name said in Simple Trigger Help:

    @Cernel @redrum

    Decent AI compatibility is a must. I want to be able to play the game solo or hotseat with a few friends. So far it works rather well, besides a couple of issues.

    For what I've read so far, I've a hard time believing this map plays rather well with any AI, but you have the map, so I guess I should take your word.

    In this case, you should definitely follow a Feudal Japan style setup, in which every power is on its own (FFA) and you have a simple politics set of rules, then the map being played by taking 1 power per each person in the game, assigning all remaining ones to Hard AI.

    You can have the politics working not too badly as long as you don't use any archetype alliance and allows downgrading from any relationships directly to war (for something like alliance, just use the archetype Neutral, but allowing moving into territories, and be sure that you can directly go from that to war).

    I strongly suggest not doing any extreme hacks like the ones you described. We already have maps that were tailored around the limits of the old AI, and now that AI is completely gone, and the maps are there broken. Rather, make some chance triggers to give some of the units the AI doesn't buy, removing the resources that would be needed to purchase them, before such a phase (basically, random purchasing for part of the money). You would need adding something to tell the triggers if the player is AI or not, for example like Feudal Japan does with its various triggers adding Ashigarus, et cetera, for AI powers, depending on having placed stuff on boxes, at start game.



  • @Cernel said in Simple Trigger Help:

    For what I've read so far, I've a hard time believing this map plays rather well with any AI, but you have the map, so I guess I should take your word.

    Don't exactly take my word. I'm a tripleA newbie, even though a rather experienced TBS/RTS/Grand Strategy player. I actually haven't played much of any map to have a good comparison, but can usually beat HardAI in my map with relatively unfavorable conditions, not without a challenge though. Most of it's functions work well I think (minus garrisons and maybe negative isMarine?). I haven't edited much from the core gameplay and alliances are still fixed. Maybe the map having multiple resources (several of them used for upkeep besides purchace, one of them also fuel) could be a downgrade on the AI?

    In this case, you should definitely follow a Feudal Japan style setup, in which every power is on its own (FFA) and you have a simple politics set of rules, then the map being played by taking 1 power per each person in the game, assigning all remaining ones to Hard AI.

    You can have the politics working not too badly as long as you don't use any archetype alliance and allows downgrading from any relationships directly to war (for something like alliance, just use the archetype Neutral, but allowing moving into territories, and be sure that you can directly go from that to war).

    This system seems very tedious to code, especially with so many players, and I'd like true alliances since they are appropriate for the setting. I think I'll go with fixed alliances and probably add some conditions to change them as I described. If this works badly I'll probably revert to just fixed alliances or consider your suggestion.

    Btw Feudal Japan uses this, so I'm confused.

            <attachment name="relationshipTypeAttachment" attachTo="Allied" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
              <option name="archeType" value="allied"/>
              <option name="canMoveLandUnitsOverOwnedLand" value="true"/>
              <option name="givesBackOriginalTerritories" value="false"/>
              <option name="canTakeOverOwnedTerritory" value="false"/>
            </attachment>
    

    I strongly suggest not doing any extreme hacks like the ones you described. We already have maps that were tailored around the limits of the old AI, and now that AI is completely gone, and the maps are there broken. Rather, make some chance triggers to give some of the units the AI doesn't buy, removing the resources that would be needed to purchase them, before such a phase (basically, random purchasing for part of the money). You would need adding something to tell the triggers if the player is AI or not, for example like Feudal Japan does with its various triggers adding Ashigarus, et cetera, for AI powers, depending on having placed stuff on boxes, at start game.

    I'll consider that among the options, not sure yet on how to handle this.


  • Admin

    @Name

    • "Garrisons" (0/3/0), maximum of 4 per territory are a central part of the gameplay. But the AI won't buy them or I have to use "hacks" giving them 1 movement (triggered movement change during purchase, requiresUnitsToMove, or the best it seems, givesMoment -1 from factory type units). But if I use those hacks, the AI often buys more Garrisons than it can place.

    Yeah, the AI currently doesn't support purchasing non-factory 0 movement units. This is something that I'll probably look to add soon as enough maps have them that its probably worth it.

    • I'm under the impression (could be wrong though), that the AI doesn't consider nevative isMarine when launching naval invasions and I have the majority of land units at isMarine -1 or -2.

    Not sure on this one. Very few if any maps use negative isMarine so I can't remember if the AI handles that or not. I'll have to take a closer look.

    If you want a sort of fixed with some triggers system, I would probably model it after something like Global 40. Where based on certain conditions, nations can/will declare war on each other but that generally there are fixed alliances just that maybe some of them don't start out as at war.

    What I meant by that is that when a trigger to (potentially) change relationship is activated (say Player1 captured region X )
    - If Player2 is AI it is given a set reaction (declare war on Player1) or a chance (say 1:6 to declare war - maybe increasing by further 1:6 each passing turn).
    - If Player2 is Human, they are given a choice (User/Political Action I guess), to declare war if they want.
    

    This should be possible though you may need to create a prompt like in Greyhawk Wars to set a flag whether each player is human or AI to then be used to determine which action or trigger is fired.



  • @redrum said in Simple Trigger Help:

    @Name

    • "Garrisons" (0/3/0), maximum of 4 per territory are a central part of the gameplay. But the AI won't buy them or I have to use "hacks" giving them 1 movement (triggered movement change during purchase, requiresUnitsToMove, or the best it seems, givesMoment -1 from factory type units). But if I use those hacks, the AI often buys more Garrisons than it can place.

    Yeah, the AI currently doesn't support purchasing non-factory 0 movement units. This is something that I'll probably look to add soon as enough maps have them that its probably worth it.

    • I'm under the impression (could be wrong though), that the AI doesn't consider nevative isMarine when launching naval invasions and I have the majority of land units at isMarine -1 or -2.

    Not sure on this one. Very few if any maps use negative isMarine so I can't remember if the AI handles that or not. I'll have to take a closer look.

    That's great:) Do you have estimate on when the update could be?

    If you want a sort of fixed with some triggers system, I would probably model it after something like Global 40. Where based on certain conditions, nations can/will declare war on each other but that generally there are fixed alliances just that maybe some of them don't start out as at war.

    What I meant by that is that when a trigger to (potentially) change relationship is activated (say Player1 captured region X )
    - If Player2 is AI it is given a set reaction (declare war on Player1) or a chance (say 1:6 to declare war - maybe increasing by further 1:6 each passing turn).
    - If Player2 is Human, they are given a choice (User/Political Action I guess), to declare war if they want.
    

    This should be possible though you may need to create a prompt like in Greyhawk Wars to set a flag whether each player is human or AI to then be used to determine which action or trigger is fired.

    If one player is supposed to change from a fixed/starting alliance to another one, is that doable? I guess only by using relationshipInitialize instead? Can alliancesCanChainTogether help in some way?

    Say Aetolia is allied to Rome (+Roman Allies). Seleucids invades a territory in Greece, triggering war with Rome (+Roman Allies). (How) can I have Aetolia switch sides to being at war with Rome (+Roman Allies) and allied to Seleucids (+Seleucid Allies)?

    Edit: I also can't make units CapturedOnEnteringBy

    The unit has:

       <option name='canBeCapturedOnEnteringBy' value='Macedon'/>	
    

    Territory has:

                        <option name='captureUnitOnEnteringBy' value='Macedon'/>		
    		    <option name='changeUnitOwners'	value='Macedon_Allies'/>
    

    (Not having the second option like Global 40 or setting it to Macedon won't work either)

    Player has:

                <attachment name='playerAttachment' attachTo='Macedon' javaClass='PlayerAttachment' type='player'>
        	        <option name='captureUnitOnEnteringBy' value='Macedon_Allies'/>
                </attachment>
    

    Properties:

        		<property name='Capture Units On Entering Territory' value='true' editable='false'>
        			<boolean/>
        		</property>
    

    Edit2: Before making a map thread to showcase things and get better informed feedback I'd like to know if it's ok to use 2d art from other (commercial) games. I've seen a couple of downloadable maps do it, but just to be sure, should I avoid screenshots due to "my" (possibly placeholder) icons?


  • Admin

    @Name Responses:

    1. AI updates - Hard to say. I'll try to at least take a look at it this week or next week but would depend on the LoE.

    2. To have nations change relationship/alliance, I believe you'd need something like this:

    Change the relationship based on some conditions:

        <attachment name="triggerAttachmentRussiansWarJapanese" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="conditions" value="conditionAttachmentRussiansNeutralJapanTurn5plus"/>
          <option name="relationshipChange" value="Russians:Japanese:anyNeutral:War"/>
          <option name="notification" value="RUSSIANS_AT_WAR_WITH_JAPAN"/>
          <option name="when" value="before:russianPolitics"/>
        </attachment>
    

    Have alliancesCanChainTogether if you want to will share both allies and enemies once they reach Allied or War:

        <attachment name="relationshipTypeAttachment" attachTo="Allied" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
          <option name="archeType" value="allied"/>
          <option name="alliancesCanChainTogether" value="true"/>
        </attachment>
    
    1. A bit hard to follow what the issue is but you might have the player attachment inverted. I would recommend looking at TWW XML: https://github.com/triplea-maps/total_world_war/blob/master/map/games/Total_World_War_Dec1941_3.0.xml

    2. For images, its really up to each map maker on what they use. TripleA primarily just asks that you don't use any profanity or controversial images. There is no way for us to check all your images and where you get them from so its up to you on what you are comfortable using in regards to copyright and other laws. Outside of some A&A images/terminology a long time ago, I haven't seen any issues around this.



  • @redrum said in Simple Trigger Help:

    @Name Responses:

    1. AI updates - Hard to say. I'll try to at least take a look at it this week or next week but would depend on the LoE.

    Np, but what does LoE mean?

    1. To have nations change relationship/alliance, I believe you'd need something like this:

    Change the relationship based on some conditions:

        <attachment name="triggerAttachmentRussiansWarJapanese" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="conditions" value="conditionAttachmentRussiansNeutralJapanTurn5plus"/>
          <option name="relationshipChange" value="Russians:Japanese:anyNeutral:War"/>
          <option name="notification" value="RUSSIANS_AT_WAR_WITH_JAPAN"/>
          <option name="when" value="before:russianPolitics"/>
        </attachment>
    

    Have alliancesCanChainTogether if you want to will share both allies and enemies once they reach Allied or War:

        <attachment name="relationshipTypeAttachment" attachTo="Allied" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
          <option name="archeType" value="allied"/>
          <option name="alliancesCanChainTogether" value="true"/>
        </attachment>
    

    My issue is that I plan to have some players that will have fixed alliances (say "alliance leaders") for the whole game and others changing on conditions. If a changeable one gets to an alliance with a new "alliance leader", will alliancesCanChainTogether have them ally the alliance leader's allies and war their enemies, including past allies of the changeable player? Or do I have to include at least one past ally of the changeable as enemy? Or do I have to cover all possible combinations of player alliances in my triggers? I hope this time my description makes more sense.

    1. A bit hard to follow what the issue is but you might have the player attachment inverted. I would recommend looking at TWW XML: https://github.com/triplea-maps/total_world_war/blob/master/map/games/Total_World_War_Dec1941_3.0.xml

    I'll check those thanks.

    1. For images, its really up to each map maker on what they use. TripleA primarily just asks that you don't use any profanity or controversial images. There is no way for us to check all your images and where you get them from so its up to you on what you are comfortable using in regards to copyright and other laws. Outside of some A&A images/terminology a long time ago, I haven't seen any issues around this.

    Thanks again.


  • Admin

    @Name

    1. LoE - level of effort, ie. how long it would take me to implement 🙂

    2. I believe alliancesCanChainTogether looks at the current allies/enemies of the nation its relationship changed with (nothing that isn't current). So in your example, if your changed the relationship of Aetolia and Seleucids to Allied then Aetolia would become allied with all the Seleucid Allies and go to war with all its enemies (and vice versa).



  • @redrum said in Simple Trigger Help:

    1. I believe alliancesCanChainTogether looks at the current allies/enemies of the nation its relationship changed with (nothing that isn't current). So in your example, if your changed the relationship of Aetolia and Seleucids to Allied then Aetolia would become allied with all the Seleucid Allies and go to war with all its enemies (and vice versa).

    Nice that's desired and potentially saves a lot of work, but now I'm trying to understand if it covers all my cases.

    • If Macedon was allied to both of them but declares war on the Seleucids, Aetolia will stay with the Seleucid alliance right? Desired
    • If Aetolia makes peace with Rome, will the Seleucids also do the same? Undesired

    I'm a little puzzled on this, if anyone can come up with/inform me of more scenarios, applications and potential issues with alliancesCanChainTogether it would be great.


  • Moderators

    @Name said in Simple Trigger Help:

    Np, but what does LoE mean?

    Lol I was just gonna look it up 🙂



  • Btw trying to test the things discussed above I think I found a bug.

    Corinth (Territory) belongs to Achaia, but has some of (Allied) Macedon's units starting there. When I have the following option enabled for the Allied relationshipTypeAttachment

    <option name='canTakeOverOwnedTerritory' value='true'/>
    

    and I move ALL of Macedon's troops to invade a neighbouring territory, Corinth ownership changes to Macedon.

    I guess I need two allied types to fix this, one for true alliance and one for capturable vassals, but it still seems unintended/strange anyway.

    @beelee said in Simple Trigger Help:

    @Name said in Simple Trigger Help:

    Np, but what does LoE mean?

    Lol I was just gonna look it up 🙂

    I did and the various acronym results made me ask 😛


  • Moderators

    @Name said in Simple Trigger Help:

    Btw trying to test the things discussed above I think I found a bug.

    Corinth (Territory) belongs to Achaia, but has some of (Allied) Macedon's units starting there. When I have the following option enabled for the Allied relationshipTypeAttachment

    <option name='canTakeOverOwnedTerritory' value='true'/>

    and I move ALL of Macedon's troops to invade a neighbouring territory, Corinth ownership changes to Macedon.

    I guess I need two allied types to fix this, one for true alliance and one for capturable vassals, but it still seems unintended/strange anyway.

    @beelee said in Simple Trigger Help:

    @Name said in Simple Trigger Help:

    Np, but what does LoE mean?

    Lol I was just gonna look it up 🙂

    I did and the various acronym results made me ask 😛

    This seems perfectly reasonable to me, if I understand correctly that the territory is taken over upon exiting like it would be upon entering, but only as long as at least one of the involved units is able to blitz.



  • @Cernel

    This seems perfectly reasonable to me, if I understand correctly that the territory is taken over upon exiting like it would be upon entering, but only as long as at least one of the involved units is able to blitz.

    Seems to be the case, indeed there's a unit with blitz as well. But why is capture on exit intended?


  • Moderators Admin

    @Name LoE: \L-o-E abbreviation (2020) Language of origin; Nerd. HOBBY, ACTION 1 Lack of Energy. To be in a perpetual state of lethargy. 2 Limits of Espousal. The constraints placed on an individual based on the waning patience of a spouse.


  • Admin

    @Name So glancing at the code this is how alliancesCanChainTogether works when a relationship is changed (in this order):

    1. Leave Alliance: if I'm allied with a nation and a trigger changes that relationship to not allied then change all current allies to that new relationship
    2. Alliances Make Peace: if I'm at war with a nation and a trigger changes that relationship to not at war then change all of my current allies to that new relationship with all of my former enemy's allies
    3. Chain Allies: Make sure any allied nations are also allied with all of each other's allies
    4. Chain Enemies: Make sure any allied nations are also at war with all of each other's enemies
    • If Macedon was allied to both of them (Seleucids & Aetolia?) but declares war on the Seleucids, Aetolia will stay with the Seleucid alliance right?
      So I believe this would meet the first condition as they are essentially leaving their alliance (declaring war or any non-allied relationship with a current ally) and cause Macedon to declare war on both Seleucids and Aetolia who will both stay allied to each other.

    • If Aetolia makes peace with Rome, will the Seleucids also do the same?
      I'm assuming this is indicating that both Aetolia and Seleucids are allied together and at war with Rome. If so then yes this meets condition 2 where Aetolia is essentially making peace for its entire alliance with Rome's entire alliance. If you didn't want the entire alliances to make peace then instead you would want to have Aetolia leave its alliance by declaring war or neutral relationship with Seleucids (become essentially its own alliance) and then make peace with Rome.



  • @redrum said in Simple Trigger Help:

    @Name So glancing at the code this is how alliancesCanChainTogether works when a relationship is changed (in this order):

    1. Leave Alliance: if I'm allied with a nation and a trigger changes that relationship to not allied then change all current allies to that new relationship
    2. Alliances Make Peace: if I'm at war with a nation and a trigger changes that relationship to not at war then change all of my current allies to that new relationship with all of my former enemy's allies
    3. Chain Allies: Make sure any allied nations are also allied with all of each other's allies
    4. Chain Enemies: Make sure any allied nations are also at war with all of each other's enemies
    • If Macedon was allied to both of them (Seleucids & Aetolia?) but declares war on the Seleucids, Aetolia will stay with the Seleucid alliance right?
      So I believe this would meet the first condition as they are essentially leaving their alliance (declaring war or any non-allied relationship with a current ally) and cause Macedon to declare war on both Seleucids and Aetolia who will both stay allied to each other.

    • If Aetolia makes peace with Rome, will the Seleucids also do the same?
      I'm assuming this is indicating that both Aetolia and Seleucids are allied together and at war with Rome. If so then yes this meets condition 2 where Aetolia is essentially making peace for its entire alliance with Rome's entire alliance. If you didn't want the entire alliances to make peace then instead you would want to have Aetolia leave its alliance by declaring war or neutral relationship with Seleucids (become essentially its own alliance) and then make peace with Rome.

    Being as lazy as impacient I already started testing those and managed to figure some things out. I have both allies and enemies chained so could this explain differences on what you describe and what I found?

    If I changed only one player's relationship, in the first example, Macedon would be forced back to alliance with the Seleucids, since the are both allied to Aetolia. So the way I'm doing it is make Macedon at war to both. Extra work and will need to be careful to include many conditions on similar following triggers, but I don't know how else to handle it.

    So on the second example I guess I'd have to make Aetolia neutral (or war) every member of the Seleucid alliance on one trigger, and then on a second one have it peace Rome.


  • Moderators

    @Name said in Simple Trigger Help:

    @Cernel

    This seems perfectly reasonable to me, if I understand correctly that the territory is taken over upon exiting like it would be upon entering, but only as long as at least one of the involved units is able to blitz.

    Seems to be the case, indeed there's a unit with blitz as well. But why is capture on exit intended?

    I don't know, but it seems to me being clearly the most reasonable behaviour. Why do you think that blitzing a territory you are already inside should be harder than blitzing a nearby one, for example? Because I assume you realize that, if you would not be able to blitz it upon exiting, then you would need to do 2 moves (going out, then back into) to blitz a territory you are in, as opposite to only 1 move for blitzing a territory you are next to.

    However, I believe that:

    • The territory should not bet conquered upon exiting if all the units making this move are unable to blitz.
    • The territory should not bet conquered upon exiting if in it there are any hostile units that, under the rules, would block blitz.
    • The territory should also be conquered in case the units stay in it, without moving during the Combat Move phase, then the units should be unable to move, during the subsequent Non Combat Move phase (no matter if able to blitz).

    Are the above three behaviours exactly what you are experiencing or not. If not, what not, and I would say that is where the bug (or bugs) would be.

    @redrum What do you think about this?


  • Admin

    @Name Interesting. I can only tell you what I think its supposed to do without seeing your XML. If what you describe is happening then the first condition of leaving the alliance isn't really working properly. The only thing I can think of without seeing them is you want to make sure that the "attachTo" is set to the player that is taking the action (in your first example Macedon since they are leaving the alliance).

    @Cernel Hard to say without seeing the example. Once you get to changing relationships and having troops in existing territories, things get a bit questionable. I would probably argue that whenever Macedon's troops came to be in Corinth and they met the other conditions for taking it over, it should switch immediately. But because the way the engine only triggers these during combat move related to those territories, this behavior is probably a result of that.



  • @redrum

    I made sure I have the attach to the proper player and checked again.
    Macedon starts in alliance with Achaia (Allied) and Macedonian_Allies (Vassal).
    Then I run this trigger:

    <attachment name="Social_War" attachTo="Achaia" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
    	<option name="conditions" value="Social_War_Condition"/>
    	<option name="relationshipChange" value="Achaia:Macedon:any:War"/>
    	<option name='notification' value='Social_War'/>			
    	<option name="chance" value="6:6"/>
       </attachment>	
    

    Result:

    Round: 1
    Politics
    Social War: Changing Relationship for Achaia and Macedon from Allied to War
    Macedon and Achaia are joined together in an Vassal treaty

    My relationship attachments.

    	<!-- Relationships -->	
    	<attachment name="relationshipTypeAttachment" attachTo="War" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
    	    	<option name="archeType" value="war"/>
    		<option name='isDefaultWarPosition' value='true'/>
             </attachment>
             <attachment name="relationshipTypeAttachment" attachTo="Allied" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
                         <option name="archeType" value="allied"/>
                         <option name="givesBackOriginalTerritories" value="true"/>
    		 <option name='alliancesCanChainTogether' value='true'/>
                 </attachment>		
                 <attachment name="relationshipTypeAttachment" attachTo="Vassal" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
                         <option name="archeType" value="allied"/>
    		<option name='alliancesCanChainTogether' value='true'/>
    		 <option name='canTakeOverOwnedTerritory' value='true'/>
                    </attachment>							
                    <attachment name="relationshipTypeAttachment" attachTo="Peace" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
                         <option name="archeType" value="neutral"/>
                    </attachment>
    

    Maybe I need some extra property besides 'Alliances Can Chain Together? Maybe something "Chain Enemies/isDefaultWarPosition" related I failed to spot?

    Or is isDefaultWarPosition the problem? I'm not sure I get what it means.
    If true, any players that reach an alliance chaining relationship, will have their enemies who are not yet at war with, set to this relationship.

    I can attach the XML if that helps.


Log in to reply