ep!c
Banned
- 124
- Posts
- 12
- Years
- Seen Jan 4, 2015
Creating custom Move-Tutors
Introduction
Here is another small research-thingie which I want to share with the community.
It's nothing special, but could still make a hack better, such as paying some money
or shards (like in DPP) for specific attacks. I will also provide a little script which contains
all extra-stuff like multichoice-boxes etc., but don't copy it 1:1 please! =)
Let's get started!
We need approximately three tools. A hex-editor, Advance-Map to insert the script and
XSE (eXtreme Script Editor) to create and insert the script. We will do the hex-editing first.
Open your hex-editor, load your ROM and jump to the offset 0x459B60.
On the first view, these bytes look very random. But they aren't.
Firstly, download the attack-list on my dropbox.
Compare some of the bytes in our ROM with some attacks in the list.
[05]..[0E]..[19].. these look like Mega Punch, Swords Dance and Mega Kick!!
But as you might noticed, the attacks are stored in half-words.
Thats logical, as there are attacks over the value 0xFF and must be stored in a byte-reversed half-word =)
The value 0x5 or 0x0005 (its the same) will get [05][00] then. 0xE will get [0E][00], etc.B
And what do we do with the attacks over 0xFF, such as 0x108, Focus-Punch?
Well, we do the same as above. 0x108 is the same as 0x0108.
0108 -> [01][08] and we reverse it -> [08][01].
So, if we insert 0801 instead of 0500 for example, the move-tutor with Index 0 will teach your
Pokémon Focus-Punch.
Spoiler:
![[PokeCommunity.com] Creating custom Move-Tutors [PokeCommunity.com] Creating custom Move-Tutors](https://dl.dropboxusercontent.com/u/109327839/tutmovetutor/hex.png)
You might as well complain about the space you are provided for the move-tutors.
Well, we simply repoint the table for more space.
Go to the offset 0x120BE4 and you see a pointer located there: [60][9B][45][08]
This pointer points to our previous offset 0x459B60 which we want to change of course!
For this tutorial I will take 0xA00000 as our new table, for example.
[A0][00][00] -> [00][00][A0]-[08].
Now we replace the string 609B4508 with our new string 0000A008.
Spoiler:
![[PokeCommunity.com] Creating custom Move-Tutors [PokeCommunity.com] Creating custom Move-Tutors](https://dl.dropboxusercontent.com/u/109327839/tutmovetutor/hex2.png)
Setting up our table
For my tutorial, as I previously said, I will use the offset 0xA00000 for the new table.
Go there with your hex-editor and you will just see 0xFF bytes, which means free space.
The structure of the Move-Tutor table is actually damn-easy.
: [Attack_Word][Attack_Word][Attack_Word] ... ... :
: [Attack_Word][Attack_Word][Attack_Word] ... ... :
Yeah, it's just the bytereversed attacks, one after another.
Let's say I want headbutt as Index 0 and Eruption as Index 1.
We take our attack-list and we see:
Headbutt 0x1D ------ [1D][00]
Eruption 0x11C ------ [1C][01]
Spoiler:
![[PokeCommunity.com] Creating custom Move-Tutors [PokeCommunity.com] Creating custom Move-Tutors](https://dl.dropboxusercontent.com/u/109327839/tutmovetutor/hex3.png)
Making the script!
The script is actually not as hard as many people might expect.
Basically you need:
setvar 0x8005 0x[Index]
special 0x18D
waitstate
If we insert this, it can be kinda .. ugly.
We should add some smooth fadescreens and cancel-checks.
What is a cancel check? When you cancel the move-tutor, the special returns 0x0 in LASTRESULT.
I will just show you an example of my move-tutor script in my hack.
Spoiler:
Code:
...
fadescreen 0x1 '---- makes a smooth fadescreen :3
setvar 0x8005 [Index] '---- sets the var with your desired index of attack.
call @subscript_for_special '---- is useful for space-saving if you define 0x8005 before the call.
compare 0x800D 0x0 '---- compares cancel (if you pressed B) and "cannot learn move"
if 0x1 goto @cancel
goto @pay_item
....
#org @subscript_for_special
special 0x18D '--- executes movetutor
waitstate '--- waits until movetutor is finished
lock
faceplayer
return '--- returns where the subscript was called from
As you can see, if you press B or the Pokémon cannot learn the attack, it will jump
to @cancel. If everything is fine, it will jump to @pay_item.
Yeah.. and that basically was it! =D
Have fun and good luck with your hack!
~epic