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!

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old December 4th, 2013 (4:51 PM).
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay DoesntKnowHowToPlay is offline
Tiny Umbrella with Lots and Lots of Good
     
    Join Date: Jan 2012
    Posts: 258


    In XY, there is a new type of battle known as the Inverse Battle. In this mode, type match-ups are reversed- moves that are normally super-effective become ineffective, and moves that are normally resisted or would have no effect become super-effective. I did some poking at the type chart code recently and found that it's actually quite easy to implement these in FR.

    "But that's easy! Just edit the well-documented type chart so every match-up is backwards!"

    That isn't what this does. This hack hijacks the code that reads the type chart to make the game use the inverse of what's there. This means you can use a flag to have hacks with both regular and inverse battles.

    The routine is as follows:

    Code:
    .align 2
    .thumb
    .thumb_func
    push {r4, r5, lr}
    mov r4, r0
    mov r0, #0x02
    lsl r0, #0x8
    mov r1, #0x3D
    add r0, r1
    bl FlagCheck
    cmp r0, #0x0
    beq End
    cmp r4, #0x0
    beq SuperEffective
    cmp r4, #0x5
    beq SuperEffective
    cmp r4, #0x14
    beq Ineffective
    b End
    
    SuperEffective:
    mov r4, #0x14
    b End
    
    Ineffective:
    mov r4, #0x5
    
    End:
    ldr r5, .damageAddr
    ldr r0, [r5, #0x0]
    mul r0, r4
    ldr r1, .returnAddr
    bx r1
    
    FlagCheck:
    ldr r2, .flagAddr
    bx r2
    
    
    .align 2
    .returnAddr: .word 0x0801e77d
    .flagAddr: .word 0x0806e6d1
    .damageAddr: .word 0x02023d50
    .end
    You can insert it anywhere. To call it, insert 00 49 08 47 at x1E770, followed by a pointer to where you inserted the method + 1. (For example, I inserted the method at x170900- I would put 00 49 08 47 01 09 17 08 at x1E770).

    This code ties the Inverse Battle rules to flag x23D. If flag x23D is set, battles will use the Inverse Battle ruleset- otherwise they will work normally. If you want to use a different flag, you can change it quite easily by adjusting the values on the sixth and eighth lines. Note that in vanilla FireRed, flag x23D is used by the Pokeflute- if that script is still in the game you will want to pick a different one.
    __________________

    Yet Another Fire Red Hack

    Physical/Special Split
    Reply With Quote

    Relevant Advertising!

      #2    
    Old December 4th, 2013 (7:25 PM).
    MrDollSteak's Avatar
    MrDollSteak MrDollSteak is offline
    Formerly known as 11bayerf1
       
      Join Date: Dec 2008
      Location: Hong Kong
      Age: 22
      Gender: Male
      Posts: 816
      That's fantastic Doesn't!

      A very useful feature for hacks looking for different things!

      You never cease to amaze me!
      __________________
      Reply With Quote
        #3    
      Old December 5th, 2013 (12:46 AM).
      Sniper's Avatar
      Sniper Sniper is offline
      ふゆかい
         
        Join Date: Nov 2013
        Location: Philippines
        Gender: Male
        Nature: Quiet
        Posts: 1,453
        Awesome, will this be able to implement in Emerald as well?
        __________________


        Reply With Quote
          #4    
        Old December 5th, 2013 (2:08 PM).
        esperance's Avatar
        esperance esperance is offline
        • Platinum Tier
         
        Join Date: Mar 2010
        Location: Ohio
        Age: 20
        Gender: Male
        Nature: Relaxed
        Posts: 3,830
        Ah, very nice.

        Quite an impressive feature despite its simplicity. Well done.
        __________________
        What are you so afraid of?
        Reply With Quote
          #5    
        Old December 5th, 2013 (3:34 PM).
        xGal xGal is offline
        Mhm
           
          Join Date: Nov 2011
          Location: A tree
          Gender: Other
          Nature: Relaxed
          Posts: 243
          This routine just gave me an idea for my hack. Thanks for the routine! I will give you a credit if i will use it .
          __________________
          Reply With Quote
            #6    
          Old December 5th, 2013 (6:24 PM).
          Kawaii Shoujo Duskull's Avatar
          Kawaii Shoujo Duskull Kawaii Shoujo Duskull is offline
          The Cutest Duskull
             
            Join Date: Jul 2013
            Location: Far too deep in my thoughts.
            Age: 21
            Gender: Female
            Nature: Timid
            Posts: 283
            Okay, this is pretty cool. Nice job~
            Reply With Quote
              #7    
            Old September 9th, 2014 (3:45 AM).
            Lance32497's Avatar
            Lance32497 Lance32497 is offline
            LanceKoijer of Pokemon_Addicts
               
              Join Date: Aug 2014
              Location: Criscanto town-Ginoa Region xD
              Gender: Male
              Nature: Adamant
              Posts: 793
              Quote:
              Originally Posted by DoesntKnowHowToPlay View Post


              In XY, there is a new type of battle known as the Inverse Battle. In this mode, type match-ups are reversed- moves that are normally super-effective become ineffective, and moves that are normally resisted or would have no effect become super-effective. I did some poking at the type chart code recently and found that it's actually quite easy to implement these in FR.

              "But that's easy! Just edit the well-documented type chart so every match-up is backwards!"

              That isn't what this does. This hack hijacks the code that reads the type chart to make the game use the inverse of what's there. This means you can use a flag to have hacks with both regular and inverse battles.

              The routine is as follows:

              Code:
              .align 2
              .thumb
              .thumb_func
              push {r4, r5, lr}
              mov r4, r0
              mov r0, #0x02
              lsl r0, #0x8
              mov r1, #0x3D
              add r0, r1
              bl FlagCheck
              cmp r0, #0x0
              beq End
              cmp r4, #0x0
              beq SuperEffective
              cmp r4, #0x5
              beq SuperEffective
              cmp r4, #0x14
              beq Ineffective
              b End
              
              SuperEffective:
              mov r4, #0x14
              b End
              
              Ineffective:
              mov r4, #0x5
              
              End:
              ldr r5, .damageAddr
              ldr r0, [r5, #0x0]
              mul r0, r4
              ldr r1, .returnAddr
              bx r1
              
              FlagCheck:
              ldr r2, .flagAddr
              bx r2
              
              
              .align 2
              .returnAddr: .word 0x0801e77d
              .flagAddr: .word 0x0806e6d1
              .damageAddr: .word 0x02023d50
              .end
              You can insert it anywhere. To call it, insert 00 49 08 47 at x1E770, followed by a pointer to where you inserted the method + 1. (For example, I inserted the method at x170900- I would put 00 49 08 47 01 09 17 08 at x1E770).

              This code ties the Inverse Battle rules to flag x23D. If flag x23D is set, battles will use the Inverse Battle ruleset- otherwise they will work normally. If you want to use a different flag, you can change it quite easily by adjusting the values on the sixth and eighth lines. Note that in vanilla FireRed, flag x23D is used by the Pokeflute- if that script is still in the game you will want to pick a different one.
              Why when I use it in a rom, when I use a move that the type is expanded, the game crashed?
              Reply With Quote
                #8    
              Old September 11th, 2014 (3:48 PM). Edited September 11th, 2014 by LocksmithArmy.
              LocksmithArmy's Avatar
              LocksmithArmy LocksmithArmy is offline
              Mew!
                 
                Join Date: Feb 2013
                Age: 28
                Gender: Male
                Posts: 415
                Quote:
                Originally Posted by DoesntKnowHowToPlay View Post
                Code:
                .align 2
                .thumb
                .thumb_func
                push {r4, r5, lr}
                mov r4, r0
                mov r0, #0x02
                lsl r0, #0x8
                mov r1, #0x3D
                add r0, r1
                bl FlagCheck
                cmp r0, #0x0
                beq End
                cmp r4, #0x0
                beq SuperEffective
                cmp r4, #0x5
                beq SuperEffective
                cmp r4, #0x14
                beq Ineffective
                b End
                
                SuperEffective:
                mov r4, #0x14
                b End
                
                Ineffective:
                mov r4, #0x5
                
                End:
                ldr r5, .damageAddr
                ldr r0, [r5, #0x0]
                mul r0, r4
                ldr r1, .returnAddr
                bx r1
                
                FlagCheck:
                ldr r2, .flagAddr
                bx r2
                
                
                .align 2
                .returnAddr: .word 0x0801e77d
                .flagAddr: .word 0x0806e6d1
                .damageAddr: .word 0x02023d50
                .end
                I kinda wanna make this as a tool lol... but I dont know how to compile ASM into hex bytes...

                how would I do that?

                P.S. Amazing work, really cool option for any hack.

                On a completely unrelated note, wouldn't this make a cool hold item... wouldn't know what to call it though lol
                __________________
                Reply With Quote
                  #9    
                Old September 11th, 2014 (4:22 PM). Edited September 11th, 2014 by Deokishisu.
                Deokishisu's Avatar
                Deokishisu Deokishisu is online now
                Mr. Magius
                   
                  Join Date: Feb 2006
                  Location: If I'm online, it's a safe bet I'm at a computer.
                  Gender: Male
                  Nature: Relaxed
                  Posts: 884
                  Quote:
                  Originally Posted by LocksmithArmy View Post
                  On a completely unrelated note, wouldn't this make a cool hold item... wouldn't know what to call it though lol
                  Like an item that forces the inverse ruleset when a Pokemon that is holding one comes into battle?

                  It'd be super cool, but super broken. Put it on all your pure Ice-types. #IceMasterType

                  Or giving Normal-type moves unresisted coverage.
                  Reply With Quote
                    #10    
                  Old September 11th, 2014 (5:53 PM).
                  LocksmithArmy's Avatar
                  LocksmithArmy LocksmithArmy is offline
                  Mew!
                     
                    Join Date: Feb 2013
                    Age: 28
                    Gender: Male
                    Posts: 415
                    Quote:
                    Originally Posted by Deokishisu View Post
                    Like an item that forces the inverse ruleset when a Pokemon that is holding one comes into battle?

                    It'd be super cool, but super broken. Put it on all your pure Ice-types. #IceMasterType

                    Or giving Normal-type moves unresisted coverage.
                    Ud have to only give 1 per game...
                    __________________
                    Reply With Quote
                      #11    
                    Old September 12th, 2014 (3:17 PM).
                    LocksmithArmy's Avatar
                    LocksmithArmy LocksmithArmy is offline
                    Mew!
                       
                      Join Date: Feb 2013
                      Age: 28
                      Gender: Male
                      Posts: 415
                      Quote:
                      Originally Posted by DoesntKnowHowToPlay View Post


                      In XY, there is a new type of battle known as the Inverse Battle. In this mode, type match-ups are reversed- moves that are normally super-effective become ineffective, and moves that are normally resisted or would have no effect become super-effective. I did some poking at the type chart code recently and found that it's actually quite easy to implement these in FR.

                      "But that's easy! Just edit the well-documented type chart so every match-up is backwards!"

                      That isn't what this does. This hack hijacks the code that reads the type chart to make the game use the inverse of what's there. This means you can use a flag to have hacks with both regular and inverse battles.

                      The routine is as follows:

                      Code:
                      .align 2
                      .thumb
                      .thumb_func
                      push {r4, r5, lr}
                      mov r4, r0
                      mov r0, #0x02
                      lsl r0, #0x8
                      mov r1, #0x3D
                      add r0, r1
                      bl FlagCheck
                      cmp r0, #0x0
                      beq End
                      cmp r4, #0x0
                      beq SuperEffective
                      cmp r4, #0x5
                      beq SuperEffective
                      cmp r4, #0x14
                      beq Ineffective
                      b End
                      
                      SuperEffective:
                      mov r4, #0x14
                      b End
                      
                      Ineffective:
                      mov r4, #0x5
                      
                      End:
                      ldr r5, .damageAddr
                      ldr r0, [r5, #0x0]
                      mul r0, r4
                      ldr r1, .returnAddr
                      bx r1
                      
                      FlagCheck:
                      ldr r2, .flagAddr
                      bx r2
                      
                      
                      .align 2
                      .returnAddr: .word 0x0801e77d
                      .flagAddr: .word 0x0806e6d1
                      .damageAddr: .word 0x02023d50
                      .end
                      You can insert it anywhere. To call it, insert 00 49 08 47 at x1E770, followed by a pointer to where you inserted the method + 1. (For example, I inserted the method at x170900- I would put 00 49 08 47 01 09 17 08 at x1E770).

                      This code ties the Inverse Battle rules to flag x23D. If flag x23D is set, battles will use the Inverse Battle ruleset- otherwise they will work normally. If you want to use a different flag, you can change it quite easily by adjusting the values on the sixth and eighth lines. Note that in vanilla FireRed, flag x23D is used by the Pokeflute- if that script is still in the game you will want to pick a different one.
                      IBA1.JPG

                      Soo here is the tool I made... if it meets your approval I would like to publish it about the web (it seems to work as prescribed)

                      LSA - Inverse Battle Applier.zip
                      __________________
                      Reply With Quote
                        #12    
                      Old September 12th, 2014 (6:39 PM).
                      DoesntKnowHowToPlay's Avatar
                      DoesntKnowHowToPlay DoesntKnowHowToPlay is offline
                      Tiny Umbrella with Lots and Lots of Good
                         
                        Join Date: Jan 2012
                        Posts: 258
                        Quote:
                        Originally Posted by LocksmithArmy View Post
                        Attachment 73380

                        Soo here is the tool I made... if it meets your approval I would like to publish it about the web (it seems to work as prescribed)

                        Attachment 73379
                        I'm fine with it, although I'd appreciate if you linked back to this thread wherever you distribute it.
                        __________________

                        Yet Another Fire Red Hack

                        Physical/Special Split
                        Reply With Quote
                          #13    
                        Old September 12th, 2014 (7:10 PM).
                        LocksmithArmy's Avatar
                        LocksmithArmy LocksmithArmy is offline
                        Mew!
                           
                          Join Date: Feb 2013
                          Age: 28
                          Gender: Male
                          Posts: 415
                          Quote:
                          Originally Posted by DoesntKnowHowToPlay View Post
                          I'm fine with it, although I'd appreciate if you linked back to this thread wherever you distribute it.
                          Consider it done Thanks
                          __________________
                          Reply With Quote
                            #14    
                          Old September 14th, 2014 (12:50 PM).
                          byrikudouvlog's Avatar
                          byrikudouvlog byrikudouvlog is offline
                          Romhacker promise
                             
                            Join Date: Feb 2014
                            Location: Milano, IT
                            Gender: Male
                            Nature: Naughty
                            Posts: 3
                            how do i to set in a script the inverse batle?
                            someone can show me an expample please?
                            i'm not understand so
                            __________________
                            Reply With Quote
                              #15    
                            Old September 14th, 2014 (12:54 PM).
                            LocksmithArmy's Avatar
                            LocksmithArmy LocksmithArmy is offline
                            Mew!
                               
                              Join Date: Feb 2013
                              Age: 28
                              Gender: Male
                              Posts: 415
                              Quote:
                              Originally Posted by byrikudouvlog View Post
                              how do i to set in a script the inverse batle?
                              someone can show me an expample please?
                              i'm not understand so
                              Code:
                              setflag 0x23D //turns on inverse battles
                              Code:
                              clearflag 0x23D //returns battles to normal
                              the flag you set or clear should be the flag you chose, not specifically 23D
                              __________________
                              Reply With Quote
                                #16    
                              Old September 27th, 2014 (1:09 PM).
                              LocksmithArmy's Avatar
                              LocksmithArmy LocksmithArmy is offline
                              Mew!
                                 
                                Join Date: Feb 2013
                                Age: 28
                                Gender: Male
                                Posts: 415
                                For anyone wanting to know how to make a trainer have an inverse battle with you... here is a detailed script:

                                Code:
                                #dynamic 0x725BEF ' any free space
                                #org @start
                                '-----------------------------------
                                setflag 0x33D ' the flag you chose
                                trainerbattle 0x1 0x(battle) 0x0 @text1 0x(oldtext2) @clearinverse 
                                msgbox 0x(oldwon)
                                callstd MSG_LOCK ' Built-in lock command
                                clearflag 0x33D ' the flag you chose
                                end
                                
                                #org @text1
                                = (old intro text)\pThis will be an\nINVERSE BATTLE.
                                
                                #org @clearinverse
                                '-----------------------------------
                                clearflag 0x33D ' the flag you chose
                                release
                                end
                                It is color coded to the parts that need to be pasted in:
                                Code:
                                #org 0x816A63E
                                '-----------------------------------
                                trainerbattle 0x0 0x8E 0x0 0x81911EC 0x8191237
                                msgbox 0x819126B ' You're pretty hot.\n...
                                callstd MSG_LOCK ' Built-in lock command
                                end
                                
                                
                                #org 0x81911EC
                                = Stop right there, kid!\pYou're ten thousand light-years \nfrom facing BROCK!
                                
                                #org 0x8191237
                                = Darn!\pLight-years isn't time[.]\nIt measures distance!
                                
                                #org 0x819126B
                                = You're pretty hot.\n[.]But not as hot as BROCK!
                                The example trainer(above) is the trainer in brocks gym, but the same parts can be copied from any trainer.

                                trainers using this script will not approach the player, they must be talked too.

                                X and Y usually ask the player if they want to continue... this script warns the player but does not let them back out. A simple yes/no script can make that happen. If you can't figure that out, you probably shouldn't be scripting.

                                If you are doing this for multiple trainers, you do not need to compile the '@clearinverse' section each time, you can just use the same offset where it is compiled once.
                                __________________
                                Reply With Quote
                                  #17    
                                Old November 5th, 2014 (11:26 PM).
                                HidoranBlaze's Avatar
                                HidoranBlaze HidoranBlaze is offline
                                   
                                  Join Date: Apr 2013
                                  Age: 21
                                  Gender: Male
                                  Posts: 253
                                  Managed to port this to EM.

                                  Replace the addresses at the end with this:

                                  Code:
                                  .returnAddr: .word 0x08046f6d
                                  .flagAddr: .word 0x0809d791
                                  .damageAddr: .word 0x020241f0
                                  Next, put 00 49 08 47 at 0x46f60, followed by the pointer to where you inserted the ASM + 1.

                                  That's it! I believe flag 0x2CD is used by something in EM as well, so just change the values in the sixth and eighth line if you want a different flag.
                                  Reply With Quote
                                    #18    
                                  Old November 6th, 2014 (5:32 AM).
                                  Aruaruu Aruaruu is offline
                                     
                                    Join Date: Sep 2011
                                    Gender: Male
                                    Posts: 199
                                    Quote:
                                    Originally Posted by HidoranBlaze View Post
                                    I believe flag 0x2CD is used by something in EM as well, so just change the values in the sixth and eighth line if you want a different flag.
                                    1. Thanks for the port of this (and of course to you, Doesnt)
                                    2. Flag 0x2CD appears to be set sometime during the Hall of Fame script. So you probably would like to change that.
                                    Reply With Quote
                                      #19    
                                    Old November 6th, 2014 (7:32 AM).
                                    LocksmithArmy's Avatar
                                    LocksmithArmy LocksmithArmy is offline
                                    Mew!
                                       
                                      Join Date: Feb 2013
                                      Age: 28
                                      Gender: Male
                                      Posts: 415
                                      Quote:
                                      Originally Posted by HidoranBlaze View Post
                                      Managed to port this to EM.

                                      Replace the addresses at the end with this:

                                      Code:
                                      .returnAddr: .word 0x08046f6d
                                      .flagAddr: .word 0x0809d791
                                      .damageAddr: .word 0x020241f0
                                      Next, put 00 49 08 47 at 0x46f60, followed by the pointer to where you inserted the ASM + 1.

                                      That's it! I believe flag 0x2CD is used by something in EM as well, so just change the values in the sixth and eighth line if you want a different flag.
                                      would you care terrably if I added this to my tool? cedit given of course.
                                      __________________
                                      Reply With Quote
                                        #20    
                                      Old November 6th, 2014 (7:36 AM).
                                      HidoranBlaze's Avatar
                                      HidoranBlaze HidoranBlaze is offline
                                         
                                        Join Date: Apr 2013
                                        Age: 21
                                        Gender: Male
                                        Posts: 253
                                        Quote:
                                        Originally Posted by LocksmithArmy View Post
                                        would you care terrably if I added this to my tool? cedit given of course.
                                        Feel free to do so. Why would I port this if I didn't want others to use it? lol
                                        Reply With Quote
                                          #21    
                                        Old November 6th, 2014 (8:00 AM). Edited November 6th, 2014 by LocksmithArmy.
                                        LocksmithArmy's Avatar
                                        LocksmithArmy LocksmithArmy is offline
                                        Mew!
                                           
                                          Join Date: Feb 2013
                                          Age: 28
                                          Gender: Male
                                          Posts: 415
                                          Quote:
                                          Originally Posted by HidoranBlaze View Post
                                          Feel free to do so. Why would I port this if I didn't want others to use it? lol
                                          I just like to make sure

                                          for those that are following this thread, version 2.0 of my tool can be downloaded from this thread:
                                          http://www.pokecommunity.com/showthread.php?p=8435317
                                          __________________
                                          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 4:27 PM.