Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources

Notices
For all updates, view the main page.

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.



Reply
 
Thread Tools
  #1    
Old December 13th, 2013 (02:45 AM).
ep!c
Banned
 
Join Date: Mar 2013
Gender: Male
Send a message via Skype™ to ep!c


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:


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:


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:


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
Reply With Quote
  #2    
Old December 14th, 2013 (06:29 AM).
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
This looks pretty good.

My question however is, by expanding this table to have more moves, how do you
create the compatibility.

For example if Gunk Shot is the new tutor move, how would you make it realise that
Charizard cannot learn it?
__________________
Reply With Quote
  #3    
Old December 14th, 2013 (04:07 PM).
ShyRayq's Avatar
ShyRayq
Unprofessional Unprofessional
 
Join Date: Aug 2007
Gender: Male
Nature: Adamant
Quote originally posted by MrDollSteak:
This looks pretty good.

My question however is, by expanding this table to have more moves, how do you
create the compatibility.

For example if Gunk Shot is the new tutor move, how would you make it realise that
Charizard cannot learn it?
I believe you would have to repoint and expand the compatibility table. It's stored in 16 bits (?) or 2 bytes I believes. So if you have more than 16 moves, you're gonna have to expand and repoint. Which would probably be a massive pain, ruining compatibility with some tools.
__________________
3DS Friend Code: 5069-3944-3902
IGN: Peter, (Pokemon Y, Pokemon OR)
Friend Safari: (Fighting) Throh, Meditite, Breloom
Live Pokedex (Y) Completed as of 02/03/14 (718), 10/11/14 (719)
Live Pokedex (OR) Completed as of 25/12/14 (719)
Big thanks especially to DestinedJagold, Xerneas_X, Elements1 and ~RNC~

PM me if you want to trade, or add my FC.
Reply With Quote
  #4    
Old December 15th, 2013 (02:27 AM).
ep!c
Banned
 
Join Date: Mar 2013
Gender: Male
Send a message via Skype™ to ep!c
Dude, when special 0x18D is called, and you want to teach Charizard, dunno, Surf.
It just won't work because the special accesses to a table of learnable moves, where
100 tools for editing exist, and if Charizard hasn't a specific byte, it can't learn the move.

However, if you want to have more than 16 attacks, learnable by move tutors, you
must simply repoint the table to free space where you can make up to 256 (0xFF) slots.
Reply With Quote
  #5    
Old December 15th, 2013 (03:00 AM).
Sniper's Avatar
Sniper
ワイルドフラワー
 
Join Date: Nov 2013
Location: Void
Gender: Male
Nature: Quiet
Send a message via Skype™ to Sniper
So that's how it works, thanks. I'll try this later on and hope won't fail -.-
__________________
PM | Flower | VM | Pair
Reply With Quote
  #6    
Old December 15th, 2013 (07:24 AM). Edited December 15th, 2013 by MrDollSteak.
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
Quote originally posted by ep!c:
Dude, when special 0x18D is called, and you want to teach Charizard, dunno, Surf.
It just won't work because the special accesses to a table of learnable moves, where
100 tools for editing exist, and if Charizard hasn't a specific byte, it can't learn the move.

However, if you want to have more than 16 attacks, learnable by move tutors, you
must simply repoint the table to free space where you can make up to 256 (0xFF) slots.
Yeah that's what I was asking thanks, I knew there was a compatibility table for existing tutor moves, I just didn't realise it could be expanded so easily.

Quote:
I believe you would have to repoint and expand the compatibility table. It's stored in 16 bits (?) or 2 bytes I believes. So if you have more than 16 moves, you're gonna have to expand and repoint. Which would probably be a massive pain, ruining compatibility with some tools.
Yeah it looks like an odd structure, it seems that each Pokemon has 2 bytes, where if every move is selected the value becomes FF FF (although that breaks, so more like FF 7F). It doesn't look that easy to change in all honesty without altering the actual routine.
__________________
Reply With Quote
  #7    
Old December 15th, 2013 (07:43 AM).
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
Move tutor compatibilities are located at x459B80 (right after the tutor moves themselves actually), and are just a series of two-byte bitmaps, one for each mon. As such, having more than 16 tutors while retaining reasonable compatibilities isn't feasible without editing the ASM involved (although I can't imagine it'd be very hard). You would break support for all one of the tutor-editing tools I know of though.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #8    
Old December 15th, 2013 (07:59 AM).
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
Quote originally posted by DoesntKnowHowToPlay:
Move tutor compatibilities are located at x459B80 (right after the tutor moves themselves actually), and are just a series of two-byte bitmaps, one for each mon. As such, having more than 16 tutors while retaining reasonable compatibilities isn't feasible without editing the ASM involved (although I can't imagine it'd be very hard). You would break support for all one of the tutor-editing tools I know of though.
Yeah there seem to be two routines involved specifically, one that loads the list of moves, and one that checks compatibility, this may mean, that it could be possible to check an extra condition and if that's the case load a separate tutor and compatibility table, this would seem easier to me than rewriting the move compatibility table entirely. Though I'll give both a go in the future.
__________________
Reply With Quote
  #9    
Old December 15th, 2013 (08:20 AM).
ep!c
Banned
 
Join Date: Mar 2013
Gender: Male
Send a message via Skype™ to ep!c
I may support this too and expanding the tutorial.
But if you want to teach specific moves for a specific Pokémon (like the super attacks in DPP) you will be fine with this already.
Reply With Quote
  #10    
Old December 17th, 2013 (11:29 AM).
Gorrioncillo
 
Join Date: Nov 2013
Gender: Male
so with this tuto i can make more that the 16th move tutors, can't i? or is tu change what the already (or maybe a new ones) move tutors can teach to pokemons (wich is only 15 in FR).
Reply With Quote
  #11    
Old December 20th, 2013 (12:41 PM).
haven1433
Modder / Programmer
 
Join Date: Oct 2013
Gender: Male
Great tutorial, gives me exactly what I need for a small number of tutors. I assume the "100 tools to edit compatibility" comment is incorrect, and the "2 bytes per pokemon limits to 16 tutors" forms a hard limit. But it does leave me wondering - given that one of the tutors teaches you 1 of 3 moves, how does compatibility work for that one? Is it possible to do something similar to combine multiple moves into a single tutor?
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 07:59 AM.