Exarion

Gen 3 RNG manip research, day 1

Jan 1st, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. Research from Day 1 focused on RNG manipulation in Sapphire only. Credit to MKDasher for basically all of this.
  2.  
  3. In Sapphire, the random() function is called in only two ways before you select your Mudkip:
  4. 1. When your trainer ID is generated, random() is called 38 to 45 times. Each ID corresponds to a specific number between 38 and 45. These calls control random events like Feebas fishing tiles.
  5. 2. When an NPC begins a movement, random() is called once. When an NPC finishes a movement, random() is called again. If the NPC tries to move but cannot because he is blocked (by your character or his movement boundaries), random() is called twice.
  6.  
  7. Your trainer ID is generated inside the truck. The ID corresponds to the frame on which it was chosen (starting from soft reset), so it can be manipulated by being frame-perfect. If you were able to find a cluster of IDs with the same number of random() calls, you could consistently manipulate the RNG through the truck and Mom cutscenes. Note that during the Mom cutscene, there is a hidden NPC that can move several times.
  8.  
  9. SAMPLE TABLE #1
  10. Frames from SR Trainer ID Calls (truck) Calls (NPC) Calls (total)
  11. 2100 12345 41 0 41
  12. 2101 23456 41 0 41
  13. 2102 34567 39 2 41
  14. 2103 45678 41 0 41
  15.  
  16. After the Mom cutscene, there are two more cutscenes in which NPCs can advance the RNG. The first occurs after exiting your house, and the second occurs after exiting May's house. You can track some movements by watching the NPCs, but there will always be several frames on which they can move while hidden. However, if you know how many times random() has been called through the Mom cutscene, you can determine these hidden movements, and thus the number of random() calls, based on how many frames you spend between the truck cutscene and exiting the house.
  17.  
  18. SAMPLE TABLE #2
  19. RNG calls Frames between cutscenes Fat guy movement Calls (NPCs)
  20. 41 3100 None 2 (meaning one hidden movement)
  21. 41 3101 Down, then left 4
  22. 41 3102 Up 2
  23. 41 3103 Left 4 (meaning one hidden movement)
  24.  
  25. The number of random() calls from ID generation and hidden movements can be tracked on emulator. From there, we'd need to look up the IDs that we're likely to get while manipulating desirable Mudkips. The goal would be to find a good cluster of IDs that correspond to a good Mudkip (or cluster of Mudkips). Our results might look something like this:
  26.  
  27. Mudkip(s) Best ID cluster ID cluster wait time (in frames)
  28. 9829 3 15
  29. 10536 5 60
  30. 10606 4 20
  31. 15823 3 5
  32.  
  33. Note that the in-game timer does not run during the intro cutscene in which you name your character, so you can wait on the last input before your trainer ID is generated in order to optimize your ID cluster timing.
Add Comment
Please, Sign In to add comment