Jump to content

Recommended Posts

Posted

For a while now I've been using the AR code for pokemon black that allows a person to encounter every pokemon, 1-649, in every area (not including water).

I've started to notice, though, that this code isn't as random as one might expect. Some pokemon seem to spawn in certain patches at much higher frequencies than others, while some I haven't seen at all.

'Random' is a rather tricky word so if anyone can explain how the code randomizes the finds I'd be most grateful.

Here's the code:

923FFFFE 00000001

62250010 00000000

DA000000 02250010

D4000000 00000029

D7000000 02250010

D3000000 00000000

82250010 00000289

D4000000 FFFFFD77

D7000000 02250010

D2000000 00000000

923FFFFE 00000001

123FFFFE 00000000

DA000000 02250010

C0000000 0000001E

D7000000 02250014

DC000000 00000002

D2000000 00000000

A2257010 00000000

923FFC3C FFF00000

923FFFFE 00000000

123FFFFE 00000001

D2000000 00000000

Also, this code causes wild double battles to always consist of the same two pokemon (levels, gender, etc. are not always the same). Another note is that in patches which only initiate single battles the same wild pokemon can be encountered in quick succession two or three times i.g., moving a single square into another patch after a battle with one pokemon will trigger another battle with the same pokemon.

EDIT: I've found that the code seems to 'reset' upon entering and exiting a route. That is to say that pokemon with lower or nearly non-existant frequencies are encountered the longer I stay and search in the route. While the dozen or two I usually see don't always appear in the same order they still spawn first.

Posted

923FFFFE 00000001

if (*23ffffe)

62250010 00000000

if the encounter slots are sitting in ram

DA000000 02250010

load first encounter into rD

D4000000 00000029

add 41 to rD

D7000000 02250010

*(2250010 + offset) = rD

D3000000 00000000

set the offset to 0

82250010 00000289

is 0x289 < (*2250010 & 0xFFFF)

D4000000 FFFFFD77

two's compliment subtract 289 from rD

D7000000 02250010

*(2250010 + offset) = rD

D2000000 00000000

end

923FFFFE 00000001

if (*23ffffe)

123FFFFE 00000000

*23ffffe = 0

DA000000 02250010

rD = *(2250010 + offset)

C0000000 0000001E

for(i = 30; i > 0; --i)

D7000000 02250014

*(2250014 + offset) = rD

DC000000 00000002

offset += 2

D2000000 00000000

continue;

A2257010 00000000

if(*2257010 & 0xffff)

923FFC3C FFF00000

if 0 == (*2fffc3c)&F ;this is true every 16 frames

923FFFFE 00000000

if(!*23ffffe)

123FFFFE 00000001

*23ffffe = 1 ;change the encounter slots every 16 frames

D2000000 00000000

i only spent about 5 minutes on this, but as best i can see it, it "randomizes" the encounter slots by adding 41 to them every 16 frames? also, it makes sure that you're walking around. 2257010 is a step counter. if the step counter is 0, it never checks for (vframe & ffff) & f.

Posted

The one I made for Black 2/White 2 seems like it randomizes a little better than this version. I never felt the need to add 0x29 each time... Adding 0x1 is good enough since once the counter is > 0x289 or == 0x28A, it'll reset to 0x1 and continue to add 0x1 each time; thus, continuing the randomization cycle. The code will continue to do this at a very fast pace since I never set a conditional on the execution timer address (something along the lines of 74000100 FF00000C at the top of the code) so you'll never get the same Pokemon back-to-back.

Maybe this could be ported (or remade) for Black/White?

https://github.com/Demonic722/pokemon_collection/tree/master/src/b2w2/random_encounter

I should have removed the button activator on that code, eh?

Posted

if i was doing it, i would probably hook the encounter code off to my own code that uses actual rand calls to build the random poke encounter table. seems like that would probably be the best way. rand(649(0x289) + 1 for each of the 10 pokes to encounter.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...