Can anyone think of a way to create a pseudo random number generator for RPGM3? The only way I can think of doing it is to start off with a given variable equalling a certain number, and as each day passes, and each event transpires, add or subtract to this number. That way, depending on the things you do in the game, and the order in which you do them, a "random" number will always exist, which can then be checked to trigger other events. This is the best I can come up with. Any other ideas? I really need to have a mechanic for this in my game, or some of the events (as this is for a dating/farming sim) will be repeated with the same results every day. I need some variety in this game, or it might just be kind of lame. Thanks in advance.
Announcement
Collapse
No announcement yet.
Pseudo random number generator
Collapse
X
-
Re: Pseudo random number generator
Umm....heres one. When you've used up all of the events you'll need on a map, make an auto event on each map. Have them using 4 way val control branches that work in a way that no loops will be made on that particular map (You'll need another event to do this). As such, using shared variable 1:
Auto Event:
Val Control Branch (Shared Variable 2)
Option 1: Shared Variable 2 = 0
Val Control Branch (Shared Variable 1)
Option 1: Shared Variable 1 <= 3
Shared Variable 1 + 2
Takeover event 2
End Option 1
Option 2: Shared Variable 1 = 4
Shared Variable 1 - 2
takeover event 2
End Option 2
Option 3: Shared Variable 1 =5
Shared Variable 1 + 4
takeover event 2
End Option 3
Option 4: Shared Variable 1 >= 6
Shared Variable 1 + 6
takeover event 2
End Option 4
End Option 1
Option 2: Shared Variable 2 = 1
End Option 2
Event 2:
Shared Variable 2 = 1
So basically, have the less then or equal to, two equal to's, and a greater then or equal to done so that the variable will always change but only once. Then ,have all the variables making the change happen only once a day reset when you wake up.
Did that make sense?Last edited by hitogoroshi; 07-10-2006, 08:41 PM.
Comment
-
Re: Pseudo random number generator
Oh...when you said Variable 1 + 6, I thought you meant adding two variables together. Staring at this screen, it makes absolutely no sense to me, but I'll print it out and enter it into my game, where it might make more sense. What is the event you are transitioning to, though? Don't you have to transition to SOMETHING?
Comment
-
Re: Pseudo random number generator
I was looking over Hito's info for the "random" number generator, and improvised something on my own. I was stuck with auto-event loops for about 2 hours until I decided the way to solve the problem is to put a "turn display off" code at the end of mode 5, then each morning, turn the dispay back on. Enjoy!!
Auto event Mode 1 set to time=morning
Val Conditional Branch Variable 1
Option 1:Variable 1=0
Modify mode 2
End Option 1
Option 2:Variable 1=1
Modify mode 3
End Option 2
Option 3:Variable 1=2
Modify mode 4
End Option 3
End Branch
Modes 2, 3, and four are the same, except the "+ or - a fixed number" values are different...so, on to mode 2, 3, and 4
Auto event Modes 2, 3, and 4
Val Conditional Branch Variable 2
Option 1:Variable 2 <= 4
---Val Conditional Branch Variable 2
--- Option 1:Variable 2 <=1
--- Variable 2 (+ or - a fixed number value here)
--- End Option 1
--- Option 2: Variable 2=2
--- Variable 2 (+ or - a fixed number value here)
--- End Option 2
--- Option 3: Variable 2=3
--- Variable 2 (+ or - a fixed number value here)
--- End Option 3
--- Option 4: Variable 2=4
--- Variable 2 (+ or - a fixed number value here)
--- End Option 4
End Branch
End Option 1
Option 2:Variable 2=5
Variable 2 (+ or - a fixed number value here)
End Option 2
Option 3:Variable 2=6
Variable 2 (+ or - a fixed number value here)
End Option 3
Option 4:Variable 2 >=7
---Val Conditional Branch Variable 2
--- Option 1:Variable 2=7
--- Variable 2 (+ or - a fixed number value here)
--- End Option 1
--- Option 2:Variable 2=8
--- Variable 2 (+ or - a fixed number value here)
--- End Option 2
--- Option 3:Variable 2=9
--- Variable 2 (+ or - a fixed number value here)
--- End Option 3
--- Option 4:Variable 2 >=10
--- Variable 2 (+ or - a fixed number value here)
--- End Option 4
--- End Branch
End Option 4
End Branch
Modify Mode 5
Mode 5 set to time !=morning
Val Conditional Branch Variable 2
Option 1:Variable 2 <=4
---Val Conditional Branch Variable 2
--- Option 1:Variable 2 <=1
--- Modify Variable 2=0
--- End Option 1
--- Option 2:Variable 2=2
--- Modify Variable 2=1
--- End Option 2
--- Option 3:Variable 2=3
--- Modify Variable 1=2
--- End Option 3
--- Option 4:Variable 2=4
--- Modify Variable 1=0
--- End Option 4
End Option 1
End Branch
Option 2:Variable 2=5
Modify Variable 1=1
End Option 2
Option 3:Variable 2=6
Modify Variable 1=2
End Option 3
Option 4:Variable 2 >=7
---Val Conditional Branch
--- Option 1:Variable 2=7
--- Modify Variable 1=0
--- End Option 1
--- Option 2:Variable 2=8
--- Modify Variable 1=1
--- End Option 2
--- Option 3:Variable 2=9
--- Modify Variable 1=2
--- End Option 3
--- Option 4:Variable 1 >=10
--- Modify Variable 1=0
--- End Option 4
--- End Branch
End Option 4
End Branch
Modify Mode 1
Turn Event Display Off...this is very important!!
The way I have my game set up, I'm not using a standard inn. I have a character that changes the time of day back to morning after staying there. In the code for the innkeeper, I have the display for the event turned back on every morning you leave the inn.
So what does all this do? First, it gives me 2 groups of pseudo-random numbers, one from 1-10, and the other from 0-2. I can then use these anywhere in my game. The slight problem with this is that the numbers follow a certain pattern, so if you play the game more than once (or if multiple people play), you will ALWAYS get the same "random" result. Therefore, what I decided to do is at the beginning of the game, I will ask two questions before you start playing. The first will have 4 responses, and depending on your response, you will start out with variable 2 equalling either 1, 2, 3, or 4. The second question will have three responses, and depending on your response, you will start out with variable 1 equalling 0, 1, or 2. Therefore, there are quite a few permutations (don't ask me how many!) of number patterns that you will ultimately play the game with.
So that's my own "pseudo random number generator." Feel free to use this information if you so desire.Last edited by Perversion; 07-11-2006, 09:20 PM.
Comment
-
Re: Pseudo random number generator
Please disregard the above code I posted for the "random number generator." I worked it out on paper yesterday, and it appears that the numbers follow a certain pattern no matter which values you start with...and these numbers get stuck repeating over and over again. For example, the first number is 4. Then 3. Then 6. Then 1. Then it goes back to 4 again. So this just kind of sucks. Looks like I'm going to have to go back to my original idea of modifying the number each time you talk to someone or sell something, etc. I'm going to leave that code in the game, and just change the second number (the 0,1,2 variable) each time you talk to someone. This way you will still have the same 1-10 number every day, but depending on who you talk to last that day, it will always be a different value the next day...I hope this makes some sense. All that work for nothing...oh, well. You live, you learn. That's all for now.
Comment
-
Re: Pseudo random number generator
I think there is a way to get random numbers by attaching them to...Random Battles!
Have each monster party always drop a treasure item, then create an event on each map that detects which treasure item you have. When said treasure is in your possession, the event will change the shared variable used for your generator, then remove the treasure from your inventory.
Comment
-
Re: Pseudo random number generator
If you leave the name of the treasure blank, then it doesn't look like the player is getting anything.
Also, you need to set the treasure as the event's trigger. If the treasure is removed afterward, the event won't be stuck in a loop.
I figured this out when I was trying to make a battle counter.
Comment



Comment