TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    How to create random spawning during the game?

    Scheduled Pinned Locked Moved Map Making
    8 Posts 4 Posters 1.2k Views 4 Watching
    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.
    • ebbeE Offline
      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 Offline
        Cernel Moderators
        last edited by

        Just do a nested "foreach" loop.

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

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

          @cernel 👍

          RogerCooperR 1 Reply Last reply Reply Quote 0
          • RogerCooperR Offline
            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
            • ebbeE Offline
              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!

              wc_sumptonW 1 Reply Last reply Reply Quote 0
              • wc_sumptonW Offline
                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...

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

                  @wc_sumpton

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

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

                    @ebbe
                    👍

                    1 Reply Last reply Reply Quote 0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • 1 / 1
                    • First post
                      Last post
                    Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums