• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Quick Research & Development Thread

redriders180

Mastermind of Pokemon Glazed
314
Posts
13
Years
Do it! ASM isn't nearly as hard as people make it out to be, and it's a lot of fun.

Maybe it's me, but ASM is a pain. I've found plenty of tutorials saying the basic stuff, but nothing that says what tools you need, or anything of that nature. ANYWAYS...

How easy or hard would it be to make it so pokemon that hatch from an egg are level 1 instead of level 5 in firered? I think it was unsafe to have level 1 Pokemon in Gen I and II, but in Gen III they're fine for the most part. Anyway, I just think it makes more sense if they hatch at Level 1.
 

JPAN

pokemon rom researcher
104
Posts
15
Years
  • Seen Jul 2, 2016
Unfortunately, time to hack is growing shorter by the semester, and research subjects seem to pile up when you have little time. I was hoping to release some examples with this, but...

The subject is Battle AI.
Battles are pretty much a mystery when compared to other fields of pokemon study. We can pretty much change the Overworld to do whatever we want, but to get the code to run anything else (other than that for which it was intended) in the battle screen is hard. Even strings, that outside we can display with a simple call, need to be encoded into the battle string displayer and accessed by an index, requiring repointing tables, changing limiter bytes and much more.

When we look at a battle, we expect the opposing team to do something back. They supposedly have some strategy, but digging into the trainer and wild pokemon code revealed something suprising: Trainers and wild pokemon seem to share the same code.
Functions used by the wild pokemon have trainer only functions, disabled because of the battle flag.
And I have yet to find where they select what they do. The trainer "AI byte" only function seem to be setting the IV's for each party member (0xff being 31 IV's for everything).

So, what I found was the attack selection byte. In the case the pokemon will attack, this is the byte that is used to see what he selected.
At 0x0801488E is the last location the selected attack is stored. It first goes through a series of temporary addresses that change a lot, so pinpointing the origin is hard. Replacing that location with a hook and creating a routine to handle it can create diverse AI.

At 0x02000090 is the location of your attack. 0x02000091 keeps the enemy attack, 92 and 93 the same for partner pokemon. That attack is stored as the Attack slot number. The attack it corresponds can be found by going into the battle data for each pokemon (0x02023be4 for yours, 0x02023be4 + 0x58 for opponent) + 0xc + (attackSlot*2).

So, what can we use this for? We can hook this routine to simulate lots of different scenarios.
For instance, using it to create smarter pokemon (like Elite Four members that know the type chart and use the most effective attacks, and learn information about your team during battle). Or change attacks on your own pokemon(like simulating the battle palace on Fire Red). Or create double battles with a secondary trainer (AI for the second trainer).

The main reason I don't have any simple examples for this one is because other than the really dumb "random attack" model, there are no simple examples. Programming an AI is time consuming (specially in assembly), but for anyone out there that wants to try, I give you a way to start.

As you may notice, the function refered is not the AI function. It's merely the last in a series of memory variables being copied, that end at that location when the attack is selected. This findings do not allow you to change Item usage for trainers, and if the game decides to use an item, or change the pokemon on the field, your attack changes at this level will have no effect. But for wild pokemon, it works perfectly.
 
3,830
Posts
14
Years
  • Age 26
  • OH
  • Seen Feb 26, 2024
For anyone that wants to change the badge required for surf, the offset of the flag is 0806D59C. Also, I'm pretty sure that 0806D5D0 is waterfall, but I haven't tested it. (FireRed)
 
Last edited:

droomph

weeb
4,285
Posts
12
Years
Specials BPEE

I've noticed that JPAN has a thread on Specials in Fire Red, but I can't find a thread (or post) that has one that is just as comprehensive as his on any other game. So I dug out some of the more common Specials, and a little bit on flags, variables, and stuff.

Spoiler:
Note that this is far from finished; I only started this afternoon. I will add more as I find even more stuff.

I hope this will be of some help to the Emerald population.
 
Last edited:

sonic1

ASM is my life now...
77
Posts
15
Years
Hey, for emerald i have something too:
Spoiler:
 

droomph

weeb
4,285
Posts
12
Years
Hey Guys. I've been trying to find out how to edit the PC Boxes for a while. So far all I've find out is that it is stored in the VRAM and what I've include in the screenshot below. If anyone experienced with Hex etc. can help me out, I would really appreciate it :)

Findings


