The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Quick Research & Development Thread (https://www.pokecommunity.com/showthread.php?t=205158)

EddyHg80 December 29th, 2016 6:06 AM

Guys I need some help to port this feature to the Italian Emerald rom.
I found the battle script offset and the other offsets required but I'm pretty sure some hex valuse needs to be changed. When inserting this new battle script when I catch a pokemon it's all fine, then the pokeball disappears but the battle doesn't end, if I go to the bag and then back into the battle the pokemon is still there.
Can someone have a look into this?

Battle script offset: 0x2DCD10
Pokemons evolve from this experience, replace the bytes at 0x3DE80 with B9 DE 03 08

You can use my save file to test the results.

Trev December 29th, 2016 6:32 AM

The bytes you put at 0x3DE80 should be B5 DE 03 08. Unless that has something to do with Emerald, I don't know because I don't hack Emerald...

Anyway, you don't need to insert any actual battle scripts. Copy this:

Code:

2A 00 08 42 02 02 05 00 92 BD 2D 08 60 0B 10 0B 01 F1 XX XX XX XX 2E 90 44 02 02 00 2E AC 40 02 02 00 2E AD 40 02 02 00 23 00 10 0F 01 3A 2E 32 43 02 02 00 F2 10 0D 01 3A 2E 32 43 02 02 00 F3 C2 BD 2D 08 F0 13 7A C9 5C 08 12 40 00 28 C3 BD 2D 08


to freespace, and replace the XX XX XX XX with a pointer to:

Code:

2E 90 44 02 02 00 2E AC 40 02 02 00 2E AD 40 02 02 00 23 00 10 0D 01 3A 2E 32 43 02 02 00 F3 C2 BD 2D 08 F0 13 7A C9 5C 08 12 40 00 28 C3 BD 2D 08


which you also insert into freespace. Then, go to your offset in a hex editor, and write the pointer to the first code overtop of the pointer already there. The pointer in the first code should be XX XX XX 08 (I don't know why Chaos wouldn't put the 08 there). That's what I did in FireRed so it should, theoretically, work.

Quote:

Originally Posted by Lost Heart (Post 9524148)
Spoiler:
Door Animation Format

Door animations follow a very simple 12-byte format, which I'm sharing for anyone that needs a reference.

Code:

| Offset  | Type          | Notes                            |
|------------------------------------------------------------|
| 0-1    | Tile index    |                                  |
| 2      | Sound flag    | 00 = door, other = sliding door  |
| 3      | Tile flag    | 00 = one tile, other = two tiles |
| 4-7    | Image        | pointer, uncompressed            |
| 8-11    | Palette      | pointer                          |


The data is stored in tables, and can be found at the following offsets:
Code:

AXVE: 30F9B4
AXPE: 30F944
BPRE: 35B5D8
BPGE: 35B5B8
BPEE: 497174



We can repoint this, I assume, which means we could probably have a much easier time inserting and creating doors. Images encompass the animation frames, yes? Does the animation occur naturally if data is added to this table? How would we utilize a newly-inserted door in a map editor?

EddyHg80 December 30th, 2016 3:42 AM

Quote:

Originally Posted by Trev (Post 9532601)
Spoiler:
The bytes you put at 0x3DE80 should be B5 DE 03 08. Unless that has something to do with Emerald, I don't know because I don't hack Emerald...

Anyway, you don't need to insert any actual battle scripts. Copy this:

Code:

2A 00 08 42 02 02 05 00 92 BD 2D 08 60 0B 10 0B 01 F1 XX XX XX XX 2E 90 44 02 02 00 2E AC 40 02 02 00 2E AD 40 02 02 00 23 00 10 0F 01 3A 2E 32 43 02 02 00 F2 10 0D 01 3A 2E 32 43 02 02 00 F3 C2 BD 2D 08 F0 13 7A C9 5C 08 12 40 00 28 C3 BD 2D 08


to freespace, and replace the XX XX XX XX with a pointer to:

Code:

2E 90 44 02 02 00 2E AC 40 02 02 00 2E AD 40 02 02 00 23 00 10 0D 01 3A 2E 32 43 02 02 00 F3 C2 BD 2D 08 F0 13 7A C9 5C 08 12 40 00 28 C3 BD 2D 08


which you also insert into freespace. Then, go to your offset in a hex editor, and write the pointer to the first code overtop of the pointer already there. The pointer in the first code should be XX XX XX 08 (I don't know why Chaos wouldn't put the 08 there). That's what I did in FireRed so it should, theoretically, work.


You just made a copy paste of what Chaos wrote, didn't you? :D
Same result, something has to be changed to get this work with the Italian rom.

Quote:

Originally Posted by Trev (Post 9532601)
The bytes you put at 0x3DE80 should be B5 DE 03 08. Unless that has something to do with Emerald, I don't know because I don't hack Emerald...

In the italian rom that pointer need to be changed since the bytes are not in the same place of the english one.

Can someone download an italian rom and try to fix it please?
(just serch for "Pokemon Smeraldo ita rom download")
Here's my save file to test the results.

Trev December 30th, 2016 6:26 AM

[FR] If you want every Pokemon who participates in battle to receive full exp instead of having it divided, write 01 21 at 0x21C3A. Credit to Doesnt for finding this (somehow).

frezgle December 30th, 2016 1:44 PM

Quote:

Originally Posted by Trev (Post 9533473)
[FR] If you want every Pokemon who participates in battle to receive full exp instead of having it divided, write 01 21 at 0x21C3A.

On this note, the equivalent bytes to change in Emerald are located at 0x4A4FE.

Froosty January 4th, 2017 2:47 AM

Quote:

Originally Posted by azurile13 (Post 9090677)
I don't know if this has been posted before, but whatevs. It came to my attention today that the bag in FireRed crashes if a "main" pocket has more than 42 items (the normal max for regular items). I had always assumed the malloc was done based on a multiple of the numbers inputted at the routine beginning 0x08099E44, because the TM pocket works fine even with over 100 items, but apparently the berry/TM cases mean they run off of something different. Anyhow, to allow for sufficient malloc requests, change ".equ largest_pocket_size" to your new max and insert this:
Code:

.equ largest_pocket_size,        CHANGE THIS LINE
.equ largest_pocket_size_plus_one, largest_pocket_size + 1
.equ strings_size,        largest_pocket_size_plus_one * 19

.org 0x08002B9C
malloc:
        push {lr}
        mov r1, r0

.org 0x081083F4
main:
        push {r4, lr}
        ldr r4, =(0x0203AD18)
        mov r0, #largest_pocket_size_plus_one
        lsl r0, r0, #0x3
        bl malloc
        str r0, [r4, #0x0]
        cmp r0, #0x0
        beq return
        ldr r0, =strings_size
        bl malloc
        str r0, [r4, #0x4]
        cmp r0, #0x0
        beq return
        mov r0, #0x1

return:
        pop {r4}
        pop {r1}
        bx r1


EDIT: I haven't done much testing. I've only thrown like 60 items into the general items pocket before I got bored & assumed this routine was the only problem.

Info on 0x08099E44: http://www.pokecommunity.com/showpost.php?p=9014911&postcount=2018

I cant seem to compile it,
can anyone help me out???

Trev January 4th, 2017 6:12 AM

Quote:

Originally Posted by The_learner (Post 9537833)
I cant seem to compile it,
can anyone help me out???

Post a thread in the Help-Me-Hack section.

Megax Rocker January 4th, 2017 10:52 AM

Is there a way to make Wobuffet and Maril/Azumaril always breed their baby forms without the need of the Incense items to be held? Essentially making them behave like Pikachu and pichu?

Chaotix January 4th, 2017 2:03 PM

Quote:

Originally Posted by Touched (Post 8987453)
Try increasing the value at 0809B430 (FR) from 4 to 5. That number should be the digit length of prices for the Pokemart.

I just tried this recently and I can't seem to get it to work. On attempting to load a pokemart containing an item with a value greater than 5 digits in it's stock the game gets stuck on a black screen. Not sure what could be going wrong here.

BluRose January 4th, 2017 3:55 PM

Quote:

Originally Posted by Chaotix (Post 9538212)
I just tried this recently and I can't seem to get it to work. On attempting to load a pokemart containing an item with a value greater than 5 digits in it's stock the game gets stuck on a black screen. Not sure what could be going wrong here.

hi chaotix! me again

figured it out
9B430 - 05 (max characters taken from a string)
9B440 - 05 (i have no idea, maybe max characters that can be shown? necessary nonetheless)

so just doing these two changes creates an annoying thing where everything has its last digit cut off
9B47A - 64 (instead of 69) (it's an x-coordinate, so i don't know if this value is exact or not)
http://i.imgur.com/QzAT2K9.png
(resultant picture, you can use to compare to original and subtract/add pixel values as necessary)

EDIT: AHHHH KILL ATTACHED THUMBNAILS WITH FIRE

Chaotix January 4th, 2017 4:07 PM

Quote:

Originally Posted by BluRose (Post 9538288)
hi chaotix! me again

figured it out
9B430 - 05 (max characters taken from a string)
9B440 - 05 (i have no idea, maybe max characters that can be shown? necessary nonetheless)

so just doing these two changes creates an annoying thing where everything has its last digit cut off
9B47A - 64 (instead of 69) (it's an x-coordinate, so i don't know if this value is exact or not)

I appreciate this sooo much BluRose! I'll mess around with it soon and thanks much, sorry to bother you with all this.

Squeetz January 5th, 2017 7:03 AM

To change what Pokémon gets the DeepseaScale and DeepseaTooth boosts, change the bytes at 0x3F24C to your new Pokémon's index, reversed. (0x175 is Clamperl)

This will give the Pokémon both boosts, however, so if you want a separate Pokémon for each item, insert this routine somewhere:
Spoiler:
.text
.align 2
.thumb
.thumb_func

main:
LDR R0, .index
CMP R1, R0
BNE .skip
MOV R1, R8
LDR R0, .return
BX R0

.skip
LDR R0, .return2
BX R0

.align 2
.index: .word 0x00000175 @pokemon that should get SpA boost from Deepseatooth
.return: .word 0x803EFD8 +1
.return2: .word 0x803EFDE +1


After that, go to 0x3EFD0 and place:
Code:

00 48 00 47 XX XX XX 08


where the XX is the pointer to the routine, +1.
After this, the byte change you made first in this post will only be relevant for the Pokémon that should get the Sp. Def boost from Deepseascale.

A huge thanks to NewDenverCity for helping me out with this, and making me understand instructions and hooks better!

ShyGuy25 January 7th, 2017 6:01 AM

Does anyone know how to remove the 10% stat boosts given by badges in Fire Red?

Quote:

Originally Posted by Megax Rocker (Post 9538125)
Is there a way to make Wobuffet and Maril/Azumaril always breed their baby forms without the need of the Incense items to be held? Essentially making them behave like Pikachu and pichu?

Open up any Pokemon editor and remove the "breeding only" in the evolutions tab for Wobbuffet, Marill and Azumarill. Its very simple.

Shiny Quagsire January 7th, 2017 5:23 PM

In Fire Red, 0824EFC4 contains a table of structures 4 bytes long describing which environments go with a map's Fight Type. The structure is as follows:
Code:

<byte> Map Type
<byte> Battle Background Index
<Half-Word> Padding


An equivalent structure does not seem to exist in Emerald or Ruby.

The routine which reads the table has a maximum of 7 elements it will attempt to check the map type against. This table can be extended by repointing it and increasing the byte value at 0800F254. In theory, this can allow forcing particular environments in a map for wild/trainer battles. This table is only ever read if the Fight Type is not index 0 (Random in A-Map), and it overrides environments from tile types (ie all grass, water, cave, trainer etc battles will be forced). In theory you could also add additional battle backgrounds by extending the structure array at 0824EE34.

Trev January 7th, 2017 6:51 PM

Quote:

Originally Posted by Shiny Quagsire (Post 9541562)
In Fire Red, 0824EFC4 contains a table of structures 4 bytes long describing which environments go with a map's Fight Type. The structure is as follows:
Code:

<byte> Map Type
<byte> Battle Background Index
<Half-Word> Padding


An equivalent structure does not seem to exist in Emerald or Ruby.

The routine which reads the table has a maximum of 7 elements it will attempt to check the map type against. This table can be extended by repointing it and increasing the byte value at 0800F254. In theory, this can allow forcing particular environments in a map for wild/trainer battles. This table is only ever read if the Fight Type is not index 0 (Random in A-Map), and it overrides environments from tile types (ie all grass, water, cave, trainer etc battles will be forced). In theory you could also add additional battle backgrounds by extending the structure array at 0824EE34.

So, this? :v

BluRose January 8th, 2017 5:32 PM

Quote:

Originally Posted by Megax Rocker (Post 9538125)
Is there a way to make Wobuffet and Maril/Azumaril always breed their baby forms without the need of the Incense items to be held? Essentially making them behave like Pikachu and pichu?

idk if the previous answer actually works (it seems like it wouldn't because there's literally a func handling this) but here's a definite one (fire red)
45FA8 - wynaut's index (1/2 value)
45FB0, 45FE6 - azurill's index (1/2 value)
45FD8, 45FDC - lax incense index
45FE0 - wobbuffet index
45FEE , 45FF2 - sea incense index
45FF6 - marill index
so the way this works is it checks for the species in the egg. if it matches with wynaut or azurill, it checks the held items of the padres. if this matches, it does nothing, if it doesn't, it changes the index to the correct one.

the "fix?" write 00 to 45FA8, 45FB0, and 45FE6. this just changes the pokémon to check for, making the pokémon with index 0 the required pokémon to do the checks. since you never encounter 0, you won't rewlly run into a problem (but it is theoretically possible to have your 00 turn into wobbuffet/marill if you use like cheats to get it smh)
Quote:

Originally Posted by ShyGuy25 (Post 9540962)
Does anyone know how to remove the 10% stat boosts given by badges in Fire Red?

Open up any Pokemon editor and remove the "breeding only" in the evolutions tab for Wobbuffet, Marill and Azumarill. Its very simple.

flag checks in the damage calc for this (don't know where speed is)
3EE1C - boulderbadge check (atk)
3EE50 - soulbadge check (def)
3EE86 - volcanobadge (sp. atk)
3EEBE - volcanobadge (sp. def)
as for speed i'm too lazy to find it :(

Megax Rocker January 8th, 2017 6:11 PM

Quote:

Originally Posted by BluRose (Post 9542547)
idk if the previous answer actually works (it seems like it wouldn't because there's literally a func handling this) but here's a definite one (fire red)
45FA8 - wynaut's index (1/2 value)
45FB0, 45FE6 - azurill's index (1/2 value)
45FD8, 45FDC - lax incense index
45FE0 - wobbuffet index
45FEE , 45FF2 - sea incense index
45FF6 - marill index
so the way this works is it checks for the species in the egg. if it matches with wynaut or azurill, it checks the held items of the padres. if this matches, it does nothing, if it doesn't, it changes the index to the correct one.

the "fix?" write 00 to 45FA8, 45FB0, and 45FE6. this just changes the pokémon to check for, making the pokémon with index 0 the required pokémon to do the checks. since you never encounter 0, you won't rewlly run into a problem (but it is theoretically possible to have your 00 turn into wobbuffet/marill if you use like cheats to get it smh)
flag checks in the damage calc for this (don't know where speed is)
3EE1C - boulderbadge check (atk)
3EE50 - soulbadge check (def)
3EE86 - volcanobadge (sp. atk)
3EEBE - volcanobadge (sp. def)
as for speed i'm too lazy to find it :(

Thanks bro, I really appreciate it.

Froosty January 16th, 2017 8:32 PM

Quote:

Originally Posted by kearnseyboy6 (Post 8271341)
If you want to change a text box permanently navigate to 0x160450. There are pointer to textbox type 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 etc.

Yes you can use XSE to decompile these scripts and feel free to add in anything you may desire.... permanently!

So you won't have to call the transparency asm in every script you want, it does it automatically.

I checked the pointer,
the first two pointers in the offset you gave somehow account to the "found an item" and "bag is full" events,
but the pointers after that really account to the text box :)

BluRose January 18th, 2017 2:12 PM

esipode's question made me do this and i have exams all throughout this week
my priorities literally do not matter

EDIT: a lot more values that are a lot better and that i'd actually be interested in changing!
shoutouts to esipode again for finding 136684 way before i did

fire red - miscellaneous summary screen values that somewhat make sense
as they appear in my notes:
Spoiler:
Code:

when i say "character limit" it's more accurate to say "loaded amount of characters"

13627E - character limit for shown OT
1362B2 - character limit for OT ID, natively supports 7 before showing NONE at the end
1362C8 - character limit for level shown next to pokémon's name
136378 - character limit for current hp
13639C - character limit for maximum hp
1363FA, 136432, 136468, 13649E, 1364D4 - "something probablyTM" but i haven't found anything that it changes
136534 - character limit for attack
136552 - x-value for stats (signed int but only on background?)
13656E - character limit for defense
1365A4 - character limit for sp. atk
1365DA - character limit for sp. def
136610 - character limit for speed
13664C - character limit for maximum experience
13666A - x-value for both experience values (signed int but only on covered area)
136684 - sets the exp to next level to 0 when the level is this +1
1366C0 - character limit for experience to next level
136992 - character limit for current pp
1369CA - character limit for max pp
136A7E - character limit for base power
136A9C - the accuracy value replaced by --- (0)
136AD4 - character limit for accuracy
136DCE - x-value for text in top left
136DD0 - y-value for text in top left
136E92 - x-value for the level above the sprite
136E94 - y-value for the level above the sprite
136EB2 - x-value for the name above the sprite
136EB4 - y-value for the name above the sprite
136EE0 - x-value for the pokémon gender (female)
136EE2 - y-value for the pokémon gender (female)
136F20 - x-value for the pokémon gender (male)
136F22 - y-value for the pokémon gender (male)
136FD0 - x-value for pokémon name
136FD2 - y-value for pokémon name
136FF2 - x-value for pokédex number
137004 - y-value for pokédex number
13701E - x-value for OT name
137020 - y-value for OT name
13703A - x-value for OT ID
13703C - y-value for OT ID
137056 - x-value for item
137058 - y-value for item
1370C2 - x-value for egg state description
1370C4 - y-value for egg state description
13710A - x-value for hp
137122 - y-value for hp
137136 - x-value for attack
137148 - y-value for attack
13715C - x-value for defense
13716E - y-value for defense
137182 - x-value for special attack
137194 - y-value for special attack
1371A8 - x-value for special defense
1371BA - y-value for special defense
1371CE - x-value for speed
1371E0 - y-value for speed
1371F4 - x-value for current exp
137206 - y-value for current exp
13721A - x-value for exp to next level
13722C - y-value for exp to next level
137B3E - x-value for base power
137B40 - y-value for base power
133B62 - x-value for accuracy
133B64 - y-value for accuracy
137B96 - x-value for move description
137B98 - y-value for move description
137C4A - x-value for ability name
137C4C - y-value for ability name
137C66 - x-value for ability description
137C68 - y-value for ability description
138A80 - x-value for first type
138A82 - y-value for first type
138AA4 - x-value for second type (first screen)
138AA6 - y-value for second type (first screen)
138ADA - x-value for first type (when move selected)
138ADC - y-value for first type (when move selected)
138AFC - x-value for second type (when move selected)
138AFE - y-value for second type (when move selected)
138BB4 - change it to anything lower than 64 to badeggify the team entire
139CF4 - x-value for poké ball shown
139CF6 - y-value for poké ball shown
139E5C - x-value for pokémon icon (when move selected)
139E5E - y-value for pokémon icon (when move selected)
13A028 - x-value for the thing that shows you have selected a move (the red border)
13A154 - initial y-value for the thing that shows you have selected a move (the red border)
note  - the y-value shown on-screen is dependent on position.
0203B16D - position of the move selected
0203B16E - position of the move selected to switch
13A6E6 - partitions on hp bar?
13A904 - exp bar y-value
note  - x is in r1 but values i thought would work aren't
13A9DC - when the pokemon level is this +1, then the exp bar in the summary will not show any progress
13AC24 - pokérus indicator x-value-loaded on direct access
13AC26 - pokérus indicator y-value-loaded on direct access
13AD98 - pokérus indicator x-value-loaded on switching pokémon
13AD9E - pokérus indicator y-value-loaded on switching pokémon
13AE20 - something x-value - same as shiny indicator
13AE22 - something y-value - same as shiny indicator
13AF26 - x-value shiny indicator when move selected
13AF2C - y-value shiny indicator when move selected
13AF40 - shiny indicator x-value
13AF46 - shiny indicator y-value
13B040 - markings x-value
13B046 - markings y-value


i'll organize it sometime or something

EDIT2: but blurose! there are multiple x-values for a few things!
haha ye i know and i have no idea what the difference is, either!
it's important to know that the x- and y-values don't match with what is shown in vba as x-/y-values (usually)

EDIT3: found a few more values
still searching for the x-value to the pokémon sprite itself (likely not hardcoded at this point)

Megax Rocker January 25th, 2017 1:12 PM

Is there a way to make link battles faster, as in making the default text speed set as fast in link battles similar to how the battle mode is always SET in link battles, so basically how to change the default options in link battles?

Panda Face January 29th, 2017 6:27 AM

How to disable paralysis in electricity type pokemon in Emerald?

PurpleOrange January 31st, 2017 9:17 AM

In FireRed, LeafGreen, and Emerald there's the altering cave which only has zubat in, however if you went to an event (whether these events happened varies by sources) it would change them to other pokemon.

However making them change in the game is actually really easy.

For FireRed/LeafGreen:
Code:

setvar 0x4024 0xYY


For Emerald
Code:

setvar 0x403E 0xYY


Replace YY with the following:
Code:

00 (for zubat)
01 (for mareep)
02 (for pineco)
03 (for houndour)
04 (for teddiursa)
05 (for aipom)
06 (for shuckle)
07 (for stantler)
08 (for smeargle)
(Anything above this will result in zubat)


This is worked out from the scripts already in the rom of FRLG and Emerald

FireRed
Spoiler:
'-----------------------
#org 0x489862
setvirtualaddress 0x8489862
addvar 0x4024 0x1
compare 0x4024 0xA
virtualjumpif 0x0 0x848987C
setvar 0x4024 0x0
lock
faceplayer
virtualmsgbox 0x8489887 '"Thank you for using the MYSTERY\nGI..."
waitmsgbox
waitkeypress
release
end

'-----------------------
#org 0x48987C
lock
faceplayer
virtualmsgbox 0x8489887 '"Thank you for using the MYSTERY\nGI..."
waitmsgbox
waitkeypress
release
end


'---------
' Strings
'---------
#org 0x489887
= Thank you for using the MYSTERY\nGIFT System.\pRecently, there have been rumors\nof rare POKéMON appearances.\pThe rumors are about ALTERING\nCAVE on OUTCAST ISLAND.\pWhy not visit there and check if\nthe rumors are indeed true?

Emerald
Spoiler:
'-----------------------
#org 0x6756E3
setvirtualaddress 0x86756E3
addvar 0x403E 0x1
compare 0x403E 0xA
virtualjumpif 0x0 0x86756FD
setvar 0x403E 0x0
lock
faceplayer
virtualmsgbox 0x8675708 '"Thank you for using the MYSTERY\nGI..."
waitmsgbox
waitkeypress
release
end

'-----------------------
#org 0x6756FD
lock
faceplayer
virtualmsgbox 0x8675708 '"Thank you for using the MYSTERY\nGI..."
waitmsgbox
waitkeypress
release
end


'---------
' Strings
'---------
#org 0x675708
= Thank you for using the MYSTERY\nGIFT System.\pThere appears to be a rumor about\nrare POKéMON sightings.\pThe sightings reportedly came from\nthe ALTERING CAVE on ROUTE 103.\pPerhaps it would be worthwhile for\nyou to investigate this rumor.

Panda Face February 1st, 2017 2:07 AM

In Emerald, if type 00 00 00 00 in F978F, it will become BW poison effect. Pokemon will not lose HP by poison in overworld.

PurpleOrange February 1st, 2017 5:03 AM

Another bit of scripting stuff, not sure if this has been documented before. But you're able to give pokemon custom moves without asm.
Code:

setpkmnpp 0xAA 0xBB 0xCC


Where AA is the pokemon's party slot -1
Where BB is the move slot -1
Where CC is the move (in hex)

This is worked out from from the surfing pikachu egg scipt which is already in the ROM (at least in emerald)
Spoiler:
'-----------------------
#org 0x674D3D
setvirtualaddress 0x8674D3D
checkflag 0x1E4
virtualjumpif 0x0 0x8674D4C
jumpram
special2 0x40DD 0x86
compare 0x40DD 0x6
virtualjumpif 0x1 0x8674D73
setflag 0x1E4
virtualcall 0x8674D7E
lock
faceplayer
virtualmsgbox 0x8674DDE '"Thank you for using the MYSTERY\nGI..."
waitmsgbox
waitkeypress
fanfare 0x172
waitfanfare
release
end

'-----------------------
#org 0x674D4C
special2 0x40DD 0x86
compare 0x40DD 0x6
virtualjumpif 0x1 0x8674D73
setflag 0x1E4
virtualcall 0x8674D7E
lock
faceplayer
virtualmsgbox 0x8674DDE '"Thank you for using the MYSTERY\nGI..."
waitmsgbox
waitkeypress
fanfare 0x172
waitfanfare
release
end

'-----------------------
#org 0x674D73
lock
faceplayer
virtualmsgbox 0x8674E6A '"Oh, your party appears to be full.\..."
waitmsgbox
waitkeypress
release
end

'-----------------------
#org 0x674D7E
giveegg 0xAC
setobedience 0x40DD
setcatchlocation 0x40DD 0xFF
compare 0x40DD 0x1
virtualjumpif 0x1 0x8674DC0
compare 0x40DD 0x2
virtualjumpif 0x1 0x8674DC6
compare 0x40DD 0x3
virtualjumpif 0x1 0x8674DCC
compare 0x40DD 0x4
virtualjumpif 0x1 0x8674DD2
compare 0x40DD 0x5
virtualjumpif 0x1 0x8674DD8
return

'-----------------------
#org 0x674DC0
setpkmnpp 0x1 0x2 0x39
return

'-----------------------
#org 0x674DC6
setpkmnpp 0x2 0x2 0x39
return

'-----------------------
#org 0x674DCC
setpkmnpp 0x3 0x2 0x39
return

'-----------------------
#org 0x674DD2
setpkmnpp 0x4 0x2 0x39
return

'-----------------------
#org 0x674DD8
setpkmnpp 0x5 0x2 0x39
return


'---------
' Strings
'---------
#org 0x674DDE
= Thank you for using the MYSTERY\nGIFT System.\pFrom the POKéMON CENTER we\nhave a gift--a POKéMON EGG!\pPlease raise it with love and\nkindness.

#org 0x674E6A
= Oh, your party appears to be full.\pPlease come see me after storing\na POKéMON on a PC.

Deokishisu February 3rd, 2017 6:54 AM

Quote:

Originally Posted by PurpleOrange (Post 9561803)
Another bit of scripting stuff, not sure if this has been documented before. But you're able to give pokemon custom moves without asm.
Code:

setpkmnpp 0xAA 0xBB 0xCC


Where AA is the pokemon's party slot -1
Where BB is the move slot -1
Where CC is the move (in hex)

This is worked out from from the surfing pikachu egg scipt which is already in the ROM (at least in emerald)
Spoiler:
'-----------------------
#org 0x674D3D
setvirtualaddress 0x8674D3D
checkflag 0x1E4
virtualjumpif 0x0 0x8674D4C
jumpram
special2 0x40DD 0x86
compare 0x40DD 0x6
virtualjumpif 0x1 0x8674D73
setflag 0x1E4
virtualcall 0x8674D7E
lock
faceplayer
virtualmsgbox 0x8674DDE '"Thank you for using the MYSTERY\nGI..."
waitmsgbox
waitkeypress
fanfare 0x172
waitfanfare
release
end

'-----------------------
#org 0x674D4C
special2 0x40DD 0x86
compare 0x40DD 0x6
virtualjumpif 0x1 0x8674D73
setflag 0x1E4
virtualcall 0x8674D7E
lock
faceplayer
virtualmsgbox 0x8674DDE '"Thank you for using the MYSTERY\nGI..."
waitmsgbox
waitkeypress
fanfare 0x172
waitfanfare
release
end

'-----------------------
#org 0x674D73
lock
faceplayer
virtualmsgbox 0x8674E6A '"Oh, your party appears to be full.\..."
waitmsgbox
waitkeypress
release
end

'-----------------------
#org 0x674D7E
giveegg 0xAC
setobedience 0x40DD
setcatchlocation 0x40DD 0xFF
compare 0x40DD 0x1
virtualjumpif 0x1 0x8674DC0
compare 0x40DD 0x2
virtualjumpif 0x1 0x8674DC6
compare 0x40DD 0x3
virtualjumpif 0x1 0x8674DCC
compare 0x40DD 0x4
virtualjumpif 0x1 0x8674DD2
compare 0x40DD 0x5
virtualjumpif 0x1 0x8674DD8
return

'-----------------------
#org 0x674DC0
setpkmnpp 0x1 0x2 0x39
return

'-----------------------
#org 0x674DC6
setpkmnpp 0x2 0x2 0x39
return

'-----------------------
#org 0x674DCC
setpkmnpp 0x3 0x2 0x39
return

'-----------------------
#org 0x674DD2
setpkmnpp 0x4 0x2 0x39
return

'-----------------------
#org 0x674DD8
setpkmnpp 0x5 0x2 0x39
return


'---------
' Strings
'---------
#org 0x674DDE
= Thank you for using the MYSTERY\nGIFT System.\pFrom the POKéMON CENTER we\nhave a gift--a POKéMON EGG!\pPlease raise it with love and\nkindness.

#org 0x674E6A
= Oh, your party appears to be full.\pPlease come see me after storing\na POKéMON on a PC.

This has been documented and only works this way for Emerald.

PurpleOrange February 3rd, 2017 1:28 PM

Quote:

Originally Posted by Deokishisu (Post 9563026)
This has been documented and only works this way for Emerald.

well as i said, i wasn't sure if it was documented :)
regardless i wonder why this only works in emerald, since the pichu can transfer to all main gen iii games (assuming this is the pokemon box pichu) surely this means that there must be a way that RSFRLG do it no?

DizzyEgg February 3rd, 2017 2:07 PM

Quote:

Originally Posted by PurpleOrange (Post 9563263)
well as i said, i wasn't sure if it was documented :)
regardless i wonder why this only works in emerald, since the pichu can transfer to all main gen iii games (assuming this is the pokemon box pichu) surely this means that there must be a way that RSFRLG do it no?

Yeah, that way is using ASM.

PurpleOrange February 4th, 2017 6:18 AM

Quote:

Originally Posted by Deokishisu (Post 9563026)
This has been documented and only works this way for Emerald.

Quote:

Originally Posted by DizzyEgg (Post 9563313)
Yeah, that way is using ASM.

Not sure where you got this info from, but i tested it and it works in both firered and ruby just fine :)

tkim February 10th, 2017 10:26 PM

Anybody interested in finding out the table offset that special 0x158 uses in FireRed? Special 0x158 = opens several different multichoice boxes depending on 0x8004 *key: 0x0 = badge talk; 0x1 = silph-co elevator; 0x2 = rocket elevator; 0x3 = celadon department store elevator; 0x4 = link options; 0x5 = pharmacy options?; 0x6 other elevator; 0x7 and up - return 0x7f to lastresult* (quoted from JPAN's special/special2 research thread)

PurpleOrange February 11th, 2017 7:04 PM

Whilst HERE tells us where the swarm table is in Emerald, the swarm table in Ruby is at 0x3D13F8, and the table in Sapphire is at 0x3D1450 using their formula the swarms are:

Surskit Lv3, Route 102: Bubble, Quick Attack
Surskit Lv15, Route 114: Bubble, Quick Attack
Surskit Lv15, Route 117: Bubble, Quick Attack
Surskit Lv28, Route 120: Bubble, Quick Attack
Skitty Lv15, Route 116: Growl, Tackle

Something to note, some are using lower level movesets than they should, surskit learns sweetscent at level 13, whilst skitty should know tail whip (lv3), attract (lv7), sing (lv13), and double slap (lv15), maybe the movepools were updated after swarms were coded, or the swarm levels were changed but the table not updated to match the new levels

Also as a note the previous table for emerald is a bit wrong, here's the new one:

Seedot Lv3, Route 102: Bide, Harden, Leech Seed
Nuzleaf Lv15, Route 114: Harden, Growth, Nature Power, Leech Seed
Seedot Lv13, Route 117: Harden, Growth, Nature Power, Leech Seed
Seedot Lv25, Route 120: Giga Drain, Frustration, Solarbeam, Leech Seed
Skitty Lv8, Route 116: Growl, Tackle, Tail Whip, Attract

tkim February 12th, 2017 10:16 PM

FIRERED v1.0: Special 0x158 (shows multichoice based on values 0x0-0x6 stored in var 0x8004) uses a table at 0x3F5BCC that is 0x12C bytes long. There are six entries in the table and each starting entry is 0x30 bytes away from each other. Now one can easily extend this table by repointing, but there is probably the question of where the offset for the multichoice box properties table is and/or the limiting byte location.

edit: FBI's scrolling multichoice routine seems to have the offset for the multichoice box properties but I have no idea how to read or understand it. The offset seems to be at 0x0CBA7C.

Le pug February 13th, 2017 4:53 AM

Quote:

Originally Posted by aar2697 (Post 7209316)
What I've noticed is that when you insert a map, you are not able to ride the bicycle on that map even if you edit all of the header settings for the map. The solution to this lies in the string of bytes for the map header.

1. In Advance Map, go to the map header and enter the professional map header settings with CTRL+H.
2. In the string of bytes for the map header under "Map options:," find the first of the last four bytes (byte #25 if that confuses you).
3. Change that byte (byte #25) to 01.
4. You can now ride the bicycle on that map!

To build on to this, this is for FR only.

For Emerald, it is very close in similarity. Follow the below image in order to get bike to work or not work on your inserted maps or maps already created. The byte is the same on all maps. It is the second to last one every time.

https://i.snag.gy/92zqHO.jpg

Also if anyone is curious, yes you can also do this by changing the Show name on entering drop down for that map. 01 is the "Show name [01]" option. This allows you to bike on that map but doesn't show the map's name. If you want to bike AND show the map's name on entering the map, the byte is 0D or you can choose "Show city names [0D]". If you want to show the city name but NOT allow biking, the byte is 0C or just choose ??? [0C]

Squeetz February 22nd, 2017 3:10 AM

Unsure if this has been found or not, but in Firered, Unown encountered outside the Island Chambers crash the game.
To fix that, go to 0x82A10 and put 00 00 00 00, this will also make every Unown encountered random.

Goblin the Cat March 6th, 2017 9:22 AM

Is it possible to have items with multiple effects? Ex. an item that increases the damage of both fire and water type moves.

NewDenverCity March 6th, 2017 8:29 PM

Quote:

Originally Posted by Goblin the Cat (Post 9588448)
Is it possible to have items with multiple effects? Ex. an item that increases the damage of both fire and water type moves.

Yes, you just have to make it.

PufferJumps March 10th, 2017 5:54 PM

Hello. I hope I'm on the right thread.

I just wanna ask if there's a way to decrease the pages of Pokedex.

Like for example; The National Pokedex would be up to Celebi only.

MWisBest March 18th, 2017 11:18 PM

Quote:

Originally Posted by FamiliaWerneck (Post 8895647)
I know it's nothing hard, nothing WOOOOW, but that's something and my first alone-research-area collaboration. This is for Fire Red:

INFINITE SAFARI TIME


Simply go to 0xA0F1A and replace the 01 38 there, for 00 38.

The game will still give you 600 steps, but it won't decrease, so you will be there until you retire or run out of Safari Balls.
When I figure out how to hide the step count in the start menu, I'll edit this post.

The equivalent "Infinite Safari Steps" for Emerald appears to be at 0xFC15E. Again, just replace 01 38 with 00 38.
Emerald doesn't have a visible step counter in the menu to hide either, which is nice I guess.

Quote:

Originally Posted by Shiny Quagsire (Post 7803428)
If you ever feel the urge to stone a Pokemon to death, setting the byte at 080169D4 from 0x6 to 0x0 will make it so Pokemon don't flee after throwing 20 rocks at them in the safari zone in Fire Red. Not sure if anyone will ever actually use this but whatever. :P

If you'd like to "stone Pokemon to death" in Emerald, change the byte at 0x3EF94 from 0x06 to 0x00 as well.

AkameTheBulbasaur March 21st, 2017 4:05 PM

How To Give ?? Pokemon Separate Cries
In between Celebi and Treecko in \FR{FireRed} and \EM{Emerald}, there are 25 empty Pokemon slots. These slots appear to have originally been used for the 25 Unown forms before Game Freak decided to go a different route. These slots are all hard-coded to have the cry of Unown, and there is no way to change this with a regular cry editor (it will just change the cry of all of them at once, and will also change the cry of Unown itself).

So, in order to give these Pokemon separate cries, you must do the following.

Insert 00 00 00 00 00 00 00 00 00 00 at:

FireRed: 0x4330C
Emerald: 0x6D518
Ruby: 0x3F90C

Insert 00 00 00 00 at:

FireRed: 0x43318
Emerald: 0x6D524
Ruby: 0x3F918

Repoint the table at:

FireRed: 0x2539D4
Emerald: 0x31F61C
Ruby: 0x1FDE6A

To make repointing the table easier, here is a table you can copy-paste to free space. The 00 00 entries are the 25 ?? slots. You can replace the 00 00's with whatever index number you need to.

Spoiler:

00 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00
08 00 09 00 0a 00 0b 00 0c 00 0d 00 0e 00 0f 00
10 00 11 00 12 00 13 00 14 00 15 00 16 00 17 00
18 00 19 00 1a 00 1b 00 1c 00 1d 00 1e 00 1f 00
20 00 21 00 22 00 23 00 24 00 25 00 26 00 27 00
28 00 29 00 2a 00 2b 00 2c 00 2d 00 2e 00 2f 00
30 00 31 00 32 00 33 00 34 00 35 00 36 00 37 00
38 00 39 00 3a 00 3b 00 3c 00 3d 00 3e 00 3f 00
40 00 41 00 42 00 43 00 44 00 45 00 46 00 47 00
48 00 49 00 4a 00 4b 00 4c 00 4d 00 4e 00 4f 00
50 00 51 00 52 00 53 00 54 00 55 00 56 00 57 00
58 00 59 00 5a 00 5b 00 5c 00 5d 00 5e 00 5f 00
60 00 61 00 62 00 63 00 64 00 65 00 66 00 67 00
68 00 69 00 6a 00 6b 00 6c 00 6d 00 6e 00 6f 00
70 00 71 00 72 00 73 00 74 00 75 00 76 00 77 00
78 00 79 00 7a 00 7b 00 7c 00 7d 00 7e 00 7f 00
80 00 81 00 82 00 83 00 84 00 85 00 86 00 87 00
88 00 89 00 8a 00 8b 00 8c 00 8d 00 8e 00 8f 00
90 00 91 00 92 00 93 00 94 00 95 00 96 00 97 00
98 00 99 00 9a 00 9b 00 9c 00 9d 00 9e 00 9f 00
a0 00 a1 00 a2 00 a3 00 a4 00 a5 00 a6 00 a7 00
a8 00 a9 00 aa 00 ab 00 ac 00 ad 00 ae 00 af 00
b0 00 b1 00 b2 00 b3 00 b4 00 b5 00 b6 00 b7 00
b8 00 b9 00 ba 00 bb 00 bc 00 bd 00 be 00 bf 00
c0 00 c1 00 c2 00 c3 00 c4 00 c5 00 c6 00 c7 00
c8 00 c9 00 ca 00 cb 00 cc 00 cd 00 ce 00 cf 00
d0 00 d1 00 d2 00 d3 00 d4 00 d5 00 d6 00 d7 00
d8 00 d9 00 da 00 db 00 dc 00 dd 00 de 00 df 00
e0 00 e1 00 e2 00 e3 00 e4 00 e5 00 e6 00 e7 00
e8 00 e9 00 ea 00 eb 00 ec 00 ed 00 ee 00 ef 00
f0 00 f1 00 f2 00 f3 00 f4 00 f5 00 f6 00 f7 00
f8 00 f9 00 fa 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 11 01 12 01 13 01 0e 01
0f 01 10 01 14 01 15 01 16 01 67 01 68 01 7a 01
77 01 22 01 23 01 24 01 25 01 26 01 1b 01 1c 01
1d 01 1e 01 1f 01 20 01 2d 01 2e 01 2f 01 0a 01
0b 01 76 01 75 01 0d 01 18 01 17 01 36 01 37 01
79 01 7d 01 38 01 39 01 fb 00 49 01 4a 01 32 01
fd 00 6a 01 3e 01 3f 01 70 01 40 01 41 01 4d 01
4e 01 21 01 04 01 44 01 45 01 46 01 30 01 31 01
fe 00 ff 00 3c 01 3d 01 52 01 53 01 54 01 47 01
48 01 7f 01 33 01 4b 01 4c 01 06 01 42 01 43 01
34 01 35 01 6b 01 50 01 51 01 07 01 08 01 02 01
00 01 69 01 fc 00 2a 01 2b 01 2c 01 3a 01 3b 01
78 01 7e 01 7c 01 7b 01 55 01 56 01 57 01 4f 01
1a 01 19 01 03 01 05 01 6f 01 6c 01 6d 01 6e 01
64 01 65 01 66 01 58 01 59 01 5a 01 5b 01 27 01
28 01 29 01 5f 01 60 01 74 01 5c 01 5d 01 5e 01
61 01 62 01 63 01 72 01 71 01 73 01 01 01 80 01
81 01 82 01 83 01 83 01


Offsets for FireRed were found by DoesntKnowHowToPlay and ThomasWinwood. Details are in this post.

All I did was find the Emerald and Ruby offsets. (I put the FireRed offsets here too for convenience).

PurpleOrange March 22nd, 2017 2:25 PM

Quote:

Originally Posted by AkameTheBulbasaur (Post 9598162)
To allow the 25 ?? Pokemon (the ones between Celebi and Treecko) to have separate cries:

Insert 00 00 00 00 00 00 00 00 00 00 at:

FireRed: 0x4330C
Emerald: 0x6D518
Ruby: 0x3F90C

Insert 00 00 00 00 at:

FireRed: 0x43318
Emerald: 0x6D524
Ruby: 0x3F918

Repoint the table at:

FireRed: 0x2539D4
Emerald: 0x31F61C
Ruby: 0x1FDE6A

Offsets for FireRed were found by DoesntKnowHowToPlay and ThomasWinwood. Details are in this post.

All I did was find the Emerald and Ruby offsets. (I put the FireRed offsets here too for convenience).

hey so this isn't actually fully complete as I found out when I first did it and ported to emerald, what I worked out is you actually have to manually write the cry table for the gen one and two mons in hex -1 followed by a 00 then followed by 50 00's (the limbo slots) eg bulbasaur is 00 00, ivysaur is 01 00 venusaur is 02 00 as stated in my post HERE. so you have to make sure the pointer of the table is to the start of the gen one mons

MWisBest March 22nd, 2017 7:47 PM

Quote:

Originally Posted by Sky High (Post 8824230)

DPPt Save/Summary Pokedex Seen Count Display into Emerald



For those who want the DPPt Amount Display of Pokedex which displays the seen amount in while saving and in the continue-new game menu into Emerald:

08031F96: 00 20
08031FA4: 00 20
0819A3B0: 00 20
0819A3B8: 00 20

Again, it is really that simple. :)

Credits to Jambo51 for his original routine for FireRed.

Only error though: the Trainer's ID. While these changes, it doesn't show the seen amount. Does it supposedly to happen or not? I'll look into that later.

To fix the Trainer Card to show the "Seen" amount too:
080C3776: 00 20
080C377E: 00 20

MWisBest March 23rd, 2017 11:08 PM

Quote:

Originally Posted by knizz (Post 7529991)
Firered's "wait-for-interrupt"-loop is quite inefficient. Here is my suggested patch. (Experimental, may or may not freeze the game.)
Code:

BEFORE:
080008aa  8b91 ldrh r1, [r2, #0x1c]
080008ac  1c18 add r0, r3, #0x0
080008ae  4008 and r0, r1
080008b0  2800 cmp r0, #0x0
080008b2  d0fa beq $080008aa
080008b4  bc01 pop {r0}
080008b6  4700 bx r0

AFTER:
080008aa  df02 swi $02
080008ac  8b91 ldrh r1, [r2, #0x1c]
080008ae  1c18 add r0, r3, #0x0
080008b0  4008 and r0, r1
080008b2  2800 cmp r0, #0x0
080008b4  d0f9 beq $080008aa
080008b6  bd00 pop {pc}


This should be useful if emulation is slow on your machine. Or if you want to be even faster when holding the space key.

The same improvement can be made to Emerald.

Code:

BEFORE:
080008c6  8b91 ldrh r1, [r2, #0x1c]
080008c8  1c18 add r0, r3, #0x0
080008ca  4008 and r0, r1
080008cc  2800 cmp r0, #0x0
080008ce  d0fa beq $080008c6
080008d0  bc01 pop {r0}
080008d2  4700 bx r0

AFTER:
080008c6  df02 swi $02
080008c8  8b91 ldrh r1, [r2, #0x1c]
080008ca  1c18 add r0, r3, #0x0
080008cc  4008 and r0, r1
080008ce  2800 cmp r0, #0x0
080008d0  d0f9 beq $080008c6
080008d2  bd00 pop {pc}


TL;DR:
At 0x8C6, change:
91 8B 18 1C 08 40 00 28 FA D0 01 BC 00 47
to:
02 DF 91 8B 18 1C 08 40 00 28 F9 D0 00 BD

Squeetz March 24th, 2017 4:19 AM

Toggling "set" battle mode (Firered)

First insert this somewhere:
Code:

29 00 FE F4 03 02 AA 92 87 1D 08 2B 04 D0 3D 02 02 00 00 40 00 92 87 1D 08 28 35 87 1D 08


Then, at 0x1D8727, put:
Code:

28 XX XX XX 08


Where XX is the pointer to the battle script you inserted above.

Usage:
In a script, put this:
Code:

...
writebytetooffset 0xAA 0x203F4FE
...


Make sure you writebytetooffset 0x0 0x203F4FE after the battle(s) and on the whiteout script, so it doesn't get stuck on Set mode forever.

Explanation:
This is a really cheap and inefficient solution that branches off the original script that asks this:
http://i.imgur.com/XOZLhfX.png
And if 0x203F4FE = 0xAA, it won't ask at all regardless of the player's option setting.
This could be useful if you're making a battle facility and don't want them to be able to switch after knocking out a Pokémon.

I colored some of the numbers in red, this is the ram offset 0203F4FE, so if you're using this for something else, find another area. (By default this isn't used).

Credits to Doesnt who made the "forced" version:
Quote:

Originally Posted by DoesntKnowHowToPlay (Post 8538908)
Either turn set mode on in the options, or put 28 92 87 1D 08 at x1D8727. Be warned that the latter approach has a nasty side effect; scrubs will complain about your hack being "bugged" or that you removed a feature that should've stayed.


Megax Rocker March 24th, 2017 9:06 AM

Quote:

Originally Posted by Squeetz (Post 9599936)
Snip

Hi there, do you happen to know how to change battle options for link battles?

for example can i change the battle mode to "shift" in link battles or increase the text speed?

MWisBest March 25th, 2017 3:44 AM

Surprised nobody has posted this before.

Change Daycare XP Amount Per Step (Emerald)

At 0x70AE8, change 01 30 to XX 30, where XX is the amount of XP you want per step. Personally, I think 2 is more reasonable than 1.
At 0x70B04, change 04 39 to 04 31. This fixes the eggs-not-appearing-with-even-xp-amounts thing. This does have one minor side-effect: the first chance for an egg to appear after placing 2 Pokemon in the daycare can take anywhere between 1 and 256 steps instead of a fixed amount of 256 steps. After the first "egg chance" it goes back to the fixed 1 chance per 256 steps as usual.

Edit: Even values may or may not break breeding (eggs won't show up). Looking into this more currently. Fixed.

ghoulslash April 1st, 2017 9:36 AM

Before I start digging much further, has anybody been able to figure out how to increase the maximum number of casino coins beyond 9,999?

I'll post anything I find here. I will begin by looking at the following commands/offsets:
display coins: 0806C258
show coins: 0809B578
get coin amount: 0809BB00
add coins: 0809BB20
hide coins: 0809B5A0
updatecoins: 0809B5B4

MWisBest April 3rd, 2017 8:32 AM

Continuing with my daycare stuff:

Change Daycare Breeding Rate [EM]

For those unaware, the "Breeding Rate" is the chance of receiving an egg after taking 256 steps.

This is just a basic version that requires only small hex edits; I'm planning on trying to create a routine that separates the one 50% value into two separate configurable values as well as hopefully allowing Pokemon from the same evolution chain to count as "same species" instead of different species (that has always bothered me).

Anyway, the default breeding rates work like this:
  • 70%: Same Species, Different OT
  • 50%: Same Species, Same OT, [I]or[/] Different Species, Different OT
  • 20%: Different Species, Same OT

To change the 70% value, the following hex edits are required:
  1. At 0x70E48, change 46 20 to XX 20
  2. At 0x70EAC, change 46 2A to XX 2A
To change the 50% value...:
  1. At 0x70E5A, change 32 20 to XX 20
  2. At 0x70EA6, change 32 28 to XX 28
To change the 20% value...:
  1. At 0x70E56, change 14 20 to XX 20
  2. At 0x70EA0, change 14 28 to XX 28
XX would be the percentage value you'd like (in hex of course), 0(?) to 100. The first edits listed are to the main compatibility check function, the second edits are to the function that determines which message the daycare man displays when spoken to.

Skeli April 3rd, 2017 8:57 AM

I just copied the above post because I'm lazy. Credits go to MWisBest for the format.

Change Daycare Breeding Rate [FR]

To change the 70% value, the following hex edits are required:
  1. At 0x46648, change 46 20 to XX 20
  2. At 0x466A8, change 46 2A to XX 2A
To change the 50% value...:
  1. At 0x4665A, change 32 20 to XX 20
  2. At 0x466A2, change 32 28 to XX 28
To change the 20% value...:
  1. At 0x46656, change 14 20 to XX 20
  2. At 0x4669C, change 14 28 to XX 28
XX would be the percentage value you'd like (in hex of course), 0(?) to 100. The first edits listed are to the main compatibility check function, the second edits are to the function that determines which message the daycare man displays when spoken to.

MWisBest April 3rd, 2017 9:27 AM

Quote:

Originally Posted by Skeli789 (Post 9608853)
I just copied the above post because I'm lazy. Credits go to MWisBest for the format.

Heh, works for me. Thanks for porting it.

C me April 3rd, 2017 11:29 AM

To continue a bit on the cries research from 3 years ago there is a byte at:

Emerald: 0x080626AE - Opponent
Emerald: 0x0805CA30 - Ally


*FireRed: 0x08038C32 - Opponent
*FireRed: 0x08033428 - Ally

This byte controls the pitch of the cry played when a Pokemon faints. It is normally set to 5 which is low pitched but follows the same structure as the cry command seen here.

I tested them from 0x0 to 0x10 and it's the same as previously researched. As far as I know it only affects fainting in battle, it won't affect the lower pitched cries when your Pokemon is sent out with low hp or overworld cries.

Useful if you don't want lower pitched faint cries, maybe you're using separate cries for fainting or maybe you want high pitched cries.

*Not 100% sure on the FireRed offsets since I found these in Emerald but the routines are almost identical so pretty likely to be correct.

DizzyEgg April 3rd, 2017 11:32 AM

Quote:

Originally Posted by C me (Post 9608909)

Emerald: 0x080626AE


This byte controls the pitch of the cry played when a Pokemon faints. It is normally set to 5 which is low pitched but follows the same structure as the cry command seen here.

I tested them from 0x0 to 0x10 and it's the same as previously researched. As far as I know it only affects fainting in battle, it won't affect the lower pitched cries when your Pokemon is sent out with low hp or overworld cries.
.

Actually it just controls the fainting cry of the pokemon's opponent.
Btw, do you know what does the 0x19 before it do? It's an argument too.

C me April 3rd, 2017 12:06 PM

Quote:

Originally Posted by DizzyEgg (Post 9608911)
Actually it just controls the fainting cry of the pokemon's opponent.
Btw, do you know what does the 0x19 before it do? It's an argument too.

Do you mean when you make the opponent faint as opposed to self destruct/poison etc?

I noticed the 0x19 first but then messed around with the 0x5 and got results so I just ignored 0x19. Can you please share your extra information on this?

DizzyEgg April 3rd, 2017 12:22 PM

Quote:

Originally Posted by C me (Post 9608926)
Do you mean when you make the opponent faint as opposed to self destruct/poison etc?

I noticed the 0x19 first but then messed around with the 0x5 and got results so I just ignored 0x19. Can you please share your extra information on this?

I mean whenever an opposing pokemon faints, so not yours or yours partner, but the opposing one.

This code is calling a function that plays poke cry. First argument is species, second is 0x19 which I dont know what does and the third is 0x5 which you said is responsible for the pitch.

C me April 3rd, 2017 1:04 PM

Quote:

Originally Posted by DizzyEgg (Post 9608936)
I mean whenever an opposing pokemon faints, so not yours or yours partner, but the opposing one.

This code is calling a function that plays poke cry. First argument is species, second is 0x19 which I dont know what does and the third is 0x5 which you said is responsible for the pitch.

Makes sense since I when looking for a breakpoint I only tested fainting the opponent. I hope it's done in a similar way, will make it easy to find.

Also makes sense, I spent ages looking at the prepare faint cry function then came across this just looking at the playcry function. I orignially though 0x19 would be speed but I can't really hear a difference in speed.

Aryan 10 April 5th, 2017 9:03 PM

[FireRed] Mew Obey Fix tutorial


In Pokemon FireRed, if you will encounter Mew by any method except Event, then Mew will not obey.

Game Freak made the rarest Pokemon cheat-protected. This is also true with Deoxys, but the Deoxys caught at Birth Island will obey. Since Mew is uncatchable in FireRed. It is not possible with Mew.

So I don't know if someone posted this but I can tell how to fix it. It is really easy to do it.

Quote:

[Step 1]Open any hex editor.

[Step 2]Change the byte at 0x801D402(0x801D416 for FireRed 1.1, in case if someone needs that) from 0x97 to 0x00.
By doing this you no longer need to use 'setobedience' command in every Mew battle script.

MWisBest April 7th, 2017 12:14 PM

Berries Replant Forever [EM]

As most people know, you only have so much time to pick a grown berry before it "replants itself" and becomes a sprout again. By default, the berry can only do this 9 times (for a total of 10 plantings, including the initial time you put the berry in the soil yourself). This has always bothered me because it's possible to lose rare berries forever if you aren't careful, and I tend to be very forgetful.

To allow berries to continue to replant themselves until you pick them, make the following change:
At 0xE185A, replace 04 48 41 68 00 68 20 60 61 60 with 00 20 60 71 C0 46 C0 46 C0 46.

Spherical Ice April 8th, 2017 5:22 AM

Just a reminder to some users who have been using this as a quick question thread: if you don't provide at least some semblance of research or development of your own, your question does not belong here. Instead, create a thread in the parent ROM Hacking forum, here: https://www.pokecommunity.com/forumdisplay.php?f=284, and give it the appropriate category (usually, this will be [ASM & Hex] if you were choosing to post here).

Aryan 10 April 8th, 2017 6:26 AM

[FireRed] Black out script offsets


Nurse Joy blackout: 0x081A8D97
Mom blackout: 0x081A8DD8

Quote:

0x0807F5C8 = Pointer for Nurse Joy
0x0807F5E8 = Pointer for Mom

MWisBest April 10th, 2017 11:11 AM

HM Flash Lightens Entire Screen [EM]

I got a little irked trying to train in the Victory Road basement by the Flash HM not clearing the entire screen. I'm playing the game on my phone, which has an AMOLED display. AMOLED displays are very susceptible to burn-in, so to avoid getting a nice big dark circle in the middle of my screen...

I modified the Flash brightness table to make it work like FR/LG and light up the entire screen:

At 0x54FE66, change 48 to C8.

This is kind of cheap because it makes navigating Granite Cave and Victory Road easier than intended, but whatever.

mbcn10ww April 10th, 2017 8:06 PM

<Remove Field Moves options from Pokémon menu [FR]>
0x122A8C: 00
0x45A76E: 00 00

<Remove Ending Credits (Reset the Game) [FR]>
0x16730B: 9C 50 00 6B 02 FF (see the EDIT below)

EDIT:

In some free space place 00 DF 00 00 and save it's offset

At 0x16730B: 23 XX XX XX 08 FF (XX XX XX is the reverse of the offset you saved +1)

robinjea April 12th, 2017 12:02 AM

Quote:

Originally Posted by mbcn10ww (Post 9615200)
<Remove Field Moves options from Pokémon menu>
0x122A8C: 00
0x45A76E: 00 00

<Remove Ending Credits (Reset the Game)>
0x16730B: 9C 50 00 6B 02 FF

EM or FR?

mbcn10ww April 12th, 2017 6:13 AM

Quote:

Originally Posted by BlackWhiteRobin (Post 9616290)
EM or FR?

Oh sorry, it's for Fire Red.

Aryan 10 April 13th, 2017 9:31 AM

Expanded Pokemon In Advance Map


Take the total number of pokemon.

Change it to hex and reverse it.
Quote:

For example, 123 to 23 01

For Advance Map 1.92
Go to D027C

For Advance Map 1.95
Go to 77DD5

and change
Code:

9C 01


to your reverse hex number of Pokemon.

And it's done.

Wesley FG April 13th, 2017 1:43 PM

Quote:

Originally Posted by Aryan 10 (Post 9617486)
Expanded Pokemon In Advance Map


Take the total number of pokemon.

Change it to hex and reverse it.



Go to D027C and change
Code:

9C 01


to your reverse hex number of Pokemon.

And it's done.

you need specific what version of Advance Map (1.92, 1.95)
are you tutorial

mbcn10ww April 13th, 2017 5:55 PM

Quote:

Originally Posted by Aryan 10 (Post 9617486)
Expanded Pokemon In Advance Map


Take the total number of pokemon.

Change it to hex and reverse it.



Go to D027C and change
Code:

9C 01


to your reverse hex number of Pokemon.

And it's done.

Quote:

Originally Posted by Wesley FG (Post 9617690)
you need specific what version of Advance Map (1.92, 1.95)
are you tutorial

It's for 1.92

The offset for 1.95 is 0x77DD5

Aryan 10 April 13th, 2017 6:13 PM

Quote:

Originally Posted by mbcn10ww (Post 9617821)
It's for 1.92
The offset for 1.95 is 0x77DD5

Oh, thanks for informing,
Actually, I rarely use 1.95 because it's buggy.

I better edit my post.

mbcn10ww April 14th, 2017 5:17 AM

Quote:

Originally Posted by mbcn10ww (Post 9615200)
<Remove Field Moves options from Pokémon menu [FR]>
0x122A8C: 00
0x45A76E: 00 00

<Remove Ending Credits (Reset the Game) [FR]>
0x16730B: 9C 50 00 6B 02 FF

I found some problems with skipping the game credits in mobile emulators (like MyBoy), it freezes instead of reset, then I fixed it with a new hex edit:

<Remove Ending Credits (Reset the Game) [FR]>

In some free space place 00 DF 00 00 and save it's offset

At 0x16730B: 23 XX XX XX 08 FF (XX XX XX is the reverse of the offset you saved +1)

Z-nogyroP April 15th, 2017 7:33 AM

the table for the berry tag images begins at 0x57FC94, at the cheri berry. four bytes are the image pointer, next four are the palette, repeat.

kelario27 April 15th, 2017 6:16 PM

Okay, so I'm still a noob at this, but I think I understand better now how memory works. So for some things, I've decided to brute force my way through the hack with a hex editor.

Just to play around and reverse engineer things a bit, I tried the old fashioned method of opening up scripts with PKSV, then opening the ROM in the hex editor and going to the offsets it mentioned. Except...PKSV uses seven digits for "offsets", when there are only six digits for offsets in the ROM.

I don't really know what in particular to ask about this. Is there some way to translate between the two numbers? Does PKSV lie?

So just as I typed that entire paragraph, I realized that PKSV starts everything with 0x8 and then the offset number.

Posting this anyway in case anyone else was wondering.

mbcn10ww April 16th, 2017 5:14 AM

Quote:

Originally Posted by kelario27 (Post 9619590)
Okay, so I'm still a noob at this, but I think I understand better now how memory works. So for some things, I've decided to brute force my way through the hack with a hex editor.

Just to play around and reverse engineer things a bit, I tried the old fashioned method of opening up scripts with PKSV, then opening the ROM in the hex editor and going to the offsets it mentioned. Except...PKSV uses seven digits for "offsets", when there are only six digits for offsets in the ROM.

I don't really know what in particular to ask about this. Is there some way to translate between the two numbers? Does PKSV lie?

So just as I typed that entire paragraph, I realized that PKSV starts everything with 0x8 and then the offset number.

Posting this anyway in case anyone else was wondering.

First, it's the wrong place to ask for help.
Second, the 0x8 (0x9 too, for expanded Roms) is only to tell the system "It's a ROM offset!", if it begins with 0x2 it's a RAM offset.

Shiny Quagsire April 17th, 2017 11:14 PM

Quote:

Originally Posted by kelario27 (Post 9619590)
Okay, so I'm still a noob at this, but I think I understand better now how memory works. So for some things, I've decided to brute force my way through the hack with a hex editor.

Just to play around and reverse engineer things a bit, I tried the old fashioned method of opening up scripts with PKSV, then opening the ROM in the hex editor and going to the offsets it mentioned. Except...PKSV uses seven digits for "offsets", when there are only six digits for offsets in the ROM.

I don't really know what in particular to ask about this. Is there some way to translate between the two numbers? Does PKSV lie?

So just as I typed that entire paragraph, I realized that PKSV starts everything with 0x8 and then the offset number.

Posting this anyway in case anyone else was wondering.

This is a GBA memory mapping thing, http://problemkaputt.de/gbatek.htm#gbamemorymap

mbcn10ww April 20th, 2017 6:50 PM

<Skip Player and Rival Naming [FR]>

Change the pointer at 0x13009C to D1 08 13 08

After choosing the player gender the gameplay will start without naming the player and the rival, then you will be able to use static names in-game.

Note: If you don't have used some ASM to set the player/rival names the game will freeze.

AtecainCorp. April 24th, 2017 8:05 AM

Quote:

Originally Posted by lsmash (Post 8310182)
Would you mind telling me how you fixed the music that plays after you captured a pokemon?
I made the same feature (though differently: I didn't need to replace the bytes at x15A68), which is almost flawless, if not for the music: it plays the captured pokemon jingle, then the receive exp jingle.
You can check it here: http://pokemonhackersonline.com/showthread.php?t=14839-FR-Pokemons-receive-EXP-after-capturing

Is any chance for repoin this for Ruby? I have troubles with my own researches.

Squeetz April 25th, 2017 1:07 AM

It's often been asked how the Hidden Items work, and what flags they use.
I was curious myself, so I did some digging. (FR)

The routine responsible for handling the flag check/set and item give is at 0x6D17A.
The subroutine that converts the Hidden ID to the flag to check/set here is located at 0xCC45E.
It adds 0x3E8 to the Hidden ID, which is then the flag to be checked/set.
This means that hidden ID 0x0 equates to flag 0x3E8, 0x1 equates to 0x3E9, and so on, until you reach ID 0xFF, which is flag 0x4E7.

DarkPsychic April 28th, 2017 11:18 AM

Dynamic Wild Battles(with Green script tiles)
 
Hello all,
I made a way to have random wild battles which also randomize not only the Pokemon but the level as well.
I got the idea and the know how from a thread called " PokeMart as debug input ".

Anyway here is the XSE script.
Code:
Code:

//wildbattle2hex
00 B6 | ?? ??  | ?? 00  | ?? ?? |  B7 03 |
 cmd  | pkid  | lvl      |  item  |
 4100 | 4101 | 4102    | 4103  |  4104  |
Hand to put B7 03 place of(25 39 01 27) wich means dowildbattle followed by '03' return.
Also to get the address of vars 0x4000+ you need to take the pointer stored at 0x3005008 and add 0x1000 to it.
To get var 0x4100 you would add 0x1200 to the pointer at 0x3005008.
//

#dynamic 0xD00000

#org @start
random 0x64
compare 0x800D 0x8
if 0x2 goto @snippet1
random 0x64
copyvar 0x4000 0x800D
setvar 0x4100 0xB600
copyvar 0x4101 0x4000
random 0xFF
copyvar 0x4102 0x800D
setvar 0x4103 0x0000
setvar 0x4104 0x03B7
setvar 0x5006 0x1
setvar 0x800D 0x0
call @snippet2
setvar 0x5006 0x0
release
end

#org @snippet1
release
end

#org @snippet2
writebytetooffset 0x4 0x20370D0
copybyte 0x20370D1 0x3005008
copybyte 0x20370D2 0x3005009
copybyte 0x20370D3 0x300500A
copybyte 0x20370D8 0x20370D2
copybyte 0x20370D9 0x20370D3
addvar 0x8011 0x12
copybyte 0x20370D2 0x20370D8
copybyte 0x20370D3 0x20370D9
copybyte 0x20370D4 0x300500B
writebytetooffset 0x3 0x20370D5
writebytetooffset 0xFF 0x20370D6
writebytetooffset 0x0 0x20370D7
call 0x20370D0
return


At the moment it still uses the default vars from the debug input thread.
But I will make a different version that uses the safe vars hack.
Just in case.

To use this,
Simply compile and place on green script tile then set the tiles var to 0x5006 and the value to 0.
The default script is made so you have an 8% chance of a wildbattle to happen.

What this does:
It takes a script command and writes it in hex into vars 0x4100 - 0x4104.
Then it changes the certain values to the random number (PokemonID and Level),
after that it sets up vars 0x800D - 0x8012 and then calls the 0x800D to execute the code at 0x4100-0x4105.
Then returns.

Hope it can help someone out there.

kleenexfeu May 4th, 2017 4:06 AM

Quote:

Originally Posted by Artemis64 (Post 8913506)
To do the same in Emerald, place 0xFC at 0x6DC48 and 0x6DC4E.
To elaborate for the people who don't understand what this is about, it is setting the limiters for the maximum number of EVs a Pokémon can have per stat. Because only four EVs translate into a single stat point, having 255 EVs per stat is pointless, as the last three EVs do not make any difference.

In addition to that, you can also change the total of EV each pokémon can get:
Spoiler:
Code:

.equ New_Limit_Ev_Cap, Max_ev_per_stat @ can't go beyond 255*6 obviously
.equ EV_by_stats_cap, Max_ev_per_poke @ can't go beyond 255 without rewriting a ton of routine, it's the original value

@@ moving the EV cap per poke
.org 0x6DC2A, 0xFF
ldr r0, New_Limit_Ev_Cap
add r0, #1

@@ EV by stats cap
.org 0x6DC48, 0xFF
cmp r0, #EV_by_stats_cap
ble 0x6DC58
mov r0, r1
add r0, #EV_by_stats_cap

@@ moving the EV cap per poke
.org 0x6DC88, 0xFF
New_Limit_Ev_Cap:
.word Max_EV_per_poke-1



Mariow2 May 10th, 2017 6:56 AM

Quote:

Originally Posted by Aryan 10 (Post 9617486)
Expanded Pokemon In Advance Map


Take the total number of pokemon.

Change it to hex and reverse it.



For Advance Map 1.92
Go to D027C

For Advance Map 1.95
Go to 77DD5

and change
Code:

9C 01


to your reverse hex number of Pokemon.

And it's done.

So how do you hack advance map?

BluRose May 10th, 2017 7:03 PM

Quote:

Originally Posted by Mariow2 (Post 9642742)
So how do you hack advance map?

you open it in a hex editor

Squeetz May 11th, 2017 6:59 AM

In Firered at 0x15FD0C there's a table of pointers for the vars 0x8000-0x8014.
You can easily repoint this and add your own entries. I added 12 new ones (0x8015-0x8020) and using them all in a script worked perfectly.
So instead of writing to your static addresses with 'writebytetooffset', you could just set a var.

Wesley FG May 15th, 2017 3:08 PM

This is one Information About Catch areas in Pokédex FR

Probably you have problem making you hack with it

Existe one table that control it
Table Located at 463580 have this format

[TT][XX][YY][00]

TT = Shape of the catch area (varies from 00 - 06) the img explain better
https://image.ibb.co/dyKP0k/untitled.png
XX = X-coordinate of the area on the worldmap in the pokedex
YY = Y-coordinate of the area on the worldmap in the pokedex
00 = Padding

00463580 = FILLER
00463584 = PALLET TOWN
00463588 = VIRIDIAN CITY
0046358c = PEWTER CITY
00463590 = CERULEAN CITY
00463594 = LAVENDER TOWN
00463598 = VERMILION CITY
0046359c = CELADON CITY
004635a0 = FUCHSIA CITY
004635a4 = CINNABAR ISLAND
004635a8 = INDIGO PLATEAU
004635ac = SAFFRON CITY
004635bc = ROUTE 4
004635d4 = ROUTE 10
004635b0 = ROUTE 1
004635b4 = ROUTE 2
004635b8 = ROUTE 3
004635bc = ROUTE 4
004635c0 = ROUTE 5
004635c4 = ROUTE 6
004635c8 = ROUTE 7
004635cc = ROUTE 8
004635d0 = ROUTE 9
004635d4 = ROUTE 10
004635d8 = ROUTE 11
004635dc = ROUTE 12
004635e0 = ROUTE 13
004635e4 = ROUTE 14
004635e8 = ROUTE 15
004635ec = ROUTE 16
004635f0 = ROUTE 17
004635f4 = ROUTE 18
004635f8 = ROUTE 19
004635fc = ROUTE 20
00463600 = ROUTE 21
00463604 = ROUTE 22
00463608 = ROUTE 23
0046360c = ROUTE 24
00463610 = ROUTE 25
00463614 = VIRIDIAN FOREST
0046361c = MT. MOON
00463598 = S.S. ANNE (SAME OFFSET OF VERMILLION)
004635ac = UNDERGROUND PATH (SAME OFFSET OF SAFRON)
004635ac = UNDERGROUND PATH ( SAME OFFSET OF SAFRON)
00463618 = DIGLETT'S CAVE
0046363c = VICTORY ROAD
0046359c = ROCKET HIDEOUT (SAME OFFSET OF CELADON)
004635ac = SILPH CO. (SAME OFFSET OF SAFRON)
00463638 = POKéMON MANSION
00463630 = SAFARI ZONE
0046363c = POKéMON LEAGUE (SAME OFFSET VICTORY ROAD)
00463624 = ROCK TUNNEL
00463634 = SEAFOAM ISLANDS
0046362c = POKéMON TOWER
00463620 = CERULEAN CAVE
00463628 = POWER PLANT

Need search for the rest of Island Maps
Credit : sfc.pokefans.net/lesson.php?id=20
for the base of my search

Panda Face June 8th, 2017 5:53 AM

How to change the Latias and Latios event after chose red and blue?

BobbyTom June 9th, 2017 3:10 AM

Changing the experience gain formula (Emerald)

** The purpose of this research isn't to learn the EXP calculation formula. We already know that. The purpose is to give offsets we can use to easily change the formula.

The exact point where the game yanks a Pokemon's experience yield is here:
Code:

0804A4A4 LDRB            R2, [R0,#pokemon_base.exp_yield]


At which point one of the following calculations occur:
Code:

if ( v0 )
        {
          v8 = (unsigned int)(battle_participants[unk_202420D].level
                            * pokemon_basestats[battle_participants[unk_202420D].species].exp_yield
                            / 7 << 16) >> 17;
          v9 = v8 / v4;
          *v1 = v9;
          if ( !(v9 << 16) )
            *v1 = 1;
          word_20243CC[27] = v8 / v0;
          if ( !(v8 / v0 << 16) )
            word_20243CC[27] = 1;
        }
else
        {
          v10 = (battle_participants[unk_202420D].level
              * pokemon_basestats[battle_participants[unk_202420D].species].exp_yield
              / 7 & 0xFFFF)
              / v4;
          *v1 = v10;
          if ( !(v10 << 16) )
            *v1 = 1;
          word_20243CC[27] = 0;
        }


Basically:
Code:

(exp_yield * level / 7) & 0xFFFF


Is always calculated, and then split according to how many Pokemon participated in the battle. This is that calculation in full:
Code:

ROM:0804A4A4 42 7A                                  LDRB            R2, [R0,#pokemon_base.exp_yield]
ROM:0804A4A6 2A 31                                  ADDS            R1, #0x2A @ '*'
ROM:0804A4A8 08 78                                  LDRB            R0, [R1]
ROM:0804A4AA 50 43                                  MULS            R0, R2
ROM:0804A4AC 07 21                                  MOVS            R1, #7
ROM:0804A4AE 9D F2 47 F8                            BL              __divsi3
ROM:0804A4B2 00 04                                  LSLS            R0, R0, #0x10
ROM:0804A4B4 01 0C                                  LSRS            R1, R0, #0x10


You can modify these opcodes however you like.
Before these opcodes:
  • R0 is pokemon_base, the struct with all the information about the species of Pokemon we just KO'd.
  • R1 contains knowledge about the specific Pokemon we battled, such as its level (offset 0x2A).
After these opcodes:
  • R1 must contain the total EXP to split between the battling Pokemon.
Me, I just wanted to cancel EXP growth. So instead of the first opcode I zeroed out R2, and the result is that you always gain 1 EXP. Because of those checks in the psuedo-code - if the game detects that you're about to gain 0 EXP it changes it to 1 EXP. You can change that code as well if you want, it's right here:
Code:

ROM:0804A4C8 00 04                                  LSLS            R0, R0, #0x10
ROM:0804A4CA 00 28                                  CMP            R0, #0
ROM:0804A4CC 01 D1                                  BNE            loc_804A4D2
ROM:0804A4CE 01 20                                  MOVS            R0, #1
ROM:0804A4D0 08 80                                  STRH            R0, [R1]


....and here:
Code:

ROM:0804A4DE 00 04                                  LSLS            R0, R0, #0x10
ROM:0804A4E0 00 28                                  CMP            R0, #0
ROM:0804A4E2 18 D1                                  BNE            loc_804A516
ROM:0804A4E4 01 20                                  MOVS            R0, #1
ROM:0804A4E6 28 80                                  STRH            R0, [R5]
ROM:0804A4E8 15 E0                                  B              loc_804A516



DizzyEgg June 9th, 2017 7:53 AM

Quote:

Originally Posted by BobbyTom (Post 9673421)
snip

Pretty nice, but it's already known. See https://github.com/KDSKardabox/Pokemon-Emerald-Battle-Engine-Upgrade/blob/master/src/bscommands_updated.c#L3229

BobbyTom June 9th, 2017 9:24 AM

Quote:

Originally Posted by DizzyEgg (Post 9673559)

Is that someone's attempt to recreate the source code? That's pretty rad. I guess the upshot in my post is that you can make changes directly to the engine. Even if you used a compiler you'd still need to know the offsets in the ROM.

DizzyEgg June 9th, 2017 10:06 AM

Quote:

Originally Posted by BobbyTom (Post 9673663)
Is that someone's attempt to recreate the source code? That's pretty rad. I guess the upshot in my post is that you can make changes directly to the engine. Even if you used a compiler you'd still need to know the offsets in the ROM.

Nah, recreating the source code is another thing. :P
I linked you to the github of my and one other guy project. We basically rewrote a huge part of the original battle engine in C and added stuff in later generations. For more info, see my signature.

BobbyTom June 9th, 2017 1:14 PM

Changing global wild encounter levels (Emerald)

** Again, something I did for my own uses. Instead of changing the wild encounter tables for each route, you can make sweeping changes to all wild encounters by changing the code that uses those tables.

This is what the flow for generating wild encounters looks like (call order):
ROM:080B5288 walking_func
ROM:080B4F4C choose_wild_pokemon_encounter
ROM:080B4C74 choose_encounter_level

The first function performs some check for every step (or turn) the player takes. If the player's tile is encounter-eligible it enters the second function, which eventually calls the third function, "choose_encounter_level" which does just that. Let's look at some pseudo-code:

Code:

int __fastcall choose_encounter_level(int encounter_table)
{
  int encounter_table_loc; // [email protected]
  unsigned int v2; // [email protected]
  int level_min; // [email protected]
  unsigned int level_max; // [email protected]
  int rand; // [email protected]
  int v6; // [email protected]
  int v7; // [email protected]

  encounter_table_loc = encounter_table;
  v2 = *(_BYTE *)(encounter_table + 1);
  if ( v2 < *(_BYTE *)encounter_table_loc )
  {
    level_min = *(_BYTE *)(encounter_table_loc + 1);
    level_max = *(_BYTE *)encounter_table_loc;
  }
  else
  {
    level_min = *(_BYTE *)encounter_table_loc;
    level_max = v2;
  }
  rand = (unsigned __int16)rng() % (signed int)((level_max - level_min + 1) & 0xFF) & 0xFF;
  if ( !pokemon_getattr(0x20244EC, 6, v6) )
  {
    v7 = (unsigned __int8)sub_806B6D8(0x20244EC);
    if ( v7 == 55 || v7 == 72 || v7 == 46 )
    {
      if ( !(rng() & 1) )
        return level_max;
      if ( rand )
        rand = (rand - 1) & 0xFF;
    }
  }
  return (level_min + rand) & 0xFF;
}


Only some of the stuff here I found important, mostly the computation for "rand". It's worth clarifying that "level_min" etc. are encounter-specific, and come straight out of the encounter tables. Here are the relevant opcodes:

Computing "rand"
Code:

ROM:080B4C8A F4 1B                                  SUBS            R4, R6, R7
ROM:080B4C8C 01 34                                  ADDS            R4, #1
ROM:080B4C8E 24 06                                  LSLS            R4, R4, #0x18
ROM:080B4C90 24 0E                                  LSRS            R4, R4, #0x18
ROM:080B4C92 BA F7 9B FC                            BL              rng
ROM:080B4C96 00 04                                  LSLS            R0, R0, #0x10
ROM:080B4C98 00 0C                                  LSRS            R0, R0, #0x10
ROM:080B4C9A 21 1C                                  MOVS            R1, R4
ROM:080B4C9C 32 F2 D8 FC                            BL              __modsi3
ROM:080B4CA0 00 06                                  LSLS            R0, R0, #0x18
ROM:080B4CA2 04 0E                                  LSRS            R4, R0, #0x18


On entering:
  • R6 is level_min
  • R7 is level_max
On leaving:
  • R4 is "rand"

Returning "rand" as the encounter level
Code:

ROM:080B4CEA 38 19                                  ADDS            R0, R7, R4
ROM:080B4CEC 00 06                                  LSLS            R0, R0, #0x18
ROM:080B4CEE 00 0E                                  LSRS            R0, R0, #0x18


  • R4 and R7 keep their values from the "rand" computation - "rand" and "level_min" respectively.
Use cases

So, what now? Well, say you wanted to make encounters a bit scarier - it's as easy as adding to R4 or R7. In my own experiments I replaced the useless left-shift/right-shift opcodes near the "rand" computation with something more useful:

Code:

ROM:080B4C8A                SUBS            R4, R6, R7
ROM:080B4C8C                ADDS            R4, #1
ROM:080B4C8E                LDR            R5, =0x3005D8C
ROM:080B4C90                LDR            R5, [R5,#4]
ROM:080B4C92                BL              rng
ROM:080B4C96                LDRB            R5, [R5,#0x14]
ROM:080B4C98                NOP
ROM:080B4C9A                MOVS            R1, R4
ROM:080B4C9C                BL              __modsi3
ROM:080B4CA0                LSRS            R5, R5, #3
ROM:080B4CA2                ADDS            R4, R0, R5


Since R5 was unused, I borrowed it to add to "rand" the message frame value! You know, the value in the options that decides what pretty frame your menus have (I prefer the pink one with the bows!). Based on this research:
showthread.php?p=8615361#post8615361

The value's behind pointer 0x3005D90, offset 0x14. The reason I counted from 0x3005D8c is convenience - it's used a bit later at 080B4D50:
Code:

ROM:080B4D50 dword_80B4D50  DCD 0x3005D8C



frezgle June 13th, 2017 5:32 PM

Quote:

Originally Posted by MWisBest (Post 9614863)
HM Flash Lightens Entire Screen [EM]

I got a little irked trying to train in the Victory Road basement by the Flash HM not clearing the entire screen. I'm playing the game on my phone, which has an AMOLED display. AMOLED displays are very susceptible to burn-in, so to avoid getting a nice big dark circle in the middle of my screen...

I modified the Flash brightness table to make it work like FR/LG and light up the entire screen:

At 0x54FE66, change 48 to C8.

This is kind of cheap because it makes navigating Granite Cave and Victory Road easier than intended, but whatever.

Would just like to point out that doing this causes a softlock in the Dewford Gym if you defeat Brawly after defeating all of his trainers.

NewDenverCity June 13th, 2017 6:53 PM

I just happened to stumble on this

Writing C0 46 C0 46 to 0x03DF40 will allow the Weedle in the Old Man's tutorial to be female or genderless. Obviously this is only for FR but hey something similar should be out there for Emerald.

Also at 0x07F88C, there is a
Code:

mov r1, #0xD


which is where it loads Weedle's species, so you can change that to whatever you want with hooks or whatever.

Criminon June 14th, 2017 8:07 AM

Quote:

Originally Posted by Criminon (Post 8781253)
This stuff should help anyone wanting to check their party's hp.
0x20242DA is the address stored in RAM for the 1st pokemon in your party's HP.
0x20242DC is the max HP.
0x20242D4 is the status ailment a pokemon is currently suffering. (00 being nothing)

Using comparefarbytetobyte 0x20242DA 0xnumber you want to check
you can easily check a pokemon's hp.

using comparefarbytetobyte 0x20242DC 0xnumber you want to check
you can easily see if a pokemon has enough hp for something.

using writebytetooffset 0xstatus 0x20242D4
you can easily edit the status effecting them.

For the rest of your party, take these offsets and add 0x64 to them.

It's crazy how much stuff I've written that I have completely forgot. Here's to remembering your own findings.

ghoulslash June 15th, 2017 1:50 AM

I did a little investigation into trainerbattle 0x9:

Rather than nop-ing out of the Oak's text function, you can just change the reserved byte from 0x3 to 0x0 to prevent Oak's text from appearing during battle. So you could re-use trainerbattle 0x9 and still have a battle that uses the text. It would look like:
Code:

trainerbattle 0x9 0x(trianer_ID) 0x0 @win @lose      //Oak's text does NOT appear
trainerbattle 0x9 0x(trainer_ID) 0x3 @win @lose    //Oak's text appears



EDIT: setting the reserved byte to 0x0 instead of 0x3 removes the functionality allowing you to continue with a script even if you white out. I made an assembly routine to toggle the text on and off while keeping this functionality in this post, though.

Additionally, trainerbattle 0x9 writes 0x0 or 0x1 to variable 0x800D (lastresult) depending on if you won or lost the battle, respectively. This allows you to branch to separate scripts depending on the result of your trainer battle

Derlo June 28th, 2017 3:06 PM

Quote:

Originally Posted by ghoulslash (Post 9679786)
I did a little investigation into trainerbattle 0x9:

Rather than nop-ing out of the Oak's text function, you can just change the reserved byte from 0x3 to 0x0 to prevent Oak's text from appearing during battle. So you could re-use trainerbattle 0x9 and still have a battle that uses the text. It would look like:
Code:

trainerbattle 0x9 0x(trianer_ID) 0x0 @win @lose      //Oak's text does NOT appear
trainerbattle 0x9 0x(trainer_ID) 0x3 @win @lose    //Oak's text appears


Additionally, trainerbattle 0x9 writes 0x0 or 0x1 to variable 0x800D (lastresult) depending on if you won or lost the battle, respectively. This allows you to branch to separate scripts depending on the result of your trainer battle

well, I tried this, but don't work!
Doing what Knizz did, I get fix a bug in GBA emulator for android. when the OAK's battle start, the emu freezes.

ghoulslash June 29th, 2017 5:09 PM

Quote:

Originally Posted by Derlo (Post 9691084)
well, I tried this, but don't work!
Doing what Knizz did, I get fix a bug in GBA emulator for android. when the OAK's battle start, the emu freezes.

I've never tried using knizz's method, so perhaps it's an either-or situation. Try restoring the bytes that you nop-ed out of and see if that works.

AkameTheBulbasaur June 29th, 2017 6:56 PM

There was a conflict between JPAN's set trainer levels hack and Doesntknowhowtoplay's trainer EVs hack. I may have found a way to fix it so that one can have both in their hack at the same time.

I posted it in Doesnt's original thread here, but I thought I'd link it here too so more people could see it, because it may be something useful for a lot of people's hacks if it works for everyone the way it worked for me.

I haven't tested it on a clean ROM yet, but I think it should still work there too.

Zeturic July 3rd, 2017 5:41 PM

Class-based Poké Balls [FR]

In Sun and Moon, NPC trainers started using different types of Poké Balls. Specifically, it's tied to their trainer class - for example, Elite Four members and Ace Trainers keep their Pokemon in Ultra Balls. Prior to this, NPC trainers only ever used basic Poké Balls.

Vivacity July 4th, 2017 1:53 PM

Quote:

Originally Posted by Sagiri (Post 9695740)
Class-based AWESOMENESS

Well hot danggg, this is AWESOME! And totally came out of nowhere - thanks so much for pulling this off and releasing it for us all to enjoy!

(I totally think this is cool/complex enough to deserve its own thread, by the way... but hey, your call. ;))

also:

1) your Readme file is a radiant and beautiful thing and an absolute MODEL of clarity and conciseness; I sort of wish you'd write a tutorial just on how to write documentation, haha, it could not be easier to understand
2) your smart automatic double battle implementation is brilliant, by the way - what a subtle but giant improvement to the default engine

and finally:

Quote:

Emerald?
No.
hee ;)

eMMe97 July 7th, 2017 4:51 AM

Quote:

Originally Posted by Sagiri (Post 9695740)
Class-based Poke Balls [FR]

In Sun and Moon, NPC trainers started using different types of Poke Balls. Specifically, it's tied to their trainer class - for example, Elite Four members and Ace Trainers keep their Pokemon in Ultra Balls. Prior to this, NPC trainers only ever used basic Poke Balls.

I ported this to Fire Red. The repo is here, and I've also added it as an attachment. The readme explains how to use it.

Great! But I have a problem with the insertion :S
I open the prompt and write "src/build" but nothing...if I write "script/build" a pop-up ask me with how program I want to open this file...
How can I compile it???
Thanks :D

Z-nogyroP July 7th, 2017 6:31 AM

Quote:

Originally Posted by Chaos Rush (Post 8466427)
(for Emerald) These offsets determine how many Pokémon show up in the Hoenn dex:
xBC8FE - amount you want
xBC926 - amount you want
xC0890 - amount you want minus one
You can only have up to 255 in the regional dex.

I'm sure there's some limiters related to the Summary screen and the Save screen that I've possibly missed but I can't confirm it right now.

0x6E3E2 should be changed to the amount you want as well to fix the bug where pokemon beyond 202 wouldn't have their dex number displayed on the summary screen

ghoulslash July 9th, 2017 9:01 PM

I hadn't seen this anywhere but my apologies if it's already been posted elsewhere.

The sprite that shows the rival walking in place in the nickname screen is different than the overworld rival character. I have no idea why; but regardless, I went ahead and searched for the appropriate offsets for the nickname screen images/palette:

Code:

Pallette: 0xE98004
        -pointer at 0x3E23C8
Frames: (0x100 or 256 bytes each)
        3E1980 = frame 1 (facing down), pointer at 0x3E23C0
        3E1A80 = frame 2 (facing up)
        3E1B80 = frame 3 (facing left)
        3E1C80 = frame 4 (walk down left)
        3E1D80 = frame 5 (walk down right)
        3E1E80 = frame 6 (walk up right)
        3E1F80 = frame 7 (walk up left)
        3E2080 = frame 8 (walk left 1)
        3E2180 = frame 9 (walk left 2)



tkim July 11th, 2017 12:04 PM

Quote:

Originally Posted by ghoulslash (Post 9700992)
I hadn't seen this anywhere but my apologies if it's already been posted elsewhere.

The sprite that shows the rival walking in place in the nickname screen is different than the overworld rival character. I have no idea why; but regardless, I went ahead and searched for the appropriate offsets for the nickname screen images/palette:

Code:

Pallette: 0xE98004
    -pointer at 0x3E23C8
Frames: (0x100 or 256 bytes each)
    3E1980 = frame 1 (facing down), pointer at 0x3E23C0
    3E1A80 = frame 2 (facing up)
    3E1B80 = frame 3 (facing left)
    3E1C80 = frame 4 (walk down left)
    3E1D80 = frame 5 (walk down right)
    3E1E80 = frame 6 (walk up right)
    3E1F80 = frame 7 (walk up left)
    3E2080 = frame 8 (walk left 1)
    3E2180 = frame 9 (walk left 2)



Good eyes!

Enn July 14th, 2017 8:11 AM

Quote:

Originally Posted by Sagiri (Post 9695740)
Class-based Poke Balls [FR]

In Sun and Moon, NPC trainers started using different types of Poke Balls. Specifically, it's tied to their trainer class - for example, Elite Four members and Ace Trainers keep their Pokemon in Ultra Balls. Prior to this, NPC trainers only ever used basic Poke Balls.

I ported this to Fire Red. The repo is here, and I've also added it as an attachment. The readme explains how to use it.

I tried it and for me works perfect on insert2, but have to ask, are there any bugs so far?

Zeturic July 14th, 2017 6:08 PM

Choose Poké Mart Inventory Based on Badge Progress [FR]

This shouldn't need too much of an explanation. Gen IV prevented early-game Poké Marts from becoming completely useless by late-game by tying the Poké Mart's inventory to how many badges you have, rather than the location of the Mart. This is the same thing for Fire Red.

Basically, if your script contains
pokemart 0
, it will pick the appropriate item list (which you can customize). Any argument other than zero is still understood as a static item list.

Remove flag check for running [FR]

Code:

0x0805BA3A: 01 20 C0 46


Combine this with the Run Inside Buildings hack, and you'll get the same running mechanics as Gen VI and Gen VII (as in, run anywhere and start out with the ability to run).

Automatically unlock National Dex [FR]

I could've sworn I posted this at some point, but I couldn't find it. The function responsible for determining whether you have the national dex or not is at
0x0806E25C
. By making it always return true, you'll always be considered to have the national dex. To be clear, this doesn't make the Pokédex active on the start menu, but (for example) national dex Pokémon will be able to evolve and their Pokédex number will show on the summary screen (instead of ???). It's the equivalent of immediately invoking
special 0x16F
at the beginning of the game.

Code:

0x0806E25C: 01 20 70 47


Port of Emerald's Pickup mechanics [FR]
To be clear, this does not include the in-battle effect (where a Pokémon with Pickup may pick up an item that was just used), as introduced in BW; it just makes the item list depend on the level of the Pokémon, like in Emerald.

Can't forget HM08 [FR]
FRLG didn't use HM08 (Dive), so the move it contains can be freely forgotten without the Move Deleter. To make it like the rest of the HMs (in that the move can't be forgotten):

Code:

0x08125AB6: 07


-----------------------------------------

Quote:

Originally Posted by Nisarg
I tried it and for me works perfect on insert2, but have to ask, are there any bugs so far?

I haven't experienced any bugs with it, but if you do, please let me know. Just open an issue on github.

Quote:

Originally Posted by tkim
Could you clarify, if I wanted to completely disable 'The Pokémon stopped evolving' due to not having the national dex, do I have to use all of the offsets provided, or just the '@ all three'?

Use all the offsets.

Also, I apologize if moving my response to this post (it was originally two posts down) notifies you again.


All times are GMT -8. The time now is 8:53 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.