EnemyPresence Trigger not working



  • The following code is supposed to give the Japanese 1 PU for every territory that contains an enemy unit. It does not seem to be firing. What is wrong?

    <attachment name="conditionAttachmentJapaneseEnemyUnitPresent" attachTo="Japanese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
      <option name="enemyPresenceTerritories" value="all" count="each"/>
     </attachment>
     
     <attachment name="triggerAttachmentJapaneseEnemyUnitCount" attachTo="Japanese" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
      <option name="conditions" value="conditionAttachmentJapaneseEnemyUnitPresent"/>
      <option name="resource" value="PUs"/>
      <option name="resourceCount" value="1"/>
      <option name="when" value="before:JapaneseBidplace"/>
     </attachment>
    
    

    This scenario assigns the players randomly between 2 alliances, so I don't know the number of enemy territories in advance.


  • Moderators Admin

    @RogerCooper If you are getting no error, it should be something not validated. For example, are you sure the phase is called exactly as "JapaneseBidplace" (instead of, say, "japaneseBidPlace").



  • @Cernel You were right on the capitalization issue, but fixing it did not solve the problem.


  • Moderators Admin

    @RogerCooper said in EnemyPresence Trigger not working:

    for every territory that contains an enemy unit.

    For this, you need a "map" value, instead of an "all" value, or the full list of territories ("all" doesn't actually mean all).



  • @Cernel I put "map" in, but is doesn't help.

    Could the issue be the definition of "enemyPresenceTerritories"? There no preset alliances in the scenario, so enemy would be defined only through 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>
    


  • @RogerCooper I also tried the players option, but it didn't help.

    <attachment name="conditionAttachmentJapaneseEnemyUnitPresent" attachTo="Japanese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
      <option name="enemyPresenceTerritories" value="map" count="each"/>
      <option name="players" value="Japanese:Germans:British:Italians:Chinese:Americans"/>
     </attachment>
    
    

  • Moderators

    @RogerCooper

    Can you try "unitPresence" and then don't list Japan ?



  • @beelee Removing Japan does not make the trigger work.


  • Moderators Admin

    @RogerCooper said in EnemyPresence Trigger not working:

    @Cernel I put "map" in, but is doesn't help.

    Could the issue be the definition of "enemyPresenceTerritories"? There no preset alliances in the scenario, so enemy would be defined only through relationships.

    My assumption is that thing should look at everything owned by a player that is in an archetype "war" relationship with the attached player. So, if you have no fixed alliances, be sure to have that "War" relationship defined since before the trigger should fire (usually, with the relationships initialize).



  • @Cernel The war relationship is defined.


  • Moderators Admin

    @RogerCooper It's not only the relationship that must be defined. It must also be assigned specifically to every couple of powers having it between one another. Normally this is done with the relationship initialize. Just trying to make sure.



  • @Cernel All the relationships are properly defined. I start with A&B at war with each other and everyone else neutral. Then this bit of code randomly distributes them into 2 alliances.

        <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="alliancesCanChainTogether" value="true"/>
        </attachment>
        <attachment name="relationshipTypeAttachment" attachTo="Neutrality" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
          <option name="archeType" value="neutral"/>
        </attachment>
        
    <attachment name="conditionAttachmentTurn1" attachTo="A" javaClass="games.strategy.triplea.attachments.RulesAttachment"  type="player"><option name="rounds"  value="1"/></attachment>
        
      <attachment foreach="$TriggerPlayer$" name="triggerAttachment@TriggerPlayer@ToA" attachTo="@TriggerPlayer@" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="conditions" value="conditionAttachmentTurn1"/>
          <option name="relationshipChange" value="@TriggerPlayer@:A:Neutrality:Allied"/>
          <option name="uses" value="1"/>
          <option name="chance" value="1:2"/>
          <option name="when"  value="before:ABidPlace"/>
    	</attachment>
    
    <attachment foreach="$TriggerPlayer$" name="triggerAttachment@TriggerPlayer@ToB" attachTo="@TriggerPlayer@" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="conditions" value="conditionAttachmentTurn1"/>
          <option name="relationshipChange" value="@TriggerPlayer@:B:Neutrality:Allied"/>
          <option name="uses" value="1"/>
          <option name="chance" value="1:1"/>
          <option name="when"  value="before:BBidPlace"/>
    	</attachment>
    
    

    What I am trying to do now is to automatically balance the sides by giving money based upon the number of enemy units. If I can get this working I will have a neat system for randomizing any map,


  • Moderators Admin

    @RogerCooper To be tested by the other triggers, that should happen at a point before when the triggers testing such relationships may fire. Just to make sure both triggers are not firing at the same time.

    Assuming the former is true, then the matter, here, is that I'm seeing only triggers changing "Neutrality" to "Allied". Are you sure there are the needed archetype "War" relationships in effect, when you need them? May you post a screenshot of what you get in Game/Show Politics Panel at the moment, or the closest next stable point, in which the wanted triggers should fire?



  • @Cernel Here is the panel

    844c0c9d-d5a3-4dcb-b165-45d2ad417fa2-image.png

    The trick is that A&B start at war and the real players randomly ally with A or B. A & B are nominal players with no territories or units.


Log in to reply