I managed to find the header. I havn't tried editing it yet. As I'm more interested interested in the actual box. I noticed that most boxes only use one or two different tiles repeated over and over, so maybe there isn't actually a whole image to edit unlike Gen IV games. In which case it's possible that those tiles are in that picture and I missed them.
You do realize in that picture you didn't include ALL the tiles in the tileset, right? Go check on those. When you find a couple "grainy" tiles, those are the tiles.

Uh... they're stored in the ROM, and copied to the VRAM when the game needs to draw them to the screen. I suspect they're uncompressed in the ROM, so you could just use a tile editor to change them (if you can find them).

If you want to find it in the ROM, simply go to 0x600400, note the first hundred or so bytes (copy function?) and search for that in the actual ROM (0x8000000 onwards).
 
Last edited:
37
Posts
13
Years
  • Age 27
  • Seen Feb 7, 2014
For music hacking with Pokemon Emerald, you can find out the voicegroups by doing this...

1. Have two windows of Sappy open.
2. http://www.pokecommunity.com/showthread.php?t=148811 Use this page
3. One window of Sappy has Emerald. The other has Fire Red.
4. Look for a song in Fire Red that has a voicegroup from the link that you want.
5. Open the same song in the Emerald Sappy window.
6. The voicegroups correspond with each other.
7. Use the Emerald voicegroup for the new song your inserting.
 

sonic1

ASM is my life now...
77
Posts
15
Years
In emerald, at the offset 0x611C9A, there's a table with 10 entries of 2 bytes (shorts), followed by an FFFF at the end of the table, which marks the pokemon restricted for entry in Battle Tower. To add or remove entries, add the pokemon number reversed in hex, and end the table with FFFF. If you want to remove all the limitations, just write FFFF to the beginning of the table (offset 611C9A).

~Sonic1
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
I have found the transform animation in FireRed. It's located at 0xDF9BC.
It gets called multiple times, once a frame I believe, during the transformation. Everything is in here, including the pallet loading part which gets the "whited out" pallet, and the part which gets the actual sprite.

Using this routine, we could theoretically create custom transformations, such as Burmy changing into a different forme, or perhaps even in battle evolution.
 

Darkdata

15 year old me was an idiot.
137
Posts
18
Years
  • Age 39
  • Seen Nov 25, 2013
I have a spreadsheet file that contains a bunch of useful information for those who like to keep organized when scripting. With it, you can quickly reference and grab information in a easy to read format.

Credits for the information are on the last sheet.



Click picture to download
 

droomph

weeb
4,285
Posts
12
Years
Material ID D/P

I got bored, so I made this. I'll probably add to it as I find out more about NSBMD. Hm, maybe not.
Spoiler:
 
Last edited:

redriders180

Mastermind of Pokemon Glazed
314
Posts
13
Years
Complete Edit: I decided to delete my previous post, and ask something else instead
Oh wow, you guys are quite a few calibers above me...I feel sort of insignificant, but I guess I'll post my ideas.

Anyway, I'd like to implement a very dynamic script in my game...Basically, I wanted to allow myself to release events for my game. But instead of being limited to whatever I choose at the time, and avoiding releasing a new patch every time I wanted to do an event, I decided to make a spot in my game with a person that asks for a series of codes. These codes would be released by me, and the script would take the codes hex values, arrange them as necessary, do some checks to make sure the player isn't just mashing buttons, and "build" a completely custom Pokemon. This would allow me to easily decide an event, calculate the code, and release it in a post.

But my problem is that I need a keyboard to pop up, in order to enter the code. I've decided on two approaches:

The easy way would be to edit the mail input to take easy chat words and convert them into code. This would be good, since there are so many words, and I assume each is a byte value. But it's somewhat unprofessional.

The hard way would be to recreate the "nickname" keyboard. I wouldn't know whats involved, but I know emerald has one for Walda...could we port it over.

Aw man, I made my post immensely long for no reason again ._. Sorry, and thanks for the help!
 

sonic1

ASM is my life now...
77
Posts
15
Years
Complete Edit: I decided to delete my previous post, and ask something else instead
Oh wow, you guys are quite a few calibers above me...I feel sort of insignificant, but I guess I'll post my ideas.

Anyway, I'd like to implement a very dynamic script in my game...Basically, I wanted to allow myself to release events for my game. But instead of being limited to whatever I choose at the time, and avoiding releasing a new patch every time I wanted to do an event, I decided to make a spot in my game with a person that asks for a series of codes. These codes would be released by me, and the script would take the codes hex values, arrange them as necessary, do some checks to make sure the player isn't just mashing buttons, and "build" a completely custom Pokemon. This would allow me to easily decide an event, calculate the code, and release it in a post.

