Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Help
  3. adding "luck" to a game

adding "luck" to a game

Scheduled Pinned Locked Moved Help
8 Posts 3 Posters 1.7k Views
  • 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.
  • TheNicknameGovT Offline
    TheNicknameGovT Offline
    TheNicknameGov
    trusted helpers
    wrote on last edited by
    #1

    How do you make a luck system with another variable with how much chance there is to get better stuff in said luck system?

    Please help all my projects are 3000+ blocks

    SirBotsS JaecadeJnightJ 2 Replies Last reply
    1
    • TheNicknameGovT TheNicknameGov

      How do you make a luck system with another variable with how much chance there is to get better stuff in said luck system?

      SirBotsS Offline
      SirBotsS Offline
      SirBots
      wrote on last edited by SirBots
      #2

      @the_true_odst said in adding "luck" to a game:

      How do you make a luck system with another variable with how much chance there is to get better stuff in said luck system?

      A very simple system is to create a list with all the variables that you want it to pick. If you want something to be very common, put a high amount of the same variable in the list. If you want it to be rarer, put very little (at minimum one mention somewhere on the list) of that variable on the list. The more mentions of one variable, the more common it is, and vice versa. If you want to have multiple luck systems for multiple different scenarios, you need a list for each individual system or scenario.

      Your local coder who is working around the clock to make sure great games are made

      TheNicknameGovT 1 Reply Last reply
      1
      • SirBotsS SirBots

        @the_true_odst said in adding "luck" to a game:

        How do you make a luck system with another variable with how much chance there is to get better stuff in said luck system?

        A very simple system is to create a list with all the variables that you want it to pick. If you want something to be very common, put a high amount of the same variable in the list. If you want it to be rarer, put very little (at minimum one mention somewhere on the list) of that variable on the list. The more mentions of one variable, the more common it is, and vice versa. If you want to have multiple luck systems for multiple different scenarios, you need a list for each individual system or scenario.

        TheNicknameGovT Offline
        TheNicknameGovT Offline
        TheNicknameGov
        trusted helpers
        wrote on last edited by
        #3

        @sirbots said in adding "luck" to a game:

        multiple luck systems for multiple different scenarios…

        So if you have greater luck for rarer things, you would need create a different table with rarer things appearing more?

        Please help all my projects are 3000+ blocks

        SirBotsS 1 Reply Last reply
        1
        • TheNicknameGovT TheNicknameGov

          How do you make a luck system with another variable with how much chance there is to get better stuff in said luck system?

          JaecadeJnightJ Offline
          JaecadeJnightJ Offline
          JaecadeJnight
          Mod Helper
          wrote on last edited by
          #4

          @the_true_odst You could have a custom reporter block that will take an input and return either “true” or “false”, which is if the user is lucky enough for something to happen or not. That block’s logic would just be making a random number from 1-100, and checking if it is greater than or equal to 50, and if it is, then return true, if not, return false. You could then use that to kind of like guard features (“Sorry, you aren’t lucky enough to do this action. ACCESS DENIED”) or to provide little easter eggs like only showing a different title art or something if a random number is like 38 or whatever. You don’t wanna make it too impossible though, then there’d be no point in putting the feature unless enough people are playing your game (over 1000) that at least one person will find the easter egg.

          You could also provide a more varied output for things that aren’t just “true” and “false”, like say, determining how much XP to give a player after a mission. You might wanna take into account if the user did everything right on that mission, or just make it random (or a bit of both!).

          This block (returns true/false) could just be
          (lucky enough?)
          Psuedo-code:

          if random number from 1-100 is greater than or equal to 50:
            return true
          else:
            return false
          

          And for a more complex luck system (like the one I described farther up above) would perhaps need inputs in its custom block, and/or using lists (tables may be a bit much unless you need to store like items/different treasures). Inputs could be like the user’s luck, so if you wrote 0, the block would return a trash item, or if you wrote 100, they’d get a super mythical admin weapon, and of course, there’s the in-between (like common,uncommon,rare, epic, legendary, etc.).
          I don’t have sample code to provide for a more complicated luck system, but I hope what I said can help you!

          #LLJW
          <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

          TheNicknameGovT 1 Reply Last reply
          0
          • JaecadeJnightJ JaecadeJnight

            @the_true_odst You could have a custom reporter block that will take an input and return either “true” or “false”, which is if the user is lucky enough for something to happen or not. That block’s logic would just be making a random number from 1-100, and checking if it is greater than or equal to 50, and if it is, then return true, if not, return false. You could then use that to kind of like guard features (“Sorry, you aren’t lucky enough to do this action. ACCESS DENIED”) or to provide little easter eggs like only showing a different title art or something if a random number is like 38 or whatever. You don’t wanna make it too impossible though, then there’d be no point in putting the feature unless enough people are playing your game (over 1000) that at least one person will find the easter egg.

            You could also provide a more varied output for things that aren’t just “true” and “false”, like say, determining how much XP to give a player after a mission. You might wanna take into account if the user did everything right on that mission, or just make it random (or a bit of both!).

            This block (returns true/false) could just be
            (lucky enough?)
            Psuedo-code:

            if random number from 1-100 is greater than or equal to 50:
              return true
            else:
              return false
            

            And for a more complex luck system (like the one I described farther up above) would perhaps need inputs in its custom block, and/or using lists (tables may be a bit much unless you need to store like items/different treasures). Inputs could be like the user’s luck, so if you wrote 0, the block would return a trash item, or if you wrote 100, they’d get a super mythical admin weapon, and of course, there’s the in-between (like common,uncommon,rare, epic, legendary, etc.).
            I don’t have sample code to provide for a more complicated luck system, but I hope what I said can help you!

            TheNicknameGovT Offline
            TheNicknameGovT Offline
            TheNicknameGov
            trusted helpers
            wrote on last edited by
            #5

            @jeffreyrb03-gmail No, I meant like how some RNG games, depending on the luck you have determines how high of a roll you get. I want to implement this style into my game

            Please help all my projects are 3000+ blocks

            JaecadeJnightJ 1 Reply Last reply
            1
            • TheNicknameGovT TheNicknameGov

              @jeffreyrb03-gmail No, I meant like how some RNG games, depending on the luck you have determines how high of a roll you get. I want to implement this style into my game

              JaecadeJnightJ Offline
              JaecadeJnightJ Offline
              JaecadeJnight
              Mod Helper
              wrote on last edited by
              #6

              @the_true_odst well then the last part of my answer applies to your RNG game, and you will need a table to store stuff like the item name, description, and rarity. It shouldn’t be too hard to just use random numbers, I think you should try it out the way I said first

              #LLJW
              <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

              1 Reply Last reply
              0
              • TheNicknameGovT TheNicknameGov

                @sirbots said in adding "luck" to a game:

                multiple luck systems for multiple different scenarios…

                So if you have greater luck for rarer things, you would need create a different table with rarer things appearing more?

                SirBotsS Offline
                SirBotsS Offline
                SirBots
                wrote on last edited by
                #7

                @the_true_odst Creating a list for when you would have “Higher luck”, yes. You would make the rarer things have more entries in the list.

                Your local coder who is working around the clock to make sure great games are made

                TheNicknameGovT 1 Reply Last reply
                1
                • SirBotsS SirBots

                  @the_true_odst Creating a list for when you would have “Higher luck”, yes. You would make the rarer things have more entries in the list.

                  TheNicknameGovT Offline
                  TheNicknameGovT Offline
                  TheNicknameGov
                  trusted helpers
                  wrote on last edited by
                  #8

                  @sirbots I created 50 of something (let’s called it “thing1” bc the game I’m making is a secret), 25 of thing2, 12 of thing3, 6 of thing4, 3 of thing5, 1 of thing6, reshuffled the table a few times and pulled the first item out of that table. If that’s what you mean, would you make another table if you have a higher rarity with more rarer things added?

                  Please help all my projects are 3000+ blocks

                  1 Reply Last reply
                  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
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • CreatiCode