Quick Research & Development Thread Page 28

Started by Spherical Ice January 9th, 2010 2:23 AM
  • 478603 views
  • 1138 replies

MrDollSteak

Formerly known as 11bayerf1

Age 25
Male
Hong Kong
Seen 14 Hours Ago
Posted March 24th, 2020
853 posts
11.5 Years
In Emerald :

Wrap and such does 1/8 damage instead of 1/16 : write C0 08 instead of 00 09 at 08040D90
To add onto this, to make it so that (like Gen 5 and onwards) the Wrap moves last for 4 or 5 turns (instead of 2 to 5) change the byte at the following locations to:

Fire Red:
020A4A: 01
020A4E: 05
Emerald:
0492EE: 01
0492F2: 05

Splash

But nothing happened.

Male
Just use an Old Rod
Seen January 4th, 2020
Posted November 24th, 2017
659 posts
10.6 Years
In Emerald :

Wrap and such does 1/8 damage instead of 1/16 : write C0 08 instead of 00 09 at 08040D90
Know where the firered offset for this is at?
༼ つ ◕_◕ ༽つ PRAISE Splash ༼ つ ◕_◕ ༽つ
|VM|PM
|
Male
São Paulo, Brasil
Seen September 7th, 2019
Posted September 7th, 2019
275 posts
5.1 Years
Ditto's unique ability to breed with everything despite being genderless is a property of its egg group, but it won't actually produce the right eggs if you give something outside of slot x84 the Ditto egg group- you'll just get a bunch of Bulbasaur if there's no female involved. To fix this, change the byte at x4602A from x84 to the slot you want to behave like Ditto.

While I'm pointing out breeding quirks that are of no use to anyone:

An egg that would hatch as the byte at x46068 (normally x1D, female nidoran) has a 50% chance to instead hatch as the byte at x4607E (normally x20, male nidoran).

