• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Code: ASM Resource Thread

Lunos

Random Uruguayan User
3,114
Posts
15
Years
  • use TL's quick enhancer tool
    The_Learner removed the DL Link until the next update because its modifications were messing some people's ROMs.

    I know there's several routines like this one, but I didn't found them practical.

    Check a specific pokémon with a specific slot through the use of Special 0xA2, for Emerald :
    Spoiler:
    The routine has apparently some flaws.
    They were fixed by @Squeetz in the community's Discord.
    I don't know a single thing about ASM, but I thought someone needed to bring this up in case anyone wanted to use it.
    Code:
    .thumb
    
    Start:
        push {r0-r7, lr}
        ldr r6, var8005
        ldr r0, party_amount
        ldrb r4, [r0]
        cmp r4, #0x0
        beq End
        ldrh r3, [r6]
        cmp r3, #0x0
        beq End
    Check:
        ldr r0, party_player
        mov r1, #0x64
        ldr r7, var8004
        ldrb r6, [r7]
        mul r1, r6
        add r0, r0, r1
        push {r0-r7}
        mov r1, #0xB
        ldr r2, decrypt_poke
        bl Jump
        mov r9, r0
        pop {r0-r7}
        cmp r9, r3
        bne NoSuccess
        mov r6, #1
        b Success
    NoSuccess:
        mov r6, #0
    Success:
        ldr r7, var8005
        strh r6, [r7]
    
    End:
        pop {r0-r7, pc}
    Jump:
    mov pc, r2
        
    .align 2
    party_amount:    .word 0x020244E9
    var8004:        .word 0x020275D8 + (0x8004*2)
    var8005:        .word 0x020275D8 + (0x8005*2)
    decrypt_poke:    .word 0x0806A519
    party_player:  .word 0x020244EC
    
    /*var 0x8005, species you want to check*/
     
    239
    Posts
    8
    Years
    • Seen Apr 15, 2024
    Sorry for being dumb, but how do I actually implement this into the game?

    I would suggest learning how to compile and insert assembly instead of relying on tools.

    1. First, you'll want to download HackMew's thumb compiler, found on this page.

    2. Then, save the files you quoted individually as [filename].asm, eg. attack.asm. Using the windows command prompt, type 'thumb [filename].asm [filename].bin' in the same directory as your .asm file and the compiler. Then, open the .bin file with a hex editor, and insert into free space, making sure the offset ends in a 0,4,8, or C. With these particular routines, you'll need to also insert [00 01 0A 00] for red font and [00 07 0A 00] for blue font, somewhere in your rom, and then change the pointer at the bottom of each routine to the location of each 4bytes string. So, if you inserted 00 07 0A 00 at 0x123456, 0x08BBBBBB would become 0x08123456.

    3. At the top of each assembly routine you're trying to insert, there is an insertion instruction that has been commented out, eg. @ 00 49 08 47 XX XX XX XX at x137134 in the attack.asm routine. This means, at offset 0x137134 you type the above hex, where XX XX XX XX is a reverse pointer (+1) to the location of the attack.bin hex you inserted into free space from step 2. For example, if you inserted attack.bin at 0x987654, for example, XX XX XX XX will be 55 76 98 08.

    Do this for each routine and you should be all set!

    I hope this helps. let me know if you have any issues.
     
    59
    Posts
    8
    Years
    • He / Him
    • Seen May 19, 2022
    I would suggest learning how to compile and insert assembly instead of relying on tools.

    1. First, you'll want to download HackMew's thumb compiler, found on this page.

    2. Then, save the files you quoted individually as [filename].asm, eg. attack.asm. Using the windows command prompt, type 'thumb [filename].asm [filename].bin' in the same directory as your .asm file and the compiler. Then, open the .bin file with a hex editor, and insert into free space, making sure the offset ends in a 0,4,8, or C. With these particular routines, you'll need to also insert [00 01 0A 00] for red font and [00 07 0A 00] for blue font, somewhere in your rom, and then change the pointer at the bottom of each routine to the location of each 4bytes string. So, if you inserted 00 07 0A 00 at 0x123456, 0x08BBBBBB would become 0x08123456.

    3. At the top of each assembly routine you're trying to insert, there is an insertion instruction that has been commented out, eg. @ 00 49 08 47 XX XX XX XX at x137134 in the attack.asm routine. This means, at offset 0x137134 you type the above hex, where XX XX XX XX is a reverse pointer (+1) to the location of the attack.bin hex you inserted into free space from step 2. For example, if you inserted attack.bin at 0x987654, for example, XX XX XX XX will be 55 76 98 08.

    Do this for each routine and you should be all set!

    I hope this helps. let me know if you have any issues.

    Thank you! This kind of simple, easy to follow tutorial on how to insert ASM is exactly what I've been looking for! I'll try it now and see if it works.

    EDIT: So when I try that, I get this error.
    attack.asm: Assembler messages:
    attack.asm:0: Warning: end of file in comment; newline inserted
    attack.asm:60: Error: junk at end of line, first unrecognized character is `R'

    EDIT #2: nvm, I figured out that I had to insert the redfont and bluefont and change the .asm file to show where they are.

    EDIT #3: So, if I put the hex for attack.bin at 0x71A6B0, XX XX XX XX would be B1 A6 71 08?

    EDIT #4: It works! Thanks! Yours is the only tutorial for inserting ASM that I could actually follow and understand.
     
    Last edited:
    232
    Posts
    12
    Years
    • Seen Sep 10, 2019
    Request for FR:

    Volt Tackle by breeding with either parent holding a Light Ball.
     
    59
    Posts
    8
    Years
    • He / Him
    • Seen May 19, 2022
    Request for Platinum:

    Having coloured stats based on natures. I don't know if this could be done by editing the ASM used to implement this into FireRed and changing the offsets or if they are just too different.

    Either way, I think more work needs to be done on hacking 4th gen games, and I'd be happy to help (although I am very dumb). I'm currently looking into editing the hex of the 4th gen games but there doesn't seem to be any documentation on ASM for 4th gen and very little documentation on hex for 4th gen. If someone smarter than me can give me a good starting point as to where I could learn how to find out how to do this (if that makes any sense) I would be more than willing to learn.
     
    59
    Posts
    8
    Years
    • He / Him
    • Seen May 19, 2022
    Dumb question but what program is used to compile the ASM routines?

    This easy to follow tutorial is what I used to be able to do it (with extremely little prior knowledge on the subject).

    I would suggest learning how to compile and insert assembly instead of relying on tools.

    1. First, you'll want to download HackMew's thumb compiler, found on this page.

    2. Then, save the files you quoted individually as [filename].asm, eg. attack.asm. Using the windows command prompt, type 'thumb [filename].asm [filename].bin' in the same directory as your .asm file and the compiler. Then, open the .bin file with a hex editor, and insert into free space, making sure the offset ends in a 0,4,8, or C. With these particular routines, you'll need to also insert [00 01 0A 00] for red font and [00 07 0A 00] for blue font, somewhere in your rom, and then change the pointer at the bottom of each routine to the location of each 4bytes string. So, if you inserted 00 07 0A 00 at 0x123456, 0x08BBBBBB would become 0x08123456.

    3. At the top of each assembly routine you're trying to insert, there is an insertion instruction that has been commented out, eg. @ 00 49 08 47 XX XX XX XX at x137134 in the attack.asm routine. This means, at offset 0x137134 you type the above hex, where XX XX XX XX is a reverse pointer (+1) to the location of the attack.bin hex you inserted into free space from step 2. For example, if you inserted attack.bin at 0x987654, for example, XX XX XX XX will be 55 76 98 08.

    Do this for each routine and you should be all set!

    I hope this helps. let me know if you have any issues.

    If you run into any problems, just look at the edits I made to my response to that message. It's probable that you may come across the same problems as I did.

    EDIT: So when I try that, I get this error.
    attack.asm: Assembler messages:
    attack.asm:0: Warning: end of file in comment; newline inserted
    attack.asm:60: Error: junk at end of line, first unrecognized character is `R'

    EDIT #2: nvm, I figured out that I had to insert the redfont and bluefont and change the .asm file to show where they are.

    EDIT #3: So, if I put the hex for attack.bin at 0x71A6B0, XX XX XX XX would be B1 A6 71 08?

    EDIT #4: It works! Thanks! Yours is the only tutorial for inserting ASM that I could actually follow and understand.
     
    232
    Posts
    12
    Years
    • Seen Sep 10, 2019
    [FR] Volt Tackle port from EM:

    If you have free space from 0x270670-0x270741 (0xD2 bytes), use the IPS patch I provide here. ...It's a long story, so I will expand on this when I get the time. Fully working, I promise. You're gonna love it.

    edit: A bit of explanation now: I took a look at an Emerald disassembly and found the routine that calls to check if the egg at the Day-Care is a pichu and if either of the parents are holding a Light Ball. I ported that exact routine into FR, but I had to make a copy of the routine at sub_80460D4 as to include the pichu check. Then I had to make special 0xB8 call the new routine instead of sub_80460D4. Since I had made a copy of the routine I also had to make sure the new routine used all the same offsets as before, and therefore I placed the routine at 0x270670, which I happened to have free space. I wanted to place the routine at something like 0x760000 or higher, but the old offsets wouldn't work any more. Down below are the uncompiled stuff:

    This routine (located at 0x270670 in my patch) is a copy of the routine at 0x0460D4 but now includes the pichu egg check (in orange):
    Code:
    sub_80460D4:                @ CODE XREF: sp0B8_daycare+Cp
    
    var_18        = -0x18
    var_14        = -0x14
    
            PUSH    {R4-R6,LR}
            SUB    SP, SP,    #0x6C
            ADD    R5, R0,    #0
            ADD    R6, SP,    #0x7C+var_18
            ADD    R1, R6,    #0
            BL    sub_8046000
            ADD    R4, SP,    #0x7C+var_14
            STRH    R0, [R4]
            ADD    R0, R4,    #0
            ADD    R1, R5,    #0
            BL    incense_effects
            LDRH    R1, [R4]
            MOV    R0, SP
            ADD    R2, R5,    #0
            BL    sub_8046208
            MOV    R0, SP
            ADD    R1, R5,    #0
            BL    sub_8045AC0
            LDRB    R0, [R6,#1]
            MOV    R2, #0x8C @ '?'
            ADD    R1, R0,    #0
            MUL    R1, R2
            ADD    R1, R5,    R1
            LDRB    R0, [R6]
            MUL    R2, R0
            ADD    R2, R5,    R2
            MOV    R0, SP
            BL    daycare_build_child_moveset
    [COLOR=DarkOrange]        ldrh r0, [r4]
            cmp r0, #0xAC
            bne _08070918
            mov r0, sp
            add r1, r5, #0
            bl sub_82706FC
    _08070918:[/COLOR]
            MOV    R2, SP
            ADD    R2, #0x6A @ 'j'
            MOV    R0, #1
            STRB    R0, [R2]
            MOV    R0, SP
            MOV    R1, #0x2D @ '-'
            BL    pokemon_setattr
            LDR    R0, off_804614C
            MOV    R1, #0xFA @ '?'
            LSL    R1, R1,    #1
            ADD    R0, R0,    R1
            MOV    R1, SP
            MOV    R2, #0x64 @ 'd'
            BL    memcpy
            BL    party_compaction
            BL    party_count_pokemon
            ADD    R0, R5,    #0
            BL    sub_8045F70
            ADD    SP, SP,    #0x6C
            POP    {R4-R6}
            POP    {R0}
            BX    R0
    @ End of function sub_80460D4
    
    @ ---------------------------------------------------------------------------
    .align 2
    off_804614C:    .long 0x2024284        @ DATA XREF: sub_80460D4+52r
    This routine (located at 0x2706FC in my patch) handles the volt tackle inheriting:
    Code:
    sub_80707A4:
        push {r4-r6,lr}
        add r5, r0, #0
        add r4, r1, #0
        add r0, r4, #0
        mov r1, #0xC
        bl pokemon_getattr_encrypted
        add r6, r0, #0
        add r4, #0x8C
        add r0, r4, #0
        mov r1, #0xC
        bl pokemon_getattr_encrypted
        cmp r6, #0xCA
        beq _080707C6
        cmp r0, #0xCA
        bne _080707E2
    
    _080707C6:
        mov r4, #0xAC
        lsl r4, r4, #0x1
        add r0, r5, #0
        add r1, r4, #0
        bl pokemon_moveset_pad_
        lsl r0, r0, #0x10
        ldr r1, =(0xffff0000)
        cmp r0, r1
        bne _080707E2
        add r0, r5, #0
        add r1, r4, #0
        bl sub_803EB94
    
    _080707E2:
        pop {r4-r6}
        pop {r0}
        bx r0
    This last one makes sure the old offsets work correctly from the new offsets:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    
    .org 0x0462B8
    bl 0x270670
    
    .org 0x27067A
    bl 0x046000
    
    .org 0x270686
    bl 0x045FA0
    
    .org 0x270690
    bl 0x046208
    
    .org 0x270698
    bl 0x045AC0
    
    .org 0x2706AE
    bl 0x045CD0
    
    .org 0x2706BC
    bl 0x2706FC
    
    .org 0x2706CC
    bl 0x04037C
    
    .org 0x2706DC
    bl 0x1E5E78
    
    .org 0x2706E0
    bl 0x0937DC
    
    .org 0x2706E4
    bl 0x040C3C
    
    .org 0x2706EA
    bl 0x045F70
    
    .org 0x270706
    bl 0x03FD44
    
    .org 0x270712
    bl 0x03FD44
    
    .org 0x270726
    bl 0x03E89C
    
    .org 0x270736
    bl 0x03EB94
    If anybody has a better way of porting this, please post it here.
    edit2: I could probably just use bx r3?
     

    Attachments

    • Volt tackle.ips
      232 bytes · Views: 9
    Last edited:
    232
    Posts
    12
    Years
    • Seen Sep 10, 2019
    Pokemon Emerald Multichoice Scrolling Box

    Spoiler:

    I'm having a bit of trouble getting this to work. First of all, isn't the jumptable at 0x813A168 and not 0x813A156? I can repoint 0x813A168, but not your given 0x813A156. Second, I can only get the default choices to work. Anything above 12 (0xC) won't work for me. As soon as special 0x1BE is called ingame with a value of 0xD or more, the game freezes without the list showing up at all.

    Here's the steps I did in order:

    - repointed the first table located at 0x5B2CF0 to 0xDE43E0 and changed two pointers.
    - repointed the jumptable located at 0x13A168 (instead of 0x13A156 as I couldn't find the pointers for it) to 0xDE4760 and changed one pointer.
    - compiled your routine and inserted at 0xDE4794 (which is right after the repointed jumptable)
    - added new entry (6 pre-existing pointers) to 0xDE4720.
    - changed the byte at 0x813A148 from 0xC to 0xD.
     

    Froosty

    The_Learner
    535
    Posts
    9
    Years
  • DIFFERENT PALS FOR THE MALE AND FEMALE BAG [FR]
    Thanks to KDS for helping me fix the error. :)
    Insert this code:
    Spoiler:


    example:
    Spoiler:
     
    Last edited:

    AkameTheBulbasaur

    Akame Marukawa of Iyotono
    409
    Posts
    10
    Years
  • Scaled Experience Formula

    In Generation V, a new way of determining the Experience Points gained after Battle was introduced. Previously, the Experience Formula was a flat one, which did not change based on Level Differences between your Pokemon and the other one.

    In Black & White, they used a Scaled Experience Formula, which would cause your Pokemon to gain more experience if their opponent was a higher Level, and less if their opponent was a lower one.

    Today, I am sharing a way to have this sort of Scaled Experience Points in Fire Red or Emerald. I have included the download link to a folder which contains four items.

    Folder: (Download)
    1. The Routine (For Fire Red)
    2. The Routine (For Emerald)
    3. Think0028's Experience All Patch
    4. An Instruction Manual

    The Instruction Manual explains how the routine works and any extra information that is necessary to know (particularly if you would like to modify this routine for your specific hack).

    Important:
    Considering I first uploaded the first version of this routine a long time ago, you may have an older version of it. This version may be preferable to that one, and it is smaller than the previous version is. Therefore, one can simply insert it over the old version and not have to repoint anything.

    Extra Information

    This routine is compatible with Think0028's Experience All Patch. His original download link is unfortunately broken, hence why I put it in the download folder. If it was still active, I would have linked directly to it.

    If you inserted the Disable Experience Gain With Flag routine, originally by FBI, then you may wish to remove it, as this routine implements it. I am not sure if there is a conflict due to this, but at the very least there is a redundant check if you have two routines which both check the same Flag. It is also possible that this routine bypasses that one entirely, in which case you would want to remove it to avoid wasting space.

    Thanks and credits to FBI for that original routine, as without it I would likely not have been able to find the correct branching address for this routine.

    As I have nowhere else to post this information, I will say here that to remove the 1.5x Experience Boost you get for defeating a Pokemon in a Trainer Battle (like they did in Generation VII), do the following:

    Put 07 E0 at 0x21DD8 (FireRed) or 0x4A698 (Emerald)

    Put 1C E0 at 0x21E00 (FireRed) or put 28 E0 at 0x4A6C0 (Emerald)
     
    Last edited:

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • The two requests I ever made over here were in vain.. allow me to try another one instead.
    How about a port of JPAN's Overworld Hacks to Emerald?
    I'm looking for a way to basically change a character's Front sprite, Back sprite and OWs to another one until I revert things back to how it was manually with another command.
     
    10
    Posts
    7
    Years
    • Seen Jun 14, 2019
    I need help making an eeveelution evolution happen i need it made so when an eevee faints in battle and then you feed it a rare candy while its fainted after battle it evolves into a ghost type eeveelution
     

    AkameTheBulbasaur

    Akame Marukawa of Iyotono
    409
    Posts
    10
    Years
  • I need help making an eeveelution evolution happen i need it made so when an eevee faints in battle and then you feed it a rare candy while its fainted after battle it evolves into a ghost type eeveelution

    This is just off the top of my head, so I haven't tested this or anything, but it should give you a head start.

    First here's a link to a tutorial on how to add new evolution methods.

    https://www.pokecommunity.com/showthread.php?t=329357

    Second, you need a way to check if a Pok?mon in your party is fainted. You can check the current HP of a Pok?mon using the RAM offsets I posted here.

    ldr r1, .FirstPoke
    mov r1, #0x39
    bl Decrypt
    cmp r0, #0x0
    beq Evolve

    .FirstPoke is the first RAM offset in the lists I posted under the "Yours" heading. Basically what this little snippet does is it checks the current HP of the first Pok?mon in your party and compares it to zero. If it's zero, the Pok?mon is fainted and you can then branch to the next thing. You can change the party slot it checks, but ideally you would want a way for the code to know which Pokemon you selected.

    It might help to look through the evolution routines posted in the tutorial and see how they're structured.

    That's all I can really do without doing testing first, but that will have to wait until later because it's 2:30 in the morning as I'm posting this. PM me later if you still need help.
     

    Derlo

    Tired....
    135
    Posts
    16
    Years
  • Hello, I would like to request a hook routine to be added to the original TM's routine.
    The new routine would be activated when the TM's were used and deleted, so a new item would be created in the ITEN bag.
    If possible, include checking if the bag is full. If yes, discard new item.
    Thanks in advance.
     

    Derlo

    Tired....
    135
    Posts
    16
    Years
  • Hello,
    I think reuable tms are already done, if thats what you need...

    It looks like he wants an item to be created after a TM is used and naturally deleted.
    He didn't mentioned if he wants the exact TM to be created yet again, so I'd say he's not looking for reusable TMs.

    In fact what I need is to maintain the original routine that deletes the TM after use and add the creation of an item along with the TM exclusion.
    Example: After using any TM, it is deleted from TM CASE and creates a NUGGET in the player bag.
    And if possible show the informed message where the new item will be in the bag.
     
    88
    Posts
    7
    Years
    • Seen Jan 16, 2020
    Fixing some major bugs/oversights with this routine seemed worthy of a new post so anyone who has implemented it can notice the changes:

    Adding a Dodge Rate for Catching Wild Pokemon [FR]

    This routine uses the wild pokemon's base speed stat to calculate a probability that it will dodge a thrown pokeball (nominally ~5-10%)

    (credits to Urz, shanem7, and ghoulslash for bug finding, scripting, and testing!)

    Important Routine Notes:
    • This routine does not affect Safari Balls
    • In its current form, the Master Ball skips all dodge rate checks (can be changed easily)
    • The hook address may have changed from previous routine versions. Make sure you are using the correct hook address!

    Insertion Instructions:
    1. Insert custom 'dodging' message at 0xXXYYZZ. This is what will be displayed when the Pokemon dodges your thrown Poke Ball
    2. Insert the following custom battle script at 0x08XXXXXX (requires the setword command. Also add #command cmdF6 0xF6 to commands.bsh file)
      waitmessage 0x40
      setword 0x203C020 0x08XXYYZZ
      printstring 0x184
      waitmessage 0x40
      cmdF6
    3. Replace .Message: word 0x8XXXXXX in the assembly routine below with the offset you compiled this battle script in
    4. Compile and insert the routine in free space (0x08TTUUVV)
    5. Insert 00 48 00 47 (VV+1) UU TT 08 at 0802D508

    The Routine:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    	
    Main:
    	ldr r1, .BallThrown
    	ldrb r0, [r1]
    	cmp r0, #0x1	  @master ball
    	bne OtherBall
    	ldr r0, =(0x03004F90)
    	ldr r1, =(0x0802D688 +1)
    	bx r1
    
    OtherBall:
    	ldr r6, .TargetBank
    	ldrb r0, [r6]
    	ldr r1, .SpecialStatus
    	lsl r0, r0, #0x2
    	add r2, r1, r0
    	ldr r0, [r2]
    	ldr r1, =(0x000400C0)	@fly/dig/bounce/dive status flags
    	and r0, r1
    	cmp r0, #0x0	
    	bne DodgeBall     @auto dodge if offscreen
    	ldrb r0, [r2, #0x1]
    	mov r1, #0x4
    	and r0, r1
    	cmp r0, #0x0
    	bne NoDodge	@ingrain -> cant dodge
    	ldrb r0, [r6]
    	mov r1, #0x58
    	mul r0, r1
    	ldr r1, .BattleStruct
    	add r5, r1, r0
    	mov r0, #0x4C
    	add r0, r5, r0
    	ldrb r1, [r0, #0x7]
    	mov r2, #0x1
    	and r1, r2
    	cmp r1, #0x0
    	bne DodgeBall     @substitute on -> auto dodge
    	ldrb r1, [r0, #0x3]
    	cmp r1, #0x20
    	beq NoDodge	@frozen = can't dodge
    	mov r2, #0x7
    	and r1, r2
    	cmp r1, #0x0
    	bne NoDodge	@target is asleep -> cant dodge
    	
    GetThreshold:
    	ldrh r0, [r5]
    	mov r1, #0x1C
    	mul r0, r0, r1
    	ldr r1, .BaseStats
    	add r0, r0, r1
    	ldrb r0, [r0, #0x3]		@r0 = wild pokemon base speed
    	mov r1, #0xA		@number to divide base speed by (change if you want)
    	bl div_func			@r0 =  base speed / 10
    	mov r1, #0xD		@r1 = 13 (lower limit ~5% - change if you want)
    	add r1, r0, r1		@r1 = 13 + base_speed/10 = base threshold
    	
    CheckParalysis:
    	mov r0, r5
    	add r0, #0x4F
    	ldrb r0, [r0]
    	cmp r0, #0x40
    	bne CheckWrap
    	lsr r1, r1, #0x1	@if pokemon paralyzed, its dodge rate is halved
    	
    CheckWrap:
    	mov r0, r5
    	add r0, #0x51
    	ldrb r0, [r0]
    	mov r2, #0xE0
    	and r0, r2
    	cmp r0, #0x0	
    	beq CheckDodge
    	lsr r2, r1, #0x2
    	sub r1, r1, r2		@3/4 dodge rate if trapped by wrap effect
    	
    CheckDodge:
    	mov r3, r1
    	bl rand_func
    	lsr r0, r0, #0x8
    	cmp r0, r3
    	bls DodgeBall	@if r0 <= threshold value, the pokemon dodges the ball
    
    NoDodge:
    	ldr r3, .BaseStats	@replaced routine from hook
    	ldr r2, .BattleStruct
    	ldrb r1, [r6]
    	mov r0, #0x58
    	ldr r5, =(0x0802D510 +1)	@return to original routine
    	bx r5
    	
    div_func:
    	ldr r2, .Divide
    	bx r2
    	
    rand_func:
    	ldr r2, .Rand
    	bx r2
    	
    DodgeBall:
    	mov r0, #0x0
    	mov r1, #0x6		@change to mov r1, #0x5 for ball deflection instead of dodging animation
    	ldr r2, =(0x0800E194 +1)
    	bl linker
    	ldr r5, =(0x02023BC4)
    	ldrb r0, [r5]
    	ldr r2, =(0x08017248 +1)
    	bl linker
    	ldr r1, =(0x02023D74)
    	ldr r0, .DodgeMessage
    	ldr r2, =(0x0802D7EC +1)
    	
    linker:
    	bx r2
    
    .align 2
    .BallThrown:	.word 0x02023D68
    .Rand: .word 0x08044EC9
    .WildPoke:	.word 0x0202402C
    .BaseStats: .word 0x08254784
    .Divide:	.word 0x081E4019
    .UserBank:	.word 0x02023D6B
    .TargetBank:	.word 0x02023D6C
    .BattleStruct:	.word 0x02023BE4
    .SpecialStatus:	.word 0x02023DFC
    .DodgeMessage:	.word 0x08XXXXXX	@battle script to display custom message

    Current Routine Features:
    1. Target will automatically dodge a thrown ball if it is off-screen (dig, fly, bounce, dive) or has a substitute out
    2. Target will never dodge if it is asleep, frozen, or rooted in the ground (ingrain)
    3. 50% dodge rate for paralysis and 75% dodge rate if trapped by wrap effect
    There are lots of other little dodge rate modifiers one could implement, such as speed/evasion stat modifiers, held item, ability, weather, etc. I have implemented some of these, so let me know if you want me to add these in!
     
    Last edited:

    Skeli

    Lord of the Rings
    300
    Posts
    10
    Years
  • Expanding the Bag Entirely [FR]

    -Big Edit: The routines have been completely rewritten from scratch to work properly now.

    This has been done in bits and pieces over the years (I believe it's actually been done completely for Emerald), so I decided to rewrite the bag storage routine for Fire Red.

    Pre-Requisites
    • JPAN's Save Block Recycle
      Spoiler:
    • An updated Conversion attack routine:
      Spoiler:

      Why Conversion?
      Spoiler:

    The Code
    Spoiler:


    Credits
     
    Last edited:
    Back
    Top