But my problem is that I need a keyboard to pop up, in order to enter the code. I've decided on two approaches:

The easy way would be to edit the mail input to take easy chat words and convert them into code. This would be good, since there are so many words, and I assume each is a byte value. But it's somewhat unprofessional.

The hard way would be to recreate the "nickname" keyboard. I wouldn't know whats involved, but I know emerald has one for Walda...could we port it over.

Aw man, I made my post immensely long for no reason again ._. Sorry, and thanks for the help!

Well, either way of doing things, if you want to create a completely "custom" pokemon, you're gonna need ASM.
My approach is: why don't you build a system that, when inputting some values in the ram, reads them and does things based on them?
Did you know that VBA's Memory Viewer has the ability of loading hex data into ram offsets? You could create your .raw/.bin files and ask the player to load them manually with vba.

But yeah, thats only an idea i have.

~Sonic1
 

redriders180

Mastermind of Pokemon Glazed
314
Posts
13
Years


Well, either way of doing things, if you want to create a completely "custom" pokemon, you're gonna need ASM.
My approach is: why don't you build a system that, when inputting some values in the ram, reads them and does things based on them?
Did you know that VBA's Memory Viewer has the ability of loading hex data into ram offsets? You could create your .raw/.bin files and ask the player to load them manually with vba.

But yeah, thats only an idea i have.

~Sonic1
I already knew that I'd need ASM, and I do have a plan on making this work...Each letter has a byte value, and I want to make the keyboard thing store a byte value to certain variables (0x8000 to 0x8009 come to mind). The all you need to do is create a certain code, e.g the first two bytes determine pokemon species, etc. etc, put in some checks, and then voila, the Pokemon is created. I've already studied extensively on pokemon data structures, and JPANs hack engine makes it easier...simply give a "base pokemon" (aka Bulbasaur), use the special that "unlocks" the pokemon, and "push" the values from the variables to the corresponding bytes. All I need to make is the keyboard store each letters byte value into a variable.

I realise that simply giving a .raw file would be simple, but I dunno, I kinda want it to look nice, keep it interesting, and make it so even the noobiest of rom hack players could obtain my events, and I'm sure almost everyone can input some codes.
 

droomph

weeb
4,285
Posts
12
Years
I already knew that I'd need ASM, and I do have a plan on making this work...Each letter has a byte value, and I want to make the keyboard thing store a byte value to certain variables (0x8000 to 0x8009 come to mind). The all you need to do is create a certain code, e.g the first two bytes determine pokemon species, etc. etc, put in some checks, and then voila, the Pokemon is created. I've already studied extensively on pokemon data structures, and JPANs hack engine makes it easier...simply give a "base pokemon" (aka Bulbasaur), use the special that "unlocks" the pokemon, and "push" the values from the variables to the corresponding bytes. All I need to make is the keyboard store each letters byte value into a variable.

I realise that simply giving a .raw file would be simple, but I dunno, I kinda want it to look nice, keep it interesting, and make it so even the noobiest of rom hack players could obtain my events, and I'm sure almost everyone can input some codes.
well, 0x815F9B4+(0x79x4) in FireRed is the pointer to the ASM routine for givepokemon...maybe you could try a little call-with-parameters to that or whatnot?

Also, if you wanna do that keyboard thing, DavidJCobb has a keyboard (of sorts) for variable reading, although it's kinda cumbersome. I think he has a link in his sig or something...

If you know some programming you could set up a small applet online which automatically patches your save file, like a real Event.
 
Last edited:

sonic1

ASM is my life now...
77
Posts
15
Years
There's just one problem with that. What about people that use hardware (ie. A Flashcard) and not VBA?
Well... Yeah, i admit, it isn't good for those, but you can just do an action replay that overwrites the values in RAM.


I already knew that I'd need ASM, and I do have a plan on making this work...Each letter has a byte value, and I want to make the keyboard thing store a byte value to certain variables (0x8000 to 0x8009 come to mind). The all you need to do is create a certain code, e.g the first two bytes determine pokemon species, etc. etc, put in some checks, and then voila, the Pokemon is created. I've already studied extensively on pokemon data structures, and JPANs hack engine makes it easier...simply give a "base pokemon" (aka Bulbasaur), use the special that "unlocks" the pokemon, and "push" the values from the variables to the corresponding bytes. All I need to make is the keyboard store each letters byte value into a variable.

