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

Development: Adding New Moves to Gen 3

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
I wrote the following script for Hammer Arm:

Spoiler:

You didn't write that, I did. You copied the Flare Blitz effect verbatim. I explained step by step how to find the effect you want, and how to use it. You haven't done any of it in this case. Also, as I said, it will only work on BPRE 1.0. It WILL NOT work on any other ROM, or at least, not in the form that I gave it.

Hm...Have you tried looking into the script for AincentPower? Although that raises your stats, not decrease it, I think it could be the same process for the opposite...

Hammer Arm lowers the user's speed, doesn't it? In which case, the code should be thus:

Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 48 01 03 09 2E DE 3F 02 02 93 89 C1 62 8F 1D 08 12 40 00 28 47 69 1D 08

I knocked this up quickly, so it might not be 100% right.
 

DoesntKnowHowToPlay

Tiny Umbrella with Lots and Lots of Good
265
Posts
12
Years
  • Seen Feb 24, 2024
Jambo, he probably made the same goof I did and copied the wrong thing, as he claimed to have a partially working Hammer Arm (which that clearly isn't). And your Flare Blitz actually seems to work just fine in vanilla FR.

If you don't mind piggybacking off the game's code (and are using FR), try this:

2E 85 3E 02 02 58 28 00 69 1D 08

The 58 may be incorrect as I haven't tested this...it's basically Metal Claw/Steel Wing with the effect byte changed.

As for making a version that doesn't use the game's scripts, I knocked this up real quick from the Close Combat I made last night:

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 58 15 28 47 69 1D 08

And if anyone was curious about the Close Combat script...it works, but it doesn't apply the debuffs in the graceful manner Superpower does- it plays the -defense animation twice rather than doing one animation appropriate to what is being debuffed.

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 57 15 2E 85 3E 02 02 5A 15 28 47 69 1D 08
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
I also made a close combat one which rather ungracefully applies the stat changes. I'm not awfully sure why this happens, in all honesty.

I'm glad to see that people are willing to test this stuff out and push its limits though! I put a lot of time and effort into working out how and why the game did certain things, so it's nice to see it's appreciated. :)
 

redriders180

Mastermind of Pokemon Glazed
314
Posts
13
Years
Sorry Jambo! It must've been a typo, because I was sure I copied the code from my Hex Editor, but I guess I selected the wrong thing.

The code you gave me does the same thing, it lowers the speed, and plays the animation, but it doesn't say "______s Speed fell!". I wonder if this is something worth trying to figure out. Actually, I think we should figure out how to make moves to display types of strings...It's probably dependent on the effect bytes, and not the move itself, but I'm sure you all knew that.

Also, Jambo, do you mind giving some insight on making moves that are NOT combinations of existing effects? I know you mentioned ASM, but I don't know where you'd put the ASM. Thanks!
 

droomph

weeb
4,285
Posts
12
Years
Could you share your code? and i'm curious what effects you did?
Code:
2E 85 3E 02 02 E6 15
also about "E6"
the second bit means the objective of the effect
0 : opponent
1 : user

the else 6 bits means what effect it does
Spoiler:
over
I dunno what you mean, but here's what I've got:
Spoiler:
It's probably because I have Emerald (or because I called it directly through 0x15), but yeah. Nothing below 0x80 seems to do anything

PS How do you do the do um...How do you find the actual move-script (not the effects-script)?
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Sorry Jambo! It must've been a typo, because I was sure I copied the code from my Hex Editor, but I guess I selected the wrong thing.

No need to apologise, everyone makes mistakes, but I had to assume you were using the wrong thing and try to correct you if you were.

Also, Jambo, do you mind giving some insight on making moves that are NOT combinations of existing effects? I know you mentioned ASM, but I don't know where you'd put the ASM. Thanks!

Basically, I wrote a custom BS command which is just a clone of the scripting (over world scripting, I mean) Callasm.

I use it to check various things which need ASM and to write data to the RAM.

I also hacked the text string writer to use one index as a print anything sort of command. How that works is that I store the pointer using BS commands to a set RAM address, and then call the battle string writer with that index. It then reads the RAM address for the pointer, and then uses the pointer to write the actual text. Works kinda like the OW scripting message box command.
 

ShadowTails

I'm working on a better Avatar
638
Posts
18
Years
  • Age 32
  • Seen Mar 7, 2015
So, I've been tinkering around in Emerald with this, and I've gotten new attacks to work. However I'm wondering about the whole animations thing, reusing existing ones. I have two new moves currently and the first move is using Pound, as expected, but the second move is using a poisoned animation. I looked for similar data to the animation pointer table, but it doesn't seem to be effecting anything in game animation wise for the new moves I've added, I definitely found a pointer table and re-pointed the data. I'm just not getting the results I expected, and it doesn't seem like all the bytes in the pointer table are pointers, assuming there are 355 animations in the game, and I jumped in the pointer data in Fire Red as well to check, and there appears to be more than 355 animation pointers for attacks, and the final bit of the 1420 bytes from 1C68F4 don't look like pointer data. Unless I have the wrong pointer, which is entirely possible, as I'm doing this in Emerald. These bytes 2F00C3004001FFFF both appear before a pointer table in both roms, and in Fire Red those bytes are before 1C68F4 and in Emerald the pointer table after those bytes is at 2C8D6C.

I decided to see if replacing the data at 2C8D6C in Emerald with 0's after re-pointing it to another part of the rom (which ends in 0, so like the first post warned, I did put it in the right place) would have any effect on the game, and now Sand Stream, Switching, Throwing a Pokeball, and various other things causes the game to reset. I'm not sure what's going on at all, is there another pointer for the animations table? I'm assuming that's what I've found, but I have no way of knowing. I guess I could try the same stuff I'm doing in Fire Red. I don't suppose this whole animation thing is on the top of my priorities, but it's still something I'd like to figure out...


Nevermind I figured it out.
 
Last edited:
76
Posts
15
Years
  • Age 31
  • Seen Aug 8, 2021
Ok - This is what I have managed to come up with over the last few weeks/months.

Once I stopped getting caught up in understanding what each and every command actually does, and started looking at the bigger picture, I realised that there are groups of commands which, when executed together, produce the effect we are looking for. If we were ever to create a compiler for battle scripts - I would term these as "super commands".

So, without further ado - the combination of commands which activates the stat changing effects:

Spoiler:


Obviously, these differing bytes will all need quantified. I'll start at the top:

Command 48:
Spoiler:


Command 2E (storebyte):
Spoiler:


Command 89 (executestatchange):
Spoiler:


Command 12 (showstatus):
Spoiler:


Fantastic - So far I've only talked about changing stats. What about burning, poisoning or damaging the foe? Well, these require yet more different commands!

Spoiler:


Feel free to test out and use this battle script! Using this methodology, it is possible to combine any existing effects in the BPRE 1.0 ROM, which makes the vast majority of Gen 4's (and a fair number of Gen 5's) moves possible on Gen 3 ROMs, animations notwithstanding. A short health warning, all the pointers I include in this post apply specifically to BPRE. However, this string of commands:
Spoiler:


