The PokéCommunity Forums Fan Games ROM Hacking Help Research & Development
Development Ability Resource 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
  #26    
Old April 17th, 2015 (6:50 AM). Edited April 17th, 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

    Expanding Ability Names Data and Ability Descriptions Pointer Table


    I think this should be here so I don't need to make a new thread with a very simple tutorial. Alright! I'm going to tell you how to expand Ability tables (the Names and the Descriptions). I'm using HxD here as a HEX Editor.

    Legend:
    • Green bolded text are for Emerald.
    • Red bolded text are for FireRed.

    Step 1: Ability Names

    • Go to a new free space names (example: 0x720000). Select 3328 (0xD00 in HEX) bytes. Fill the bytes with AE AE AE AE AE AE AE FF 00 00 00 00 00.
    • Go to 31B6DB or 24FC40. Select and copy 1014 (0x3F6 in HEX) bytes.
    • Go to the offset of your names data (which the example is 0x720000) and paste the data there.
    • Replace all DB B6 31 08 or 40 FC 24 08 with the "reversed hex in little indian of your new names data offset with 08 at the end" (example: 00 00 72 08)

    Step 2: Ability Descriptions

    • Go to a new free space descriptions (example: 0x720D00). Select 1024 (0x400 in HEX) bytes. Fill the bytes with 98 AF 31 08 or C4 F3 24 08.
    • Go to 31BAD4 or 24FB08. Select and copy 312 (0x138 in HEX) bytes.
    • Go to the offset of your description table (which the example is 0x720D00) and paste the data there.
    • Replace all D4 BA 31 08 or 08 FB 24 08 with the "reversed hex in little indian of your new description data offset with 08 at the end" (example: 00 0D 72 08)

    Then, change your .ini-s. Replace the old offsets in the .ini with your new data (they should be at where the Ability Names and Ability Descriptions are). Luckily, these don't have limiter stuff at all.

    With the expanded data, the new data should be working. I have made this tutorial to have maximized the slots to 256 abilities (255 usable abilities plus one for the none "-----" slot). Now you have 178 new slots for Generation IV+ abilities. Noted that the game can only support up to 256 abilities. The rest of the tutorial on how to insert ability routines are on the first post of this thread since inserting ability routines are now complicated. I hope this post is to be linked up in the Extra Information of this thread so everyone can expand stuff too.
    __________________

    Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)
    Reply With Quote
      #27    
    Old April 17th, 2015 (7:35 AM). Edited April 17th, 2015 by kleenexfeu.
    kleenexfeu kleenexfeu is offline
       
      Join Date: Aug 2013
      Gender: Male
      Posts: 216
      Quote:
      Originally Posted by RaileysXerilyasRX View Post

      Expanding Ability Names Data and Ability Descriptions Pointer Table


      I think this should be here so I don't need to make a new thread with a very simple tutorial. Alright! I'm going to tell you how to expand Ability tables (the Names and the Descriptions). I'm using HxD here as a HEX Editor.

      Legend:
      • Green bolded text are for Emerald.
      • Red bolded text are for FireRed.

      Step 1: Ability Names

      • Go to a new free space names (example: 0x720000). Select 3328 (0xD00 in HEX) bytes. Fill the bytes with AE AE AE AE AE AE AE FF 00 00 00 00 00.
      • Go to 31B6DB or 24FC40. Select and copy 1014 (0x3F6 in HEX) bytes.
      • Go to the offset of your names data (which the example is 0x720000) and paste the data there.
      • Replace all DB B6 31 08 or 40 FC 24 08 with the "reversed hex in little indian of your new names data offset with 08 at the end" (example: 00 00 72 08)

      Step 2: Ability Descriptions

      • Go to a new free space descriptions (example: 0x720D00). Select 1024 (0x400 in HEX) bytes. Fill the bytes with 98 AF 31 08 or C4 F3 24 08.
      • Go to 31BAD4 or 24FB08. Select and copy 1014 (0x3F6 in HEX) bytes.
      • Go to the offset of your description table (which the example is 0x720D00) and paste the data there.
      • Replace all D4 BA 31 08 or 08 FB 24 08 with the "reversed hex in little indian of your new description data offset with 08 at the end" (example: 00 0D 72 08)

      Then, change your .ini-s. Replace the old offsets in the .ini with your new data (they should be at where the Ability Names and Ability Descriptions are). Luckily, these don't have limiter stuff at all.

      With the expanded data, the new data should be working. I have made this tutorial to have maximized the slots to 256 abilities (255 usable abilities plus one for the none "-----" slot). Now you have 178 new slots for Generation IV+ abilities. Noted that the game can only support up to 256 abilities. The rest of the tutorial on how to insert ability routines are on the first post of this thread since inserting ability routines are now complicated. I hope this post is to be linked up in the Extra Information of this thread so everyone can expand stuff too.
      Until now I had to use Sigma Emerald to test new abilities, thank's to you I can do it on clean ROM now !

      EDIT : Little problem, as always. Problems in bold :

      Quote:
      Originally Posted by KDS View Post
      Emerald There are questions in the spoiler too
      Spoiler:

      At x49C04, insert in reverse hex: XX XX XX 08 Do I have to put +1 at this pointer ? Like a pointer to an ASM routine ? And for the others pointers in battle scripts ?

      Battle Script at XXXXXX:
      Spoiler:
      Code:
      56 00
      39 40 00
      1A 00
      1B 00
      10 1D 00
      10 30 01
      1E 01 9A YY YY YY 08
      3C


      Battle Script at YYYYYY: I don't understand here. How am I supposed to know whether the "setword command is at FB, and the RAM location for the string pointer is at 0x203E320" or not ?
      Spoiler:
      Code:
      E3 01 ZZ ZZ ZZ 08
      20 01 00 01 0C ZZ ZZ ZZ 08
      39 20 00
      2E 8F 44 02 02 00
      48 01 02 00
      2E 8E 44 02 02 11
      89 41 ZZ ZZ ZZ 08
      FB 20 E3 03 02 SS SS SS 08 //Assuming that setword command is at FB, and the RAM location for the string pointer is at 0x203E320. If not, then change this line accordingly 
      10 84 01
      12 40 00
      3C


      Battle Script at ZZZZZZ:
      Code:
      3C
      String At SSSSSS:
      Code:
      FD 0F B4 E7 00 C7 E3 EC DD D9 FE E6 D5 DD E7 D9 D8 00 DD E8 E7 00 BB E8 E8 D5 D7 DF AB FF


      Also, these require Jambo's Callasm and Setword commands, and his Battle String Loader Hack. Is it needed since the battle script are already compiled ? If so, where can I find those?
      Reply With Quote
        #28    
      Old April 17th, 2015 (9:51 AM).
      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 kleenexfeu View Post
        Until now I had to use Sigma Emerald to test new abilities, thank's to you I can do it on clean ROM now !

        EDIT : Little problem, as always. Problems in bold :
        Q: Do I have to put +1 at this pointer ? Like a pointer to an ASM routine ? And for the others pointers in battle scripts ?
        A: Yes. ASM pointers are +1. Scripts stuff do not need +1 for pointers, ASMs only.

        Q: I don't understand here. How am I supposed to know whether the "setword command is at FB, and the RAM location for the string pointer is at 0x203E320" or not?
        A: I don't also understand that but it is something you want to use another rather than 0x203E320 or FB (the given safest stuff).

        Q: Is it needed since the battle script are already compiled ? If so, where can I find those?
        A: Yes. They are truly necessary. For the Battle String Loader Hack, look for it at Move Resource Thread. Emerald routines, just look for the authors KDS or HidoranBlaze. For the Callasm, use the routine here: http://www.pokecommunity.com/showpost.php?p=7101031&postcount=230 and use scriptlocation: .word 0x02024214 if you are using Emerald. Then, for the Setword command, I dunno how to do that but the link I have typed at the last sentence might guide you.
        __________________

        Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)
        Reply With Quote
          #29    
        Old April 17th, 2015 (1:16 PM).
        Z-nogyroP Z-nogyroP is offline
           
          Join Date: May 2014
          Age: 17
          Gender: Male
          Posts: 125
          Quote:
          Originally Posted by KDS View Post
          3. New Switch-in Ability System
          Spoiler:
          Note:-
          Spoiler:
          There is an existing one made that has been used for implementing abilities like Download etc.
          But there is one problem with that switch-in manager. It performs an OR logic with status byte of the banked pokemon with x00000200 (so that the switch-in script does not execute repeatedly at the start of a turn) which causes a nasty side effect. The nasty side effect is that pokemon possessing an ability which uses that switch-in logic becomes totally immune to non-volatile status conditions (e.g burn, poison, sleep etc.).

          A battling banked mon's status condition is stored in a Word and the functions responible for inflicting these status have a check that the content of status Word should be absolute zero otherwise no status infliction happens. So when the switch-in ability mon is inflicted with a Status Move, the Status Word of the banked mon would always atleast consist of x00000200 (i.e 1 in its 9th bit) and hence fails to be inflicted with the status.

          The new system in this post hooks with the Intimidate ability and ORs special status flag with x800000 to avoid the repetitive problem instead of ORing with the status byte to avoid the statusimmunity problem. This also uses a similar table system compared that previous switch-in one but uses custom Battle Scripts instead of custom ASM as entries.

          Also, there is logic added to solve inconsistencies due to Trace, Skill Swap and Role Play on switch-in abilities while simultaneously updating Intimidate to latest Generation (activation due to copying by Trace, RolePlay etc.)

          Fire Red:
          Spoiler:
          Step I
          Spoiler:

          1a. Two custom tables of same size ((No. of Switch-in Abilities)*8 bytes) are going to be used for this system, so select suitable starting offsets for these tables according to the requirements.
          1b. In the first routine, replace x8TTTTTT (near the last line) with the first table's starting offset and in the second one, replace x8TTTTTT with the second tables's one.
          1c. Insert these two routines somewhere and make byte changes mentioned in their comment sections.
          Routine I:
          Code:
          .text
          .align 2
          .thumb
          .thumb_func
          .global switchinabilities
          
          IntimidateCheck:
          cmp r1, #0x16
          bne LoadTable
          ldr r0, [r2, #0x0]
          and r0, r6
          cmp r0, #0x0
          beq NextIter
          ldr r0, =0x0801BAAD
          bx r0
          
          LoadTable:
          push {r2-r3}
          mov r3, #0x0
          ldr r0, .TableLoc
          Loop:
          lsl r2, r3, #0x3
          add r2, r2, r0
          ldrb r2, [r2]
          cmp r1, r2
          beq Success
          cmp r2, #0xFF
          beq PopBeforeNextIter
          add r3, #0x1
          b Loop
          
          Success:
          lsl r2, r3, #0x3
          add r2, r2, r0
          ldr r0, [r2, #0x4]
          pop {r2-r3}
          push {r0}
          ldr r0, [r2, #0x0]
          and r0, r6
          cmp r0, #0x0
          bne PopR0BeforeNextIter
          mov r4, r8
          strb r1, [r4, #0x0]
          ldr r0, [r2, #0x0]
          orr r0, r6
          str r0, [r2, #0x0]
          ldr r0, =0x02023D6B
          strb r5, [r0]
          pop {r0}
          ldr r1, =0x0801BABB
          bx r1
          
          PopR0BeforeNextIter:
          pop {r0}
          b NextIter
          
          PopBeforeNextIter:
          pop {r2-r3}
          
          NextIter:
          ldr r0, =0x0801B4FF
          bx r0
          
          
          .align
          .TableLoc: .word 0x8TTTTTT
          
          @insert 00 48 00 47 xx+1 xx xx 08 at 1B4F0
          Routine II:
          Code:
          .text
          .align 2
          .thumb
          .thumb_func
          .global switchinabilities2
          
          IntimidateCheck:
          cmp r1, #0x16
          bne LoadTable
          ldr r0, [r2, #0x0]
          and r0, r6
          cmp r0, #0x0
          beq NextIter
          ldr r0, =0x0801BB3D
          bx r0
          
          LoadTable:
          push {r2-r3}
          mov r3, #0x0
          ldr r0, .TableLoc
          Loop:
          lsl r2, r3, #0x3
          add r2, r2, r0
          ldrb r2, [r2]
          cmp r1, r2
          beq Success
          cmp r2, #0xFF
          beq PopBeforeNextIter
          add r3, #0x1
          b Loop
          
          Success:
          lsl r2, r3, #0x3
          add r2, r2, r0
          ldr r0, [r2, #0x4]
          pop {r2-r3}
          push {r0}
          ldr r0, [r2, #0x0]
          and r0, r6
          cmp r0, #0x0
          bne PopR0BeforeNextIter
          mov r3, r8
          strb r1, [r3, #0x0]
          ldr r0, [r2, #0x0]
          orr r0, r6
          str r0, [r2, #0x0]
          ldr r0, =0x02023D6B
          strb r5, [r0]
          bl ScriptPlacer
          pop {r0}
          ldr r1, =0x02023D74
          str r0, [r1, #0x0]
          ldr r0, =0x0801BB53
          bx r0
          
          PopR0BeforeNextIter:
          pop {r0}
          b NextIter
          
          PopBeforeNextIter:
          pop {r2-r3}
          
          NextIter:
          ldr r0, =0x0801B727
          bx r0
          
          ScriptPlacer:
          ldr r1, =0x08017545
          bx r1
          
          .align
          .TableLoc: .word 0x8TTTTTT
          
          @insert 00 48 00 47 xx+1 xx xx 08 at 1B718

          Step II
          Spoiler:

          Now, here are some sample Battle Scripts to understand how to make custom Battle Scripts for switch-in abilities.

          Pressure Message Battle Script:
          Spoiler:

          #dynamic 0x740280

          #org @main
          call @pressuremessage
          // First table should have pointer to this
          end3

          #org @pressuremessage
          pause 0x20


          setbyte 0x2023D6C 0x0 //Second table shoudl have pointer this one
          cmde1 0x81D936A

          setword 0x0203C020 ("Offset to pressure message")
          printstring 0x184
          waitmessage 0x40
          return

          // Pressure Message Hex: FD 13 FE DD E7 00 D9 EC D9 E6 E8 DD E2 DB 00 E4 E6 D9 E7 E7 E9 E6 D9 AB FF


          The bolded part will be the crux of every switch-in script using this system, so make sure to start your switch-in battle script using these lines. Also, in case if you want to understand the need for this part:
          Spoiler:

          'pause 0x20' - Pauses for half a second
          'setbyte 0x2023D6C 0x0 - Sets the content of 0x2023D6C to 0x0. This must be set to zero for command e1 to work properly.
          'cmd e1 0x81D936A' - This sets the user buffer (0x2023FDB not 0x2023D6B in this case) and target buffer (0x2023D6C) and is used in Target Iteration for Intimidate in doubles. The second parameter is an offset to branch after the Iteration finishes, the offset '0x81D936A' just contains a script containing the command '3C' (i.e a return command).


          Similarly, message scripts can be created for Mold Breaker, Terravolt and Turboblaze.
          Abilities like Download, Imposter and Frisk would require some extra logic.

          Now compile them and also note down the first table and second table pointers of the script

          Step III
          Spoiler:

          Now create the first table in the format: (Ability ID) 00 00 00 (first pointer to the associated script) , and second table in a similar format (Ability ID) 00 00 00 (second pointer to the associated script). Hence, each ability entry will use 8 (1+1+1+1+4) entries per table for this implementation.
          Only include those abilities in the tables that have switch-in logic. Also make sure that both the tables are terminated by a FF.

          Step IV
          Spoiler:

          This adjusts Trace, Skill Swap and Role Play to the latest standards while simultaneously solving the inconsistencies due to the routines.

          Insert these custom ASM and corresponding battle scripts.

          Skill Swap Adjust:
          Spoiler:

          Code:
          text
          .align 2
          .thumb
          .thumb_func
          .global switchinabilitiesskillswap
          
          push {lr}
          ldr r6, =0x2023C04
          ldr r7, =0x2023DFC
          mov r5, #0x80
          lsl r5, r5, #0xC
          mov r4, #0x58
          ldr r3, =0x2023D6B
          ldrb r2, [r3, #0x0]
          lsl r1, r2, #0x2
          add r1, r1, r7
          ldr r0, [r1] 
          mul r2, r4
          add r2, r2, r6
          ldrb r2, [r2, #0x0]
          cmp r2, #0x16
          beq orrmarker
          bic r0, r5
          b cont
          
          orrmarker:
          orr r0, r5
          cont: 
          str r0, [r1]
          add r3, #0x1
          ldrb r2, [r3, #0x0]
          lsl r1, r2, #0x2
          add r1, r1, r7
          ldr r0, [r1] 
          mul r2, r4
          add r2, r2, r6
          ldrb r2, [r2, #0x0]
          cmp r2, #0x16
          beq orrmarker2
          bic r0, r5
          b cont2
          
          orrmarker2:
          orr r0, r5
          cont2: 
          str r0, [r1]
          pop {r0}
          bx r0
          Battle Script at YYYYYY:
          Code:
          F8 XX+1 XX XX 28 4E 69 1D 08
          At x1D82C6 insert YY YY YY 08 in reverse hex



          Role Play Adjust
          Spoiler:

          Code:
          .text
          .align 2
          .thumb
          .thumb_func
          .global switchinabilitiesroleplay
          
          push {lr}
          ldr r6, =0x2023C04
          ldr r7, =0x2023DFC
          mov r5, #0x80
          lsl r5, r5, #0xC
          mov r4, #0x58
          ldr r3, =0x2023D6B
          ldrb r2, [r3, #0x0]
          lsl r1, r2, #0x2
          add r1, r1, r7
          ldr r0, [r1] 
          mul r2, r4
          add r2, r2, r6
          ldrb r2, [r2, #0x0]
          cmp r2, #0x16
          beq orrmarker
          bic r0, r5
          b cont
          
          orrmarker:
          orr r0, r5
          cont: 
          str r0, [r1]
          pop {r0}
          bx r0
          Battle Script at YYYYYY:
          Code:
          F8 XX+1 XX XX 28 4E 69 1D 08
          At x1D813D insert YY YY YY 08 in reverse hex



          Trace Adjust
          Spoiler:

          Code:
          .text
          .align 2
          .thumb
          .thumb_func
          .global switchinabilitiestrace
          
          push {lr}
          ldr r6, =0x2023c04
          ldr r7, =0x2023DFC
          mov r5, #0x80
          lsl r5, r5, #0xC
          mov r4, #0x58
          ldr r3, =0x2023FDB
          ldrb r2, [r3, #0x0]
          lsl r1, r2, #0x2
          add r1, r1, r7
          ldr r0, [r1] 
          mul r2, r4
          add r2, r2, r6
          ldrb r2, [r2, #0x0]
          cmp r2, #0x16
          beq orrmarker
          bic r0, r5
          b cont
          
          orrmarker:
          orr r0, r5
          cont: 
          str r0, [r1]
          pop {r0}
          bx r0
          Battle Script at YYYYYY:
          Code:
          39 20 00 10 D0 00 12 40 00 F8 XX+1 XX XX 08 3F
          At x1BB18 insert YY YY YY 08 in reverse hex




          Would the flawed switch-in system be the reason that Natural Cure is broken? At the moment, switching out a Pokemon with Natural Cure doesn't heal it (in the MrDS base). If so, I'm even more anticipating the update of the base, because I'd like to have Natural Cure actually function for Spritzee and Aromatisse.
          Reply With Quote
            #30    
          Old April 18th, 2015 (5:35 AM).
          Chacha Dinosaur's Avatar
          Chacha Dinosaur Chacha Dinosaur is offline
          Adamant and adaptive dinosaur.
             
            Join Date: Jul 2013
            Age: 24
            Gender: Male
            Posts: 453
            Quote:
            Originally Posted by kleenexfeu View Post
            --questions
            Spoiler:

            Q: Do I have to put +1 at this pointer ? Like a pointer to an ASM routine ? And for the others pointers in battle scripts ?
            Nope, this is a pointer to a battle script so you don't.

            Q: Is it needed since the battle script are already compiled ? If so, where can I find those?
            Yes, these are needed.
            For the Callasm and Battle Script Loader do as Raileys mentioned.
            Since setword command is not posted anywhere in the forum (and now I have some time) I decide to post it here.
            Spoiler:


            Insert the compiled ASM in free space and add a new entry in the repointed command table pointing to this ASM.

            Fire Red:-
            Code:
            00 B5 FE B4 14 48 00 68 41 78 82 78 12 02 11 43 C2 78 12 04 11 43 02 79 12 06 11 43 08 1C 06 B4 04 21 00 F0 16 F8 06 BC 80 00 88 42 0E D1 0A 48 02 68 53 79 94 79 24 02 23 43 D4 79 24 04 23 43 14 7A 24 06 23 43 0B 60 09 32 02 60 FE BC 01 BC 00 47 02 4A 10 47 C0 46 74 3D 02 02 19 40 1E 08
            Emerald:-
            Code:
            00 B5 FE B4 14 48 00 68 41 78 82 78 12 02 11 43 C2 78 12 04 11 43 02 79 12 06 11 43 08 1C 06 B4 04 21 00 F0 16 F8 06 BC 80 00 88 42 0E D1 0A 48 02 68 53 79 94 79 24 02 23 43 D4 79 24 04 23 43 14 7A 24 06 23 43 0B 60 09 32 02 60 FE BC 01 BC 00 47 02 4A 10 47 C0 46 14 42 02 02 41 75 2E 08


            Q: I don't understand here. How am I supposed to know whether the "setword command is at FB, and the RAM location for the string pointer is at 0x203E320" or not?

            In an Emerald ROM there are F9 (in hex) entries (00-F8) in the command table before the repoint. So after the table is repointed to free space, if from the 8 bytes right to the end of this table you specify the pointer to the setword command ASM code, then the setword command will be at FB.
            The RAM location of the string pointer will be at 0x203E320 if in the Emerald Battle String Loader code (in the move resource thread) the ramlocation variable has the value 0x203E320. So you should change 0x0202C4D0 to 0x0203E320 in the code.

            I don't have the offset of the command table for EM
            It start at x31BD10

            Q: Ok it's the same for emerald here too. But do I have to use this since I use the KDS's one ?
            No. For emerald, use only the one mentioned in the Move Resource Thread. Change the ramlocation value to 0x0203E320 to match the Moxie code.


            Quote:
            Originally Posted by Z-nogyroP
            Would the flawed switch-in system be the reason that Natural Cure is broken? At the moment, switching out a Pokemon with Natural Cure doesn't heal it (in the MrDS base). If so, I'm even more anticipating the update of the base, because I'd like to have Natural Cure actually function for Spritzee and Aromatisse.
            Nope. Natural Cure is a switch-out ability rather than a switch-in one.
            Reply With Quote
              #31    
            Old April 18th, 2015 (7:06 AM).
            Chacha Dinosaur's Avatar
            Chacha Dinosaur Chacha Dinosaur is offline
            Adamant and adaptive dinosaur.
               
              Join Date: Jul 2013
              Age: 24
              Gender: Male
              Posts: 453
              Quote:
              Originally Posted by kleenexfeu View Post
              So, I repointed my table, it ends with "...D1 6E 05 08 DD 6E 05 08 F9 6E 05 08 (pointer callasm Jambo with .word 0x02024214 instead) (pointer battlestring loader from the resource thread with 0x0203E320 in the code in the code) (pointer setword command that you given)"

              And after that I insert the ability and that's all ? (didn't say it was easy x))

              EDIT : Doesn't seem to work for me
              You don't need to add the pointer to battle string loader in command table. Just make the byte changes mentioned in spoiler above the battle string loader's code. Rest is correct.
              Reply With Quote
                #32    
              Old April 18th, 2015 (7:34 AM). Edited April 18th, 2015 by kleenexfeu.
              kleenexfeu kleenexfeu is offline
                 
                Join Date: Aug 2013
                Gender: Male
                Posts: 216
                Quote:
                Originally Posted by KDS View Post
                You don't need to add the pointer to battle string loader in command table. Just make the byte changes mentioned in spoiler above the battle string loader's code. Rest is correct.
                Ok so then the setword will be at FA, doesn't it ?
                Don't know what I missed because I tried to toggle (in the moxie code) the setword at F8, F9 , FA, FB, nothing works. And it's weird because it doesn't even freeze or restart or whatever. It's just like my scizor has no ability. Yet I toggle 9A to 50 because it's my 80th ability, I triple checked, count 2 or 3 times :/
                Sorry if it turns at ASM lesson/fix, I'll delete the posts when it'll be ok

                I think 0x49C04 is not the good location to put the pointer of moxie's battle script because no matter what I set here, nothing changes.
                Reply With Quote
                  #33    
                Old April 18th, 2015 (9:53 AM).
                Chacha Dinosaur's Avatar
                Chacha Dinosaur Chacha Dinosaur is offline
                Adamant and adaptive dinosaur.
                   
                  Join Date: Jul 2013
                  Age: 24
                  Gender: Male
                  Posts: 453
                  The emerald offset turned out to be incorrect. It shoulf be x49C8c instead of x49c04. The OP is now updated as well.
                  Reply With Quote
                    #34    
                  Old April 19th, 2015 (7:17 AM). Edited June 5th, 2015 by kleenexfeu.
                  kleenexfeu kleenexfeu is offline
                     
                    Join Date: Aug 2013
                    Gender: Male
                    Posts: 216
                    I guess this one deserves to be here, of course all the credit goes to Tlachtli :

                    Quote:
                    Originally Posted by Tlachtli View Post
                    Spoiler:


                    I think I've finally worked the bugs out of Protean, and I'm 96% sure it'll work with no problem now. As promised here's the (Emerald BPEE) ASM for it, so hold on to your butts:

                    Code:
                    .align 2
                    .thumb
                    
                    GetPokeTypes:
                        push {r0-r5}
                        ldr r1, .BattleData
                        ldr r0, .CurPokeIndex
                        ldrb r0, [r0]
                        mov r2, #0x58
                        mul r2, r0
                        add r1, #0x21
                        add r1, r2
                        ldrh r0, [r1]
                        mov r2, r0
                        lsr r0, #2
                        lsl r2, #24
                        lsr r2, #24
                    
                    GetMoveType:
                        ldr r3, .CurMoveIndex
                        ldrh r3, [r3]
                        ldr r4, .MoveData
                        mov r5, #0xC
                        mul r5, r3
                        add r4, r5
                        add r4, #0x2
                        ldrb r4, [r4]
                    
                    ChangePokeType:
                        cmp r0, r4
                        beq End
                        cmp r2, r4
                        beq End
                        lsl r4, #2
                        ldr r5, .TypeList1
                        add r5, r4
                        mov r0, r5
                        mov r2, #0x2
                        sub r1, #0x1
                        swi #0x0B
                        ldr r0, .TypeList1
                        ldr r1, .CheckForChange
                        mov r2, #0x1
                        swi #0x0B
                        ldr r0, .TypeList2
                        add r0, r4
                        ldr r1, .TypeBuffer
                        mov r2, #0x2
                        swi #0x0B
                    
                    End:
                        pop {r0-r5}
                        bx lr
                    
                    .align 2
                    .BattleData:        .word 0x02024084
                    .CurPokeIndex:        .word 0x0202420B
                    .CurMoveIndex:        .word 0x020241EA
                    .MoveData:        .word 0x[addressmovedata]
                    .CheckForChange:    .word 0x02024200
                    .TypeBuffer:        .word 0x02022F58
                    .TypeList1:        .word 0x[address1]
                    .TypeList2:        .word 0x[address2]
                    For TypeList1, copy this hex somewhere and use its start as address1 In bold your ability number:
                    Code:
                    6A 00 00 00 6A 01 01 00 6A 02 02 00 6A 03 03 00 6A 04 04 00 6A 05 05 00  6A 06 06 00 6A 07 07 00 6A 08 08 00 6A 09 09 00 6A 0A 0A 00 6A 0B 0B 00  6A 0C 0C 00 6A 0D 0D 00 6A 0E 0E 00 6A 0F 0F 00 6A 10 10 00 6A 11 11 00
                    For TypeList2, copy this hex somewhere and use its start as address2
                    Code:
                    FD 03 00 FF FD 03 01 FF FD 03 02 FF FD 03 03 FF FD 03 04 FF FD 03 05 FF  FD 03 06 FF FD 03 07 FF FD 03 08 FF FD 03 09 FF FD 03 0A FF FD 03 0B FF  FD 03 0C FF FD 03 0D FF FD 03 0E FF FD 03 0F FF FD 03 10 FF FD 03 11 FF
                    Now actually implementing it is the tricky part, it won't be a simple copy/paste job; you'll need some insight on what the battle scripts for different moves are actually doing to decide the appropriate place(s) to put ability checks. For any move you want to be affected by Protean you'll need to add a check for it somewhere in the battle script before calculatedamage. In order for a notification string to print out correctly callasm must be before printstring 0x49, and the printstring must be before attackcanceller. You should add a check to see if the user's ability is Protean, if so execute the ASM and optionally print a message if the type is changed, then jump back to the right point in the script. A potential script segment would look something like:

                    Code:
                    ... (move script stuff is here) ...
                    jumpifability BANK_USER ABILITY_PROTEAN @Protean        /Note 1
                    goto 0x082D8A26                                         /Note 2
                    
                    #org @Protean
                    callasm [address of Protean asm, plus 0x1]
                    jumpifbyte B_!= 0x02024200 0x0 @Change                  /Note 3
                    jumpifbyte B_= 0x02024200 0x0 @AttackCanceller
                    
                    #org @Change
                    setbyte 0x02024200 0x0
                    printstring 0x49                                        /Note 4
                    waitmessage 0x40
                    goto @AttackCanceller
                    
                    #org @AttackCanceller
                    attackcanceler
                    accuracycheck 0x82D8A5E 0x0
                    attackstring
                    ppreduce
                    calculatedamage
                    goto 0x82D8A34
                    Note 1: You'll either need to define ABILITY_PROTEAN in BSP's abilities.bsh, or just use the hex for the ability here instead.
                    Note 2: A goto jump to an address somewhere in the area of 0x082D8A26 usually signifies the end of a moves' unique scripting, as that jumps to a segment of script shared by nearly all damaging moves. In damaging moves I'd suggest putting the check for Protean before that jump. In status moves the jump may be different.
                    Note 3: The ASM for Protean does the following: gets the type of the move being used, checks it against the user's type(s), and if necessary changes type to match the move. If there is a type change it will always result in a monotype, if one is not needed though the Poke can retain a dual typing. If a type change is done the byte at 0x02024200 is set to a non-zero garbage byte (in this case 0x6A). This can be used to decide whether or not to display a message, and should be reset to 0x0 somewhere in the battle script.
                    Note 4: String 0x49 is "[User] transformed into the [Type] type!". This is the string used in Gen 6 games.

                    As a demo, here's the script I used while testing it. It changes Psybeam, Feint Attack, and Slash (all moves known by the Kecleon I was testing with). After compiling the test script change Psybeam's move effect (effect 76) pointer to match @Psybeam, and change Slash and Feint Attack (effects 43 and 17) to both match @Slash. You'll also need Jambo's callasm for BSP and to define Protean in abilities.bsh.
                    Spoiler:
                    Code:
                    #dynamic 0xE446B0
                    #freespace 0xFF
                    #include abilities.bsh
                    
                    #org @Psybeam
                    setbyte 0x2024335 0x7
                    goto @Slash
                    
                    #org @Slash
                    jumpifhalfword 0x1 0x20241EA 0x39 @ProteanCheck
                    jumpifspecialstatusflag 0x0 0x40000 0x1 @ProteanCheck
                    orword 0x2024280 0x40000
                    setbyte 0x2024482 0x2
                    jumpifability BANK_USER ABILITY_PROTEAN @Protean
                    goto 0x082D8A26
                    
                    #org @ProteanCheck
                    jumpifability 0x1 0x6A @Protean In bold number of your ability
                    goto 0x82D8A26
                    
                    #org @Protean
                    setbyte 0x02024200 0x0
                    callasm 0x08E44621 Here is the address to your routine (+1 because in thumb)
                    jumpifbyte 0x1 0x02024200 0x0 @Change
                    goto @AttackCanceller
                    
                    #org @Change
                    printstring 0x49
                    waitmessage 0x40
                    goto @AttackCanceller
                    
                    #org @AttackCanceller
                    setbyte 0x02024200 0x0
                    attackcanceler
                    accuracycheck 0x82D8A5E 0x0
                    attackstring
                    ppreduce
                    calculatedamage
                    goto 0x82D8A34


                    Even though it seems complicated and may not be the most concise or elegant way to add Protean, it does indeed work. The only known issue is that when using Hidden Power it will change to Normal instead of the hidden type, but honestly it seems like a small issue and writing more asm to fix that is fairly low on my priority list.
                    I think I did all the stupid mistakes as possible when I tried to implement it. That's why I put some precisions that may seems obvious. So if anyone has problem with it you can PM or VM me.
                    Reply With Quote
                      #35    
                    Old April 28th, 2015 (5:53 AM). Edited August 30th, 2015 by MrDollSteak.
                    MrDollSteak's Avatar
                    MrDollSteak MrDollSteak is online now
                    Formerly known as 11bayerf1
                       
                      Join Date: Dec 2008
                      Location: Hong Kong
                      Age: 23
                      Gender: Male
                      Posts: 843
                      Sorry for the lack of updates in a while guys, I've got heaps of projects going on, and am very busy in real life at the moment. Anyway I've since written up the Regenerator routine that my rombase uses, it was improved immensely by Doesnt. It's bug free as far as I can tell considering I just fixed the bug wherein it broke Natural Cure.

                      Regenerator

                      Spoiler:
                      Fire Red
                      Spoiler:
                      Code:
                      .text
                      .align 2
                      .thumb
                      .thumb_func
                      .global regenerator
                       
                      AbilityBuffer:
                      	add r0, r1, r3
                      	add r0, #0x20
                      	ldrb r0, [r0]
                      RegeneratorCheck:
                      	cmp r0, #0x91
                      	beq Regenerator
                      NaturalCureCheck:
                      	cmp r0, #0x1E
                      	bne NoAbility
                      NaturalCure:
                      	ldr r0, .Return
                      	bx r0
                      NoAbility:
                      	ldr r0, .Return2
                      	bx r0
                      Regenerator:
                      GetHP:
                      	add r3, #0x28
                      	add r3, r1, r3
                      	ldrh r0, [r3, #0x4]
                      	mov r1, #0x20
                      	mul r0, r1
                      	mov r1, #0x60
                      	push {r3}
                      	bl Divide
                      	pop {r3}
                      	ldrh r1, [r3]
                      	add r0, r0, r1
                      CheckHP:
                      	ldrh r2, [r3, #0x4]
                      	cmp r0, r2
                      	ble StoreHP
                      MaxHP:
                      	mov r0, r2
                      StoreHP:
                      	strh r0, [r3]
                      BufferHealthChange:
                      	ldr r2, .CommandTable
                      	ldrb r1, [r4]
                      	ldr r0, .RamLoc
                      	ldr r0, [r0]
                      	add r0, r1, r0
                      	add r0, #0x58
                      	ldrb r0, [r0]
                      	lsl r0, r0, #0x2
                      	add r0, r0, r2
                      	ldrb r2, [r0]
                      	mov r0, r1
                      	mul r0, r6
                      	add r0, r0, r3
                      	str r0, [sp]
                      	mov r0, #0x0
                      HealthChangeIndex:
                      	mov r1, #0x2A
                      Success:
                      	ldr r3, .Return3
                      	bx r3
                      Divide:
                      	ldr r3, .DivideLoc
                      	bx r3
                      
                      .align 2
                      
                      .Return: .word 0x0802CCE7
                      .Return2: .word 0x0802CD1B
                      .CommandTable: .word 0x0825E45C
                      .RamLoc: .word 0x02023FE8
                      .Return3: .word 0x0802CD0F
                      .DivideLoc: .word 0x081E4019
                      
                      #insert 00 48 00 47 xx xx xx 08 00 00 at 02CCDC
                      The buffer health change command as far as I can tell gets the game to recognise the changes in both status for natural cure, and health for Regenerator, it likely updates the graphics also.

                      Emerald
                      Spoiler:
                      Code:
                      .text
                      .align 2
                      .thumb
                      .thumb_func
                      .global regenerator
                       
                      AbilityBuffer:
                      	add r0, r1, r3
                      	add r0, #0x20
                      	ldrb r0, [r0]
                      RegeneratorCheck:
                      	cmp r0, #0x91
                      	beq Regenerator
                      NaturalCureCheck:
                      	cmp r0, #0x1E
                      	bne NoAbility
                      NaturalCure:
                      	ldr r0, .Return
                      	bx r0
                      NoAbility:
                      	ldr r0, .Return2
                      	bx r0
                      Regenerator:
                      GetHP:
                      	add r3, #0x28
                      	add r3, r1, r3
                      	ldrh r0, [r3, #0x4]
                      	mov r1, #0x20
                      	mul r0, r1
                      	mov r1, #0x60
                      	push {r3}
                      	bl Divide
                      	pop {r3}
                      	ldrh r1, [r3]
                      	add r0, r0, r1
                      CheckHP:
                      	ldrh r2, [r3, #0x4]
                      	cmp r0, r2
                      	ble StoreHP
                      MaxHP:
                      	mov r0, r2
                      StoreHP:
                      	strh r0, [r3]
                      BufferHealthChange:
                      	ldr r2, .CommandTable
                      	ldrb r1, [r4]
                      	ldr r0, .RamLoc
                      	ldr r0, [r0]
                      	add r0, r1, r0
                      	add r0, #0x58
                      	ldrb r0, [r0]
                      	lsl r0, r0, #0x2
                      	add r0, r0, r2
                      	ldrb r2, [r0]
                      	mov r0, r1
                      	mul r0, r6
                      	add r0, r0, r3
                      	str r0, [sp]
                      	mov r0, #0x0
                      HealthChangeIndex:
                      	mov r1, #0x2A
                      Success:
                      	ldr r3, .Return3
                      	bx r3
                      Divide:
                      	ldr r3, .DivideLoc
                      	bx r3
                      
                      .align 2
                      
                      .Return: .word 0x08055A9F
                      .Return2: .word 0x08055AD3
                      .CommandTable: .word 0x0832A328
                      .RamLoc: .word 0x0202449C
                      .Return3: .word 0x08055AC7
                      .DivideLoc: .word 0x082E7541
                      
                      #insert 00 48 00 47 xx xx xx 08 00 00 at 055A94
                      The buffer health change command as far as I can tell gets the game to recognise the changes in both status for natural cure, and health for Regenerator, it likely updates the graphics also.
                      __________________
                      Reply With Quote
                        #36    
                      Old April 28th, 2015 (7:32 AM).
                      mamamama mamamama is offline
                         
                        Join Date: Feb 2014
                        Posts: 180
                        Quote:
                        Originally Posted by MrDollSteak View Post
                        Regenerator
                        Nice job. Are your Prankster and No Guard implementations glitch free or still a work-in-progress? Is No Guard possible by just altering battle script?
                        Reply With Quote
                          #37    
                        Old April 28th, 2015 (7:52 AM). Edited April 28th, 2015 by kleenexfeu.
                        kleenexfeu kleenexfeu is offline
                           
                          Join Date: Aug 2013
                          Gender: Male
                          Posts: 216
                          Quote:
                          Originally Posted by MrDollSteak View Post
                          Sorry for the lack of updates in a while guys, I've got heaps of projects going on, and am very busy in real life at the moment. Anyway I've since written up the Regenerator routine that my rombase uses, it was improved immensely by Doesnt. It's bug free as far as I can tell considering I just fixed the bug wherein it broke Natural Cure.

                          Regenerator

                          Spoiler:
                          Fire Red
                          Spoiler:
                          Code:
                          .text
                          .align 2
                          .thumb
                          .thumb_func
                          .global regenerator
                           
                          AbilityBuffer:
                          	add r0, r1, r3
                          	add r0, #0x20
                          	ldrb r0, [r0]
                          RegeneratorCheck:
                          	cmp r0, #0x91
                          	beq Regenerator
                          NaturalCureCheck:
                          	cmp r0, #0x1E
                          	bne NoAbility
                          NaturalCure:
                          	ldr r0, .Return
                          	bx r0
                          NoAbility:
                          	ldr r0, .Return2
                          	bx r0
                          Regenerator:
                          	add r3, #0x28
                          GetHP:
                          	ldrh r0, [r3, #0x4]
                          	mov r1, #0x20
                          	mul r0, r1
                          	mov r1, #0x60
                          	push {r3}
                          	bl Divide
                          	pop {r3}
                          	ldrh r1, [r3]
                          	add r0, r0, r1
                          CheckHP:
                          	ldrh r2, [r3, #0x4]
                          	cmp r0, r2
                          	ble StoreHP
                          MaxHP:
                          	mov r0, r2
                          StoreHP:
                          	strh r0, [r3]
                          BufferHealthChange:
                          	ldr r2, .CommandTable
                          	ldrb r1, [r4]
                          	ldr r0, .RamLoc
                          	ldr r0, [r0]
                          	add r0, r1, r0
                          	add r0, #0x58
                          	ldrb r0, [r0]
                          	lsl r0, r0, #0x2
                          	add r0, r0, r2
                          	ldrb r2, [r0]
                          	mov r0, r1
                          	mul r0, r6
                          	add r0, r0, r3
                          	str r0, [sp]
                          	mov r0, #0x0
                          HealthChangeIndex:
                          	mov r1, #0x2A
                          Success:
                          	ldr r3, .Return3
                          	bx r3
                          Divide:
                          	ldr r3, .DivideLoc
                          	bx r3
                          
                          .align 2
                          
                          .Return: .word 0x0802CCE7
                          .Return2: .word 0x0802CD1B
                          .CommandTable: .word 0x0825E45C
                          .RamLoc: .word 0x02023FE8
                          .Return3: .word 0x0802CD0F
                          .DivideLoc: .word 0x081E4019
                          
                          #insert 00 48 00 47 xx xx xx 08 00 00 at 02CCDC
                          The buffer health change command as far as I can tell gets the game to recognise the changes in both status for natural cure, and health for Regenerator, it likely updates the graphics also.

                          Emerald
                          Spoiler:
                          Code:
                          .text
                          .align 2
                          .thumb
                          .thumb_func
                          .global regenerator
                           
                          AbilityBuffer:
                          	add r0, r1, r3
                          	add r0, #0x20
                          	ldrb r0, [r0]
                          RegeneratorCheck:
                          	cmp r0, #0x91
                          	beq Regenerator
                          NaturalCureCheck:
                          	cmp r0, #0x1E
                          	bne NoAbility
                          NaturalCure:
                          	ldr r0, .Return
                          	bx r0
                          NoAbility:
                          	ldr r0, .Return2
                          	bx r0
                          Regenerator:
                          	add r3, #0x28
                          GetHP:
                          	ldrh r0, [r3, #0x4]
                          	mov r1, #0x20
                          	mul r0, r1
                          	mov r1, #0x60
                          	push {r3}
                          	bl Divide
                          	pop {r3}
                          	ldrh r1, [r3]
                          	add r0, r0, r1
                          CheckHP:
                          	ldrh r2, [r3, #0x4]
                          	cmp r0, r2
                          	ble StoreHP
                          MaxHP:
                          	mov r0, r2
                          StoreHP:
                          	strh r0, [r3]
                          BufferHealthChange:
                          	ldr r2, .CommandTable
                          	ldrb r1, [r4]
                          	ldr r0, .RamLoc
                          	ldr r0, [r0]
                          	add r0, r1, r0
                          	add r0, #0x58
                          	ldrb r0, [r0]
                          	lsl r0, r0, #0x2
                          	add r0, r0, r2
                          	ldrb r2, [r0]
                          	mov r0, r1
                          	mul r0, r6
                          	add r0, r0, r3
                          	str r0, [sp]
                          	mov r0, #0x0
                          HealthChangeIndex:
                          	mov r1, #0x2A
                          Success:
                          	ldr r3, .Return3
                          	bx r3
                          Divide:
                          	ldr r3, .DivideLoc
                          	bx r3
                          
                          .align 2
                          
                          .Return: .word 0x08055A9F
                          .Return2: .word 0x08055AD3
                          .CommandTable: .word 0x0832A328
                          .RamLoc: .word 0x0202449C
                          .Return3: .word 0x08055AC7
                          .DivideLoc: .word 0x082E7541
                          
                          #insert 00 48 00 47 xx xx xx 08 00 00 at 055A94
                          The buffer health change command as far as I can tell gets the game to recognise the changes in both status for natural cure, and health for Regenerator, it likely updates the graphics also.
                          Regenerator just does nothing for me. No freeze but not regenerated

                          As usually I tested it on double battle, seems to works on One VS One but doubles don't like your routine x)

                          Precisions : Work in double battle if the poke is your first poke, otherwise doesn't work
                          I think it only update the RAM stats of our first pokemon (yeah obvious I know..)

                          Tested on Emerald

                          But I'm only talking about the bad, thank's for sharing it. I personally don't mind if you release routines that are not completed or that have still bugs. I think it forces people to take a look into it to make it works (like me), and it gives idea for creating new ones. Only the offset where you hook is useful so, keep going :)

                          For contrary I have an idea but it's gonna be boring : Editing the moves that affect stats change, something like :
                          jumpifability 0xDependsonthetarget 0xContrary 0xReverseEffect,
                          For the problem of intimidate, I don't know how exactly but it should be easy enough since the statu's change is always the same : -1 attack
                          Reply With Quote
                            #38    
                          Old April 28th, 2015 (4:20 PM). Edited January 27th, 2016 by MrDollSteak.
                          MrDollSteak's Avatar
                          MrDollSteak MrDollSteak is online now
                          Formerly known as 11bayerf1
                             
                            Join Date: Dec 2008
                            Location: Hong Kong
                            Age: 23
                            Gender: Male
                            Posts: 843
                            Quote:
                            Nice job. Are your Prankster and No Guard implementations glitch free or still a work-in-progress? Is No Guard possible by just altering battle script?
                            Prankster in my rombase is glitched, but I've made a new bug free routine.

                            Quote:
                            Originally Posted by kleenexfeu View Post
                            Regenerator just does nothing for me. No freeze but not regenerated

                            As usually I tested it on double battle, seems to works on One VS One but doubles don't like your routine x)

                            Precisions : Work in double battle if the poke is your first poke, otherwise doesn't work
                            I think it only update the RAM stats of our first pokemon (yeah obvious I know..)
                            Interesting! Thanks for that feedback, I do actually know EXACTLY what the problem is. It's in the section add r1, r1, r3 in Natural Cure, however I was unsure about actually putting it in for Regenerator as I thought it was just a double index check, but it's actually making sure that you can get the second Pokemon in your double battle fixed.

                            I've updated that post, so it should be all fixed.

                            No Guard

                            Spoiler:
                            Fire Red
                            Spoiler:
                            Code:
                            .text
                            .align 2
                            .thumb
                            .thumb_func
                            .global noguard
                             
                            AbilityBufferUser:
                            	push {r0}
                            	ldr r0, .Bank
                            	ldrb r0, [r0]
                            	mov r1, #0x58
                            	ldr r2, .BattleData
                            	mul r0, r1
                            	add r0, r0, r2
                            	ldrb r0, [r0]
                            NoGuardCheckUser:
                            	cmp r0, #0x64
                            	beq AutoHit
                            AbilityBufferTarget:
                            	ldr r0, .Bank
                            	add r0, #0x1
                            	ldrb r0, [r0]
                            	mul r0, r1
                            	add r0, r0, r2
                            	ldrb r0, [r0]
                            NoGuardCheckTarget:
                            	cmp r0, #0x64
                            	beq AutoHit
                            ToxicCheck:
                            	ldr r0, .MoveLoc
                            	ldrh r0, [r0]
                            	cmp r0, #0x5C
                            	bne InvulnerableCheck
                            PoisonCheck:
                            	ldr r0, .Bank
                            	ldrb r0, [r0]
                            	mov r1, #0x58
                            	ldr r2, .BattleData
                            	mul r0, r1
                            	add r2, r0, r2
                            	ldrb r1, [r2, #0x2]
                            	ldrb r0, [r2, #0x1]
                            	cmp r0, #0x3
                            	beq AutoHit
                            	cmp r1, #0x3
                            	beq AutoHit
                            InvulnerableCheck:
                            	pop {r0}
                            	bl Method
                            	lsl r0, r0, #0x18
                            	cmp r0, #0x0
                            	bne Miss
                            Return:
                            	ldr r1, .Return
                            	bx r1
                            AutoHit:
                            	pop {r0}
                            	ldr r1, .Return2
                            	bx r1
                            Miss:
                            	ldr r1, .Return3
                            	bx r1
                            Method:
                            	ldr r1, .MethodLoc
                            	bx r1
                            
                            
                            .align 2
                            
                            .Bank: .word 0x02023D6B
                            .BattleData: .word 0x02023C04
                            .MoveLoc: .word 0x02023D4A
                            .Return: .word 0x0801DF51
                            .Return2: .word 0x0801E1BB
                            .Return3: .word 0x0801E1C3
                            .MethodLoc: .word 0x0801DC11
                            
                            #insert 00 49 08 47 xx xx xx 08 00 00 at 01DF44

                            Emerald
                            Spoiler:
                            Code:
                            .text
                            .align 2
                            .thumb
                            .thumb_func
                            .global noguard
                             
                            AbilityBufferUser:
                            	push {r0}
                            	ldr r0, .Bank
                            	ldrb r0, [r0]
                            	mov r1, #0x58
                            	ldr r2, .BattleData
                            	mul r0, r1
                            	add r0, r0, r2
                            	ldrb r0, [r0]
                            NoGuardCheckUser:
                            	cmp r0, #0x64
                            	beq AutoHit
                            AbilityBufferTarget:
                            	ldr r0, .Bank
                            	add r0, #0x1
                            	ldrb r0, [r0]
                            	mul r0, r1
                            	add r0, r0, r2
                            	ldrb r0, [r0]
                            NoGuardCheckTarget:
                            	cmp r0, #0x64
                            	beq AutoHit
                            ToxicCheck:
                            	ldr r0, .MoveLoc
                            	ldrh r0, [r0]
                            	cmp r0, #0x5C
                            	bne InvulnerableCheck
                            PoisonCheck:
                            	ldr r0, .Bank
                            	ldrb r0, [r0]
                            	mov r1, #0x58
                            	ldr r2, .BattleData
                            	mul r0, r1
                            	add r2, r0, r2
                            	ldrb r1, [r2, #0x2]
                            	ldrb r0, [r2, #0x1]
                            	cmp r0, #0x3
                            	beq AutoHit
                            	cmp r1, #0x3
                            	beq AutoHit
                            InvulnerableCheck:
                            	pop {r0}
                            	bl Method
                            	lsl r0, r0, #0x18
                            	cmp r0, #0x0
                            	bne Miss
                            Return:
                            	ldr r1, .Return
                            	bx r1
                            AutoHit:
                            	pop {r0}
                            	ldr r1, .Return2
                            	bx r1
                            Miss:
                            	ldr r1, .Return3
                            	bx r1
                            Method:
                            	ldr r1, .MethodLoc
                            	bx r1
                            
                            
                            .align 2
                            
                            .Bank: .word 0x0202420B
                            .BattleData: .word 0x020240A4
                            .MoveLoc: .word 0x020241EA
                            .Return: .word 0x08046761
                            .Return2: .word 0x080469CB
                            .Return3: .word 0x080469D3
                            .MethodLoc: .word 0x080464AD
                            
                            #insert 00 49 08 47 xx xx xx 08 00 00 at 046754
                            __________________
                            Reply With Quote
                              #39    
                            Old April 28th, 2015 (5:19 PM).
                            mamamama mamamama is offline
                               
                              Join Date: Feb 2014
                              Posts: 180
                              Quote:
                              Originally Posted by kleenexfeu View Post
                              Actually in your RomBase noguard hits through fly/dig etc. Though I don't remember if it was 1.5 or 1.5a
                              Even if it's not a big deal, I thought you would like to know

                              Another thing, do you think it's a good idea to make a new section in this thread for the news items (choiceS, eviolite, etc).
                              Don't know if it deserves a thread or not, didn't want to create one anyway because I'm still struggling to port choice spec in Emerald (yet I'm stealing your code, sorry)
                              As weird as it sounds - No Guard actually hits through Fly and Dig in the official games, too :)
                              Reply With Quote
                                #40    
                              Old April 28th, 2015 (5:57 PM). Edited April 29th, 2015 by MrDollSteak.
                              MrDollSteak's Avatar
                              MrDollSteak MrDollSteak is online now
                              Formerly known as 11bayerf1
                                 
                                Join Date: Dec 2008
                                Location: Hong Kong
                                Age: 23
                                Gender: Male
                                Posts: 843
                                Quote:
                                Originally Posted by kleenexfeu View Post
                                Actually in your RomBase noguard hits through fly/dig etc. Though I don't remember if it was 1.5 or 1.5a
                                Even if it's not a big deal, I thought you would like to know

                                Another thing, do you think it's a good idea to make a new section in this thread for the news items (choiceS, eviolite, etc).
                                Don't know if it deserves a thread or not, didn't want to create one anyway because I'm still struggling to port choice spec in Emerald (yet I'm stealing your code, sorry)
                                mamamama is right. It's supposed to do that.

                                I don't think I'll put item codes here. I've already ported it to Emerald, but I do believe there is a held item thread somewhere.

                                Also for future reference I won't be accepting the BS abilities you or Tlachtli have done so far, the only ability that should be done completely by a battle script is Skill Link. On that note, here it is.

                                Skill Link

                                Spoiler:
                                Fire Red
                                Spoiler:
                                Search for the pointer D9 6C 1D 08 in your rom, and replace it with a pointer to free space XX XX XX 08.

                                Battle Script at XX XX XX
                                Code:
                                1E 01 5D YY YY YY 08
                                28 D9 6C 1D 08
                                Battle Script at YY YY YY
                                Code:
                                00
                                01 5E 69 1D 08
                                00 00 02 03
                                8D 05 
                                8E 2E
                                2E DA 3F 02 02 00
                                28 EC 6C 1D 08

                                Emerald
                                Spoiler:
                                Search for the pointer EA 8D 2D 08 in your rom, and replace it with a pointer to free space XX XX XX 08.

                                Battle Script at XX XX XX
                                Code:
                                1E 01 5D YY YY YY 08 
                                28 EA 8D 2D 08
                                Battle Script at YY YY YY
                                Code:
                                00 
                                01 5E 8A 2D 08 
                                00 00 02 03
                                8D 05 
                                8E 2E 
                                2E 8A 44 02 02 00 
                                28 FD 8D 2D 08
                                __________________
                                Reply With Quote
                                  #41    
                                Old April 29th, 2015 (4:12 AM).
                                Z-nogyroP Z-nogyroP is offline
                                   
                                  Join Date: May 2014
                                  Age: 17
                                  Gender: Male
                                  Posts: 125
                                  For Regenerator, do we need to re-insert the routine if we're using your ROMbase and fixed Natural Cure with the byte changes, or should it work fine on its own?
                                  Reply With Quote
                                    #42    
                                  Old April 29th, 2015 (6:03 PM). Edited January 23rd, 2016 by MrDollSteak.
                                  MrDollSteak's Avatar
                                  MrDollSteak MrDollSteak is online now
                                  Formerly known as 11bayerf1
                                     
                                    Join Date: Dec 2008
                                    Location: Hong Kong
                                    Age: 23
                                    Gender: Male
                                    Posts: 843
                                    Quote:
                                    For Regenerator, do we need to re-insert the routine if we're using your ROMbase and fixed Natural Cure with the byte changes, or should it work fine on its own?
                                    The byte changes actually re-insert the routine for you. The implementation was broken, so the byte changes make it reflect this new routine.

                                    Quote:
                                    Originally Posted by kleenexfeu View Post
                                    Fur coat/multiscale still break the battle system (even if the ability is not in the battle), and noguard doesn't work for me
                                    Fur Coat and Multiscale definitely work 100% as intended, no breaking at all.
                                    I fixed No Guard, basically I put a ldr, instead of ldrb, for the bank check, it definitely works now.

                                    Mold Breaker, Teravolt and Turboblaze

                                    Spoiler:
                                    Emerald (credits to KDS for the original Fire Red routines)
                                    Spoiler:
                                    Step 1
                                    Spoiler:
                                    Mold Breaker Table
                                    Spoiler:
                                    00 00 00 00 01 01 00 01 01 00 01 01 01 00 00 01
                                    00 02 01 01 01 01 00 00 00 01 02 00 00 01 00 00
                                    00 00 00 00 00 00 00 01 01 01 00 01 00 00 00 01
                                    00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 01
                                    00 00 00 00 00 00 00 00 01 01 00 01 00 00 01 01
                                    00 00 01 00 00 00 01 01 01 00 00 00 00 00 00 00
                                    00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 00
                                    01 00 00 00 00 01 00 00 00 00 00 01 00 00 00 01
                                    00 00 00 00 00 00 00 01 01 01 00 00 00 01 00 01
                                    00 00 01 00 01 00 00 00 00 00 00 00 00 01 01 00
                                    00 00 00 00 00 00 00 00 00 00 01 00 01 00 00 00
                                    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

                                    Insert this table if your ROM has the abilities in the same order that is mentioned in the OP (otherwise you will have to modify according to the format.
                                    There are 256 entries in this table which equal to the maximum No. of abilities that can be accomodated in a GBA rom.

                                    An entry for each ability takes one byte of space and there are entries for every ability. The entry is set to 00 if Mold Breaker does not negate the ability, 01 (or a non-zero value) if Mold Breaker is able to negate it and 02 if the the ability is negated to simulate the Gen V hazard effect.

                                    For e.g, the first entry is for Ability ID 0x0 and does not need to be negated by mold breaker so its entry is set to 00. The second entry is for Stench (ID = 0x1) so set to 00. The 6th entry is set to 01 because MB negates Sturdy (ID = 0x5).

                                    There are some abilities that do not work with this method and require special explicit checks and there entry is set to 00 to avoid wastage of time.
                                    Spoiler:
                                    1. Damp (it checks in the whole battle field rather than a single target, so the 'faintifnotdamp' battlescript command needs to be edited for this. I'm leaving this for now)

                                    2. Lightning and Storm Drain (mold breaker should allow redirection of move).

                                    3. Friend Guard, Aroma Veil, Sweet Veil, Flower Veil (the target's boosts are sometimes by virtue of its ally's ability).

                                    Modify the table accordingly if there is a need to.

                                    Step 2
                                    1a. Replace x8TTTTTT in the routines with the offset of the Mold breaker table.
                                    1b. Insert these routines with byte changes in the respective code comments.
                                    Spoiler:
                                    Routine 1 (Checks for user's Mold Breaker prior to move execution and then disables abilities that negate, also probably the best place to insert Stance Change)
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global moldbreaker
                                         
                                    AbilityBufferUser:
                                         	push {r2-r4}
                                    	ldr r0, .Bank
                                    	ldrb r0, [r0]
                                    	mov r1, #0x58
                                    	ldr r2, .BattleData
                                    	mul r0, r1
                                    	add r0, r0, r2
                                    	ldrb r0, [r0]
                                    MoldBreakerCheck:
                                    	cmp r0, #0x69
                                       	beq MoldBreaker
                                        	cmp r0, #0xA4
                                        	beq MoldBreaker
                                        	cmp r0, #0xA5
                                        	bne Return
                                    MoldBreaker:
                                    AbilityBufferTarget:
                                         	ldr r0, .Bank
                                    	add r0, #0x1
                                         	ldrb r4, [r0]
                                    	mul r1, r4 
                                    	add r1, r1, r2 
                                         	ldrb r3, [r1]
                                    LoadTable:
                                         	ldr r0, .MoldBreakerTable
                                       	add r2, r0, r3
                                         	ldrb r0, [r2]
                                    CheckIfAffected:
                                        	cmp r0, #0x0
                                         	beq Return
                                    Affected:
                                         	mov r0, #0xFF
                                         	strb r0, [r1]
                                         	ldr r0, .DisabledAbilityLoc
                                         	add r0, r4
                                         	strb r3, [r0]
                                    Return:
                                        	pop {r2-r4}
                                         	bl Canceler
                                         	lsl r0, r0, #0x18
                                         	lsr r2, r0, #0x18
                                         	cmp r2, #0x0
                                         	beq Continue
                                         	ldr r0, .Return
                                         	bx r0
                                    Continue:
                                         	ldr r0, .Return2
                                         	bx r0
                                    
                                    Canceler:
                                         	ldr r0, .Return3
                                         	bx r0
                                    
                                    .align 2
                                    
                                    .Bank: .word 0x0202420B
                                    .BattleData: .word 0x020240A4
                                    .MoldBreakerTable: .word 0x08TTTTTT
                                    .DisabledAbilityLoc: .word 0x0203E32C
                                    .Return: .word 0x08046399
                                    .Return2: .word 0x08046073
                                    .Return3: .word 0x08041A6D
                                    
                                    #insert 00 48 00 47 xx xx xx 08 at 046064

                                    Routine II (Checks for user's Mold Breaker in target iterating moves like Earthquake and then disables abilities that negate damage)
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global moldbreakermultipletargets
                                         
                                    AbilityBufferUser:
                                         	push {r1-r4}
                                    	ldr r0, .Bank
                                    	ldrb r0, [r0]
                                    	mov r1, #0x58
                                    	ldr r2, .BattleData
                                    	mul r0, r1
                                    	add r0, r0, r2
                                    	ldrb r0, [r0]
                                    MoldBreakerCheck:
                                    	cmp r0, #0x69
                                       	beq MoldBreaker
                                        	cmp r0, #0xA4
                                        	beq MoldBreaker
                                        	cmp r0, #0xA5
                                        	bne Return
                                    MoldBreaker:
                                    AbilityBufferTarget:
                                         	ldr r0, .Bank
                                    	add r0, #0x1
                                         	ldrb r4, [r0]
                                    	mul r1, r4 
                                    	add r1, r1, r2 
                                         	ldrb r3, [r1]
                                    LoadTable:
                                         	ldr r0, .MoldBreakerTable
                                       	add r2, r0, r3
                                         	ldrb r0, [r2]
                                    CheckIfAffected:
                                        	cmp r0, #0x0
                                         	beq Return
                                    Affected:
                                         	mov r0, #0xFF
                                         	strb r0, [r1]
                                         	ldr r0, .DisabledAbilityLoc
                                         	add r0, r4
                                         	strb r3, [r0]
                                    Return:
                                        	pop {r1-r4}
                                         	ldr r0, [r1]
                                    	add r0, #0x1
                                    	str r0, [r1]
                                    	pop {r0}
                                    	bx r0
                                    
                                    .align 2
                                    
                                    .Bank: .word 0x0202420B
                                    .BattleData: .word 0x020240A4
                                    .MoldBreakerTable: .word 0x08TTTTTT
                                    .DisabledAbilityLoc: .word 0x0203E32C
                                    
                                    #insert 00 48 00 47 xx xx xx 08 at 04AF78

                                    Routine III (Generation V effect. Makes the foe affected by entry hazards even if it has an ability to negate the hazards effect (except Magic Guard))
                                    Spoiler:
                                    At 028308 insert a pointer to free space XX XX XX 08.

                                    Battle Script at XX XX XX
                                    Code:
                                    09 0A E2 00 58 00 3A 
                                    2B 04 EC 2F 02 02
                                    08 00 00 00
                                    YY YY YY 08
                                    2E 3A 43 02 02
                                    05 F6
                                    Battle Script at YY YY YY
                                    Code:
                                    4C 00
                                    4D 00
                                    4E 00
                                    00 3A 10 54 01
                                    F9 XX+1 XX XX 08 
                                    52 00 28 4E 8A 2D 08
                                    Routine at XX XX XX
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global moldbreakermultipletargets
                                         
                                    AbilityBufferUser:
                                         	push {lr}
                                    	ldr r0, .Bank
                                    	ldrb r0, [r0]
                                    	mov r1, #0x58
                                    	ldr r2, .BattleData
                                    	mul r0, r1
                                    	add r0, r0, r2
                                    	ldrb r0, [r0]
                                    MoldBreakerCheck:
                                    	cmp r0, #0x69
                                       	beq MoldBreaker
                                        	cmp r0, #0xA4
                                        	beq MoldBreaker
                                        	cmp r0, #0xA5
                                        	bne Return
                                    MoldBreaker:
                                    AbilityBufferTarget:
                                         	ldr r0, .Bank
                                    	add r0, #0x1
                                         	ldrb r4, [r0]
                                    	mul r1, r4 
                                    	add r1, r1, r2 
                                         	ldrb r3, [r1]
                                    LoadTable:
                                         	ldr r0, .MoldBreakerTable
                                       	add r2, r0, r3
                                         	ldrb r0, [r2]
                                    CheckIfAffected:
                                        	cmp r0, #0x0
                                         	beq Return
                                    Affected:
                                         	mov r0, #0xFF
                                         	strb r0, [r1]
                                         	ldr r0, .DisabledAbilityLoc
                                         	add r0, r4
                                         	strb r3, [r0]
                                    Return:
                                    	pop {r0}
                                    	bx r0
                                    
                                    .align 2
                                    
                                    .Bank: .word 0x0202420B
                                    .BattleData: .word 0x020240A4
                                    .MoldBreakerTable: .word 0x08TTTTTT
                                    .DisabledAbilityLoc: .word 0x0203E32C

                                    Routine IV (Restores disabled abilities at the end of move execution)
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global restoreabilities
                                         
                                    EndTurn:
                                         	ldr r0, .Outcome
                                    	mov r1, #0x0
                                    	strb r1, [r0]
                                    	ldr r0, .Index
                                    	strb r1, [r0]
                                    RestoreAbilities:
                                    	push {r2-r6}
                                    	ldr r4, .Battlers
                                    	ldrb r4, [r4]
                                    	mov r3, #0x0
                                    	ldr r5, .DisabledAbilityLoc
                                    	ldr r6, .BattleData
                                    Loop:
                                    	ldrb r2, [r5, #0x0]
                                    	cmp r2, #0x0
                                    	beq EndLoop
                                    	strb r2, [r6]
                                    	strb r1, [r5]
                                    EndLoop:
                                    	add r3, r3, #0x1
                                    	cmp r3, r4
                                    	bge Exit
                                    	add r5, r5, #0x1
                                    	add r6, r6, #0x58
                                    	b Loop
                                    Exit:
                                    	pop {r2-r6}
                                    	ldr r1, .EndLoc
                                    	mov r0, #0xB
                                    	strb r0, [r1]
                                    	pop {r0}
                                    	bx r0
                                    
                                    .align 2
                                    
                                    .Outcome: .word 0x0202427C
                                    .Index: .word 0x02024064
                                    .Battlers: .word 0x0202406C
                                    .DisabledAbilityLoc: .word 0x0203E32C
                                    .BattleData: .word 0x020240A4
                                    .EndLoc: .word 0x02024083
                                    
                                    #insert 00 48 00 47 xx xx xx 08 at 04B67C
                                    __________________
                                    Reply With Quote
                                      #43    
                                    Old April 30th, 2015 (3:00 AM).
                                    Chacha Dinosaur's Avatar
                                    Chacha Dinosaur Chacha Dinosaur is offline
                                    Adamant and adaptive dinosaur.
                                       
                                      Join Date: Jul 2013
                                      Age: 24
                                      Gender: Male
                                      Posts: 453
                                      Quote:
                                      Originally Posted by MrDollSteak View Post
                                      Mold Breaker
                                      Kudos for porting this! Saves me a lot of time.
                                      Just 2 corrections need to be done.
                                      1. In Routine I: .Return2: .word 0x08046072 should be +1
                                      2. In routine IV the instruction should be:
                                      At 4B67C: 00 48 00 47 XX+1 XX XX 08. (in FR I replaced the 'end' command with the ASM. But the Emerald's 'end' BS command uses a special BL (probably for battle frontier purposes) which is not the case in FR, so performing a branch in the 'end' code with this routine is the way to go.)

                                      Also a fun fact. The '09' present at start the Battle Script of Routine 3 executes the Roar, Whirlwind animation.
                                      Their battle scripts do not use the 'moveanimation' command directly but their animation is executed by this script reached via the 'forceswitch' command.
                                      And this why the move animation for 'dragon tail' plays twice (the first reference to the move animation from the main battle script + the second reference this script).
                                      So move id checks can be placed so that the second reference is skipped for moves like 'dragon tail' or 'circle throw'.
                                      Reply With Quote
                                        #44    
                                      Old April 30th, 2015 (3:30 AM).
                                      MrDollSteak's Avatar
                                      MrDollSteak MrDollSteak is online now
                                      Formerly known as 11bayerf1
                                         
                                        Join Date: Dec 2008
                                        Location: Hong Kong
                                        Age: 23
                                        Gender: Male
                                        Posts: 843
                                        Quote:
                                        Originally Posted by KDS View Post
                                        Kudos for porting this! Saves me a lot of time.
                                        Just 2 corrections need to be done.
                                        1. In Routine I: .Return2: .word 0x08046072 should be +1
                                        2. In routine IV the instruction should be:
                                        At 4B67C: 00 48 00 47 XX+1 XX XX 08. (in FR I replaced the 'end' command with the ASM. But the Emerald's 'end' BS command uses a special BL (probably for battle frontier purposes) which is not the case in FR, so performing a branch in the 'end' code with this routine is the way to go.)

                                        Also a fun fact. The '09' present at start the Battle Script of Routine 3 executes the Roar, Whirlwind animation.
                                        Their battle scripts do not use the 'moveanimation' command directly but their animation is executed by this script reached via the 'forceswitch' command.
                                        And this why the move animation for 'dragon tail' plays twice (the first reference to the move animation from the main battle script + the second reference this script).
                                        So move id checks can be placed so that the second reference is skipped for moves like 'dragon tail' or 'circle throw'.
                                        All fixed! Thanks KDS. Also that note about the roar animation is fantastic, i'll definitely remember it. To be honest rather than having the animation play once, it'd be best to play the move animation, and then at the 09 command, play the whirlwind animation.

                                        You may also have noticed that I optimised the ability checks a tad, just shifts exactly what registers get put in where, saving on a few command cycles (no need to mov #0x58 a second time for example), you may want to consider doing those for FR too, just to save on the tiny bit of free space. No biggy though, fantastic code.

                                        To be honest I'm also thinking of expanding your Routine 1, to include Protean because that'd probably be the best place for it. Thoughts? I'm just unsure of whether Protean would also need to be included in Routine 2.

                                        I'm also going to reserve this post for porting your Unaware / Magic Bounce Code. Maybe a few other ones from my own rombase that I've got ready.
                                        __________________
                                        Reply With Quote
                                          #45    
                                        Old April 30th, 2015 (3:45 AM).
                                        Chacha Dinosaur's Avatar
                                        Chacha Dinosaur Chacha Dinosaur is offline
                                        Adamant and adaptive dinosaur.
                                           
                                          Join Date: Jul 2013
                                          Age: 24
                                          Gender: Male
                                          Posts: 453
                                          Quote:
                                          Originally Posted by MrDollSteak View Post
                                          All fixed! Thanks KDS. Also that note about the roar animation is fantastic, i'll definitely remember it. To be honest rather than having the animation play once, it'd be best to play the move animation, and then at the 09 command, play the whirlwind animation.

                                          You may also have noticed that I optimised the ability checks a tad, just shifts exactly what registers get put in where, saving on a few command cycles (no need to mov #0x58 a second time for example), you may want to consider doing those for FR too, just to save on the tiny bit of free space. No biggy though, fantastic code.

                                          To be honest I'm also thinking of expanding your Routine 1, to include Protean because that'd probably be the best place for it. Thoughts? I'm just unsure of whether Protean would also need to be included in Routine 2.

                                          I'm also going to reserve this post for porting your Unaware / Magic Bounce Code. Maybe a few other ones from my own rombase that I've got ready.
                                          1. That is a superb idea.

                                          2. I'll def look into it. Also correcting my grammar in that post.

                                          3. It looks the best place. But before implementing this I suggest reading the Bulbapedia article regarding Protean. A very detailed explanation is given for it.

                                          4. Regarding Unaware. The Emerald code will require 6 routines instead of 4. This is because of the different way Doesn't and Tailes made the DPSS for Fire Red and Emerald respectively. The accuaracy ones can be ported but different routines for attack, defense, special attack and special defense have to be coded from scratch.
                                          Reply With Quote
                                            #46    
                                          Old April 30th, 2015 (3:47 AM).
                                          MrDollSteak's Avatar
                                          MrDollSteak MrDollSteak is online now
                                          Formerly known as 11bayerf1
                                             
                                            Join Date: Dec 2008
                                            Location: Hong Kong
                                            Age: 23
                                            Gender: Male
                                            Posts: 843
                                            Quote:
                                            Originally Posted by KDS View Post
                                            1. That is a superb idea.

                                            2. I'll def look into it. Also correcting my grammar in that post.

                                            3. It looks the best place. But before implementing this I suggest reading the Bulbapedia article regarding Protean. A very detailed explanation is given for it.

                                            4. Regarding Unaware. The Emerald code will require 6 routines instead of 4. This is because of the different way Doesn't and Tailes made the DPSS for Fire Red and Emerald respectively. The accuaracy ones can be ported but different routines for attack, defense, special attack and special defense have to be coded from scratch.
                                            Ah damn that's annoying. I was using Doesn't PSS split for Emerald as far as I can tell, it's the one on the thread anyway. It seemed basically the same as the Fire Red one from what I could tell. Worth looking into then.

                                            Protean should probably go into the Attack Canceler routine then, having looked at it on Bulbapedia.
                                            __________________
                                            Reply With Quote
                                              #47    
                                            Old April 30th, 2015 (5:31 AM).
                                            kleenexfeu kleenexfeu is offline
                                               
                                              Join Date: Aug 2013
                                              Gender: Male
                                              Posts: 216
                                              Quote:
                                              Originally Posted by MrDollSteak View Post
                                              The byte changes actually re-insert the routine for you. The implementation was broken, so the byte changes make it reflect this new routine.



                                              Fur Coat and Multiscale definitely work 100% as intended, no breaking at all.
                                              I fixed No Guard, basically I put a ldr, instead of ldrb, for the bank check, it definitely works now.

                                              Mold Breaker, Teravolt and Turboblaze

                                              Spoiler:
                                              Emerald (credits to KDS for the original Fire Red routines)
                                              Spoiler:
                                              Step 1
                                              Spoiler:
                                              Mold Breaker Table
                                              Spoiler:
                                              00 00 00 00 01 01 00 01 01 00 01 01 01 00 00 01
                                              00 02 01 01 01 01 00 00 00 01 02 00 00 01 00 00
                                              00 00 00 00 00 00 00 01 01 01 00 01 00 00 00 01
                                              00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 01
                                              00 00 00 00 00 00 00 00 01 01 00 01 00 00 01 01
                                              00 00 01 00 00 00 01 01 01 00 00 00 00 00 00 00
                                              00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 00
                                              01 00 00 00 00 01 00 00 00 00 00 01 00 00 00 01
                                              00 00 00 00 00 00 00 01 01 01 00 00 00 01 00 01
                                              00 00 01 00 01 00 00 00 00 00 00 00 00 01 01 00
                                              00 00 00 00 00 00 00 00 00 00 01 00 01 00 00 00
                                              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

                                              Insert this table if your ROM has the abilities in the same order that is mentioned in the OP (otherwise you will have to modify according to the format.
                                              There are 256 entries in this table which equal to the maximum No. of abilities that can be accomodated in a GBA rom.

                                              An entry for each ability takes one byte of space and there are entries for every ability. The entry is set to 00 if Mold Breaker does not negate the ability, 01 (or a non-zero value) if Mold Breaker is able to negate it and 02 if the the ability is negated to simulate the Gen V hazard effect.

                                              For e.g, the first entry is for Ability ID 0x0 and does not need to be negated by mold breaker so its entry is set to 00. The second entry is for Stench (ID = 0x1) so set to 00. The 6th entry is set to 01 because MB negates Sturdy (ID = 0x5).

                                              There are some abilities that do not work with this method and require special explicit checks and there entry is set to 00 to avoid wastage of time.
                                              Spoiler:
                                              1. Damp (it checks in the whole battle field rather than a single target, so the 'faintifnotdamp' battlescript command needs to be edited for this. I'm leaving this for now)

                                              2. Lightning and Storm Drain (mold breaker should allow redirection of move).

                                              3. Friend Guard, Aroma Veil, Sweet Veil, Flower Veil (the target's boosts are sometimes by virtue of its ally's ability).

                                              Modify the table accordingly if there is a need to.

                                              Step 2
                                              1a. Replace x8TTTTTT in the routines with the offset of the Mold breaker table.
                                              1b. Insert these routines with byte changes in the respective code comments.
                                              Spoiler:
                                              Routine 1 (Checks for user's Mold Breaker prior to move execution and then disables abilities that negate, also probably the best place to insert Stance Change)
                                              Spoiler:
                                              Code:
                                              .text
                                              .align 2
                                              .thumb
                                              .thumb_func
                                              .global moldbreaker
                                                   
                                              AbilityBufferUser:
                                                   	push {r2-r4}
                                              	ldr r0, .Bank
                                              	ldr r0, [r0]
                                              	mov r1, #0x58
                                              	ldr r2, .BattleData
                                              	mul r0, r1
                                              	add r0, r0, r2
                                              	ldrb r0, [r0]
                                              MoldBreakerCheck:
                                              	cmp r0, #0x69
                                                 	beq MoldBreaker
                                                  	cmp r0, #0xA4
                                                  	beq MoldBreaker
                                                  	cmp r0, #0xA5
                                                  	bne Return
                                              MoldBreaker:
                                              AbilityBufferTarget:
                                                   	ldr r0, .Bank
                                              	add r0, #0x1
                                                   	ldrb r4, [r0]
                                              	mul r1, r4 
                                              	add r1, r1, r2 
                                                   	ldrb r3, [r1]
                                              LoadTable:
                                                   	ldr r0, .MoldBreakerTable
                                                 	add r2, r0, r3
                                                   	ldrb r0, [r2]
                                              CheckIfAffected:
                                                  	cmp r0, #0x0
                                                   	beq Return
                                              Affected:
                                                   	mov r0, #0xFF
                                                   	strb r0, [r1]
                                                   	ldr r0, .DisabledAbilitiesLoc
                                                   	add r0, r4
                                                   	strb r3, [r0]
                                              Return:
                                                  	pop {r2-r4}
                                                   	bl Canceler
                                                   	lsl r0, r0, #0x18
                                                   	lsr r2, r0, #0x18
                                                   	cmp r2, #0x0
                                                   	beq Continue
                                                   	ldr r0, .Return
                                                   	bx r0
                                              Continue:
                                                   	ldr r0, .Return2
                                                   	bx r0
                                              
                                              Canceler:
                                                   	ldr r0, .Return3
                                                   	bx r0
                                              
                                              .align 2
                                              
                                              .Bank: .word 0x0202420B
                                              .BattleData: .word 0x020240A4
                                              .MoldBreakerTable: .word 0x08TTTTTT
                                              .DisabledAbilityLoc: .word 0x0203E32C
                                              .Return: .word 0x08046399
                                              .Return2: .word 0x08046073
                                              .Return3: .word 0x08041A6D
                                              
                                              #insert 00 48 00 47 xx xx xx 08 at 046064

                                              Routine II (Checks for user's Mold Breaker in target iterating moves like Earthquake and then disables abilities that negate damage)
                                              Spoiler:
                                              Code:
                                              .text
                                              .align 2
                                              .thumb
                                              .thumb_func
                                              .global moldbreakermultipletargets
                                                   
                                              AbilityBufferUser:
                                                   	push {r1-r4}
                                              	ldr r0, .Bank
                                              	ldr r0, [r0]
                                              	mov r1, #0x58
                                              	ldr r2, .BattleData
                                              	mul r0, r1
                                              	add r0, r0, r2
                                              	ldrb r0, [r0]
                                              MoldBreakerCheck:
                                              	cmp r0, #0x69
                                                 	beq MoldBreaker
                                                  	cmp r0, #0xA4
                                                  	beq MoldBreaker
                                                  	cmp r0, #0xA5
                                                  	bne Return
                                              MoldBreaker:
                                              AbilityBufferTarget:
                                                   	ldr r0, .Bank
                                              	add r0, #0x1
                                                   	ldrb r4, [r0]
                                              	mul r1, r4 
                                              	add r1, r1, r2 
                                                   	ldrb r3, [r1]
                                              LoadTable:
                                                   	ldr r0, .MoldBreakerTable
                                                 	add r2, r0, r3
                                                   	ldrb r0, [r2]
                                              CheckIfAffected:
                                                  	cmp r0, #0x0
                                                   	beq Return
                                              Affected:
                                                   	mov r0, #0xFF
                                                   	strb r0, [r1]
                                                   	ldr r0, .DisabledAbilitiesLoc
                                                   	add r0, r4
                                                   	strb r3, [r0]
                                              Return:
                                                  	pop {r1-r4}
                                                   	ldr r0, [r1]
                                              	add r0, #0x1
                                              	str r0, [r1]
                                              	pop {r0}
                                              	bx r0
                                              
                                              .align 2
                                              
                                              .Bank: .word 0x0202420B
                                              .BattleData: .word 0x020240A4
                                              .MoldBreakerTable: .word 0x08TTTTTT
                                              .DisabledAbilityLoc: .word 0x0203E32C
                                              
                                              #insert 00 48 00 47 xx xx xx 08 at 04AF78

                                              Routine III (Generation V effect. Makes the foe affected by entry hazards even if it has an ability to negate the hazards effect (except Magic Guard))
                                              Spoiler:
                                              At 028308 insert a pointer to free space XX XX XX 08.

                                              Battle Script at XX XX XX
                                              Code:
                                              09 0A E2 00 58 00 3A 
                                              2B 04 EC 2F 02 02
                                              08 00 00 00
                                              YY YY YY 08
                                              2E 3A 43 02 02
                                              05 F6
                                              Battle Script at YY YY YY
                                              Code:
                                              4C 00
                                              4D 00
                                              4E 00
                                              00 3A 10 54 01
                                              F9 XX+1 XX XX 08 
                                              52 00 28 4E 8A 2D 08
                                              Routine at XX XX XX
                                              Code:
                                              .text
                                              .align 2
                                              .thumb
                                              .thumb_func
                                              .global moldbreakermultipletargets
                                                   
                                              AbilityBufferUser:
                                                   	push {lr}
                                              	ldr r0, .Bank
                                              	ldr r0, [r0]
                                              	mov r1, #0x58
                                              	ldr r2, .BattleData
                                              	mul r0, r1
                                              	add r0, r0, r2
                                              	ldrb r0, [r0]
                                              MoldBreakerCheck:
                                              	cmp r0, #0x69
                                                 	beq MoldBreaker
                                                  	cmp r0, #0xA4
                                                  	beq MoldBreaker
                                                  	cmp r0, #0xA5
                                                  	bne Return
                                              MoldBreaker:
                                              AbilityBufferTarget:
                                                   	ldr r0, .Bank
                                              	add r0, #0x1
                                                   	ldrb r4, [r0]
                                              	mul r1, r4 
                                              	add r1, r1, r2 
                                                   	ldrb r3, [r1]
                                              LoadTable:
                                                   	ldr r0, .MoldBreakerTable
                                                 	add r2, r0, r3
                                                   	ldrb r0, [r2]
                                              CheckIfAffected:
                                                  	cmp r0, #0x0
                                                   	beq Return
                                              Affected:
                                                   	mov r0, #0xFF
                                                   	strb r0, [r1]
                                                   	ldr r0, .DisabledAbilitiesLoc
                                                   	add r0, r4
                                                   	strb r3, [r0]
                                              Return:
                                              	pop {r0}
                                              	bx r0
                                              
                                              .align 2
                                              
                                              .Bank: .word 0x0202420B
                                              .BattleData: .word 0x020240A4
                                              .MoldBreakerTable: .word 0x08TTTTTT
                                              .DisabledAbilityLoc: .word 0x0203E32C

                                              Routine IV (Restores disabled abilities at the end of move execution)
                                              Spoiler:
                                              Code:
                                              .text
                                              .align 2
                                              .thumb
                                              .thumb_func
                                              .global restoreabilities
                                                   
                                              EndTurn:
                                                   	ldr r0, .Outcome
                                              	mov r1, #0x0
                                              	strb r1, [r0]
                                              	ldr r0, .Index
                                              	strb r1, [r0]
                                              RestoreAbilities:
                                              	push {r2-r6}
                                              	ldr r4, .Battlers
                                              	ldrb r4, [r4]
                                              	mov r3, #0x0
                                              	ldr r5, .DisabledAbilityLoc
                                              	ldr r6, .BattleData
                                              Loop:
                                              	ldrb r2 [r5, #0x0]
                                              	cmp r2, #0x0
                                              	beq EndLoop
                                              	strb r2, [r6]
                                              	strb r1, [r5]
                                              EndLoop:
                                              	add r3, r3, #0x1
                                              	cmp r3, r4
                                              	bge Exit
                                              	add r5, r5, #0x1
                                              	add r6, r6, #0x58
                                              	b loop
                                              Exit:
                                              	pop {r2-r6}
                                              	ldr r1, .
                                              	mov r0, #0xB
                                              	strb r0, [r1]
                                              	bx lr
                                              
                                              .align 2
                                              
                                              .Outcome: .word 0x0202427C
                                              .Index: .word 0x02024064
                                              .Battlers: .word 0x0202406C
                                              .DisabledAbilityLoc: .word 0x0203E32C
                                              .BattleData: .word 0x020240A4
                                              .EndLoc: .word 0x02024083
                                              
                                              #insert 00 48 00 47 xx xx xx 08 at 04B67C
                                              Yep they do works with the new code, thank's, and nice porting, will try it
                                              Reply With Quote
                                                #48    
                                              Old May 1st, 2015 (4:09 PM).
                                              abdurrahman76's Avatar
                                              abdurrahman76 abdurrahman76 is offline
                                                 
                                                Join Date: Apr 2015
                                                Location: indonesia
                                                Gender: Male
                                                Nature: Mild
                                                Posts: 10
                                                Quote:
                                                Originally Posted by RaileysXerilyasRX View Post

                                                Expanding Ability Names Data and Ability Descriptions Pointer Table


                                                I think this should be here so I don't need to make a new thread with a very simple tutorial. Alright! I'm going to tell you how to expand Ability tables (the Names and the Descriptions). I'm using HxD here as a HEX Editor.

                                                Legend:
                                                • Green bolded text are for Emerald.
                                                • Red bolded text are for FireRed.

                                                Step 1: Ability Names

                                                • Go to a new free space names (example: 0x720000). Select 3328 (0xD00 in HEX) bytes. Fill the bytes with AE AE AE AE AE AE AE FF 00 00 00 00 00.
                                                • Go to 31B6DB or 24FC40. Select and copy 1014 (0x3F6 in HEX) bytes.
                                                • Go to the offset of your names data (which the example is 0x720000) and paste the data there.
                                                • Replace all DB B6 31 08 or 40 FC 24 08 with the "reversed hex in little indian of your new names data offset with 08 at the end" (example: 00 00 72 08)

                                                Step 2: Ability Descriptions

                                                • Go to a new free space descriptions (example: 0x720D00). Select 1024 (0x400 in HEX) bytes. Fill the bytes with 98 AF 31 08 or C4 F3 24 08.
                                                • Go to 31BAD4 or 24FB08. Select and copy 312 (0x138 in HEX) bytes.
                                                • Go to the offset of your description table (which the example is 0x720D00) and paste the data there.
                                                • Replace all D4 BA 31 08 or 08 FB 24 08 with the "reversed hex in little indian of your new description data offset with 08 at the end" (example: 00 0D 72 08)

                                                Then, change your .ini-s. Replace the old offsets in the .ini with your new data (they should be at where the Ability Names and Ability Descriptions are). Luckily, these don't have limiter stuff at all.

                                                With the expanded data, the new data should be working. I have made this tutorial to have maximized the slots to 256 abilities (255 usable abilities plus one for the none "-----" slot). Now you have 178 new slots for Generation IV+ abilities. Noted that the game can only support up to 256 abilities. The rest of the tutorial on how to insert ability routines are on the first post of this thread since inserting ability routines are now complicated. I hope this post is to be linked up in the Extra Information of this thread so everyone can expand stuff too.
                                                can you create a tutorial for pokemon ruby RaileysXerilyasRX?
                                                Reply With Quote
                                                  #49    
                                                Old May 2nd, 2015 (6:08 AM).
                                                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 MrDollSteak View Post
                                                  Mold Breaker, Turboblaze, and Teravolt
                                                  Nice that you have worked on this but my assembler caught up many errors (such as the .DisabledAbilities and .DisabledAbility part and more errors that mostly on the last routine as well) Better check and correct those.

                                                  Even I made the possible corrections personally, there is a bug though which after beating a Pokemon, the game freezes. I guarantee that my bs loader, callasm, and setword impelementation are correct 'cause my implementation of Moxie works. I dunno what's wrong then but I will wait for your official corrections to be done and reinsert Mold Breaker again.
                                                  __________________

                                                  Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)
                                                  Reply With Quote
                                                    #50    
                                                  Old May 2nd, 2015 (6:24 AM).
                                                  MrDollSteak's Avatar
                                                  MrDollSteak MrDollSteak is online now
                                                  Formerly known as 11bayerf1
                                                     
                                                    Join Date: Dec 2008
                                                    Location: Hong Kong
                                                    Age: 23
                                                    Gender: Male
                                                    Posts: 843
                                                    Quote:
                                                    Originally Posted by abdurrahman76 View Post
                                                    can you create a tutorial for pokemon ruby RaileysXerilyasRX?
                                                    Don't even bother with Ruby. No new abilities will be made for it.
                                                    Use Emerald with Chaos' Ruby Restoration patch, and it is literally exactly the same appearance wise, yet is a far more stable base.
                                                    __________________
                                                    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
                                                    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 9:49 PM.