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
  #376    
Old June 15th, 2017 (7:30 PM).
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay DoesntKnowHowToPlay is offline
Tiny Umbrella with Lots and Lots of Good
     
    Join Date: Jan 2012
    Posts: 258

    Later gens have added the never-miss property to a bunch of moves, such as Roar, Block, and Foresight (as well as backported moves like Clear Smog and Defog).

    In FR, the relevant code is at 0x1DD8E. By putting C0 78 00 28 01 D0 10 E0 there, the check for Swift/Vital Throw/etc. will check the accuracy byte instead of the move effect byte, and will make the move ignore accuracy if its listed accuracy is 0 (which displays as -- in-game).

    __________________


    Yet Another Fire Red Hack

    Physical/Special Split

    Reply With Quote

    Relevant Advertising!

      #377    
    Old June 30th, 2017 (4:57 AM). Edited June 30th, 2017 by sSiddhant.
    sSiddhant's Avatar
    sSiddhant sSiddhant is offline
       
      Join Date: Jul 2016
      Location: India
      Gender: Male
      Nature: Naughty
      Posts: 28

      Gen 7 Moves Effects

      These are my first ever move effect creations. They are in the compiled version. You just need to add them with Hex Editor and repoint it from the Move Effects Table.

      Toxic Thread[FR]
      Spoiler:
      2E 85 3E 02 02 18 15 2E 85 3E 02 02 C2 15 28 00 69 1D 08

      Tearful Look[FR]
      Spoiler:
      2E 85 3E 02 02 16 15 2E 85 3E 02 02 19 15 28 00 69 1D 08

      Reply With Quote
        #378    
      Old 4 Weeks Ago (1:46 PM). Edited 4 Weeks Ago by AkameTheBulbasaur.
      AkameTheBulbasaur's Avatar
      AkameTheBulbasaur AkameTheBulbasaur is online now
      Akame Marukawa of Iyotono
         
        Join Date: May 2013
        Location: A place :D
        Age: 20
        Gender: Male
        Nature: Gentle
        Posts: 321

        Some people (like me) may not have known that Volt Tackle has another effect besides recoil past generation IV. From Diamond/Pearl onward, Volt Tackle has a 10% chance to paralyze.

        To get that in FireRed, replace Battle Scrip 198 with this:

        Spoiler:
        #dynamic 0x180000
        #freespacebyte 0xFF

        #org @CheckMove
        setbyte 0x2023E85 0xE6
        jumpifhalfword 0x0 0x2023D4A 0x158 @VoltTackle
        goto 0x1D6900

        #org @VoltTackle
        attackcanceler
        accuracycheck 0x81D695E 0x0
        attackstring
        ppreduce
        calculatedamage
        attackanimation
        waitanimation
        missmessage
        cmd5c 0x0
        waitstate
        graphicalhpupdate 0x0
        datahpupdate 0x0
        critmessage
        waitmessage 0x40
        resultmessage
        waitmessage 0x40
        seteffectwithchancetarget
        jumpiftype 0x0 0xD 0x81D694E
        setbyte 0x2023E85 0x5
        seteffectwithchancetarget
        faintpokemon 0x0 0x0 0x0
        goto 0x81D694E

        The above routine takes into account whether the opponent is Electric Type, and if they are, bypasses the paralysis chance. You can do this with other attacks too by using these three scripts:

        Replace Battle Script 6 with this:

        Spoiler:
        #dynamic 0x180000
        #freespacebyte 0xFF

        #org @TypeCheck
        jumpiftype 0x0 0xD 0x1D6900
        goto 0x81D6A6B


        This just checks the Type of the opponent, and if they are an Electric Type, just goes straight to the damage calculation script.

        Replace Battle Script 152 with this:

        Spoiler:
        #dynamic 0x170000
        #freespacebyte 0xFF

        #org @Main
        jumpiftype 0x0 0xD 0x81D6926
        setbyte 0x2023E85 0x5
        goto 0x81D6926

        Replace Battle Script 67 with this:

        Spoiler:
        #dynamic 0x180000
        #freespacebyte 0xFF

        #org @Start
        attackcanceler
        attackstring
        ppreduce
        jumpifhalfword 0x0 0x2023D4A 0x4E @StunSpore
        jumpiftype 0x0 0xD 0x81D7E04
        goto 0x81D71E5

        #org @StunSpore
        jumpiftype 0x0 0xC 0x81D7E04
        goto 0x81D71E5


        This also includes the check for Stun Spore. If the opponent is a Grass Type, it will have no effect.

        Of course, I have checks for the other spore moves.

        Replace Battle Script 66 with this:

        Spoiler:
        #dynamic 0x180000
        #freespacebyte 0xFF

        #org @Start
        attackcanceler
        attackstring
        ppreduce
        jumpifhalfword 0x0 0x2023D4A 0x4D @CheckType
        goto 0x81D7184

        #org @CheckType
        jumpiftype 0x0 0xC 0x81D7E04
        goto 0x81D7184

        Replace Battle Script 1 with this:

        Spoiler:
        #dynamic 0x180000
        #freespacebyte 0xFF

        #org @Start
        attackcanceler
        attackstring
        ppreduce
        jumpifhalfword 0x0 0x2023D4A 0x4F @CheckType
        jumpifhalfword 0x0 0x2023D4A 0x93 @CheckType
        goto 0x81D6970

        #org @CheckType
        jumpiftype 0x0 0xC 0x81D7E04
        goto 0x81D6970

        I also have a script for "100% Accurate When Used by a Poison Type" Toxic for FireRed (there was one for Emerald but not for FireRed).

        Replace Battle Script 33 with this:

        Spoiler:
        #dynamic 0x180000
        #freespacebyte 0xFF

        #org @Toxic
        jumpiftype 0x1 0x3 @AccuracyBypass
        goto 0x81D6DE0

        #org @AccuracyBypass
        attackcanceler
        jumpifspecialstatusflag 0x0 0x400C0 0x0 0x1D695E
        attackstring
        ppreduce
        jumpifability 0x0 0x11 0x81D6E4F
        jumpifsecondarystatus 0x0 0x1000000 0x81D7DF2
        jumpifstatus 0x0 0x8 0x81D6E41
        jumpifstatus 0x0 0x80 0x81D6E41
        jumpifstatus 0x0 0xFF 0x81D7DF2
        jumpiftype 0x0 0x3 0x81D7E04
        jumpiftype 0x0 0x8 0x81D7E04
        goto 0x81D6E27

        Last but not least, in the current games, Ghost Types are no longer affected by trapping moves like Mean Look or by abilities like Shadow Tag. I haven't updated the abilities yet, but if you want Mean Look (and any move that uses its script) to not affect Ghost Types...

        Replace Battle Script 106 with this:

        Spoiler:
        #dynamic 0x180000
        #freespaceyte 0xFF

        #org @start
        attackcanceler
        attackstring
        ppreduce
        jumpiftype 0x0 0x7 0x81D7E04
        goto 0x81D76D7

        Whew! That was a lot! I'm not sure if this stuff is already on here, but I wasn't able to find it anywhere. Hopefully at least one of these things haven't been posted yet haha.

        __________________

        "The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo

        Reply With Quote
          #379    
        Old 2 Weeks Ago (6:05 PM).
        ghoulslash's Avatar
        ghoulslash ghoulslash is offline
           
          Join Date: Mar 2016
          Gender: Male
          Posts: 51

          This may be all for naught since FBI is working on redoing the battle system, but I was interested in solving this problem:

          Adding new Wrap-Effect moves with Custom Text/Animation [FR]:

          1. The default text for effect 42 is Sand Tomb. Rather than try and find the routine that loads the correct string, a simple hex edit will generalize the attack name and preserve the Sand Tomb printstring. At 0x3FBB2F, insert the following (there is enough space to keep the pointer)

          Quote:
          FD 10 00 EB D5 E7 00 E8 E6 D5 E4 E4 D9 D8 FE D6 ED 00 FD 14 AB FF
          This says "[target] was trapped by [attack]!" Change if you like.
          2a. There is a 'table' of between turn animations at 0x1D5C5F with a pointer at 0x1C6EC0. The table looks something like this:
          Quote:
          03 (ZZ+1) YY XX 08 05 00 21 00 01 00 D3 5C 1D 08 21 00 02 00 F8 5C 1D 08 ... ... 13 8B 5C 1D 08
          • where (ZZ+1) YY XX is a reverse pointer to a routine that loads an ID to check against 21 00 0X 00
          • D3 5C 1D 08 is a pointer to fire spin's between turn animation, F8 5C 1D 08 to Whirlpool, and so on
          • 13 8B 5C 1D 08 loads the default wrap animation if 21 00 0X 00 is not matched. This is why simply assigning effect 42 to a move yields the wrap animation between turns
          2b. Repoint this table to free space. You want to add in 21 00 05 00 AA AA AA 08 21 00 06 00 BB BB BB 08 ... etc for each move you want to add, where 0xAAAAAA, 0xBBBBBB are the between-turn animations for your new moves. These can be different than the regular attack animation. And make sure the 13 8B 5C 1D 08 is at the end of the 'table'

          3. Insert the following routine into free space. This will be our new routine to load the ID that checks against this table

          Spoiler:

          Code:
          .text
          .align 2
          .thumb
          .thumb_func
          .global TrapAnim

          Main: push {lr} ldr r0, =(0x02024018) ldr r0, [r0] ldr r1, [r0, #0x8] ldrh r1, [r1] @r1 = move ID

          CheckFireSpin: cmp r1, #0x53 @fire spin move ID bne CheckWhirlpool mov r0, #0x1 b Ending

          CheckWhirlpool: cmp r1, #0xFA @whirlpool move ID bne CheckClamp mov r0, #0x2 b Ending

          CheckClamp: cmp r1, #0x80 @clamp move ID bne CheckSandTomb mov r0, #0x3 b Ending

          CheckSandTomb: mov r0, #0xA4 lsl r0, r0, #0x1 @0x148 (sand tomb move ID) cmp r1, r0 bne CheckMine mov r0, #0x4 b Ending

          CheckMine: mov r0, #0xXX @your new move ID cmp r1, r0 bne Default mov r0, #0x5 b Ending

          /* repeat the above pattern for extra moves. */

          Default: mov r0, #0x0

          Ending: ldr r1, =(0x02037F02) @store anim ID strh r0, [r1] mov r0, r2 ldr r1, =(0x08072760 + 1) bl linker pop {r0} bx r0

          linker: bx r1

          .align 2

          4. change the pointer (ZZ+1) YY XX 08 in your repointed 'table' from (2b) to the reverse pointer (+1) to where you inserted this routine.

          And that should be everything you need! Enjoy!

          Reply With Quote
            #380    
          Old 2 Weeks Ago (7:17 PM).
          Noodlewhiz's Avatar
          Noodlewhiz Noodlewhiz is offline
             
            Join Date: Apr 2017
            Posts: 26

            Quote:
            Originally Posted by ghoulslash View Post
            snip
            I followed everything you said, but for some reason now all the between turn animations have become wrap. Do you know what I could have done wrong?
            I also modified the routine a little:
            Spoiler:
            .text
            .align 2
            .thumb
            .thumb_func
            .global TrapAnim

            Main:
            push {lr}
            lsl r0, r0, #0x18
            lsr r2, r0, #0x18
            ldr r0, =(0x02024018)
            ldr r0, [r0]
            ldr r1, [r0, #0x8]
            ldrh r1, [r0] @r1 = move ID

            CheckFireSpin:
            cmp r1, #0x53 @fire spin move ID
            bne CheckWhirlpool
            ldr r1, =(0x02037F02)
            mov r0, #0x1
            b Ending

            CheckWhirlpool:
            cmp r1, #0xFA @whirlpool move ID
            bne CheckClamp
            ldr r1, =(0x02037F02)
            mov r0, #0x2
            b Ending

            CheckClamp:
            cmp r1, #0x80 @clamp move ID
            bne CheckSandTomb
            ldr r1, =(0x02037F02)
            mov r0, #0x3
            b Ending

            CheckSandTomb:
            mov r0, #0xA4
            lsl r0, r0, #0x1 @0x148 (sand tomb move ID)
            cmp r1, r0
            bne CheckMagmaStorm
            ldr r1, =(0x02037F02)
            mov r0, #0x4
            b Ending

            CheckMagmaStorm:
            mov r0, #0xF7 @your new move ID
            lsl r0, r0, #0x1
            cmp r1, r0
            bne CheckInfestation
            mov r0, #0x5
            b Ending

            CheckInfestation:
            mov r0, #0xFF @your new move ID
            add r0, r0, #0x1E
            lsl r0, r0, #0x1
            cmp r1, r0
            bne Default
            mov r0, #0x6
            b Ending

            /* repeat the above pattern for extra moves. */

            Default:
            ldr r1, =(0x02037F02)
            mov r0, #0x0

            Ending:
            ldr r1, =(0x02037F02) @store anim ID
            strh r0, [r1]
            mov r0, r2
            ldr r1, =(0x08072760 + 1)
            bl linker
            pop {r0}
            bx r0

            linker:
            bx r1

            .align 2


            Thanks!

            Reply With Quote
              #381    
            Old 2 Weeks Ago (7:26 PM).
            ghoulslash's Avatar
            ghoulslash ghoulslash is offline
               
              Join Date: Mar 2016
              Gender: Male
              Posts: 51

              Quote:
              Originally Posted by Noodlewhiz View Post
              I followed everything you said, but for some reason now all the between turn animations have become wrap. Do you know what I could have done wrong?
              I also modified the routine a little:
              Spoiler:
              .text
              .align 2
              .thumb
              .thumb_func
              .global TrapAnim

              Main:
              push {lr}
              lsl r0, r0, #0x18
              lsr r2, r0, #0x18
              ldr r0, =(0x02024018)
              ldr r0, [r0]
              ldr r1, [r0, #0x8]
              ldrh r1, [r0] @r1 = move ID

              CheckFireSpin:
              cmp r1, #0x53 @fire spin move ID
              bne CheckWhirlpool
              ldr r1, =(0x02037F02)
              mov r0, #0x1
              b Ending

              CheckWhirlpool:
              cmp r1, #0xFA @whirlpool move ID
              bne CheckClamp
              ldr r1, =(0x02037F02)
              mov r0, #0x2
              b Ending

              CheckClamp:
              cmp r1, #0x80 @clamp move ID
              bne CheckSandTomb
              ldr r1, =(0x02037F02)
              mov r0, #0x3
              b Ending

              CheckSandTomb:
              mov r0, #0xA4
              lsl r0, r0, #0x1 @0x148 (sand tomb move ID)
              cmp r1, r0
              bne CheckMagmaStorm
              ldr r1, =(0x02037F02)
              mov r0, #0x4
              b Ending

              CheckMagmaStorm:
              mov r0, #0xF7 @your new move ID
              lsl r0, r0, #0x1
              cmp r1, r0
              bne CheckInfestation
              mov r0, #0x5
              b Ending

              CheckInfestation:
              mov r0, #0xFF @your new move ID
              add r0, r0, #0x1E
              lsl r0, r0, #0x1
              cmp r1, r0
              bne Default
              mov r0, #0x6
              b Ending

              /* repeat the above pattern for extra moves. */

              Default:
              ldr r1, =(0x02037F02)
              mov r0, #0x0

              Ending:
              ldr r1, =(0x02037F02) @store anim ID
              strh r0, [r1]
              mov r0, r2
              ldr r1, =(0x08072760 + 1)
              bl linker
              pop {r0}
              bx r0

              linker:
              bx r1

              .align 2


              Thanks!

              If it's doing the wrap animation between turns, it's somehow getting to the Default part of the assembly routine. I would double check your move IDs. It looks like Infestation is move ID 570, for example.

              Also since you load ldr r1, =(0x02037F02) at Ending, you shouldn't need to add that at every check, just in case you want to save a few bytes

              Reply With Quote
                #382    
              Old 2 Weeks Ago (7:40 PM).
              Noodlewhiz's Avatar
              Noodlewhiz Noodlewhiz is offline
                 
                Join Date: Apr 2017
                Posts: 26

                Quote:
                Originally Posted by ghoulslash View Post
                If it's doing the wrap animation between turns, it's somehow getting to the Default part of the assembly routine. I would double check your move IDs. It looks like Infestation is move ID 570, for example.

                Also since you load ldr r1, =(0x02037F02) at Ending, you shouldn't need to add that at every check, just in case you want to save a few bytes

                I've checked my move ids many times. Infestation is supposed to be 570; I expanded my level up move data. Assuming the move ids are correct, what could I be doing wrong?

                Reply With Quote
                  #383    
                Old 2 Weeks Ago (7:51 PM).
                ghoulslash's Avatar
                ghoulslash ghoulslash is offline
                   
                  Join Date: Mar 2016
                  Gender: Male
                  Posts: 51

                  Quote:
                  Originally Posted by Noodlewhiz View Post
                  I've checked my move ids many times. Infestation is supposed to be 570; I expanded my level up move data. Assuming the move ids are correct, what could I be doing wrong?

                  Ah, that makes sense then. It's possible expanding the move IDs over 511 is the issue, then? The original routine loads the attack ID in a strange manner, so I would go through and make sure that you are actually loading the move ID in Main.

                  These are my notes on what the routine actually does to load the move ID into r1:

                  Code:
                  	ldr r0, =(0x02024018)
                  	ldr r0, [r0]				@r0 = word at 02024018 -> 02005484
                  	ldr r1, [r0, #0x8]			@r1 = word at 0200548C -> 02005504
                  	ldrh r1, [r1]				@r1 = move ID

                  Reply With Quote
                    #384    
                  Old 2 Weeks Ago (8:20 PM).
                  Noodlewhiz's Avatar
                  Noodlewhiz Noodlewhiz is offline
                     
                    Join Date: Apr 2017
                    Posts: 26

                    Quote:
                    Originally Posted by ghoulslash View Post
                    Ah, that makes sense then. It's possible expanding the move IDs over 511 is the issue, then? The original routine loads the attack ID in a strange manner, so I would go through and make sure that you are actually loading the move ID in Main.

                    These are my notes on what the routine actually does to load the move ID into r1:

                    Code:
                    	ldr r0, =(0x02024018)
                    	ldr r0, [r0]				@r0 = word at 02024018 -> 02005484
                    	ldr r1, [r0, #0x8]			@r1 = word at 0200548C -> 02005504
                    	ldrh r1, [r1]				@r1 = move ID
                    I don't believe it's an issue with expanding the moves. I tested the old function with the new table and the original entries worked fine. However with this new function, even the old entries (I've been mostly trying with Whirlpool) appear as wrap. I checked 0x02005504 and FA was appearing there so I don't know what could be going wrong at this point.

                    Reply With Quote
                      #385    
                    Old 2 Weeks Ago (8:42 PM).
                    ghoulslash's Avatar
                    ghoulslash ghoulslash is offline
                       
                      Join Date: Mar 2016
                      Gender: Male
                      Posts: 51

                      Quote:
                      Originally Posted by Noodlewhiz View Post
                      I don't believe it's an issue with expanding the moves. I tested the old function with the new table and the original entries worked fine. However with this new function, even the old entries (I've been mostly trying with Whirlpool) appear as wrap. I checked 0x02005504 and FA was appearing there so I don't know what could be going wrong at this point.

                      Just took a closer look at your assembly routine, and I found the issue. In main, it should be:

                      Code:
                      ldr r1, [r0, #0x8]
                      ldrh r1, [r1]

                      whereas you have:

                      Code:
                      ldr r1, [r0, #0x8]
                      ldrh r1, [r0]	@r1 = move ID

                      So the move ID isn't actually getting loaded into r1

                      Reply With Quote
                        #386    
                      Old 2 Weeks Ago (9:35 PM).
                      Noodlewhiz's Avatar
                      Noodlewhiz Noodlewhiz is offline
                         
                        Join Date: Apr 2017
                        Posts: 26

                        Quote:
                        Originally Posted by ghoulslash View Post
                        Just took a closer look at your assembly routine, and I found the issue. In main, it should be:
                        Code:
                        ldr r1, [r0, #0x8]
                        ldrh r1, [r1]

                        whereas you have:

                        Code:
                        ldr r1, [r0, #0x8]
                        ldrh r1, [r0]	@r1 = move ID
                        So the move ID isn't actually getting loaded into r1
                        Yup, that was it. It works like a charm now. Thanks!

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