The PokéCommunity Forums Fan Games ROM Hacking Research & Development
Quick Research & Development Thread

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!


Reply
 
Thread Tools
  #676    
Old June 3rd, 2015 (11:48 PM).
Criminon's Avatar
Criminon Criminon is offline
Pokemon: Aqua Blue
     
    Join Date: Aug 2012
    Gender: Male
    Posts: 243
    This stuff should help anyone wanting to check their party's hp.
    0x20242DA is the address stored in RAM for the 1st pokemon in your party's HP.
    0x20242DC is the max HP.
    0x20242D4 is the status ailment a pokemon is currently suffering. (00 being nothing)

    Using comparefarbytetobyte 0x20242DA 0xnumber you want to check
    you can easily check a pokemon's hp.

    using comparefarbytetobyte 0x20242DC 0xnumber you want to check
    you can easily see if a pokemon has enough hp for something.

    using writebytetooffset 0xstatus 0x20242D4
    you can easily edit the status effecting them.

    For the rest of your party, take these offsets and add 0x64 to them.
    __________________
    FC: 3582 - 9598 - 9978. Add me!
    Reply With Quote

    Relevant Advertising!

      #677    
    Old June 4th, 2015 (2:11 AM).
    BlackWhiteRobin's Avatar
    BlackWhiteRobin BlackWhiteRobin is offline
       
      Join Date: Sep 2012
      Age: 20
      Gender: Male
      Nature: Quirky
      Posts: 543
      Quote:
      Originally Posted by Haru~ View Post
      After a long battle with cancer trying to find the RAM location of the player's money, I had a feeling that it is encrypted somewhere in the RAM and that's why I can't find it. So after going to my local POKeMART, I found a little routine that seems to decrypt something. After doing further testing, I made this routine to get the player's current money using the game's own code.

      The routine:
      Spoiler:

      Code:
      .align 2
      .thumb
      
      /*This routine does all the hard work in retrieving your current
      money and stores it in vars 0x8000 and 0x8001.
          0x8000 - Lower half
          0x8001 - Upper half
      */
      
      main:    push {r4-r6, lr}
          ldr r6, .DMA_MAP
          ldr r0, [r6, #0x0]
          mov r5, #0xA4
          lsl r5, r5, #0x2
          add r0, r0, r5
          ldr r1, .OTHER_RAMLOC
          ldr r1, [r1, #0x8]
          bl get_amount        /*Does the actual decrypting*/
          ldr r1, .VAR_8000
          str r0, [r1]
          pop {r4-r6, pc}
      
      get_amount:    ldr r4, .DO_CALC
              bx r4
      
      .hword 0x0000
      .DMA_MAP:    .word 0x03005008
      .OTHER_RAMLOC:    .word 0x02039934
      .VAR_8000:    .word 0x020370B8 /*Var 0x8000-0x8001*/
      .DO_CALC:    .word 0x0809FD59


      I slept after that...
      Umm... Hey guys, I need a little bit of help. I saw that code up there just now that Haru~ posted years ago, so I was trying to use it, and yeah it does what it does but it only works as long as your money is below 65535 (the var limit). What do I do?

      And if it helps, here's my script.
      Spoiler:
      Code:
      #dynamic 0x800000
      
      #org @start
      lock
      faceplayer
      callasm 0x71E5C1 (I inserted the routine at 0x71E5C0 just so you know)
      buffernumber 0x00 0x8001
      buffernumber 0x01 0x8000
      msgbox @display_money
      release
      end
      
      #org @display_money
      = Your current money is:\n\hB7[buffer1][buffer2].


      Thanks in advance!
      Reply With Quote
        #678    
      Old June 4th, 2015 (12:09 PM). Edited June 5th, 2015 by kleenexfeu.
      kleenexfeu kleenexfeu is offline
         
        Join Date: Aug 2013
        Gender: Male
        Posts: 216
        Choice Scarf for Emerald :
        Spoiler:

        Spoiler:

        Code:
        .text
        .align 2
        .thumb
        .thumb_func
        .global choicescarf
        
        
        Start:
        cmp r6, #0x18
        beq DropSpeed
        cmp r6, #0x1D	/*give to your choice scarf the same special than choice band*/
        beq CheckHeld
        
        Return:
        ldr r2, =(0x02024084)
        ldr r0, =(0x0803D164+1)
        bx r0
        
        DropSpeed:
        lsr r7, r7, #1
        b Return
        
        CheckHeld:
        cmp r5, #0x11	/*held item effect*/
        bne Return
        mov r0, r7
        lsr r0, r0, #1
        add r7, r0
        b Return
        
        .align 2
        
        /*Type 00 48 00 47 XX+1 XX XX 08 at 0x0803D15C with XX XX XX being the address of your routine*/


        Spoiler:

        Code:
        .text
        .align 2
        .thumb
        .thumb_func
        .global choicescarfadverse
        
        Start:
        cmp r6, #0x18
        beq DropSpeed
        cmp r6, #0x1D	/*give to your choice scarf the same special than choice band*/
        beq CheckHeld
        
        Return:
        ldr r0, =(0x0803D07E+1)
        bx r0
        
        DropSpeed:
        mov r2, r8
        lsr r2, r2, #1
        mov r8, r2
        b Return
        
        CheckHeld:
        cmp r5, #0x11	/*held item effect*/
        bne Return
        
        BoostSpeed:
        mov r2, r8
        lsr r2, r2, #1
        add r8, r2
        b Return
        
        .align 2
        
        /*Type 00 48 00 47 XX+1 XX XX 08 at 0x0803D074 with XX XX XX being the address of your routine*/



        Same idea than choice spec, give the special 0x1D to allow only one move, and give the same held effect than in the routine (which can be whatever you want). Choice scarf/spec MUST have a different held effect of course. There's two routines because there's apparently two checks (don't ask me why)
        Reply With Quote
          #679    
        Old June 15th, 2015 (8:20 AM). Edited June 19th, 2015 by kleenexfeu.
        kleenexfeu kleenexfeu is offline
           
          Join Date: Aug 2013
          Gender: Male
          Posts: 216
          In Emerald :

          Wrap and such does 1/8 damage instead of 1/16 : write C0 08 instead of 00 09 at 08040D90

          Quote:
          Originally Posted by Splash View Post
          Know where the firered offset for this is at?
          Write C0 08 at 080186C4 should work. Didn't test though
          __________________
          Links for my work:
          Dynamic Emerald Attack ROMbase
          Arceus and Giratina Forms

          Touched's Emerald IDB + Battle stuff (probably outdated)
          Touched's Emerald IDB 6.8 + Battle stuff (probably outdated)
          Reply With Quote
            #680    
          Old June 15th, 2015 (9:28 PM). Edited June 15th, 2015 by MrDollSteak.
          MrDollSteak's Avatar
          MrDollSteak MrDollSteak is offline
          Formerly known as 11bayerf1
             
            Join Date: Dec 2008
            Location: Hong Kong
            Age: 23
            Gender: Male
            Posts: 829
            Quote:
            Originally Posted by kleenexfeu View Post
            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
            __________________
            Reply With Quote
              #681    
            Old June 16th, 2015 (12:53 AM).
            Splash's Avatar
            Splash Splash is offline
            But nothing happened.
               
              Join Date: Oct 2009
              Location: Just use an Old Rod
              Gender: Male
              Nature: Hasty
              Posts: 661
              Quote:
              Originally Posted by kleenexfeu View Post
              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
              |
              Reply With Quote
                #682    
              Old June 16th, 2015 (2:15 AM).
              FamiliaWerneck's Avatar
              FamiliaWerneck FamiliaWerneck is offline
                 
                Join Date: May 2015
                Location: São Paulo, Brasil
                Gender: Male
                Posts: 274
                Quote:
                Originally Posted by DoesntKnowHowToPlay View Post
                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?
                Reply With Quote
                  #683    
                Old June 17th, 2015 (1:58 AM). Edited June 17th, 2015 by Criminon.
                Criminon's Avatar
                Criminon Criminon is offline
                Pokemon: Aqua Blue
                   
                  Join Date: Aug 2012
                  Gender: Male
                  Posts: 243
                  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!
                  __________________
                  FC: 3582 - 9598 - 9978. Add me!
                  Reply With Quote
                    #684    
                  Old June 17th, 2015 (6:00 AM).
                  FamiliaWerneck's Avatar
                  FamiliaWerneck FamiliaWerneck is offline
                     
                    Join Date: May 2015
                    Location: São Paulo, Brasil
                    Gender: Male
                    Posts: 274
                    Quote:
                    Originally Posted by Criminon View Post
                    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.
                    Reply With Quote
                      #685    
                    Old June 17th, 2015 (6:16 AM).
                    Criminon's Avatar
                    Criminon Criminon is offline
                    Pokemon: Aqua Blue
                       
                      Join Date: Aug 2012
                      Gender: Male
                      Posts: 243
                      Quote:
                      Originally Posted by FamiliaWerneck View Post
                      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.
                      __________________
                      FC: 3582 - 9598 - 9978. Add me!
                      Reply With Quote
                        #686    
                      Old June 24th, 2015 (10:42 AM).
                      Substitute Doll's Avatar
                      Substitute Doll Substitute Doll is offline
                      An Alolan Exeggutor
                         
                        Join Date: May 2015
                        Location: Under an alolan exeggutor
                        Gender: Male
                        Nature: Bashful
                        Posts: 119
                        Does anyone know how to change the exp. share to update it to gen 6 in pokemon emerald?
                        Reply With Quote
                          #687    
                        Old June 24th, 2015 (2:00 PM).
                        BLAx501!'s Avatar
                        BLAx501! BLAx501! is offline
                        Pokemon Flux
                           
                          Join Date: Oct 2013
                          Location: Madrid, Spain
                          Gender: Male
                          Nature: Gentle
                          Posts: 79
                          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
                          Reply With Quote
                            #688    
                          Old June 25th, 2015 (3:30 AM). Edited June 27th, 2015 by FamiliaWerneck.
                          FamiliaWerneck's Avatar
                          FamiliaWerneck FamiliaWerneck is offline
                             
                            Join Date: May 2015
                            Location: São Paulo, Brasil
                            Gender: Male
                            Posts: 274
                            Quote:
                            Originally Posted by BLAxTOISE View Post
                            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:


                            Reply With Quote
                              #689    
                            Old June 26th, 2015 (12:43 AM). Edited June 29th, 2015 by Artemis64.
                            Artemis64 Artemis64 is offline
                               
                              Join Date: Mar 2014
                              Location: Singapore
                              Gender: Male
                              Nature: Hasty
                              Posts: 87
                              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.
                              Reply With Quote
                                #690    
                              Old June 27th, 2015 (3:24 AM).
                              emilin_rose's Avatar
                              emilin_rose emilin_rose is offline
                                 
                                Join Date: Nov 2008
                                Posts: 101
                                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.
                                Reply With Quote
                                  #691    
                                Old June 27th, 2015 (3:44 AM).
                                ProClifo's Avatar
                                ProClifo ProClifo is offline
                                The Village Pirate Cat
                                   
                                  Join Date: Sep 2008
                                  Location: Norway
                                  Age: 21
                                  Gender: Male
                                  Nature: Lonely
                                  Posts: 92
                                  I found out that inserting a new map in Emerald will screw up the Battle Pyramid. Screen goes black when entering the blue warp thing at the beginning.

                                  Anyone got a solution to this?
                                  __________________
                                  Click to visit Jiggmin's Village
                                  Reply With Quote
                                    #692    
                                  Old June 27th, 2015 (4:25 AM).
                                  jirachiwishmaker's Avatar
                                  jirachiwishmaker jirachiwishmaker is offline
                                     
                                    Join Date: Jul 2007
                                    Location: Forina
                                    Gender: Male
                                    Nature: Lonely
                                    Posts: 105
                                    Quote:
                                    Originally Posted by Proclifo View Post
                                    I found out that inserting a new map in Emerald will screw up the Battle Pyramid. Screen goes black when entering the blue warp thing at the beginning.

                                    Anyone got a solution to this?
                                    http://www.pokecommunity.com/showpost.php?p=5425714&postcount=557
                                    Reply With Quote
                                      #693    
                                    Old June 30th, 2015 (8:25 AM).
                                    capylus's Avatar
                                    capylus capylus is offline
                                       
                                      Join Date: Jun 2015
                                      Gender: Male
                                      Posts: 16
                                      Excuse me, I have a trouble with checking 1 Pokemon if it has been seen (= check Pokedex) in Emerald, I hasn't found any our topics talk about it... so, anyone know how to write script with XSE? Thanks!
                                      (Such as: if you has seen it --> A/ hasn't --> B)
                                      Reply With Quote
                                        #694    
                                      Old June 30th, 2015 (7:38 PM). Edited July 23rd, 2015 by Xencleamas.
                                      Xencleamas's Avatar
                                      Xencleamas Xencleamas is offline
                                      Suddenly lurking in the shadows...
                                         
                                        Join Date: Feb 2014
                                        Location: Asgard
                                        Gender: Male
                                        Nature: Adamant
                                        Posts: 458
                                        Quote:
                                        Originally Posted by Jambo51 View Post
                                        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!)
                                        Reply With Quote
                                          #695    
                                        Old July 5th, 2015 (5:07 PM).
                                        ProClifo's Avatar
                                        ProClifo ProClifo is offline
                                        The Village Pirate Cat
                                           
                                          Join Date: Sep 2008
                                          Location: Norway
                                          Age: 21
                                          Gender: Male
                                          Nature: Lonely
                                          Posts: 92
                                          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
                                          Reply With Quote
                                            #696    
                                          Old July 5th, 2015 (6:14 PM).
                                          Joexv's Avatar
                                          Joexv Joexv is offline
                                          joexv.github.io
                                           
                                          Join Date: Oct 2012
                                          Location: Oregon
                                          Age: 21
                                          Gender: Male
                                          Nature: Sassy
                                          Posts: 1,031
                                          Quote:
                                          Originally Posted by Proclifo View Post
                                          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:
                                          Code:
                                          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
                                          Code:
                                          '---------------
                                          #org @start
                                          checkflag 0x //Person ID for sprite
                                          if 0x0 call @setflag
                                          end
                                          
                                          '---------------
                                          #org @setflag
                                          clearflag 0x //Person ID for sprite
                                          return
                                          __________________
                                          I died and am dead
                                          Reply With Quote
                                            #697    
                                          Old July 5th, 2015 (7:39 PM).
                                          ProClifo's Avatar
                                          ProClifo ProClifo is offline
                                          The Village Pirate Cat
                                             
                                            Join Date: Sep 2008
                                            Location: Norway
                                            Age: 21
                                            Gender: Male
                                            Nature: Lonely
                                            Posts: 92
                                            Quote:
                                            Originally Posted by joexv View Post
                                            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:
                                            Code:
                                            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
                                            Code:
                                            '---------------
                                            #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:
                                            Code:
                                            '---------------
                                            #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:
                                            Code:
                                            '---------------
                                            #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
                                            Reply With Quote
                                              #698    
                                            Old July 5th, 2015 (7:52 PM).
                                            Joexv's Avatar
                                            Joexv Joexv is offline
                                            joexv.github.io
                                             
                                            Join Date: Oct 2012
                                            Location: Oregon
                                            Age: 21
                                            Gender: Male
                                            Nature: Sassy
                                            Posts: 1,031
                                            Quote:
                                            Originally Posted by Proclifo View Post
                                            Not sure why this is included in both the level script and the battle script... take Rayquaza for example:

                                            Spoiler:
                                            Code:
                                            '---------------
                                            #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:
                                            Code:
                                            '---------------
                                            #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.
                                            __________________
                                            I died and am dead
                                            Reply With Quote
                                              #699    
                                            Old July 7th, 2015 (3:06 AM).
                                            capylus's Avatar
                                            capylus capylus is offline
                                               
                                              Join Date: Jun 2015
                                              Gender: Male
                                              Posts: 16
                                              In Emerald, anyone knows the script that check a certain PKMN in party? Tks!
                                              Reply With Quote
                                                #700    
                                              Old July 9th, 2015 (1:20 AM).
                                              Chacha Dinosaur's Avatar
                                              Chacha Dinosaur Chacha Dinosaur is offline
                                              Adamant and adaptive dinosaur.
                                                 
                                                Join Date: Jul 2013
                                                Age: 23
                                                Gender: Male
                                                Posts: 453
                                                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.
                                                Code:
                                                #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.

                                                Reply With Quote
                                                Reply

                                                Quick Reply

                                                Join the conversation!

                                                Create an account to post a reply in this thread, participate in other discussions, and more!

                                                Create a PokéCommunity Account

                                                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 11:58 PM.