• 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

BluRose

blu rass
811
Posts
10
Years
  • Doesn't work.
    then try as many different renditions of it as possible or something. for flag 200...
    00 02 00 00
    00 02 - betting half word this time if full word didn't work
    02 00
    00 00 02 00
    just try all of them in succession lol, it really shouldn't be that hard to just brute-force this until it works
     
    352
    Posts
    7
    Years
    • Seen Mar 10, 2022
    then try as many different renditions of it as possible or something. for flag 200...
    00 02 00 00
    00 02 - betting half word this time if full word didn't work
    02 00
    00 00 02 00
    just try all of them in succession lol, it really shouldn't be that hard to just brute-force this until it works

    Worked with half word. Thanks. xD
     
    11
    Posts
    7
    Years
    • Seen Feb 28, 2021
    I'm completely hopeless with assembly so if anyone could lend me a hand I'd be super greatful.

    The main feature I'm looking for is turning trainer battles into flat battles, IE levelling up has no effect on stats. (EVs and IVs are fine though)

    1) Make the players party level 100 the whole game, doesn't require ASM but it also means there's no progression, I'd still like levelling for purposes of evolution and new move acquisition.

    2) Force the teams level to be a certain level (lets say 50) then reset it after the battle. This seems like a decent strategy but I feel like the player will lose the XP gained from beating trainer pokemon, or at the very least it will fuck with the levelling process to some degree. I've done some research on this and gone through some ancient posts but I haven't been able to cobble something together yet.

    3) Disable stat scaling with level, pokemon are always treated as though they're level 50 for stat purposes. This seems best since I won't be screwing with any variables at all, just the calculations, which seems great but it also has the problem of I have literally no idea where to even start on messing with this stuff.

    I'd really appreciate any input. This one has me stumped and it's pretty critical to what I'm working on.

    EDIT: Oh yeah and I'm on Emerald.
    Hope that's not a dealbreaker but I really don't want to jump to firered since I'm planning to keep the region.
     
    11
    Posts
    7
    Years
    • Seen Feb 28, 2021
    Update: I managed to get FBI's script for forcing a party to a certain level working on Emerald:
    Spoiler:


    Here it is for anyone who needs it, but it's not really what I needed. As I suspected playing with level of the team messes up levelling beyond repair, so this approach isn't viable.

    I'm not happy with this solution since it's basically my first solution with the downside of requiring asmcalls for every single trainer battle. Not ideal!

    So that leaves me with option 3, disable level scaling. I think the solution I need is to edit the function that calculates pokemon stats, when they level up or are boxed etc. and simply change the part where it inserts the current level of the pokemon, simply force it to be 50.

    In theory that's a really simple change, but it's beyond me currently, I'm looking into some breakpoint stuff and hooking into scripts? But I'm still very new to this so if someone can help me out, or at least point me down the path I'd be greatful.

    At the very least I know where the stat calculation occurs in emerald, it starts around 0x08068D0C as far as I can tell.

    EDIT: For the record if someone is interested in building this for FR I can figure out the port to EM myself (probably).
     
    Last edited:
    11
    Posts
    7
    Years
    • Seen Feb 28, 2021
    Update3: Well I did it!
    I have disabled all level based stat scaling from my emerald cart, now only EVs and IVs affect your pokemon's stats. Super friggin cool!

    To do so is relatively simple, we're just hijacking the point in the code where it pulls the pokemons level, then replacing it with the number 50 (or whatever you want, really) the code is riduclously simple:
    Non HP stats (compiles to: 32 21)
    Spoiler:

    HP (compiles to: 32 24)
    Spoiler:

    Battle Calculations
    Spoiler:


    These are just overwriting the position where level is loaded with the number 50.
    #0x32 is the level you want to simulate, I chose 50, but you could force it to be level 1, or 100, or whatever. Doesn't make a huge difference.

    Once you've compiled those you're overwriting the following positions on your emerald rom
    I set all the registers to 32, which is 50, if you want a different level just work out the hex value and calculate it. (100 for example is 64)
    Spoiler:


    I haven't checked these, so it might not actually be in that order, but I'm fairly certain it is (HP is definitely first though)

    NMort0Y.png

    In action, note mudkip is level 30.
    He has shitty IVs though so the stats are a little off, but you can see they're close enough (tm)

    EDIT: further testing has unveiled that something slipped through my net, the pesky damage formula.
    Apparently it uses the users level as well (why? i don't know lol) so if you apply these tweaks it will result in your mons becoming stupidly bulky.
    I'm working on a fix but I wouldn't use this until I do. It's now fixed!

    EDIT2: I've located the appropriate locations and fixed them, but damage seems to be 20% higher than normal, I'm going to test more.

    EDIT3: I've fixed it, the unusual damage numbers was me being shit and redirecting one position too early (we were using some unknown number for level scaling, I don't know what)

    I've updated the instructions. This should work. Happy flat battles.
     
    Last edited:
    352
    Posts
    7
    Years
    • Seen Mar 10, 2022
    Thanks for the requests, it keeps me having something to do. Though a few things I would like to mention. First of all the thread got a little rework, so I'm no longer really allowed to restrict the kinds of requests people ask in here anymore. However, I'm still not doing any battle script related, graphics related or non FireRed hacks because that's just my policy. You're welcome to ask anyways, maybe someone else will do them for you. :)


    I believe abilities as BS related. What you would need for something like this, is probably a bitmap showing which species of Pokemon "passively" have levitate. Though, sadly, because it is battle script related, I'm not going to be fulfilling this. Hopefully someone else jumps on and lends you a hand :)


    Hi, I'll look into this. If I end up needing to adjust the PID, it may end up a little much :x



    Overworld abilities can be added by scripting. Try decompiling the script on a cut tree and you'll see what I mean :)


    Here:
    Spoiler:



    That sounds like a cool addition, though I don't know how to make the number appear onto the HP bar. Maybe someone with graphical knowledge will jump in and help you on this one.


    Thanks.

    The thing of bad egg have some problems:
    1- The Old Man catching tutorial becomes bugged https://www.pokecommunity.com/showthread.php?t=384261;
    2- Any type of Poké Ball becomes a 100% catch ball.

    There is a way to fix it?
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • The thing of bad egg have some problems:
    1- The Old Man catching tutorial becomes bugged https://www.pokecommunity.com/showthread.php?t=384261;
    2- Any type of Poké Ball becomes a 100% catch ball.

    There is a way to fix it?

    Doesn't look like those hex edits have anything to do with Catchrate of the Pokeball. First one removes a trainer's ability to block a ball, and the second one prevent the trainer ID from being written to a Pokemon, thus solving the bad egg issue.

    How did you deduce these changes caused this bug?
     
    352
    Posts
    7
    Years
    • Seen Mar 10, 2022
    Doesn't look like those hex edits have anything to do with Catchrate of the Pokeball. First one removes a trainer's ability to block a ball, and the second one prevent the trainer ID from being written to a Pokemon, thus solving the bad egg issue.

    How did you deduce these changes caused this bug?

    Because I've reverted these offsets to original, and works correctly, then when I try to use again it causes that bugs. I will try only using the second of ID, I think it will solve that.

    EDIT: I was right, I only need the second line.
     
    Last edited:
    146
    Posts
    11
    Years
    • CO
    • Seen Mar 16, 2023
    Not sure if this will help anyone but I made a routine that takes the Players 8byte(8thbyte being FF padding) Name and store it on vars 0x8000-0x8003.
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global
    
    main:
        push {r0-r3, lr}
        ldr r0, .PLAYER_DATA
        ldr r0, [r0]         //load the pointer stored at r0 into r0
        ldr r1, .VAR         //var 0x8000
        ldm r0!, {r2-r3}     //load 2 words from given pointer at r0 into r2-r3 = 8bytes
        stm r1!, {r2-r3}     //store 2 words from r2-r3 onto vars 0x8000-0x8003
        pop {r0-r3, pc}
    
    .align 2
    
    .PLAYER_DATA:
    .word 0x0300500C
    
    .VAR:
    .word 0x020370B8
    I made this so I could try making MissinNo's form changes but realize that it might take some more ASM to base its three other forms off the 3rd, 5th and 7th characters within the Players Name.

    So I hope others can find a use for it.
     
    352
    Posts
    7
    Years
    • Seen Mar 10, 2022
    Somethings to be clarified.

    Roaming Pokemon!

    1- setvar 0x8003 0x[Map table index (to be explained in a later section)] (How I determine the index? The first one is 0x0 or 0x1?)
    2- setvar 0x8000 0x[Which roaming Pokemon you want to delete (slot #)] (How I determine the slot? It's the same index of Map Table? It is the order of roamers are enabled?)
    3- Routine Table/MinuteRun Table (Routine Table and MinuteRun Table are the same? What I have to place there? Pointers for all routines? Pointers to only specific routines?)
    4- mov r0, #0xBF @flag to check divided by 4 (The flag "0x2FC" is needed to work?)
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • There is a way to do it only with the Balls Bag?

    Yes. If you analyze the original code, you will see that it does something like this:
    Code:
    for bagslot in bag:
        for item in bagslot:
            logic

    You just remove the outer loop and set bagslot to the pokeballs bag.

    Somethings to be clarified.

    I don't remember anymore. But these are all questions that would be answered if you tried it? For example if index one didn't work, then it probably uses index 0 instead. Also, that same routine series, I posted a video detailing how all the routines work. You'd be able to deduce this information from those videos.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Tried all possible ways, here the issues:
    1- MinuteRun freezes the game after 2 wild battles;
    2- I see the roamer data in memory, but it don't appear.

    If you can take a look at this I'll be grateful, if not thank you too. This is a patch including all Roaming Pokémon Routines and Random Number Generator & Shiny Pokémon routines, here is the offsets:

    BattleByMove = 0xA7A000
    RandomNumberGenerator = 0xA7A050
    CreateRoamingPokémon = 0xA7A084
    PurgeRoamer = 0xA7A150
    CancelRoam = 0xA7A1B8
    InjectIntoMap = 0xA7A21C
    MapChange = 0xA7A2D8
    MinuteRun = 0xA7A34C
    FleeBattle = 0xA7A38C

    Routines Table = 0xA7FF00
    MinuteRun Table = 0xA7FE00
    Map Table = 0xA7EFFF

    ShinyPokémon = 0x965F00

    I don't know what I'm doing wrong, but I think it should be a issue with tables.

    So I don't have a patcher and won't be downloading one for this. I suggest you do one of the following:
    1) Make a thread in the Q/A section detailing all of this
    2) Hop on the PC discord, navigate to the #romhacking section and ask there.

    I'd be more willing to help you on discord
     
    48
    Posts
    12
    Years
  • Would someone be able to help me out with FBI's Playtime as a Clock system.

    I have it inserted to free space, although I'm having a difficult time figuring out how to properly set up a script that utilizes it. In this case, could someone quick write up a basic script skeleton to help me understand what I'm doing wrong. Something basic, but with all the main bits, perhaps a berry bush that gives 1-3 cheri berries every 20 in game minutes.
     
    8
    Posts
    7
    Years
    • Seen Dec 26, 2016
    Hi, I have a quick question / request.

    Has anyone made a routine for removing fainted pokemon from the party at the end of a battle? (IE Nuzlocke challenge). If so I'd love to know :)

    The other question I had is if there is a routine for removing pokeballs from the bag at the end of the battle?

    My plan is to make a nuzlocke challenge mod of FireRed with some fakemon in it as well. I've pretty much figured out how to hack the fakemon but any pointers in the right direction for the above two routines would help me out significantly. In the mod, I want to lock people into the new routes they visit, and give them a single pokeball, which is discarded at the end of the next battle. Effectively forcing people to use the 'catch only the first pokemon per route' rule
     
    39
    Posts
    7
    Years
  • Misc:

    Evolution via Callasm in FR

    Spoiler:

    A EV-IV Display Screen

    Spoiler:

    80x80 mugshots

    Spoiler:

    Some new movement bytes (including a patch)

    Spoiler:

    Help. What does it mean in "type in make"? What exactly should I type on cmd?

    *I'm talking about the 'A EV-IV Display Screen' instructions*
     
    Last edited:
    146
    Posts
    11
    Years
    • CO
    • Seen Mar 16, 2023
    I tried to open it but this is what appears:
    9ej9HVt.png


    That is what happens when you just type make..

    You need to be in the "build" folder directory...

    Either use:
    cd C:/User/"computername"/Desktop/Build
    Then hit enter...
    Now use the "make" command and as long as you have everything else installed like DevkitArm and Cygwin then it will work like a charm.

    Hope this helps
     
    Back
    Top