Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Arbitrary Code Execution Discussion

A fun little script to randomize encounters - Page 1

A fun little script to randomize encounters

Posted by: metalmario32
Date: 2019-07-24 18:50:43
I devised a script to randomize Pokémon encounters on RBY English. Don't have time to test it, but here's the script:



ASM:


ld a, ($FFD3)
ld ($D059), a
ret


FFD3 and FFD4 are the RandomAdd and RandomSub functions in HRAM, respectively. These addresses' values are randomized every frame, so this in a sense randomizes the encounters.

Re: A fun little script to randomize encounters

Posted by: bwill11
Date: 2019-07-25 06:45:17
This might be fun to try to beat the game while using this script every time you enter a route, thus having a randomizer game but with glitch Pokemon and a very limited party due to the bootstrap necessary.

Re: A fun little script to randomize encounters

Posted by: Torchickens
Date: 2019-07-25 07:03:29
Yeah, you can change the meta-map script to change the OAM DMA to run this code (though below I did it in a messy way with broken sprites as I'm cautious modifying FF84 instead if it does the OAM DMA 'bad accesses' thing and am still naive about it). This way every time you say, Fly to Pallet Town the randomiser will be active until power off.

https://www.youtube.com/watch?v=RDq6DvWPx5M

It's also possible in Gold/Silver with a method such as this (set up the raw code with TM/HM pocket quantities):

https://www.youtube.com/watch?v=C43saZicYqk

Re: A fun little script to randomize encounters

Posted by: metalmario32
Date: 2019-07-25 08:20:17
Nice ideas! Thanks to both of you.

Re: A fun little script to randomize encounters

Posted by: Torchickens
Date: 2019-07-25 12:53:24

Nice ideas! Thanks to both of you.


You're welcome. :)

Re: A fun little script to randomize encounters

Posted by: metalmario32
Date: 2019-07-25 15:00:41
Now that I think about it, I could ROM hack the game to:

Re: A fun little script to randomize encounters

Posted by: Parzival
Date: 2019-07-27 16:30:01

Now that I think about it, I could ROM hack the game to:


    [li]Randomize starters.[/li]
    [li]Run the script upon entering a new location (Routes, cities, etc.) but only for the first time.[/li]

if you call the "Random" function (forget where it is, check your SYM) it'll re-roll the PRNG. Helpful if you wanna reroll manually instead of relying on the per-frame roll.

Re: A fun little script to randomize encounters

Posted by: metalmario32
Date: 2019-07-28 07:41:01
Thanks Parzival! I'll have to check the SYM…

Re: A fun little script to randomize encounters

Posted by: Sherkel
Date: 2019-07-28 14:25:04
Seeing as Random is called in VBlank, is there a need to use that function here?

Re: A fun little script to randomize encounters

Posted by: metalmario32
Date: 2019-07-28 19:36:10
I'm not sure. I'm not all experienced with the ROM and the underlying functions. I think you might be able to ask Torchickens.

Re: A fun little script to randomize encounters

Posted by: Sherkel
Date: 2019-07-28 23:14:28

I'm not sure. I'm not all experienced with the ROM and the underlying functions. I think you might be able to ask Torchickens.
You should check this out! https://eldred.fr/gb-asm-tutorial/

Re: A fun little script to randomize encounters

Posted by: metalmario32
Date: 2019-07-29 08:24:46
Thank you for the help! Still need to read a bit more.