End turn trigger calculation



  • I wrote small code that gives 5 pu to Germans at the end of his turn, if Holland is contolled by Neutral_True. It appears below the screen as +5 but doesn't be collected at the end of the turn. It didn't shown in end turn summary too. So, what should I add to my code to show it in end turn summary and make true calculation?

    	<attachment name="conditionAttachment_Germans_Check_Neutral_Netherlands" attachTo="Neutral_True" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
    		<option name="directOwnershipTerritories" value="Holland" count="1"/>
    	</attachment>
    
    	<attachment name="conditionAttachment_Germans_Neutral_Netherlands" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
    		<option name="conditions" value="conditionAttachment_Germans_Check_Neutral_Netherlands"/>
    	</attachment>	
    
    	    <!-- Germans Triggers -->
    	<attachment name="triggerAttachment_Germans_Neutral_Netherlands_Imports" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
    		<option name="trigger" value="conditionAttachment_Germans_Neutral_Netherlands"/>
    		<option name="resource" value="PUs"/>
    		<option name="resourceCount" value="5"/>
    	</attachment>
    

    Additional question: Pact of Steel 2 says that Strategic Bombing can do damage directly player's PUs. How can add ability to my zeppelins damage directly to the player's PUs?

    <!-- Damage From Bombing Done To Units Instead Of Territories has Strategic Bombing and Rockets do damage to a specific unit rather than directly to the player's PUs or to a territory. -->
    <property name="Damage From Bombing Done To Units Instead Of Territories" value="true" editable="false">
      <boolean/>
    </property>


  • @stalinpasha

    Second question first. To change SBR damage to affect PUs change the property to false:

    <!-- Damage From Bombing Done To Units Instead Of Territories has Strategic Bombing and Rockets do damage to a specific unit rather than directly to the player's PUs or to a territory. -->
    <property name="Damage From Bombing Done To Units Instead Of Territories" value="false" editable="false">
      <boolean/>
    </property>
    

    Change the second condition in your first example to a 'National Objective':

     <attachment name="objectiveAttachment_Germans_Neutral_Netherlands_Imports" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
       <option name="conditions" value="conditionAttachment_Germans_Neutral_Netherlands"/>
       <option name="objectiveValue" value="5"/>
    </attachment>
    

    Now the trigger is not needed.

    Or just add a "when" option to the trigger:

    <!-- Germans Triggers -->
    <attachment name="triggerAttachment_Germans_Neutral_Netherlands_Imports" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
       <!--- changed trigger to conditions -->
       <option name="conditions" value="conditionAttachment_Germans_Neutral_Netherlands"/>
       <option name="resource" value="PUs"/>
       <option name="resourceCount" value="5"/>
       <option name="when" value="after:germanyEndTurn"/>
    </attachment>
    

    Both way should work for what you are asking.

    Cheers.



  • @wc_sumpton Thanks for your helpful support. I changed it but didn't work. Holland is controlled by Neutral_True initially.
    1.png

    	<attachment name="conditionAttachment_Germans_Neutral_Netherlands" attachTo="Neutral_True" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
    		<option name="directOwnershipTerritories" value="Holland" count="1"/>
    	</attachment>		
    
    	<!-- Germans Triggers -->
    	<attachment name="triggerAttachment_Germans_Neutral_Netherlands_Imports" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
    	<!--- changed trigger to conditions -->
    		<option name="conditions" value="conditionAttachment_Germans_Neutral_Netherlands"/>
    		<option name="resource" value="PUs"/>
    		<option name="resourceCount" value="5"/>
    		<option name="when" value="after:germanyEndTurn"/>
    	</attachment>

  • Moderators

    @stalinpasha double check "after:germanyEndTurn" usually it'll be the same as attachTo="Germans" but not always.



  • @stalinpasha
    If I am understanding you correctly Neutral_True control Holland at the start of the game, and as long as Neutral_True retain control of Holland you want Germany to collect an additional 5PUs. Also you did not report any errors so you must have caught my "condition" value="conditionAttachment_Germans_Neutral_Netherlands" should have been "conditionAttachment_Germans_Check_Neutral_Netherlands". One more thing, the switch that needs a switch

    <property name="National Objectives" value="true" editable="false">
       <boolean/>
    </property>
    

    In summery, your first condition with the national objective:

    <attachment name="conditionAttachment_Germans_Check_Neutral_Netherlands" attachTo="Neutral_True" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
       <option name="directOwnershipTerritories" value="Holland" count="1"/>
    </attachment>
    
     <attachment name="objectiveAttachment_Germans_Neutral_Netherlands_Imports" attachTo="Germans" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
       <option name="conditions" value="conditionAttachment_Germans_Check_Neutral_Netherlands"/>
       <option name="objectiveValue" value="5"/>
    </attachment>
    

    With the property switch, should give you what you want.

    @beelee good catch, but I think @stalinpasha was trying the first part. Still a very good catch!!

    Cheers...



  • @wc_sumpton Thanks a lot. Finally, I have hunger games in Germany:D
    1.png

    Any recommends how I add tech to map? I tried to copy from other maps but didn't success yet.



  • @stalinpasha
    First check your properties:

     <property name="Tech Development" value="true" editable="true">
         <boolean/>
     </property>
    

    Also depending on how the tech is to be selected you may want to check some of these:

    <!-- ww2v2 rules override many individual rules to create revised rules -->
    <property name="WW2V2" value="false" editable="false">
       <boolean/>
    </property>
    <!-- Unlike the WW2V2 option, WW2V3 actually sets very little: If no techs specified then it will create WW2V3 default techs, and if a game is not WW2V2 and not WW2V3, then it must be 'classic' rules [this is applicable for when rockets fire, and how aa guns may stack, the default win conditions for classic games, and that air units create retreat paths for ground/sea units]-->
    <property name="WW2V3" value="true" editable="false">
        <boolean/>
    </property>
    <property name="WW2V3 Tech Model" value="true" editable="false">
        <boolean/>
    </property>
    

    If these are set and you are still having problems, let the board know. We are here to help!

    Cheers...



  • @wc_sumpton

    I receive java null pointer exception, when I got hit. My custom tech is about unlocking ww1 tank. I think my buytank productionRule works well, so exception related to tech activation.

    1.png

    <technology>
    	<technologies>
    		<techname name="caterpillar_combat_vehicle"/>
    	</technologies>
    	
    	<playerTech player="AustroHungarians">
    		<category name="caterpillar_combat_vehicle">
    			<tech name="caterpillar_combat_vehicle"/>			
    		</category>
    	</playerTech>
    </technology>
    
    
    	<attachment name="conditionAttachmentUnlockTankA" attachTo="AustroHungarians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
    					<option name="techs" value="caterpillar_combat_vehicle" count="1"/>
    	</attachment>
    	
    	
    	<attachment name="triggerAttachmentAustriaUnlockTank" attachTo="AustroHungarians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
                	<option name="trigger" value="conditionAttachmentUnlockTankA"/>
    				<option name="productionRule" value="productionAustroHungarians:buytank"/>
    				<option name="uses" value="1"/>
    				<option name="when" value="after:austrohungariansTechActivation"/>
        </attachment>	
    

    Error Log:

    Tem 31, 2020 6:55:34 AM games.strategy.engine.framework.GameRunner lambda$start$0
    SEVERE: null
    java.lang.NullPointerException
    at games.strategy.engine.data.changefactory.GenericTechChange.<init>(GenericTechChange.java:22)
    at games.strategy.engine.data.changefactory.ChangeFactory.genericTechChange(ChangeFactory.java:184)
    at games.strategy.triplea.delegate.TechTracker.addAdvance(TechTracker.java:62)
    at games.strategy.triplea.delegate.TechActivationDelegate.start(TechActivationDelegate.java:51)
    at games.strategy.engine.framework.ServerGame.startStep(ServerGame.java:511)
    at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:414)
    at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:290)
    at java.util.Optional.ifPresent(Unknown Source)
    at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInNewThread(LocalLauncher.java:41)
    at games.strategy.engine.framework.startup.launcher.AbstractLauncher.lambda$launch$0(AbstractLauncher.java:51)
    at java.lang.Thread.run(Unknown Source)

    List of rules that I added:

    			<property name="Tech Development" value="true" editable="true">
    					<boolean/>
    			</property>
    
    			<property name="Remove All Tech Tokens At End Of Turn" value="false" editable="true">
    					<boolean/>
    			</property>
    
    
    			<property name="WW2V3" value="true" editable="false">
    					<boolean/>
    			</property>
    
    			<property name="WW2V3 Tech Model" value="true" editable="false">
    					<boolean/>
    			</property>
    
    			<property name="Selectable Tech Roll" value="false" editable="false">
    					<boolean/>
    			</property>

  • Moderators

    @stalinpasha yea I agree it doesn't seem to be activating correctly. I'm not sure what the "ChangeFactory" is about. At any rate, do you have:

    <delegate name="tech_activation" javaClass="games.strategy.triplea.delegate.TechActivationDelegate" display="Activate Technology"/>

    All I can think of at the moment. The Wizard wc_ probably chime in soon 🙂



  • @beelee

    I started a new topic for this discussion.

    Cheers...


Log in to reply