changing support attachments with triggers



  • I am wondering how to do this. I can turn the attachment on with a trigger, but can't figure out how to change anything. At least not from reading POS2 xml.

    Alternatively, turning an attachment off could be useful as well. I could just turn one off, and another one on that has the changes already.


  • Moderators

    @ff03k64 I've never used it for a unitSupportAttachment but you could try "unitAttachmentName".

    Here's an example with it being used for unitAttachment:

    <attachment name="triggerAttachmentTransportCost8Changer" attachTo="Changer" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
    <option name="trigger" value="conditionAttachmentTransportCost8Changer"/>
    <option name="unitType" value="transport"/>
    <option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
    <option name="unitProperty" value="attack" count="0"/>
    <option name="unitProperty" value="defense" count="1"/>
    <option name="unitProperty" value="isCombatTransport" count="true"/>
    <option name="when" value="after:changerCombatMove"/>
    <option name="uses" value="1"/>
    </attachment>

    So that changes the unitAttachments for the transport to what is listed. You could try it with:
    <option name="unitAttachmentName" value="UnitSupportAttachment" count="unitSupportAttachment"/>

    then add the changes. Idk if that wording is correct but worth a try. Also you should use conditions and not trigger the way the example does.



  • @beelee Unfortunately, support attachments aren't part of the unit attachment.


  • Moderators

    @ff03k64 said in changing support attachments with triggers:

    @beelee Unfortunately, support attachments aren't part of the unit attachment.

    yea but in pos2 it says:

    unitAttachmentName values: the type of attachment (UnitAttachment, UnitSupportAttachment) and the exact full name of the attachment to be changed. Defaults to UnitAttachment if missing.

    That's why I thought you might be able to make the change with it.



  • @beelee I have to apologize, i think you are right. I was doing some digging, and I was starting to come around to your line of reasoning anyway, but the way you worded it this time it just clicked in my head.


  • Moderators

    So just to be clear here is the transport in the above example in Unit Attachments

    <!-- Transport -->
    <attachment name="unitAttachment" attachTo="transport" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
    <option name="movement" value="2"/>
    <option name="isSea" value="true"/>
    <option name="transportCapacity" value="11"/>
    <option name="attack" value="0"/>
    <option name="defense" value="0"/>
    <option name="canBeGivenByTerritoryTo" value="British"/>
    </attachment>

    When the trigger is activated it will change the transport to the "unitAttachmentName" one. Thought you could do something similar only with the Support Attachments instead.



  • @beelee
    This is what i have and doesn't work.

    		<attachment name="triggerAttachmentHeavyCAP" attachTo="XCOM" javaClass="TriggerAttachment" type="player">
    			<option name="unitType" value="heavy"/>
    			<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
    			<option name="unitProperty" value="createsUnitsList" count="1:grenade"/>
    			<option name="unitAttachmentName" value="UnitSupportAttachment" count="supportAttachmentXCOMholo"/>
    			<option name="unitProperty" value="number" count="4"/>	
    			<option name="playerAttachmentName" value="UserActionAttachment" count="userActionAttachment_heavy_promotion"/>
    			<option name="playerProperty" value="activateTrigger" count="-reset-triggerAttachmentHeavyCOL:1:false:false:false:false"/>
    			<option name="playerProperty" value="text" count="promote_heavy_col"/>
    			<option name="playerProperty" value="costResources" count="-reset-1000:XP"/>
    		</attachment>	
    

    It actually throws an error about "createsUnitsList"

    Trying some other things now

    Edit: Seperated it into a second trigger, that did it!

    
    			
    		<attachment name="triggerAttachmentHeavyCAP2" attachTo="XCOM" javaClass="TriggerAttachment" type="player">
    			<option name="unitType" value="heavy"/>
    			<option name="unitAttachmentName" value="UnitSupportAttachment" count="supportAttachmentXCOMholo"/>
    			<option name="unitProperty" value="number" count="4"/>	
    		</attachment>	
    			
    		<attachment name="triggerAttachmentHeavyCAP" attachTo="XCOM" javaClass="TriggerAttachment" type="player">
    			<option name="unitType" value="heavy"/>
    			<option name="unitAttachmentName" value="UnitAttachment" count="unitAttachment"/>
    			<option name="unitProperty" value="createsUnitsList" count="1:grenade"/>
    			<option name="playerAttachmentName" value="UserActionAttachment" count="userActionAttachment_heavy_promotion"/>
    			<option name="playerProperty" value="activateTrigger" count="-reset-triggerAttachmentHeavyCOL:1:false:false:false:false"/>
    			<option name="playerProperty" value="text" count="promote_heavy_col"/>
    			<option name="playerProperty" value="costResources" count="-reset-1000:XP"/>
                <option name="activateTrigger" value="triggerAttachmentHeavyCAP2:1:false:false:false:false"/>
    		</attachment>	
    

  • Moderators

    @ff03k64 heh heh was just gonna say that I didn't think you could do both unit attachment and support in one trigger. But you figured out 🙂 Right on I like a success story 🙂


Log in to reply