Announcement

Collapse
No announcement yet.

Need help with a difficult programming problem!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need help with a difficult programming problem!

    Just to let you know I have mostly dropped my old game and have started a new one and it is coming along great!

    I'm the making of my game I have a serious problem... The whole game would be ruined if I couldn't solve this problem! Let me elaborate a little bit!

    I plan on having a "Thieving Skill" in my game. There will be other skills (Such as Cooking) but if I can figure out how to get the Thieving going I'll be able to make everything work fine.

    My problem is this:

    Using the thieving skill you will be able to "Pickpocket" people. When you walk over to them you can ether chose to "Start A Conversation" or "Pickpocket". You can also steal from chests, pick locks, steal from market stalls, disarm traps, steal artifacts, and do many other things. The way I want this all to work is simple: At first you have "Level 1 Thieving" and after joining a band of gangsters you will be sent by the "King of thieves" on missions to steal big artifacts and expensive things. As well as raising your reputation with the gang you will also gain a "Thieving Level" for each mission. In the beginning your "Level 1 Thieving" will be very useless. For example: Level 1 Thieving means you will steal things successful 1/10 time's. Each time you complete a "Mission" you "Level up" ( Basically level 2 = 2/10 etc) the numbers may not necessarily be on a _/10 bass-is. They may change but I believe I will use _/10 because that's about how many "Missions" I want to include.

    Anyways the problem I need you guys to solve is this: I need a Random Number Generator that will generate a number from 1-10. It will have to give me new numbers very often because say it only gives me 1 number each day then I will fail EVERY TIME I use the Thieving skill that whole day! I also need to somehow have the different numbers change after a little while. That way I can level up. If you don't understand what I mean let me explain: Say for example 1=Success, 2=Success, 3=Success, 4=Success, 5=Success, 6=Success, 7=Fail 8=Fail, 9=Fail, and 10=Fail. Then my character completes a "Mission" so I want 7 to change from 7=Fail to 7=Success. How can I do this?

    So let me restate it all: I need a Random Number Generator that starts out with bad odds and slowly changes to better odds each time I finish a "Thieving Mission" up over time.

    "There's Nothing better than a drunken Russian singing Italian opera"

    #2
    Re: Need help with a difficult programming problem!

    RM3 doesnt have a built in number generator, its one of those common sense things the developers forgot to put in :/

    Perhaps just make it a variable based thing and if your skill isnt high enough you wont be able to steal it?
    Last edited by JPS; 01-27-2008, 09:06 PM.

    Here I come Pav, like the Kool-Aid man barging into a funeral! Oh yeah!

    Comment


      #3
      Re: Need help with a difficult programming problem!

      Thats easy, use the Pseudo Random Number Generator then check to see if the number generated is less than or equal to the 'Theiving Skill.'

      Somebody had been asking about them (the PRNG) lately, the threads should still be on the first page of this forum.
      stodi no na ka cenba

      Comment


        #4
        Re: Need help with a difficult programming problem!

        You can steal anything at any level but the higher the level the less chance you will be caught.

        Can someone show me how to make a Psuedo-Thingy? And I still need a method to "level up" (Read my first post to See what I mean by "Level up")

        "There's Nothing better than a drunken Russian singing Italian opera"

        Comment


          #5
          Re: Need help with a difficult programming problem!

          OK I think I will ether use a lot of space to make a Pseudo-Random-Number-Generator or I will use a system I developed myself. (Basically in just about EVERY event in the game, Whether they happen 1 time or 100 times, I will add a command to the end that says "Add/Subtract __ to/from Thieving Variable". I have also developed an even more complicated system that I believe I will use but I don't feel like typing it all out right now...)

          But I'm still suffering with 1 issue:

          Say I have a variable system for pickpocketing and it is like this: 1=Success, 2=Success, 3=Success, 4=Success, 5=Success, 6=Success, 7=Fail, 8=Fail, 9=Fail, 10=Fail.

          How can I make it so that after a quest it will change to this?: 1=Success, 2=Success, 3=Success, 4=Success, 5=Success, 6=Success, 7=Success, 8=Fail, 9=Fail, 10=Fail.

          The only thing I could think of is having different Modes... Each time I complete a Thieving Mission it will "level up and switch to the next mode to make it easier to steal. But that means that I would have to write out 10 MODES PER PICKPOCKETABLE PERSON!!!

          Anyone have a better suggestion?

          "There's Nothing better than a drunken Russian singing Italian opera"

          Comment


            #6
            Re: Need help with a difficult programming problem!

            NO, you don't get it.

            IF Shared Variable 1(random number) <= (less than or equal to) Shared Variable 2(Thieving Skill)
            THEN
            Give Treasure/Item to Party
            ELSE
            Display Message ("You were caught! You will be fined 50 gold!")
            Take 50g from Party
            END IF

            Do you understand now? The higher your skill, the more numbers there will be interpreted as a success. If your skill is 5, then any outcome with a 1, 2, 3, 4, or 5 will result in a success; while any outcome with a 6, 7, 8, 9, or 10 will result in failure. You don't need to write any extra modes, except maybe to prevent the player/party from stealing a whole bunch of the same item from the same person. Get it now/
            Last edited by Stormy; 01-28-2008, 01:43 AM.
            stodi no na ka cenba

            Comment


              #7
              Re: Need help with a difficult programming problem!

              Originally posted by Lord Cohliani View Post
              But I'm still suffering with 1 issue:

              Say I have a variable system for pickpocketing and it is like this: 1=Success, 2=Success, 3=Success, 4=Success, 5=Success, 6=Success, 7=Fail, 8=Fail, 9=Fail, 10=Fail.

              How can I make it so that after a quest it will change to this?: 1=Success, 2=Success, 3=Success, 4=Success, 5=Success, 6=Success, 7=Success, 8=Fail, 9=Fail, 10=Fail.
              Add 1 to the variable which tracks your thief quest level, whenever you complete the quest.

              - Make a 2-way VC branch which checks your thief quest level.
              ---if it equals 0 - (place a 2-way VC branch here)
              ---------if thief variable is < or = to 6, succeed
              ---------if thief variable is > or = to 7, fail
              ---if it equals 1 - (place another 2-way VC branch here)
              ---------if thief variable is < or = to 7, succeed
              ---------if thief variable is > or = to 8, fail

              So basically that's 2 2-way VC branches within 1 other 2-way VC branch for each person/thing which can be pilfered. If your thief quest level goes higher then you'll need a 3-4 way VC branch for it, and 1-2 more 2-way VC branches, but that's still not TOO bad.
              Last edited by Ωbright; 01-28-2008, 02:05 AM.

              Comment


                #8
                Re: Need help with a difficult programming problem!

                To again reference my unreleased farming sim (the other reference is in your other thread), I have a similar system of PRNG (determining a 0-9 number by using a variable change in EVERY event in the game), and then taking whatever the random variable's value is, transferring it to another variable, and adding +1 to it for every level of the skill you have (or whatever value you deem necessary to make your system work). Then make a val cond branch using the newly incorporated variable to determine if it's >= or < your chosen value for success.

                I explain this concept more fully in the PRNG thread referenced by the poster a few above me that should still be on the first page (maybe the second now).

                Comment


                  #9
                  Re: Need help with a difficult programming problem!

                  Originally posted by Obright View Post
                  - Make a 2-way VC branch which checks your thief quest level.
                  ---if it equals 0 - (place a 2-way VC branch here)
                  ---------if thief variable is < or = to 6, succeed
                  ---------if thief variable is > or = to 7, fail
                  ---if it equals 1 - (place another 2-way VC branch here)
                  ---------if thief variable is < or = to 7, succeed
                  ---------if thief variable is > or = to 8, fail
                  OK I think I can use this! Thank You Obright! Your a genius! I will actually have to write out a 10 way Variable with each branch having a 10way inside it! That will take a little wile! But I think it will be worth it!

                  Hey is there a way to "Copy and Paste" Event Codes? That would mean I only have to write it out 1 time not like 500. (I plan on using the "Thieving Skill" to let you steal from chests, pick locks, use stealth, steal from market stalls, rob shops, and so on and so forth. And if I have to write it out EVERY time that means A LOT of work! )

                  Thanks for all your help you guys!
                  Last edited by Lord Cohliani; 01-28-2008, 10:58 AM.

                  "There's Nothing better than a drunken Russian singing Italian opera"

                  Comment


                    #10
                    Re: Need help with a difficult programming problem!

                    There is no copy/paste in RM3 (except copying monsters). I don't really understand Obright's method, so I can't say if it works better than mine... But i'm pretty sure mine is simpler and takes less code. Definetly takes less variables. Mine only takes 2 variables for all pickpocketing, and has no modes. You only need like 6 comands too
                    stodi no na ka cenba

                    Comment


                      #11
                      Re: Need help with a difficult programming problem!

                      Originally posted by Stormweaver
                      IF Shared Variable 1(random number) <= (less than or equal to) Shared Variable 2(Thieving Skill)
                      Unfortunately, this code cannot be implemented in RPGM3. The right side needs to simply be a value. There IS a way to compare two variable values but it's very complicated.


                      Obright's system will definitely accomplish what you want it to, and it turns out to be some very good code. I want to suggest one alternate way of doing it, because it will be more efficient IF you're planning on implementing a lot of different factors into the success/fail system. It's akin to Pen-and-Paper "Skill Checks" where you use a modifier to change the difficulty of the roll.

                      Variable 0 = Random Number Generator
                      Variable 1 = Blank
                      Variable 2 = Skill (Beginner, Intermediate, Advanced, Expert)

                      Copy Var 0 into Var 1
                      Val-Cond. Branch: Based on Var 2
                      ..If Var 2 = 0, do nothing.
                      ..If Var 2 = 1, subtract 1 from Var 1
                      ..If Var 2 = 2, subtract 2 from Var 1
                      ..If Var 2 = 3, subract 3 from Var 1
                      Val-Cond. Branch: Based on Var 1
                      ..If Var 1 <= 6, SUCCESS
                      ..If Var 1 >= 7, FAIL

                      Thus, if you've gained one level of skill, a "roll" (RNG) of 7 will appear inside the check as a 6, and you'll succeed. It requires a little more setup in the front-end, but the beauty is that you never have to nest decision-branches. If you also want to adjust the roll based on whether you've found the Thieves Gloves, you can do a Val-Cond Branch based on Var 3 (which tracks whether you've found the gloves) right before the Val-Cond Branch based on Var 2. No nesting required.



                      Also, let's say someone checked an event that added to the RNG variable... a lot of times. The value might be something like 260! They're gonna keep failing the Thievery if they need a 6 or less. May I recommend making your system a little more sleek, as such?

                      *Add 0-9 (different in each event) to Shared Variable 0
                      *Var-Cond Branch Based on SV0:
                      ..If SV0 >= 11, subtract 10 from SV0.
                      ..If SV0 <= 10, do nothing.

                      This system will make the "chance" of having any number 1-10 to be the same. (Remember to start the Variable at a value of 1-10, not at 0.)


                      How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

                      "I live and love in God's peculiar light." - Michelangelo

                      Comment


                        #12
                        Re: Need help with a difficult programming problem!

                        Yes you CAN copy/paste event codes within the same event, but you can't copy lines of code from one event to another, nor can you copy events. Just put the cursor over the line of code that you want to copy, press X, and select 'copy' from the menu. That line of code will turn grey, and if you move the cursor up or down, you can then select a group of code lines. Press X again, and you've just copied that line of code, or that code block.

                        As for my method, it uses only 2 variables also. It uses one to determine how far along you are as a thief, and one random variable.

                        Oh, and you DO NOT have to make a 10-way VC branch for each time the stealing variable is checked, because regardless of the fact that you have 10 possible values for that variable, there are only TWO possible outcomes: Success or Failure. If the random variable is equal to or less than 6, you will succeed in stealing, and if it is greater than or equal to 7, you will fail.

                        If you have more than 1 thief quest to consider, like...if after each quest is complete you want to 'level up' the thief skill, and you have several, you can make the VC branch which checks your thief quest level be a 3-way branch, a 4-way branch, or you can add another one...but keep in mind, you're going to get really close to the 50-lines-of-code-per-mode limit.

                        There's no such thing as a 10-way VC branch anyway.

                        [EDIT] Whoa...I like Wave's idea.
                        Last edited by Ωbright; 01-28-2008, 01:36 PM.

                        Comment


                          #13
                          Re: Need help with a difficult programming problem!

                          OK I think I understand Obrights idea now... I just need to make a Random Number Generator now, because as you can see Wave pointed out my idea wouldn't work... I thought up another one but that one wouldn't work either... So anyone have any ideas on how to make a Variable Based RNG?

                          "There's Nothing better than a drunken Russian singing Italian opera"

                          Comment


                            #14
                            Re: Need help with a difficult programming problem!

                            What kind of a scripting system doesn't let you compare two variables?!

                            What the crap?!
                            stodi no na ka cenba

                            Comment


                              #15
                              Re: Need help with a difficult programming problem!

                              ?... Just answer my question OK?

                              "There's Nothing better than a drunken Russian singing Italian opera"

                              Comment

                              Working...
                              X