Furthermore, an egg that would normally hatch as the word at x460d0 (normally x183, Illumise) has a 50% chance of hatching as twice the byte at x46096 (normally xC1, half of Volbeat's index number).

Volbeat and male Nidoran family members do not produce their female counterparts when breeding with Ditto in Gen 3.

There's a second Ditto check at x460A2- this one doesn't affect the child's species but it probably is important for inheritance.

If an egg would hatch to be double the byte at x45fa8 (xB4, half of Wynaut's index number) and a parent is not holding the item at x45fd8 and x45fdc (xDD, Lax Incense), the baby will become the byte at x45fe0 (xCA, Wobbuffet).

If an egg would hatch to be double the byte at x45fb0 (xAF, half of Azurill's index number) and a parent is not holding the item at x45fee and x45ff2 (xDC, Sea Incense), the baby will become the byte at x45ff6 (xB7, Marill).

Azurill's index number is constructed a second time at x45fe6- I'm not exactly sure *why* it's needed but if the baby's index number doesn't match it the game won't consider changing it to a Marill.
Using this information, how can I make Ditto breed with himself too?
Also, how can I make Pokémon breed only with his evolutionary family and Ditto?
Will I have to make a new Egg Group for each evolutionary family? If yes, how do I do it?
What about the Nidoran's and Volbeat/Illumise's case? I just put them in the same evolutionary family and they will breed?
How can I make they not breed with Ditto, only amog themselves (Nidorans and Volbeat/Illumise)?
How can I make the first Pokémon of every evolutionary family to be surely what comes out of an egg (No Marill, Wobbuffet, Pikachu, etc.), never skipping a baby?
Lastly, how can I test this without having to go all the way 'till Island 4?

Criminon

Pokemon: Aqua Blue

Male
California
Seen February 26th, 2020
Posted February 14th, 2019
256 posts
7.8 Years
I've been researching Tile Background behavior bytes.

This thread here exists:
http://www.pokecommunity.com/showthread.php?t=144408
But its not complete. Here are a few other helpful ones. I'll update as I find more.


0x9 works like 0x1 (Wild Battle) except for the top layer covers the player.
0x21 works like 0x1 or 0x9 (Wild Battle) except for the player is above both of them.
0x60 works in an odd way. It deletes whatever image you had on there, and replaces it with random ones that you are able to walk over.

If anyone knows which block allows both the up and down layers to cover the player, please let me know!
Male
São Paulo, Brasil
Seen September 7th, 2019
Posted September 7th, 2019
275 posts
5.1 Years
I've been researching Tile Background behavior bytes.

This thread here exists:
http://www.pokecommunity.com/showthread.php?t=144408
But its not complete. Here are a few other helpful ones. I'll update as I find more.


0x9 works like 0x1 (Wild Battle) except for the top layer covers the player.
0x21 works like 0x1 or 0x9 (Wild Battle) except for the player is above both of them.
0x60 works in an odd way. It deletes whatever image you had on there, and replaces it with random ones that you are able to walk over.

If anyone knows which block allows both the up and down layers to cover the player, please let me know!
This 0x60 sounds a lot like the tile behavior you might look for when setting a cut tree or a rock smash rock.

Criminon

Pokemon: Aqua Blue

Male
California
Seen February 26th, 2020
Posted February 14th, 2019
256 posts
7.8 Years
This 0x60 sounds a lot like the tile behavior you might look for when setting a cut tree or a rock smash rock.
I tried it but it didn't do anything. I'm using two layers as a building. The player can walk behind it. However when the player walks behind it, he walks in between the layers instead. I'm trying to fix this problem by letting the player walk behind both layers. However I can't find the correct one.
Male
São Paulo, Brasil
Seen September 7th, 2019
Posted September 7th, 2019
275 posts
5.1 Years
Does anyone know which routine is executed to generate a wild Pokemon on the grass. I know JPAN create a special for this on his Hacked Engine, but it's easier with just the callasm
What do you need it for?
I ask, 'cause without that knowledge, I made encounters on sand to be possible just editing tiles with the Block Editor in Advance Map.
My Main Team:


Male
Singapore
Seen June 26th, 2018
Posted June 18th, 2018
87 posts
6.2 Years
To those people who want to expand the number of Pokémon on Emerald while retaining the animations:
Step 1:
Spoiler:
You need to repoint the table that indexes all of the Pokémon front sprite animations. Open up a hex editor, go to 3299EC, copy 0x1B8 or 411 bytes of data into free space. You need to add as many 00s as there are new Pokémon after the end of the table. Repoint the table to your new location. There should be 4 pointers to repoint.

Step 2:
Spoiler:
Next, you need to repoint the table that indexes all of the Pokémon back sprite animations. Go to 60A8C8, copy 0x1B8 bytes into free space, then add the 00s again. Repoint the table. There should only be one pointer at 17F488

Step 3:
Spoiler:
Now, you need to repoint the table that controls the timing of the Pokémon frame switching. Go to 309AAC, select 0x6E0 bytes of data, and then copy into free space. Repoint it, there should be 5 pointers to the table. Now, how the table works is that it has pointers to certain strings of data that control the timing. Thus, we need to add pointers to the end to prevent glitches. The timing parameters that you should use vary between Pokémon and different versions of said Pokémon's sprite. For instance, Swalot's timing pointer is well-used for jumping frames and so on. Since there is no known index for the timing, the method I use is to observe different Pokémon animations in Emerald then choose from there. Also, when you repoint the normal palette table (the one at 0x303678), you have to index every palette properly. What I mean by this is that, for every entry of a Pokémon's palette:
70 6E C3 08 0B 00 00 00
You have to add 0x1 and write the bolded bytes in little endian form, as the front sprite animation routine uses this to determine which front sprite switching offset is to be used.
So for example, for Pokémon 0x1E9 (#489):
XX YY ZZ 08 E9 01 00 00
where ZZ YY XX is the offset where the palette is stored.
Credits to PurpleOrange for spotting the bug and Sky High for fixing it.

Step 4:
Spoiler:
So, there is one final table we need to repoint. This table controls the amount of time that passes before the animation of the Pokémon is executed (thanks PurpleOrange). Go to 329B87, select 0x1B8 bytes of data (one for every Pokémon), then copy into free space. Now add as many 00s on the end as there are Pokémon. You can change this later to a higher number to delay the amount of time before the animation takes place. Repoint the table, there should be 2 pointers to it.

Step 5:
Spoiler:
Finally, the limiters. In your hex editor, go to 0x34BFE and overwrite it with 07 E0 (for the sprites), and then go to 0xA5FEE and overwrite that with 03 E0. That's it!


For the front sprite and back sprite animations index, Chaos Rush has an excellent index here on Pokécommunity. Now the only issue will be the creation of 2-frame sprites for Gen IV to Gen VI. Personally, knowing that Flora Sky has sprites for Gen IV to Gen V, I think that if Sky were to let us use and resize his sprites we could come up with a pretty good repository soon. Another method would be to use the Sugimori palettes DS-style sprite repository that MrDollSteak has come up with, which covers Gen I to V.
Seen January 15th, 2020
Posted April 1st, 2019
103 posts
11.5 Years
I can't find the Small/stupid Questions Thread in tools and tutorials, so i'm posting here.

I want to know if there is any way to edit the gen 2 bug catching contest pokemon.

Now using a randomizer, i've randomized them successfully, so i know that A. It can be done, and B. Someone has figured it out.

For the record, i want to make it into a ghost-catching contest, with some newer gen ghosts added to the mix.
Project Concerto is starting up again, slowly but surely.

Xencleamas

Suddenly lurking in the shadows...

Male
Asgard
Seen 1 Week Ago
Posted August 7th, 2018
460 posts
6.3 Years
For anyone interested, in FR US 1.0 (aka BPRE 1.0), to change your Pokédex "mode" to the style which DPPt used (That is, to have the seen amount displayed in the continue screen and the save screen instead of the caught numbers), change:

0800CF56: 00 20
0800CF64: 00 20
080F803C: 00 20
080F8044: 00 20

It really is that simple. :)

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.

Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)

ProClifo

The Village Pirate Cat

Age 23
Male
Norway
Seen June 21st, 2019
Posted February 18th, 2018
92 posts
11.7 Years
I've done some research on set wild battles in Emerald, and it turns out to be more complicated than what I anticipated. I can't guarantee that this is the same for Firered or any other ROM.

First of all, the command "setwildbattle PKMN LEVEL ITEM" is the same as doing "setvar 0x8004 PKMN, setvar 0x8005 LEVEL, setvar 0x8006 ITEM". Also, the flag 0x8C1 gets set before every battle and is cleared afterwards. I'm not sure why this happens. I don't see the difference when I don't include this.

A set wild battle is always followed by a special that determines the battle type, which is 0x139, 0x13A, 0x13B or 0x145.

---

SPECIAL 0x139

Special 0x139 doesn't seem to be used anywhere in the game, but it has a wave-like intro with the Kyogre/Groudon/Rayquaza battle music. Let's call it the "Weather Trio Song".

---

SPECIAL 0x13A

The special 0x13A is the strangest one, because it behaves differently depending on which Pokémon you're battling. This special is used on the Groudon, Kyogre, Rayquaza, Deoxys, Mew, Ho-oh and Lugia events.

If this special is used on any other Pokémon than the ones I mentioned, it will have the same intro that Groudon uses. Groudon image, cave background and the weather trio music.

When the special is used on Kyogre, it will have the same music but with a slightly different image and water background in battle.

On Rayquaza, it has the same music, different image and a sky background in battle.

Ho-Oh and Lugia have the same type of intro here. The screen fades black three times, then it pixelates. It uses the Kanto-legendary battle music.

Deoxys has almost the same as Ho-Oh and Lugia, except it uses a battle music that is exclusive to Deoxys.

Mew's intro fades black three times, then has a checkered-type of animation before going into battle. Not sure how to explain it, but it looks to be the same intro in special 0x13B. Mew also has its own exclusive battle music, which is similar to the Kanto-legendary music.

---

SPECIAL 0x13B

This special is only used for the Regis, and the intro depends on which of the three Pokémon is set in the wild battle.

First of all, if you use a Pokémon that isn't a Regi, it will have the Regi battle music but it will have the same type of intro that Mew uses.

In the intros, Regice shows seven yellow circles on the screen, Regirock shows seven orange circles and Registeel shows seven red circles. All in different patterns.

---

SPECIAL 0x145

This special does not behave differently depending on the Pokémon, but on the level. If the Pokémon is the same level or above your first Pokémon in the party, the intro will show white stripes. If it's under your Pokémon's level, it will be a completely normal intro, like a wild encounter in a grass patch. As far as I'm concerned, this special is pretty much the same as using a "wildbattle" command.

In the game, this special is only used on Southern Island for the Latios/Latias that isn't roaming, at level 50.

---

Here are videos with the scripts in the descriptions: https://drive.google.com/folderview?id=0B1n0SW2yBMufV18tNTdITkxhaEk&usp=sharing

I'm not sure how to change these battle types that are set to determined Pokémon. It might be possible with some ASM, but I have zero knowledge about that.

However, it's pretty easy to change the battle music. Just add a "playsong" command and use any song you like.
Click to visit Jiggmin's Village

Joexv

ManMadeOfGouda
joexv.github.io

Age 22
Male
Oregon
Seen 5 Days Ago
Posted December 21st, 2019
1,033 posts
7.6 Years
I've done some research on set wild battles in Emerald, and it turns out to be more complicated than what I anticipated. I can't guarantee that this is the same for Firered or any other ROM.

First of all, the command "setwildbattle PKMN LEVEL ITEM" is the same as doing "setvar 0x8004 PKMN, setvar 0x8005 LEVEL, setvar 0x8006 ITEM". Also, the flag 0x8C1 gets set before every battle and is cleared afterwards. I'm not sure why this happens. I don't see the difference when I don't include this.

A set wild battle is always followed by a special that determines the battle type, which is 0x139, 0x13A, 0x13B or 0x145.

---

SPECIAL 0x139

Special 0x139 doesn't seem to be used anywhere in the game, but it has a wave-like intro with the Kyogre/Groudon/Rayquaza battle music. Let's call it the "Weather Trio Song".

---

SPECIAL 0x13A

The special 0x13A is the strangest one, because it behaves differently depending on which Pokémon you're battling. This special is used on the Groudon, Kyogre, Rayquaza, Deoxys, Mew, Ho-oh and Lugia events.

If this special is used on any other Pokémon than the ones I mentioned, it will have the same intro that Groudon uses. Groudon image, cave background and the weather trio music.

When the special is used on Kyogre, it will have the same music but with a slightly different image and water background in battle.

On Rayquaza, it has the same music, different image and a sky background in battle.

Ho-Oh and Lugia have the same type of intro here. The screen fades black three times, then it pixelates. It uses the Kanto-legendary battle music.

Deoxys has almost the same as Ho-Oh and Lugia, except it uses a battle music that is exclusive to Deoxys.

Mew's intro fades black three times, then has a checkered-type of animation before going into battle. Not sure how to explain it, but it looks to be the same intro in special 0x13B. Mew also has its own exclusive battle music, which is similar to the Kanto-legendary music.

---

SPECIAL 0x13B

This special is only used for the Regis, and the intro depends on which of the three Pokémon is set in the wild battle.

First of all, if you use a Pokémon that isn't a Regi, it will have the Regi battle music but it will have the same type of intro that Mew uses.

In the intros, Regice shows seven yellow circles on the screen, Regirock shows seven orange circles and Registeel shows seven red circles. All in different patterns.

---

SPECIAL 0x145

This special does not behave differently depending on the Pokémon, but on the level. If the Pokémon is the same level or above your first Pokémon in the party, the intro will show white stripes. If it's under your Pokémon's level, it will be a completely normal intro, like a wild encounter in a grass patch. As far as I'm concerned, this special is pretty much the same as using a "wildbattle" command.

In the game, this special is only used on Southern Island for the Latios/Latias that isn't roaming, at level 50.

---

Here are videos with the scripts in the descriptions: https://drive.google.com/folderview?id=0B1n0SW2yBMufV18tNTdITkxhaEk&usp=sharing

I'm not sure how to change these battle types that are set to determined Pokémon. It might be possible with some ASM, but I have zero knowledge about that.

However, it's pretty easy to change the battle music. Just add a "playsong" command and use any song you like.
Just to add to what you've found, the flag 0x8c1 is set that way the overworld sprite that was used in the bttle is hidden via level scripts. (2 to be precise) one to hide it when you enter the map and the other to hide it directly after the battle. Its used this way in Fire Red too.
flag 0x8c1 is a temporary flag btw.

The level scripts structures are as follows:
Level Script type 5
#org @start
checkflag 0x8C1
if 0x1 call @hide
end

'---------------
#org @hide
special2 0xA 0xB7
compare 0xA 0x7
if 0x5 goto @done
hidesprite //Event number of sprite
return

'---------------
#org @done
return
'---------------
#org @start
checkflag 0x //Person ID for sprite
if 0x0 call @setflag
end

'---------------
#org @setflag
clearflag 0x //Person ID for sprite
return
New living flesh vessel who dis?

ProClifo

The Village Pirate Cat

Age 23
Male
Norway
Seen June 21st, 2019
Posted February 18th, 2018
92 posts
11.7 Years
Just to add to what you've found, the flag 0x8c1 is set that way the overworld sprite that was used in the bttle is hidden via level scripts. (2 to be precise) one to hide it when you enter the map and the other to hide it directly after the battle. Its used this way in Fire Red too.
flag 0x8c1 is a temporary flag btw.

The level scripts structures are as follows:
Level Script type 5
#org @start
checkflag 0x8C1
if 0x1 call @hide
end

'---------------
#org @hide
special2 0xA 0xB7
compare 0xA 0x7
if 0x5 goto @done
hidesprite //Event number of sprite
return

'---------------
#org @done
return
'---------------
#org @start
checkflag 0x //Person ID for sprite
if 0x0 call @setflag
end

'---------------
#org @setflag
clearflag 0x //Person ID for sprite
return
Not sure why this is included in both the level script and the battle script... take Rayquaza for example:

Spoiler:
'---------------
#org 0x239722
lockall
checksound
cry 0x196 0x2
pause 0x28
waitcry
setwildbattle 0x196 0x46 0x0
setflag 0x8C1
special 0x13A
waitstate
clearflag 0x8C1
special2 LASTRESULT 0xB7
compare LASTRESULT 0x1
if 0x1 goto 0x8239768
compare LASTRESULT 0x4
if 0x1 goto 0x8239771
compare LASTRESULT 0x5
if 0x1 goto 0x8239771
setflag 0x1C0
releaseall
end

'---------------
#org 0x239768
setflag 0x1C0
goto 0x823977C

'---------------
#org 0x239771
setvar 0x8004 0x196
goto 0x8239785

'---------------
#org 0x23977C
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
releaseall
end

'---------------
#org 0x239785
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
bufferpokemon 0x0 0x8004
msgbox 0x8273204 MSG_KEEPOPEN '"The [buffer1] flew away!"
releaseall
end


'---------
' Strings
'---------
#org 0x273204
= The [buffer1] flew away!


And the level script at Sky Pillar:

Spoiler:
'---------------
#org 0x2396C8
checkflag 0x8C1
if 0x1 call 0x82396D2
end

'---------------
#org 0x2396D2
special2 LASTRESULT 0xB7
compare LASTRESULT 0x7
if 0x5 goto 0x827374E
hidesprite LASTTALKED
return

'---------------
#org 0x27374E
return
Click to visit Jiggmin's Village

Joexv

ManMadeOfGouda
joexv.github.io

Age 22
Male
Oregon
Seen 5 Days Ago
Posted December 21st, 2019
1,033 posts
7.6 Years
Not sure why this is included in both the level script and the battle script... take Rayquaza for example:

Spoiler:
'---------------
#org 0x239722
lockall
checksound
cry 0x196 0x2
pause 0x28
waitcry
setwildbattle 0x196 0x46 0x0
setflag 0x8C1
special 0x13A
waitstate
clearflag 0x8C1
special2 LASTRESULT 0xB7
compare LASTRESULT 0x1
if 0x1 goto 0x8239768
compare LASTRESULT 0x4
if 0x1 goto 0x8239771
compare LASTRESULT 0x5
if 0x1 goto 0x8239771
setflag 0x1C0
releaseall
end

'---------------
#org 0x239768
setflag 0x1C0
goto 0x823977C

'---------------
#org 0x239771
setvar 0x8004 0x196
goto 0x8239785

'---------------
#org 0x23977C
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
releaseall
end

'---------------
#org 0x239785
fadescreen3 0x1
hidesprite LASTTALKED
fadescreen3 0x0
bufferpokemon 0x0 0x8004
msgbox 0x8273204 MSG_KEEPOPEN '"The [buffer1] flew away!"
releaseall
end


'---------
' Strings
'---------
#org 0x273204
= The [buffer1] flew away!


And the level script at Sky Pillar:

Spoiler:
'---------------
#org 0x2396C8
checkflag 0x8C1
if 0x1 call 0x82396D2
end

'---------------
#org 0x2396D2
special2 LASTRESULT 0xB7
compare LASTRESULT 0x7
if 0x5 goto 0x827374E
hidesprite LASTTALKED
return

'---------------
#org 0x27374E
return
The hidesprites and such in the battlescript are for capturing, fleeing etc. But I guess the 2nd script I posted isn't necessary on every pokemon.
New living flesh vessel who dis?
Age 25
Male
Seen August 31st, 2019
Posted August 31st, 2019
455 posts
6.9 Years
Battle Script Command cmd49 (Fire Red):
This is a very important command. It appears in 99% of the Move Effect Battle Scripts.
It is usually called at the end of battle Script (at 0x081d694E) which is used to terminates various Move Battle Scripts.
#org 0x081D694E
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end
It is responsible for executing things like Contact Abilities, Shell Bell etc. that happen at the end of a Battle Script.
The command routine is located at 0x0823210.

At 0x2337c, there is a master table that controls the order of things that happen the end of a move.
Each entry in the table, consists of offset to the ASM code for a particular end move event.
There are 0x12 (18) entries in the table. I will explain the entries that I could understand

Table Entries:
Spoiler:

0x0 - Simulates the rage effect and prints the message "[Buffer]'s rage us building". It checks whether the opponent's rage counter set or not.

0x1 - Defrosts the foe on using a fire move (You can add a hook for Scald here instead of using my Battle Script for Scald). Also, it does not defrost if the move is Physical. Since there is no DPSS split in vanilla Gen 3, this section only bothers to check Special Damage. To fix this, insert 04 at x234Dc.

0x2 - Calls the 8th section (r1=0x7 as a parameter) of the Ability bl at x19F18. The section table is located at x1A0DC. This section executes Synchronize's effect if the target having Synchronize is affected by a Status move by the user.

0x3 - Calls the 5th section (r1=0x4 as a parameter) of the Ability bl at x19F18. This sections has another table at x1a8d4 to check for abilities like Static, Color Change, Rough Skin etc. This table or the table reading routine can be rewritten to add new abilities like Cursed Body, Justified, Steadfast etc. You can go the Color Change routine to avoid Color Change in presence of a Sheer Force boosted move.

0x4 - Calls the 6th section (r1=0x5 as a parameter) of the Ability bl at x19f18. This section has another table at x1B105 for abilties like Limber, Immunity for their self-curing effect.

0x5 - Calls the 9th section (r1=0x8) of the Ability bl at x19F18. This section executes the Synchronize effect if the user having Synchronize is paralyzed by Static etc. (Can be expanded to create Poison Touch and updated Stench).

0x6 - Clears something at dynamic location (specified by x2023FE8) + 0xC8. It contains a move ID. Needs to be researched more.

0x7 - Moves the contents at dynamic location (specified by x2023FE8) + 0xD0 to the Held Item Slots for all Banked Mon. Needs to be researched more.

0x8 - Calls the 4th section (r0=0x3 as parameter) of the Held Item bl at 0x1Bc68. This section checks for status curing berries and status for all banked mons, then cures the status if applicable (Can be expanded to make Pinch Berries like Gen 6).

0x9 - Calls the 5th section (r0=0x4 as parameter) of the Held Item bl at 0x1Bc68. It checks for the User's Item, then checks for King Rock and Shell Bell (expanded this to create Life Orb).

0xA-0xC - Does something with Hidden User (Dive, Dig etc.). Needs More Research

0xD - Clears Substitute Status bit from the banked mons if the content 0x2023e0c+A is zero.

0xE-0xF - Needs more Research

0x10 - Very Important. This is responsible for execution the Second Iteration of the Battle Script for a move that targets both the Foes in Doubles.

0x11 - Just a pointer to mark the end of table exection.


Table Execution Controllers:
Spoiler:

0x2023FD8 - This byte controls the Starting Point of the Table Execution. If this byte is set to 0x5, the command routine starts execution from

the 6th entry of the table. It is incremented after each table entry is completely processed.

cmd49 0x0 0x0 - If the first parameter is zero. The table is executed in a normal manner covering all entries from the specified start point.

cmd49 0x1 0x0 - If the first parameter is one. The table is executed as long as the current Battle Script is being pushed. The moment the current Battle Script is not pushed, the table is terminated.

cmd49 0x2 0x(End Point) - If the first parameter is two, the second parameter will control the end point of move execution. If the second

parameter is 0x9 and the content of 0x2023FD8 is 0x5 then entries 0x5-0x9 (6th to 9th) are executed.


Usage and Table Expansion
Spoiler:

Entry no. 0x8 processes held item for all Banked Pokemon and Entry no. 0x9 processes held items only for the User Bank.
But items like Weakness Policy, Rocky Helmet, Cell Battery, Eject Button etc. will require a routine that processes held item only for the
Target Bank.

The solution is to repoint the table and create a custom routine that processes Held Items for Banked Target via another Table that reads a Held Item Effect Byte then branches to its particular effect.
The new entry should be prefably inserted between entry 0x7 and 0x8.

There are several limiters that need to be broken
At x23366, x23BC0, x23bd6, x23be0 & x23bec: change from 0x11 to 0x(New No. of Table Entries)
Now in Battle Scripts for moves like Earthquake, Self-Destruct and Multi-Hit Moves, each instance of 'cmd49 0x2 0x10' needs to be replaced by 'cmd49 0x2 0x(New No. of Table Entries-1)'.
For vanilla Battle Scripts you can find these at x1d6ABC, x1d6ad7, x1d6d48, x1d7661, x1d7b76, x1d7b8e, x1d7cd8, x1d839a, x1d94e6, x1d9500 & x1d9517.

For moves effect like U-Turn, cmd49 should be placed before Switching Happens or the Residual Damage in Flame Burst.



Important Locations, Registers and Shortcuts
Spoiler:

x2023ECC - This is a locations Damage Data Structure. It is used to check whether the move caused damage to the target or not. There are 4 data

structures of 20 (x14) bytes for each Bank.

0x0 - Contains the value of outcome. Stored in the user's damage structure.
0x4 - Contains the amount of damage caused by the move. Stored in the target's damage structure.
0x8 - Contains the amount of physical damage caused by the move. Stored in the target's damage structure.
0xC - Contains the amount of special damage caused by the move. Stored in the target's damage structure.
0x10 - Needs research.

x2023DCC - This contains the outcome of an attack, 'anding' it 0x29 can tell whether the move missed or was not effective or failed. If either conditions is true then you can branch out.

bl at 17544 - This pushes the current content of 2023d74 into the Battle Script stack. It is used to call another Battle Script from the current command. The content is popped back to x2023D74 using the 'return' command in the new Battle Script.

r10 - Set this to 0x1 if your routine successfully pushes the current BS Pointer and changes it to a New BS Pointer, so that the table exits the command to execute the Custom Battle Script.

[sp, #0x10] - Contains the first parameter.
[sp, #0x14] - Contains the second parameter.
[sp, #0x8] - Contains user's Held Item Effect byte.
[sp, #0x4] - Contains the move type.

Male
Seen 2 Weeks Ago
Posted 3 Weeks Ago
218 posts
6.8 Years
Spoiler:
Battle Script Command cmd49 (Fire Red):
This is a very important command. It appears in 99% of the Move Effect Battle Scripts.
It is usually called at the end of battle Script (at 0x081d694E) which is used to terminates various Move Battle Scripts.
#org 0x081D694E
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end
It is responsible for executing things like Contact Abilities, Shell Bell etc. that happen at the end of a Battle Script.
The command routine is located at 0x0823210.

At 0x2337c, there is a master table that controls the order of things that happen the end of a move.
Each entry in the table, consists of offset to the ASM code for a particular end move event.
There are 0x12 (18) entries in the table. I will explain the entries that I could understand

Table Entries:
Spoiler:

0x0 - Simulates the rage effect and prints the message "[Buffer]'s rage us building". It checks whether the opponent's rage counter set or not.

0x1 - Defrosts the foe on using a fire move (You can add a hook for Scald here instead of using my Battle Script for Scald). Also, it does not defrost if the move is Physical. Since there is no DPSS split in vanilla Gen 3, this section only bothers to check Special Damage. To fix this, insert 04 at x234Dc.

0x2 - Calls the 8th section (r1=0x7 as a parameter) of the Ability bl at x19F18. The section table is located at x1A0DC. This section executes Synchronize's effect if the target having Synchronize is affected by a Status move by the user.

0x3 - Calls the 5th section (r1=0x4 as a parameter) of the Ability bl at x19F18. This sections has another table at x1a8d4 to check for abilities like Static, Color Change, Rough Skin etc. This table or the table reading routine can be rewritten to add new abilities like Cursed Body, Justified, Steadfast etc. You can go the Color Change routine to avoid Color Change in presence of a Sheer Force boosted move.

0x4 - Calls the 6th section (r1=0x5 as a parameter) of the Ability bl at x19f18. This section has another table at x1B105 for abilties like Limber, Immunity for their self-curing effect.

0x5 - Calls the 9th section (r1=0x8) of the Ability bl at x19F18. This section executes the Synchronize effect if the user having Synchronize is paralyzed by Static etc. (Can be expanded to create Poison Touch and updated Stench).

0x6 - Clears something at dynamic location (specified by x2023FE8) + 0xC8. It contains a move ID. Needs to be researched more.

0x7 - Moves the contents at dynamic location (specified by x2023FE8) + 0xD0 to the Held Item Slots for all Banked Mon. Needs to be researched more.

0x8 - Calls the 4th section (r0=0x3 as parameter) of the Held Item bl at 0x1Bc68. This section checks for status curing berries and status for all banked mons, then cures the status if applicable (Can be expanded to make Pinch Berries like Gen 6).

0x9 - Calls the 5th section (r0=0x4 as parameter) of the Held Item bl at 0x1Bc68. It checks for the User's Item, then checks for King Rock and Shell Bell (expanded this to create Life Orb).

0xA-0xC - Does something with Hidden User (Dive, Dig etc.). Needs More Research

0xD - Clears Substitute Status bit from the banked mons if the content 0x2023e0c+A is zero.

0xE-0xF - Needs more Research

0x10 - Very Important. This is responsible for execution the Second Iteration of the Battle Script for a move that targets both the Foes in Doubles.

0x11 - Just a pointer to mark the end of table exection.


Table Execution Controllers:
Spoiler:

0x2023FD8 - This byte controls the Starting Point of the Table Execution. If this byte is set to 0x5, the command routine starts execution from

the 6th entry of the table. It is incremented after each table entry is completely processed.

cmd49 0x0 0x0 - If the first parameter is zero. The table is executed in a normal manner covering all entries from the specified start point.

cmd49 0x1 0x0 - If the first parameter is one. The table is executed as long as the current Battle Script is being pushed. The moment the current Battle Script is not pushed, the table is terminated.

cmd49 0x2 0x(End Point) - If the first parameter is two, the second parameter will control the end point of move execution. If the second

parameter is 0x9 and the content of 0x2023FD8 is 0x5 then entries 0x5-0x9 (6th to 9th) are executed.


Usage and Table Expansion
Spoiler:

Entry no. 0x8 processes held item for all Banked Pokemon and Entry no. 0x9 processes held items only for the User Bank.
But items like Weakness Policy, Rocky Helmet, Cell Battery, Eject Button etc. will require a routine that processes held item only for the
Target Bank.

The solution is to repoint the table and create a custom routine that processes Held Items for Banked Target via another Table that reads a Held Item Effect Byte then branches to its particular effect.
The new entry should be prefably inserted between entry 0x7 and 0x8.

There are several limiters that need to be broken
At x23366, x23BC0, x23bd6, x23be0 & x23bec: change from 0x11 to 0x(New No. of Table Entries)
Now in Battle Scripts for moves like Earthquake, Self-Destruct and Multi-Hit Moves, each instance of 'cmd49 0x2 0x10' needs to be replaced by 'cmd49 0x2 0x(New No. of Table Entries-1)'.
For vanilla Battle Scripts you can find these at x1d6ABC, x1d6ad7, x1d6d48, x1d7661, x1d7b76, x1d7b8e, x1d7cd8, x1d839a, x1d94e6, x1d9500 & x1d9517.

For moves effect like U-Turn, cmd49 should be placed before Switching Happens or the Residual Damage in Flame Burst.



Important Locations, Registers and Shortcuts
Spoiler:

x2023ECC - This is a locations Damage Data Structure. It is used to check whether the move caused damage to the target or not. There are 4 data

structures of 20 (x14) bytes for each Bank.

0x0 - Contains the value of outcome. Stored in the user's damage structure.
0x4 - Contains the amount of damage caused by the move. Stored in the target's damage structure.
0x8 - Contains the amount of physical damage caused by the move. Stored in the target's damage structure.
0xC - Contains the amount of special damage caused by the move. Stored in the target's damage structure.
0x10 - Needs research.

x2023DCC - This contains the outcome of an attack, 'anding' it 0x29 can tell whether the move missed or was not effective or failed. If either conditions is true then you can branch out.

bl at 17544 - This pushes the current content of 2023d74 into the Battle Script stack. It is used to call another Battle Script from the current command. The content is popped back to x2023D74 using the 'return' command in the new Battle Script.

r10 - Set this to 0x1 if your routine successfully pushes the current BS Pointer and changes it to a New BS Pointer, so that the table exits the command to execute the Custom Battle Script.

[sp, #0x10] - Contains the first parameter.
[sp, #0x14] - Contains the second parameter.
[sp, #0x8] - Contains user's Held Item Effect byte.
[sp, #0x4] - Contains the move type.

That's great KDS, thanks for sharing this !

Xencleamas

Suddenly lurking in the shadows...

Male
Asgard
Seen 1 Week Ago
Posted August 7th, 2018
460 posts
6.3 Years
Alright, it's done!

Type 01 at 080A0524, 080A064E and 080A0656 for the new HP check.
Type 02 E0 at 080A04CE to prevent friendship reducing.
Type 6B 02 at 081A8E04 to terminate the whiteout script.
Finally, insert FD0200E7E9E6EADDEAD9D800E8DCD900E4E3DDE7E3E2DDE2DBADFECEDCD900E4E3DDE7E3E200DAD5D8D9D800D5EBD5EDABFB somewhere in your ROM (or any other custom message using [buffer1]) and place a pointer to where you inserted it at 080A05E4.
That's it!

DPPt/HGSS Poison Survival Style into Emerald



For those who want the Generation IV's Poison Survival Style which leaves 1HP and the Poison status disappears in overworld into Emerald, here you go:

Type 01 at 080F962C, 080F977A and 080F9782 for the new HP check.
Type 02 E0 at 080F95D6 to prevent friendship reducing.
Type 6B 02 at 082736C1 to terminate the whiteout script.
Finally, insert FD0200E7E9E6EADDEAD9D800E8DCD900E4E3DDE7E3E2DDE2DBADFECEDCD900E4E3DDE7E3E200DAD5D8D9D800D5EBD5EDABFBFF somewhere in your ROM (or any other custom message using [buffer1]) and place a pointer to where you inserted it at 080F9710.
Credits to daniilS for his original routine for FireRed.

Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)