Navigation

    TripleA Logo

    TripleA Forum

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

    Any better way to capture the value of the a die roll?

    Map Making
    3
    4
    268
    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.
    • M
      Myrd last edited by Myrd

      Any better way to capture the value of the a die roll?

      I know triggers have a "chance" effect, but this just tests a single die roll for a threshold, and doesn't actually let you do different things on different values.

      One way I found to do this is something like this:

      1. Have one reserved territory and 6 unit types, one for each side of a die.
      2. Have 6 identical RulesAttachments checking for no die unit present in the territory.
      3. Have corresponding 6 triggers with conditions set to the RulesAttachments above (each to a distinct one), which check that there's no die placed. Each one has a "chance" of "1:N", so first one does "1:6", second one "1:5" and so forth and the last one "1:1" (always true), each creating the corresponding die unit in the territory. These have a "when" that's never true, so they don't fire directly.
      4. Have one more trigger that has 6 activateTriggers referencing the triggers in 3, with "check chance" and "check conditions" set to true.
      5. Have another trigger to remove the die unit from the territory after we're done with it.

      After all the above, we now capture the result of the d6 as a unit in a territory, that can then be tested elsewhere. (If we only need to use it once, then the actual effect can be inlined in the 6 triggers).

      Why is all this complexity needed?

      1. First, we need the 6 identical RuleAttachments because the engine will "cache" the result of evaluating one, so we can't evaluate it 6 times and get different results.
      2. We need the extra trigger in step 4 that activates the other 6 triggers, because we need them to be executed in the specified order. If we just let them fire on their own using their "when" + "conditions", they'll fire in a random order - which will not work correctly. (I wonder if it's intended that the order is arbitrary - I think it would be a lot easier for mapmakers if the order matched the order in the file.)
      3. We have to roll N different dice to simulate the result of one die, i.e. first check on a 1 on a d6, then on a 1 on d5 and so forth. Because as far as I can tell, there's no way to "get" the result of a die roll and use it somewhere.

      So, all the above works, but is a lot of complexity just to say "roll a die, on a 1 do this, on a 2, do this, etc".

      Am I missing some scripting feature that allows to do the above in a simpler way?

      If not, perhaps it's worthwhile to add. Perhaps it can be as simple as something like "activateTriggers" variant that can be based on number of dice sides (perhaps another option that tells, roll an N-side die, and run only k-th activateTriggers entry, corresponding to the die).

      RogerCooper 1 Reply Last reply Reply Quote 0
      • RogerCooper
        RogerCooper @Myrd last edited by

        @myrd What is the result you are trying to accomplish? There may be an easier way.

        If you want to save the result of randomness, the easiest thing to do is to grant a tech.

        1 Reply Last reply Reply Quote 0
        • M
          Myrd last edited by Myrd

          The map I'm implementing is based on a board game that uses dice for both income and territory value assignment.

          For territory value assignment, when you first capture a territory, a die is rolled and that's the "wealth production" of that territory.

          For income, you roll a die once during your income step and then all your territories whose "wealth production" are >= die value produce 1 wealth (which are units that are movable).

          Anyway, I have all of this implemented already using the clunky technique above. I was wondering if there's some engine feature I'm missing that can simplify this.

          I don't think tech makes sense since this happens every turn and not a 1-time thing.

          RogerCooper 1 Reply Last reply Reply Quote 0
          • RogerCooper
            RogerCooper @Myrd last edited by

            @myrd If you are trying to exactly replicate the boardgame, it is going to be complicated and I don't have anything better for you.

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