should appear in all of the Gen 3 ROMs.
First, is that Flare Blitz script compatible with Emerald?

Second, am I supposed to be able to find free space somewhere in the table? Because the earliest available free space big enough for a command is nearly 600,000 bytes past the (apparent) first entry in the table (2D8A2E? in Emerald). Somehow I get the feeling I'm going to have to repoint the entire table if I want any free space for commands.

Third, is there a full list of animations? And how do I tell the game to call a certain order of animations (for example, call Harden, then call Hidden Power)? I'm editing Emerald, if that changes anything.

Lastly, can I get someone to better explain repointing the attack table (specifically in Emerald)? Because I'm reading the instructions right now and it's like trying to read Japanese: I have no idea what the hell any of it means. Not to mention I have no idea where the attack table in Emerald is. Scratch that, reverse it. I know exactly where the Emerald attack table is: 0x31C898. I don't know what to do with this information, though.
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
1) No, but it's pretty close to compatible. You would only need to change the pointer which follows the 01 command, as that is ROM specific. This is assuming the battle scripts are the same between FR and Emerald. They may not be.

2) No, there isn't any free space in the table as standard. I keep pointing out what I post are research notes, no better. This is meant to be a semi-tutorial on how to combine existing move effects in BPRE 1.0. (aka FR US 1.0). At no stage do I ever claim it would be a good tutorial, that there is free space in the table, or that it would work on Emerald. In fact, I state that it is only applicable to BPRE!

3) We know little to nothing about the animations. Research is ongoing. Chaos Rush has had some success creating custom animations, perhaps you could contact him?