Well, you know, its fairly easy to use the naming routine (the keyboard thing). Its just calling the routine with 2 parameters plus 2 optional (optinal depending on the type of usage = player, pokemon, box, mail). R0 is type of naming/usage, and R1 is the adress in RAM where the input is gonna be stored! This is a valuable info for you. You can store the adress of the var 8000 there and it will store 10 bytes (max letters) from the initial address onward (thus ending in var 8005, if i'm correct).

But hey, don't try to put everything in just 1 input. Make 3-4 inputs depending on your needs. I doubt 2 bytes are enough to store a pokemon species using the keyboard, because the keyboard doesn't have access to 255 different symbols (ok, what i'm tryin' to explain is a bit hard, and i don't know how to explain it well).

~Sonic1
 
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
I've been fiddling around with special 0xC2 which apparently hatches eggs, to try and create a 'force hatching' scenario.

The special alone (in a script) seems to only work if 'egg' is the only thing in your party. Having 2 eggs in your party - only the first one will hatch. Having any pokemon in your party and a " - hatched from the Egg" message will occur, giving you the option to nickname 'egg' but having no effect.

The normal egg hatching script:

#org 0x1BF546
lockall
msgbox 0x81BFB5A MSG_KEEPOPEN '"Huh?"
special 0xC2
waitstate
releaseall
end

I tried using Special2 and set the store variable to 0x2 to see if it could 'select' the correct position for the egg, if it was 2/3rd in the party. However the only change this made was the egg then hatched to ??????, which then got nicknamed, but the eggs stayed in the party still.

So is it possible to use the special / special2, in co-ordination with writing a byte or calling forth a variable to then either pick what the egg hatches into, or what egg hatches.
 

droomph

weeb
4,285
Posts
12
Years
I've been fiddling around with special 0xC2 which apparently hatches eggs, to try and create a 'force hatching' scenario.

The special alone (in a script) seems to only work if 'egg' is the only thing in your party. Having 2 eggs in your party - only the first one will hatch. Having any pokemon in your party and a " - hatched from the Egg" message will occur, giving you the option to nickname 'egg' but having no effect.

The normal egg hatching script:



I tried using Special2 and set the store variable to 0x2 to see if it could 'select' the correct position for the egg, if it was 2/3rd in the party. However the only change this made was the egg then hatched to ??????, which then got nicknamed, but the eggs stayed in the party still.

So is it possible to use the special / special2, in co-ordination with writing a byte or calling forth a variable to then either pick what the egg hatches into, or what egg hatches.
Try decompiling the pointers to that script/the few bytes around the script and see what you find, maybe those pass the parameters to the variables...
 

redriders180

Mastermind of Pokemon Glazed
314
Posts
13
Years

Well... Yeah, i admit, it isn't good for those, but you can just do an action replay that overwrites the values in RAM.




Well, you know, its fairly easy to use the naming routine (the keyboard thing). Its just calling the routine with 2 parameters plus 2 optional (optinal depending on the type of usage = player, pokemon, box, mail). R0 is type of naming/usage, and R1 is the adress in RAM where the input is gonna be stored! This is a valuable info for you. You can store the adress of the var 8000 there and it will store 10 bytes (max letters) from the initial address onward (thus ending in var 8005, if i'm correct).

But hey, don't try to put everything in just 1 input. Make 3-4 inputs depending on your needs. I doubt 2 bytes are enough to store a pokemon species using the keyboard, because the keyboard doesn't have access to 255 different symbols (ok, what i'm tryin' to explain is a bit hard, and i don't know how to explain it well).

~Sonic1

I understand completely what you mean :) I had planned to make the script something with a maybe 4 or 5 inputs...I wanted complete control over species, IVs, moves, item held, and possibly nickname. How do you recommend I make this work, however? Would I have to make an ASM that just puts the ram offset into R1, then call the normal nicknaming special?

This brings up something else...If I just use the nickname keyboard, the text says "[pokemon's] Nickname?". If it's not hard, I'd like to make it say something else on it, otherwise I'm sure I could live with it.
 
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
Try decompiling the pointers to that script/the few bytes around the script and see what you find, maybe those pass the parameters to the variables...

Hmm the pointer to the egg script lies at 0x6d71c, the only data string that is just before that pointed to a script with the line 'fadesong 0x9AOD' which as far as I know doesn't exist - so looks like egg hatching is controlled by ASM.

Does anyone know where Egg-Step information is stored?

//

Been looking for possibly Egg-Step info, can't seem to find it anywhere o_o nobody lists it with species/etc. data, and I have looked around the areas with it to no avail (For example, I'm assuming Pikachu will have a value of '15' somewhere in it's data to signify 21 cycles for hatching. If that value was momentarily set to 0, I wonder if the egg would insta-hatch.
 
Back
Top