Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    destroysPUs Causing Error

    Map Making
    2
    5
    396
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      Contango last edited by

      I’m trying to implement a feature mimicking the World War II Global 1940 Balance Mod3 XML whereby on hand PUs are captured for the first time a capital is taken, but after that the PUs are destroyed. In other words, so that the attacker can’t repeatedly take the defenders cash for a capital that keeps trading hands. This is done by turning on the destroysPUs property via a trigger after the first time a capital is taken.

      Here’s a sample from the XML which I took from Balance Mod which is replicated for all Attacker/Defender combinations:

      <attachment name="triggerFrenchDestroyPUsGermans" attachTo="French" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
        <option name="conditions" value="conditionAttachment_French_1_Lose_France"/>
        <option name="uses" value="1"/>
        <option name="when" value="after:germansBattle"/>
        <option name="players" value="French"/>
        <option name="playerAttachmentName" value="PlayerAttachment" count="playerAttachment"/>
        <option name="playerProperty" value="destroysPUs" count="true"/>
      </attachment>
      

      When the Germans take the French capital however, the game crashes with the below error:

      "No player attachment for:French with name:playerAttachment

      java.lang.IllegalStateException: No player attachment for:French with name:playerAttachment"

      Oddly, the game is stable if a couple of the capitals are captured, but the majority will crash it with a similar error.

      I’m struggling to understand what the issue is, especially because it’s fine for some capitals and not others. Does anyone have any suggestions what my problem might be? I’m guessing it’s simple but so far it’s eluding me.

      Thanks, in advance.

      B 1 Reply Last reply Reply Quote 0
      • B
        beelee @Contango last edited by beelee

        @Contango yea I had some trouble adding that also. A lot going on. I have these two triggers for France and Germany for PlayerAttachments

        <attachment name="triggerGermansDestroyPUsFrench" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
        <option name="conditions" value="conditionAttachment_Germans_1_Lose_Germany1"/>
        <option name="uses" value="1"/>
        <option name="when" value="after:frenchBattle"/>
        <option name="players" value="Germans"/>
        <option name="playerAttachmentName" value="PlayerAttachment" count="playerAttachment"/>
        <option name="playerProperty" value="destroysPUs" count="true"/>
        </attachment>

        <attachment name="triggerFrenchDestroyPUsGermans" attachTo="French" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
        <option name="conditions" value="conditionAttachment_French_1_Lose_France1"/>
        <option name="uses" value="1"/>
        <option name="when" value="after:germansBattle"/>
        <option name="players" value="French"/>
        <option name="playerAttachmentName" value="PlayerAttachment" count="playerAttachment"/>
        <option name="playerProperty" value="destroysPUs" count="true"/>
        </attachment>

        So the triggers are worded a little oddly if you weren't the one originally doing it. At any rate, the second trigger is the one that kills the French PUs after Germany whacks France. It is attached to "French" and then you have the playerAttachment stuff

        <option name="playerAttachmentName" value="PlayerAttachment" count="playerAttachment"/>

        So double check your player attachments for France. If they look ok check the conditions that fire the trigger.

        Edit
        Ahh...just reread your post. Looks as if you have the correct trigger. I'll do some testing see if I can replicate the problem.

        1 Reply Last reply Reply Quote 0
        • B
          beelee last edited by beelee

          Hmm...I just tried it and it worked for me. Can you post a save and what map this is for ?

          You could aslo try searching this in the xml and see if you see anything weird

          <option name="players" value="French"/>
          <option name="playerAttachmentName" value="PlayerAttachment" count="playerAttachment"/>

          also check the condition is before the trigger

          conditionAttachment_French_1_Lose_France

          C 1 Reply Last reply Reply Quote 1
          • C
            Contango @beelee last edited by

            @beelee

            Thanks for the suggestions, they helped me figure it out.

            The problem was that I didn't realize the playerAttachment needed to be defined somewhere. (if that's the right terminology). It was defined for a couple of the nations for other purposes (UK for sharing tech, and Japan for kamikaze strikes) but most of them were missing it. For example:

            <attachment name="playerAttachment" attachTo="French" javaClass="games.strategy.triplea.attachments.PlayerAttachment" type="player">
              <option name="destroysPUs" value="false"/>
            </attachment>
            

            So, that's why it was stable for some nation's capitals and not others.

            B 1 Reply Last reply Reply Quote 2
            • B
              beelee @Contango last edited by

              @Contango right on 🙂 i had forgot about that. Glad you got it working

              1 Reply Last reply Reply Quote 1
              • 1 / 1
              • First post
                Last post
              Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums