Navigation

    TripleA Logo

    TripleA Forum

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

    How to create random spawning during the game?

    Map Making
    4
    8
    397
    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.
    • ebbe
      ebbe last edited by ebbe

      Hej code wizards & Code Gurus 🙂 mayeb @Cernel you might know..?

      Still working here on a finishing touch of The Shogun Advanced and running in to this matter:

      is there a way I could get Random Spawning (by "chance") of a specific type of unit without having to determine each single place
      in a seperate trigger ( causing in this cause with over 160 terr's to be possible to place in far tooo much code )

      Example: ```

      <attachment name="triggerAttachment_Activate_Farmer_Uprisings" attachTo="Ikko-Ikki" javaClass="TriggerAttachment" type="player">
      <option name="conditions" value="conditionAttachmentUprisingsTurn3"/>
      <option name="placement" value="Aki:Farmer" count="1"/>
      <option name="placement" value="Aki:Farmer" count="2"/>
      <option name="placement" value="Awa:Farmer" count="1"/>
      <option name="placement" value="Awa:Farmer" count="2"/>
      
            <option name="chance" value="1:20"/>
            <option name="when" value="after:minorNonCombatMove"/>
          </attachment>
      

      so this will give a 1:20 chance for all 4 places get to Farmer uprising simultaneous where I look for a 1:20 chance for each separate one...

      now the only solution I so far is as stated, getting EACH terr. its own TRIGGER... but that creates huge volume of coding..

      is there another way? please let me know! or give me a refer to an example map...
      ( and I realize after my The Shogun compagnon @TheDog had looked at it there is a only tiny chance there will be another way )
      Arrigato!

      kami-pagode.png
      kami-seductiveGeisha.png
      kami-kensei.png

      1 Reply Last reply Reply Quote 1
      • C
        Cernel Moderators last edited by

        Just do a nested "foreach" loop.

        https://forums.triplea-game.org/topic/560/categories-and-or-tags/51?_=1673720379348

        ebbe 2 Replies Last reply Reply Quote 1
        • ebbe
          ebbe @Cernel last edited by

          @cernel 👍

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

            @ebbe Take a look at my Zombies-World War 2 to see how to implement random uprisings.

            1 Reply Last reply Reply Quote 1
            • ebbe
              ebbe @Cernel last edited by ebbe

              @cernel @TheDog @RogerCooper

              Trying to crack the final issue here before starting a new ohter project!
              So close to a Nesting solution here just miss one piece of the solution, after unsuccesfully trying to solve it a whole afternoon: here my help-call: anyone sees where it goes wrong?

              I want every player to have each Fort_damaged replaced in a Fort (kind of auto-repair) in their own controlled Territory in their before their own Place-delegate: It all works fine except for the

              <option name="when" value="before:@AllPlayersMinorLC@CombatMove"/>
              

              ( =AllPlayersMinor Low Caps ) Both elements <variable name="AllPlayersMinor" & AllPlayersMinorLC" are well defined... so that is fine... but it simply doesn't work then, not even a error notification... it does work when I replace AllPlayersMinorLC with one of the players names; but that takes away the nesting advantage as I still need to repeat this trigger for 15 players each...

                  	<attachment foreach="$AllTerr$^$AllPlayersMinor$" name="conditionAttachment_Fort_damaged_@AllPlayersMinor@_@AllTerr@" attachTo="@AllPlayersMinor@" javaClass="RulesAttachment" type="player">
                      <option name="directPresenceTerritories" value="@AllTerr@"/>
                      <option name="unitPresence" value="Fort_damaged" count="1"/>
              	</attachment>	
              	
              		<attachment foreach="$AllTerr$^$AllPlayersMinor$" name="triggerAttachment_Place_Fort_@AllPlayersMinor@_@AllTerr@" attachTo="@AllPlayersMinor@" javaClass="TriggerAttachment" type="player">
                      <option name="conditions" value="conditionAttachment_Fort_damaged_@AllPlayersMinor@_@AllTerr@"/>
              	    	<option name="when" value="before:@AllPlayersMinorLC@CombatMove"/>
              	    	<option name="placement" value="@AllTerr@:Fort"/>
                  </attachment>
              
              	<attachment foreach="$AllTerr$^$AllPlayersMinor$" name="triggerAttachment_Remove_Fort_damaged_@AllPlayersMinor@_@AllTerr@" attachTo="@AllPlayersMinor@" javaClass="TriggerAttachment" type="player">
                      <option name="conditions" value="conditionAttachment_Fort_damaged_@AllPlayersMinor@_@AllTerr@"/>
              	    	<option name="when" value="before:@AllPlayersMinorLC@CombatMove"/>
              	    	<option name="removeUnits" value="@AllTerr@:Fort_damaged" count="1"/>
                  </attachment>
              

              hmmm
              Anyone who sees a solution? I'll be very thankfull!

              W 1 Reply Last reply Reply Quote 0
              • W
                wc_sumpton @ebbe last edited by

                @ebbe
                You do not have 'AllPlayersMinorLC' in your "foreach" statement.
                Try:
                foreach="$AllTerr$^$AllPlayersMinor$:$AllPlayersMinorLC$"
                and see if you get the results you are looking for.

                Cheers...

                ebbe 1 Reply Last reply Reply Quote 3
                • ebbe
                  ebbe @wc_sumpton last edited by

                  @wc_sumpton

                  That was the one!!!! thanks for getting my Nesting -skills slightly improving !!!

                  W 1 Reply Last reply Reply Quote 3
                  • W
                    wc_sumpton @ebbe last edited by

                    @ebbe
                    👍

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