Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.

Reply
 
Thread Tools
  #1    
Old December 13th, 2013 (2:45 AM).
ep!c ep!c is offline
Banned
     
    Join Date: Mar 2013
    Gender: Male
    Posts: 124


    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

    Relevant Advertising!

      #2    
    Old December 14th, 2013 (6:29 AM).
    MrDollSteak's Avatar
    MrDollSteak MrDollSteak is online now
    Formerly known as 11bayerf1
       
      Join Date: Dec 2008
      Location: Hong Kong
      Age: 22
      Gender: Male
      Posts: 811
      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 (4:07 PM).
      ShyRayq's Avatar
      ShyRayq ShyRayq is offline
      Unprofessional Unprofessional
         
        Join Date: Aug 2007
        Gender: Male
        Nature: Adamant
        Posts: 1,482
        Quote:
        Originally Posted by MrDollSteak View Post
        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; (X, Y, OR, AS, M)
        Friend Safari: (Fighting) Throh, Meditite, Breloom
        Living Pokedex Complete: LG, E, Pl, Y, OR, M
        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 (2:27 AM).
        ep!c ep!c is offline
        Banned
           
          Join Date: Mar 2013
          Gender: Male
          Posts: 124
          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 (3:00 AM).
          Sniper's Avatar
          Sniper Sniper is offline
          ふゆかい
             
            Join Date: Nov 2013
            Location: Philippines
            Gender: Male
            Nature: Quiet
            Posts: 1,453
            So that's how it works, thanks. I'll try this later on and hope won't fail -.-
            __________________


            Reply With Quote
              #6    
            Old December 15th, 2013 (7:24 AM). Edited December 15th, 2013 by MrDollSteak.
            MrDollSteak's Avatar
            MrDollSteak MrDollSteak is online now
            Formerly known as 11bayerf1
               
              Join Date: Dec 2008
              Location: Hong Kong
              Age: 22
              Gender: Male
              Posts: 811
              Quote:
              Originally Posted by ep!c View Post
              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 (7:43 AM).
              DoesntKnowHowToPlay's Avatar
              DoesntKnowHowToPlay DoesntKnowHowToPlay is offline
              Tiny Umbrella with Lots and Lots of Good
                 
                Join Date: Jan 2012
                Posts: 258
                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 (7:59 AM).
                MrDollSteak's Avatar
                MrDollSteak MrDollSteak is online now
                Formerly known as 11bayerf1
                   
                  Join Date: Dec 2008
                  Location: Hong Kong
                  Age: 22
                  Gender: Male
                  Posts: 811
                  Quote:
                  Originally Posted by DoesntKnowHowToPlay View Post
                  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 (8:20 AM).
                  ep!c ep!c is offline
                  Banned
                     
                    Join Date: Mar 2013
                    Gender: Male
                    Posts: 124
                    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 Gorrioncillo is offline
                       
                      Join Date: Nov 2013
                      Gender: Male
                      Posts: 35
                      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 haven1433 is offline
                      Modder / Programmer
                         
                        Join Date: Oct 2013
                        Gender: Male
                        Posts: 7
                        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

                        Forum Jump


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