4) Repointing the attack table? Which one? There are at LEAST 3 tables related to attacks (if not more on Emerald). The main table (with base damage etc on it) is a simple repoint. The animation table is repoint and fill out with placeholders for now.
The battle script pointers are somewhat more complicated. I have a solution for FR, which could theoretically work on Emerald, but right now, I have no intention of porting it to Emerald.
 
76
Posts
15
Years
  • Age 31
  • Seen Aug 8, 2021
So basically I'm screwed and Flare Blitz is stuck with goddamn Odor Sleuth's animation, and I don't know what I'm supposed to be doing with that Flare Blitz script or where it needs to go. Absolutely fantastic.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
So basically I'm screwed and Flare Blitz is stuck with goddamn Odor Sleuth's animation, and I don't know what I'm supposed to be doing with that Flare Blitz script or where it needs to go. Absolutely fantastic.

Bit much on the attitude! Chill out. For what it's worth, my post had a bit too much attitude yesterday, so I'm sorry about that.

You can only have a maximum of 255 battle script effects due to how the data table for the attacks is laid out. The effect it uses is only allocated a single byte, which is obviously too little for any more. My solution on FR uses one of the padding bytes to set a table value. What this means is that I have a table of tables in my ROM, and the aforementioned value sets which of the tables I want to get the Battle Script from, and then it reads the effect byte to get the actual script from the wanted table. It works, but is not ideal, since there are potential clashes (and also helpful coincidences - like I set Flare Blitz to Table 1 Effect 75 (or something like that) and because the existing code in the ROM doesn't check the table ID, Flare Blitz inherits its melting ice effect as well).

I explicitly stated in the post that you quoted that if you searched for a certain string of bytes that it would most likely be in the ROM. I ensured I left out anything BPRE specific in that string, so try searching for it. It should only appear once in the entire ROM and it should appear in a string looking somewhat like this:

Code:
00 01 XX XX XX 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 15 19 00 00 00 00 00 00

This string of commands is the workhorse of the battle scripting attack system. It generally executes most attacks, and most of their effects, which is why I branch back to it after executing the first effect (the recoil) to continue execution. The goto command in Battle Scripting is 28, so if you see a 28 followed by a pointer, it is likely to be a goto command.

The script should work as is as long as you "correct" the pointers after the 01 and 28 commands. I told you above how to track down the script which I go to after executing the Flare Blitz script. You can find the necessary pointer to go after the 01 command by finding that string of commands.

This should help somewhat. Sadly, I genuinely can't help with the animations.
 
1,323
Posts
16
Years
  • Seen Dec 9, 2023
I'm confused at how to use custom battle scripts, though. Do we need to manually expand the battle script table? (and yes, I know you can only have up to 255)

EDIT: I just went ahead and expanded the table. Working on Roost, if you assign Featherdance's animation to it, then set the battle script to this:
Code:
00 02 03 7B D1 7D 1D 08 01 09 0A 35 D0 32 02 02 00 01 00 00 [B]45 07 16 00 00 00 00[/B] 0B 01 0C 01 10 4B 00 12 40 00 28 4E 69 1D 08
You'll have a move identical to Roost but without the flying type removal. It will even play the healing animation. The bytes that I bolded is the command to play the healing animation.
1-3.png
2-3.png
3-2.png
4-2.png
5-1.png



EDIT: Does the callasm command work in battle scripts? I need it for removing the Flying type for 1 turn. (Not sure if this matters, but I'm working with FireRed)
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Nah, I wrote a completely custom command for the callasm command. It's fairly simple to do, all things considered. Also, my script is somewhat more simplistic, since mines just has the callasm, and then I just branch to the Milk Drink script to take care of the rest.

I've now written 5 custom commands for the game:
F8 (Callasm)
F9 (Store Half-Word)
FA (Store Word)
FB (Check Used Attack)
FC (Set Pledge Effect)

These sit on top of the existing commands, and the 1 index for all hack I applied to command 0x10. All in all, it works rather well.
 

Gamer2020

Accept no Imitations!
1,062
Posts
15
Years
Well guys I have made some progress on BSE!

It now compiles! I tested it a little while ago with this very simple script.

Code:
#org 0x800000
capture
end
It's still very basic in nature though and not every command is implemented. It is still a step in helping everyone be able to create their own move effects. These are the commands I have implemented to far. They're kind of blah so please give me some feedback on their names.
(Credit to JPAN and Jambo51 for their research!)

Code:
"&H0" = "unknownCommand0x00NoArgs"
"&H1" = "SomeCompare"
"&H2" = "usedattackmsg"
"&H3" = "hitmisscalc"
"&H4" = "critcalc" 
"&H5" = "basedmgcalc"
"&H6" = "typedmgcalc"
"&H7" = "effectcheck1"
"&H8" = "effectcheck2"
"&H9" = "baexe"
"&HA" = "turncheck" 
"&HB" = "healthbardec"
"&HC" = "healthvaldec"
"&HD" = "critcheck"
"&HE" = "unkloopcheck"
"&H10" = "msgdisplay" 
"&H12" = "seffectmsgdisplay" 
"&H1A" = "faintdisplay" 
"&H23" = "battleendfunc" 
"&H24" = "ifwildend" 
"&H26" = "storebyteforjump"
"&H27" = "jumpifbyte"
"&H28" = "goto" 
"&H2E" = "storebyte" 
"&H2F" = "addbyte"
"&H30" = "subtractbyte"
"&H31" = "copyarray"
"&H32" = "addarray" 
"&H39" = "pause" 
"&H3A" = "wait" 
"&H3C" = "return1" 
"&H3D" = "return2" 
"H3F" = "end"
"&H41" = "call" 
"&H45" = "animationprint"
"&H4C" = "pokemondataswitch"
"&H4D" = "pokemonbattledataswitch"
"&H4E" = "pokemonandhealthbardisplay"
"&H53" = "trainerdisplay"
"&H55" = "lvlupsnd"
"&H56" = "pkmfntsnd"
"&H57" = "flee"
"&H5C" = "hitflash"
"&H61" = "pkmswianimation"
"&H91" = "givemoney"
"&HEF" = "capture"
 

BrandoSheriff

Has a tendency to figure things out
776
Posts
16
Years
I have a question regarding the first method of adding moves.
By "supports up to 511 moves", do you mean that I can add up to 511 extra moves, or add to the existing 354 until I have exactly 511 (basically adding 157 new moves)?
 
150
Posts
15
Years
511 total. The game's default coding i believe only supports 512 moves. So we get (511 moves + struggle). if you want more, you gotta use Jambo's asm routine to change the way moves are loaded.
 

BrandoSheriff

Has a tendency to figure things out
776
Posts
16
Years
Thanks. Doing this, I've successfully added the 157 extra moves in Ruby. I also have those extra 157 slots in PGE after Psycho Boost. But am I supposed to get "unhandled exception" errors when I click on any one of them? Clicking continue lets me go as normal, but I think it might be tied to the free space I gave. When it says I have to leave 13 x the number of new attacks free bytes, I calculated it and replaced those corresponding FF's with 00's. Am I supposed to do that, or leave them as FF's?

EDIT: it just doesn't seem to matter whether I use 00's or FF's (I still don't know which is the right one, though), I just keep getting that error. It still works as normal, but that error is annoying. I'm sure I've done it right... :/
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Thanks. Doing this, I've successfully added the 157 extra moves in Ruby. I also have those extra 157 slots in PGE after Psycho Boost. But am I supposed to get "unhandled exception" errors when I click on any one of them? Clicking continue lets me go as normal, but I think it might be tied to the free space I gave. When it says I have to leave 13 x the number of new attacks free bytes, I calculated it and replaced those corresponding FF's with 00's. Am I supposed to do that, or leave them as FF's?

EDIT: it just doesn't seem to matter whether I use 00's or FF's (I still don't know which is the right one, though), I just keep getting that error. It still works as normal, but that error is annoying. I'm sure I've done it right... :/

Hmm, that free space is for the attack names. If you leave it as all 00's, it will definitely cause an error in PGE. The all 0xFF's may do so as well since it would cause PGE to display an "empty" name. Try copying and pasting the first 157 move names into that space, it may help.
 

BrandoSheriff

Has a tendency to figure things out
776
Posts
16
Years
I've just now tried that, but the errors still came up. Turns out, the cause of the error had to do with the effect of the new moves. All of them had effect 255 preset, same as the number in the error (SelectedIndex=255), and changing that to an existing effect got rid of it. However, I still get another one, where the SelectedIndex=47, that only comes up when I open the attack editor, and when selecting the first Pound attack. Other than that, everything's smooth sailing now. Thanks for the tutorial!
 
2
Posts
11
Years
  • Seen Aug 8, 2012
Sorry for sounding like a noob (because I've never hex edited anything before,) but... What's all this repointing about and how do you do it? And how much is 4260 bytes?
 
Back
Top