Trigger not triggering?

  • I have been building a scenario that requires a trigger that will remove a unit in a specific territory and give resources to the player. I want Korea to be able to import oil by moving an "oil tanker" unit into the Sea of Japan; the tanker should disappear at the end of the turn and provide Korea with 5 oil. I've followed the example of others on this forum, but my code doesn't work, and I cannot figure out why. The game runs fine with no bugs or errors, the trigger just doesn't work.

    Here is the code I'm using for this trigger:

    	    <attachment name="conditionAttachmentKoreanPacificOil" attachTo="Korea" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
    		  <option name="directPresenceTerritories" value="SZ Sea of Japan" count="1"/>
    		  <option name="unitPresence" value="oil_tanker" count="1"/>
    	    <attachment name="triggerAttachmentKoreanPacificOil" attachTo="Korea" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
    		  <option name="conditions" value="conditionAttachmentKoreanPacificOil"/>
    		  <option name="when" value="after:koreaEndTurn"/>
    	          <option name="resource" value="oil"/>
    	          <option name="resourceCount" value="5"/>
    		  <option name="removeUnits" value="SZ Sea of Japan:oil_tanker" count="1"/>

  • Moderators

    @elreigh When stuff is ineffective, that probably means it is enabled by a property you don't have true.
    In this case, "Use Triggers".

    If this is not the matter, I cannot see anything strictly wrong; so, I would need your map, or looking better, or testing.

    A final note would be that Veqryn doesn't want you to use a same trigger to do various different things; so you should, instead, have a trigger removing the units and another different trigger giving the resources, but I guess it now depends if the current developers (mainly @redrum) feel the same or have no problems with packing all kind of things in a single trigger?

  • Yes, I didn't have that property. I have enabled "Use Triggers" and now the trigger works exactly as I wanted it. Many thanks @Cernel

  • @elreigh
    Best guess 'Sea Zone' ownership. Water territories do not have ownership, give 'SZ Sea of Japan' an 'originalOwner' option in its 'territoryAttachment' and use 'alliedPresenceTerritories' in the trigger.

    Also check the property:

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

    Hope this helps