Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old July 13th, 2017 (3:10 AM). Edited July 15th, 2017 by Javi4315.
Javi4315 Javi4315 is offline
     
    Join Date: Apr 2017
    Location: Spain
    Gender: Male
    Posts: 3
    This routine allows you to continue running the script (in the case of a trainerbattle) or playing (in the case of a wildbattle) after losing with no whiteout. It is quite simple, just follow the steps!

    Step 1:

    First, open your favourite hex editor (I recommend HxD) and search for a free space. You will need 64 (0x40) bytes. Make sure that the offset you choose ends in 0, 4, 8 or C. Write down the offset!

    Step 2:

    Now, we are going to insert the routine that I wrote:

    Quote:
    push {r0,r2}
    nop @just to align
    ldr r2, sub_var_8000
    mov r0, #0x1
    strh r0, [r2] @var 0x8000 = 0x1 // Means you have lost the battle for scripting porpouses
    ldr r0, =(0x00000203) @Flag that controls the system // You can change it
    ldr r2, sub_flag_decrypt
    bl sub_call
    cmp r0, #0x1
    beq sub_flag_on
    pop {r0,r2}
    mov r0, #0x1 @Original response
    pop {r1}
    bx r1

    sub_flag_on:
    ldr r0, =(0x080A0059) @Heal the party
    bl sub_call_2
    pop {r0, r2}
    mov r0, #0x0 @Hacked response
    pop {r1}
    bx r1

    sub_call:
    bx r2

    sub_call_2:
    bx r0

    sub_flag_decrypt: .word 0x0806E6D1
    sub_var_8000: .word 0x020370B8
    And this is the code:

    Quote:
    05 B4 C0 46 0B 4A 01 20 10 80 0B 48 08 4A 00 F0 0D F8 01 28 03 D0 05 BC 01 20 02 BC 08 47 07 48 00 F0 05 F8 05 BC 00 20 02 BC 08 47 10 47 00 47 D1 E6 06 08 B8 70 03 02 03 02 00 00 59 00 0A 08
    That in bold is the flag (in reverse) that controls the system. Feel free to change it for any other flag.

    Step 3:

    Insert the code on the offset you chose in step 1. Then, add a "08" to that offset and reverse it. For example, if you chose the offset 904000, do this:

    904000 => 08904000 => 08 90 40 00 => 00 40 90 08

    Now, you have make your offset into a pointer. Write it down!

    Step 4:

    Go to the following offset: 0x800EC

    You will find the same pointer to times in a row:

    Quote:
    04 01 08 08 04 01 08 08
    Replace them with your pointer two times too. For example, if your pointer is 00 40 90 08, you have to write this:

    Quote:
    00 40 90 08 00 40 90 08
    Now, you have inserted the system.

    Understanding how it works:

    It is quite easy. You have chosen a flag, in my case the flag 0x203.

    If the flag is deactivated, the system won't be working. That means that if you lose a battle, you will be whited out as usual.

    If the flag is activated, the system will be working. That means that if you lose a battle, you won't be whited out and will continue playing. In this case, var 0x8000 will be set to 0x1, that will allow you to know that you have lost the battle. So, if you want to do a trainerbattle that you can lose, add a "setvar 0x8000 0x0" before the trainerbattle command.

    You have to do your script like this:

    Quote:
    (...)
    setvar 0x8000 0x0
    trainerbattle (config) //you can use any type of trainerbattle
    compare 0x8000 0x1
    if 0x1 goto @youlost
    (here what happens if you win)

    #org @youlost
    (here what happens if you lose)
    Example:

    I am spanish, so I made a tutorial in spanish that you won't be able to follow if you don't speak spanish. But you can go to the minute 11:54 if you want to see a video example of the system working.

    Reply With Quote

    Relevant Advertising!

      #2    
    Old August 30th, 2017 (3:39 PM).
    Hestia Hestia is offline
       
      Join Date: Jul 2017
      Posts: 5
      Very Nice, should the offsets be the same in EM?
      __________________
      New to the community, have read a lot of posts already. Intresested in making a ROM hack.
      Reply With Quote
        #3    
      Old August 30th, 2017 (5:45 PM).
      Froosty's Avatar
      Froosty Froosty is offline
      The_Learner
         
        Join Date: Sep 2014
        Location: Somewhere in this world.
        Age: 19
        Gender: Male
        Nature: Brave
        Posts: 542
        Quote:
        Originally Posted by Hestia View Post
        Very Nice, should the offsets be the same in EM?
        Nop will be completely different.
        __________________
        Want to talk with me regarding Rom-hacking ??? Want to get access to my works exclusive than anywhere else ???
        Click here to get in the discord server here where rom-hacking is a everyday talk and task.

        Want to showcase your hack on discord server ??? Click here to get the dask done.

        My works:
        TOOL: TL's Quick Enhancer
        TUTORIAL: Fire red habitat editing
        TUTORIAL: Fire red Transparent text-box


        | |
        Reply With Quote
        Reply

        Quick Reply

        Join the conversation!

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

        Create a PokéCommunity Account

        Sponsored Links
        Thread Tools

        Posting Rules
        You may not post new threads
        You may not post replies
        You may not post attachments
        You may not edit your posts

        BB code is On
        Smilies are On
        [IMG] code is On
        HTML code is Off

        Forum Jump


        All times are GMT -8. The time now is 6:34 PM.