• 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

~SAGE

Peruvian Rom Hacker
39
Posts
9
Years
  • About that, I feel very bad shutting down all of your suggestions, but that seems like a lot of work for a feature that's not even that great. There's already a large amount of space in the PC, and I'm sure to expand it will take hours and hours of work :/

    Capturing Opponent's Pokemon:

    So I was working on making trainer's Pokemon capture-able, and it does this check to see if the Pokemon is capturable, and if it was it'd check to see if it's a trainer's Pokemon. Well, I disabled the check and was successful in capturing a Pokemon that didn't belong to me :P

    Sadly, the Pokemon turned into a bad egg the moment I caught it. The only solution to this was to edit the checksum so it'd make sense again, however that would be a lot of work, and honestly the checksum is calculated relatively frequently. So upon investigation (mostly by Shinyquagsire, thanks for the deduction detective!) we were able to determine the egg was turning bad because the checksum was no longer valid with the player's trainer ID. So, after diving through the code a bit I found the part of the code that overwrote the trainer ID with the player ID. Then it was a matter of disabling it!

    To insert:
    insert the following bytes at the following offsets:
    0x2D496: E0 E0
    0x40B36: 00 00 00 00 00

    Here's Brock's Onix :3

    i've a doubt, if the pokemon is catchable this will be for all pkmn?
    it ill be boring and not have sense, it ill be better if only some pokemon having this feauture :D

    big research, thx
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • i've a doubt, if the pokemon is catchable this will be for all pkmn?
    it ill be boring and not have sense, it ill be better if only some pokemon having this feauture :D

    big research, thx

    Hi, I already made some code that allows trainer Pokemon to only be captured by certain PokeBalls. If you wanted to, you can change it from a ball check to another check of your liking. So it's definitely possible and easy to do.
     

    Lance32497

    LanceKoijer of Pokemon_Addicts
    792
    Posts
    9
    Years
  • Legendary Battle Mugshot
    Again, I know that it requires Graphics editing but Jambo made a trainer mugshot routine...
    I am also looking for a routine that when you encounter a legendary battle, it shows the legendary mugshot before wild battle.

    FBI agent;8510724 [h1 said:
    Party Item Checker:[/h1]

    How it works:
    So I use the variables 0x8000 and 0x8001 again.
    0x8000 Should be set to Pokemon species (2 bytes)
    0x8001 Needs to be set to Item ID (1 byte...can be changes to 2 if you inserted more than 255 items)

    case 1:
    If a Pokemon in your party has the item specified by 0x8001 and the species matches 0x8000, return that Pokemon's slot

    case 2:
    If 0x8000 is set to 0x0 (no species), the routine will search your whole party and return the slot of the Pokemon holding the item specified in 0x8001

    case 3:
    If no Pokemon in the party are holding the item, returns 0x6.

    The result will be stored in variable 0x8000. The result will, obviously, be 0x0-0x5 (slot) for item found and 0x6 for not found.


    How to insert:

    Compile and insert into free space the following routine:
    Spoiler:


    Here's a compiled version:
    Code:
    7F B5 18 4E 36 78 00 25 AE 42 22 D0 64 20 68 43 01 1C 15 48 40 18 0C 21 14 4A 00 F0 1E F8 0F 4B 1B 78 98 42 01 D0 01 35 EE E7 0D 4C 24 88 00 2C 0C D0 0E 4A 64 20 68 43 01 1C 0B 48 40 18 0B 21 00 F0 0B F8 06 4C 24 88 A0 42 EC D1 04 4A 15 70 7F BD 03 48 06 21 01 70 7F BD 10 47 BA 70 03 02 B8 70 03 02 29 40 02 02 84 42 02 02 E9 FB 03 08

    Usage:
    In a script,
    setvar 0x8000 0xspecies
    setvar 0x8001 0xItemID
    callasm 0x[Where you inserted the above routine +1]

    That's it!

    Should I compile this kina script?

    #dynamic 0x740000

    #org @start
    lock
    faceplayer
    checkflag 0x300
    if 0x1 goto @Done
    msgbox @1 MSG_YESNO
    compare LASTRESULT 0x0
    if 0x0 goto @Yes
    compare LASTRESULT 0x1
    if 0x1 goto @No
    release
    end

    #org @Yes
    msgbox @2 MSG_KEEPOPEN
    setvar 0x8000 0x85 (Lets use eeve)
    setvar 0x8001 0x1 (Master ball)
    msgbox @3 MSG_NOCLOSE
    release
    end

    #org @No
    msgbox @4 MSG_NORMAL
    release
    end

    #org @Done
    nsgbox @5 MSG_NORMAL

    #org @1
    = Would you like to set/n VAR number 8000 to 0x85/land VAR number 8001 to 0x1?

    #org @2
    = Setting....

    #org @3
    = Done.

    #org @4
    = What happened?


    I am just a bit confused, what will happen if I set Var 8000 and 8001?
    Does it really checks the item held by your pokemon?
     
    Last edited by a moderator:
    416
    Posts
    11
    Years
    • Seen Feb 10, 2024
    Well ive seen some ASM hacks for nuzlocke runs, where when a poke fainted, it dissapeared... but Ive never seen the code for that published...

    what Ive never seen is a hack that only allowed the player to catch one poke from each area, and the first poke from each area. you would need to have a slot in ram that checked off which areas have been captured for.

    both of these scripts and your game over (reset upon battle loss) would make a great nuzlocke game.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Legendary Battle Mugshot
    Again, I know that it requires Graphics editing but Jambo made a trainer mugshot routine...
    I am also looking for a routine that when you encounter a legendary battle, it shows the legendary mugshot before wild battle.



    Should I compile this kina script?

    #dynamic 0x740000

    #org @start
    lock
    faceplayer
    checkflag 0x300
    if 0x1 goto @Done
    msgbox @1 MSG_YESNO
    compare LASTRESULT 0x0
    if 0x0 goto @Yes
    compare LASTRESULT 0x1
    if 0x1 goto @No
    release
    end

    #org @Yes
    msgbox @2 MSG_KEEPOPEN
    setvar 0x8000 0x85 (Lets use eeve)
    setvar 0x8001 0x1 (Master ball)
    msgbox @3 MSG_NOCLOSE
    release
    end

    #org @No
    msgbox @4 MSG_NORMAL
    release
    end

    #org @Done
    nsgbox @5 MSG_NORMAL

    #org @1
    = Would you like to set/n VAR number 8000 to 0x85/land VAR number 8001 to 0x1?

    #org @2
    = Setting....

    #org @3
    = Done.

    #org @4
    = What happened?


    I am just a bit confused, what will happen if I set Var 8000 and 8001?
    Does it really checks the item held by your pokemon?

    Hi, if you read the usage/cases, you'd notice that you forgot to callasm to the routine +1. It's meaningless to set the variables if you don't callasm :P
    Code:
    setvar 0x8000 0x85 '(Lets use eeve)
    setvar 0x8001 0x1 '(Master ball)
    [B]callasm routine+1
    '[something will be written in variable 0x8000. 0x6 if none found otherwise the slot of the pokemon.][/B]

    Also unfortunately, I don't do graphic hacks, so sorry but I will have to decline your legendary's mugshot. Though using Jambo's routine you can find loop holes to insert your sprite somewhere. (I'm not sure though). Keep the ideas coming, some of these are good, they're just graphical and I don't like to do those. :P

    Well ive seen some ASM hacks for nuzlocke runs, where when a poke fainted, it dissapeared... but Ive never seen the code for that published...

    what Ive never seen is a hack that only allowed the player to catch one poke from each area, and the first poke from each area. you would need to have a slot in ram that checked off which areas have been captured for.

    both of these scripts and your game over (reset upon battle loss) would make a great nuzlocke game.

    Hi, I can do Pokemon deletion after they're fainted, but 1 Pokemon per map is hard. Where would you restrict it? when they attempt to throw a Pokeball? If you give me a specific time for the check and how you want it to behave I will look into it.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Bag Deletion and Restoration


    So this is quite a large amount of content (very similar to PSS), so unlike the previous routine posts this one will be a lot bigger!

    What it does is, basically allow the hacker to delete the player's bag contents with the ability to restore it later. This is very much ESSENTIAL if you were going to do a "Play in another character's shoes", custom safari zone, battle pyramid, or anything similar. You can also, potentially have a second bag and the same size as the original bag (though that will require some more work on your part).

    There are 4 Routines that are used to repeat the process more than 1 time. If it's only a one time thing you'd need only 3/4. They are:

    - Bag Backup
    - Item delete
    - Bag restore
    - Delete backup




    Bag Backup:


    This routine takes the items in your bag, and backs them up in free RAM space. I'll leave the technical details of the implementation out, as I had to deal with a lot of DMA, obfuscation, and sad memories. (Thanks to Touched sensei for helping me fix a bug).

    How to insert:

    Compile and insert into free space the following routine:
    Spoiler:


    Usage:
    It's very simple, all you need to do is callasm to this routine and it will back-up your bag in memory. That's all it does. If you want you can change the location of storage by updating the address .STORAGE points to. Make sure the address is divisible by four.




    Bag Delete:


    This routine, quite simply, empties your bag! I decided to make this separate from the bag backup routine because this routine in itself has some peculiar uses. Perhaps a survival game or nuzlocke?

    How to insert:

    Compile the following routine into free space:

    Spoiler:


    Usage:
    It's simple, you just callasm to this routine! It will remove all the player's items within itself.




    Bag Restoration


    This routine adds the items in the bag storage into the player's bag. It's designed to be called after you've backed up the player's bag. This will restore it! Also it doesn't overwrite the contents of the bag from before (it just adds to it). So if you wanted to delete the contents of the bag and then restore back the old bag, you'd have to call the above routine prior to calling this one.

    How to insert:

    Compile into free space the following routine:
    Spoiler:


    Usage:
    callasm to this routine! It's that easy to use. Also, if you would like to add multiple items (more than scripting would allow you) into the player's bag quickly, you can write to this RAM location in the format:
    [2 bytes (Item ID)][2 bytes (Quantity)]
    Quantity is maxed out at 999 or 0x3E7.




    Delete Backup


    It may be the case that you want to use this "bag swap" more than once. For that to work, you will have to delete the current backup. Normally if you don't delete the backup and you attempt to restore the bag for a second time, you will not have a problem. However, in the case that the first time you had your bag and you had more items that time than the second time it will not all be overwritten and you will add "extras". So to be on the safe side, after an event is over ALWAYS delete the backup!

    How to insert:

    Compile and insert into free space the following routine:

    Spoiler:


    Usage:
    Like all of these routines, you just need to callasm to this routine somewhere in your script. That's all, the rest is handle automagically!




    Technical notes:


    This is a section which I normally don't have in my routines, however, it occurred to me that if someone wanted to expand my current routines or make something similar they would have to do a lot of work which I've already done. So here are some technicalities about the bag.

    Spoiler:



    Here's a sample of what you can expect to do:
     
    Last edited:
    416
    Posts
    11
    Years
    • Seen Feb 10, 2024
    Hi, I can do Pokemon deletion after they're fainted, but 1 Pokemon per map is hard. Where would you restrict it? when they attempt to throw a Pokeball? If you give me a specific time for the check and how you want it to behave I will look into it.
    I would imagine if you have battled a wild pokemon(caught or otherwise), when you try to use a pokeball you will get a warning (similar to the "you cant use this here" message).

    So after a wild battle it puts a checkmark in a table, if the user goes back to that area, and tries to use a pokeball, they get the message.

    The table should be scalable per hack though, each hack has a different number of areas... or maybe tie it to the map flags...
     

    Lance32497

    LanceKoijer of Pokemon_Addicts
    792
    Posts
    9
    Years
  • Bag Deletion and Restoration


    So this is quite a large amount of content (very similar to PSS), so unlike the previous routine posts this one will be a lot bigger!

    What it does is, basically allow the hacker to delete the player's bag contents with the ability to restore it later. This is very much ESSENTIAL if you were going to do a "Play in another character's shoes", custom safari zone, battle pyramid, or anything similar. You can also, potentially have a second bag and the same size as the original bag (though that will require some more work on your part).

    There are 4 Routines that are used to repeat the process more than 1 time. If it's only a one time thing you'd need only 3/4. They are:

    - Bag Backup
    - Item delete
    - Bag restore
    - Delete backup




    Bag Backup:


    This routine takes the items in your bag, and backs them up in free RAM space. I'll leave the technical details of the implementation out, as I had to deal with a lot of DMA, obfuscation, and sad memories. (Thanks to Touched sensei for helping me fix a bug).

    How to insert:

    Compile and insert into free space the following routine:
    Spoiler:


    Usage:
    It's very simple, all you need to do is callasm to this routine and it will back-up your bag in memory. That's all it does. If you want you can change the location of storage by updating the address .STORAGE points to. Make sure the address is divisible by four.




    Bag Delete:


    This routine, quite simply, empties your bag! I decided to make this separate from the bag backup routine because this routine in itself has some peculiar uses. Perhaps a survival game or nuzlocke?

    How to insert:

    Compile the following routine into free space:

    Spoiler:


    Usage:
    It's simple, you just callasm to this routine! It will remove all the player's items within itself.




    Bag Restoration


    This routine adds the items in the bag storage into the player's bag. It's designed to be called after you've backed up the player's bag. This will restore it! Also it doesn't overwrite the contents of the bag from before (it just adds to it). So if you wanted to delete the contents of the bag and then restore back the old bag, you'd have to call the above routine prior to calling this one.

    How to insert:

    Compile into free space the following routine:
    Spoiler:


    Usage:
    callasm to this routine! It's that easy to use. Also, if you would like to add multiple items (more than scripting would allow you) into the player's bag quickly, you can write to this RAM location in the format:
    [2 bytes (Item ID)][2 bytes (Quantity)]
    Quantity is maxed out at 999 or 0x3E7.




    Delete Backup


    It may be the case that you want to use this "bag swap" more than once. For that to work, you will have to delete the current backup. Normally if you don't delete the backup and you attempt to restore the bag for a second time, you will not have a problem. However, in the case that the first time you had your bag and you had more items that time than the second time it will not all be overwritten and you will add "extras". So to be on the safe side, after an event is over ALWAYS delete the backup!

    How to insert:

    Compile and insert into free space the following routine:

    Spoiler:


    Usage:
    Like all of these routines, you just need to callasm to this routine somewhere in your script. That's all, the rest is handle automagically!




    Technical notes:


    This is a section which I normally don't have in my routines, however, it occurred to me that if someone wanted to expand my current routines or make something similar they would have to do a lot of work which I've already done. So here are some technicalities about the bag.

    Spoiler:



    Here's a sample of what you can expect to do:



    Trainers Pokemon with Nicknames
    I would be great seeing your opponent trainers pokemon having nicknames, this feature ia better for a Coordinators pokemon or pokemon breeders pokemon.
     
    Last edited:

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • I would imagine if you have battled a wild pokemon(caught or otherwise), when you try to use a pokeball you will get a warning (similar to the "you cant use this here" message).

    So after a wild battle it puts a checkmark in a table, if the user goes back to that area, and tries to use a pokeball, they get the message.

    The table should be scalable per hack though, each hack has a different number of areas... or maybe tie it to the map flags...
    Yeah, on second thought I'm not going to do that. It's too much work/research. Plus I don't see a lot of nuzlocke hacks being made. JPAN's nuzlocke is probably all you'd ever need for that style of hack. This is very similar to another request I declined about tracking which Pokemon appear on a map. Unfortunately, I'm just not interested to invest time on such a feature.


    Trainers Pokemon with Nicknames
    I would be great seeing your opponent trainers pokemon having nicknames, this feature ia better for a Coordinators pokemon or pokemon breeders pokemon.
    This is a little complicated. I tried simply editing the nicknames in RAM, however, quite obviously that only works for all the Pokemon who aren't the first. So I'd have to do a little investigating to find the place where it's being generated. That being said, I can imagine having nicknames on opponent's Pokemon if they were main characters or something similar.
    I will look into implementing this!
     

    Lance32497

    LanceKoijer of Pokemon_Addicts
    792
    Posts
    9
    Years
  • This is a little complicated. I tried simply editing the nicknames in RAM, however, quite obviously that only works for all the Pokemon who aren't the first. So I'd have to do a little investigating to find the place where it's being generated. That being said, I can imagine having nicknames on opponent's Pokemon if they were main characters or something similar.
    I will look into implementing this!

    Gee Thanks!
    Im very excited >_<
    Challenge Cup
    Bulbapedia said:
    Unlike the other five
    Stadium Cups, however, players cannot use
    their own Pokémon, instead being handed a
    random rental team each time they begin a
    challenge.
    Species Clause
    A player cannot have two
    Pokemon with the same National Pokédex
    number on a team.
    (like in Inverted battle, you just set a certain flag to activate it, or your method, just set a certain var to activate.)
    Sleep Clause
    You lose if, at the end of
    your turn, two of your opponent's Pokemon
    were put to sleep by a move you used but
    were not forced into, and neither have had
    their sleep removed since then.
    (like in Inverted battle, you just set a certain flag to activate it, or your method, just set a certain var to activate.)
    Evasion Clause
    A Pokemon may not have
    the moves Double Team or Minimize in its
    moveset.
    (like in Inverted battle, you just set a certain flag to activate it, or your method, just set a certain var to activate.)
    OHKO Clause
    A Pokemon may not have
    the moves Fissure, Guillotine , Horn Drill , or
    Sheer Cold in its moveset.
    (like in Inverted battle, you just set a certain flag to activate it, or your method, just set a certain var to activate.)
    Moody Clause
    A team cannot have a
    Pokemon with the nature Moody .
    (like in Inverted battle, you just set a certain flag to activate it, or your method, just set a certain var to activate.)
     
    Last edited:

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Gee Thanks!
    Im very excited >_<
    <challenge cup and challenge cup rules>
    I don't really feel like doing a challenge cup. Also some of your features can be achieved using the already created party checker routine. Species Clause, Evasion Clause, OHKO clause can all be done by it. Maybe if I feel like it in future :P


    Custom nicknames for enemy Pokemon


    So this works for any wild or trainer Pokemon. It basically allows you to nickname a Pokemon on the enemy team prior to battling. For those special trainers or maybe special Pokemon :)

    How to insert:

    There's actually a little bit of work before you can compile and insert routines. First look at the routine below. You'll notice at the last line there is a Pointer to something that I call "TABLE". This table is going to be a table full of nickname with each entry 0xB bytes long. Find some space in your ROM which you will use for this table and correct the offset accordingly.

    Spoiler:

    Once you've made the modification to the pointer, compile and insert the routine into freespace.
    Next navigate to offset 0x406DC and insert the following:
    Code:
    00 48 00 47 XX XX XX 08
    Where XX is the pointer to the above routine in reverse hex +1.

    Usage:
    First navigate to your table which will contain the nicknames (it should be the offset in the routine you changed). You need to keep the table formatted like this [10 bytes (Name in hex)] [1 byte (0xFF)]. Insert as many names as you'd like.

    Next, to activate the routine, you must setflag 0x270 AND you need to setvar 0x8000 0x[table starting index].
    If you're battling a trainer with 6 Pokemon, the nicknames will be determined from the table. It will read six nicknames starting from the starting index given by variable 0x8000. There is no need to callasm. :)

    wZeZnYU.png
     

    DJTiki

    top 3 most uninteresting microcelebrities
    1,257
    Posts
    10
    Years
  • Alright, I have a request. Remove the "Save" Option from the main menu but still be able to save it using the special, if I'm correct(I'm not sure if this was done yet, just a neat suggestion)
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Alright, I have a request. Remove the "Save" Option from the main menu but still be able to save it using the special, if I'm correct(I'm not sure if this was done yet, just a neat suggestion)

    This is a funny request. Believe it or not, I was asked this a few days ago by Team Fail. We were able to do it, and it's rather simple. I'm not sure if he would appreciate me sharing. I'll talk to him and see if he doesn't care then edit the post with the details. Documentation of the start menu was done on the HM crusade if you care to know :P
     
    416
    Posts
    11
    Years
    • Seen Feb 10, 2024
    This is a funny request. Believe it or not, I was asked this a few days ago by Team Fail. We were able to do it, and it's rather simple. I'm not sure if he would appreciate me sharing. I'll talk to him and see if he doesn't care then edit the post with the details. Documentation of the start menu was done on the HM crusade if you care to know :P

    so like you could use items to save, but not the main menu... thatd be cool
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Alright, I have a request. Remove the "Save" Option from the main menu but still be able to save it using the special, if I'm correct(I'm not sure if this was done yet, just a neat suggestion)
    He says I can post it, so I will now :)

    so like you could use items to save, but not the main menu... thatd be cool
    Hi, this is a matter of tracking the routine that does the saving and calling it. While I don't know where it is, perhaps you can track it down if I tell you that the routine called when you hit save in the start menu is 0x6F4E8. Happy hacking!

    Interesting, this will be helpful in the future. :D
    That's the plan, if you have any routines which you would like to see, feel free to request them here.

    Swapping between two possible start menus


    Basically this routine will allow the player to have two different start menus. The start menu shown is dependent on a flag being set. The second one will not have a "Save" option.

    How to insert:

    Compile and insert into free space the following routine:
    Spoiler:


    Navigate to 0x6ED5C and insert the following byte changes:
    Code:
    00 48 00 47 XX XX XX 08
    Where XX XX XX is the pointer (plus 1) in reverse hex to where you inserted the routine.
    Navigate to 0x6EE42 and change 08 to 00.

    Usage:
    setflag 0x250 = show menu without save
    clearflag 0x250 = show menu with save

    That's it. It's toggled internally depending on the flag's state.
     
    Last edited:

    Lance32497

    LanceKoijer of Pokemon_Addicts
    792
    Posts
    9
    Years
  • Pokemon Item Checker + Silent Evolution Combination as an item effect
    This is my personal request that canbe a general feature.
    I wanted in my hack to make Mewtwo evolves into Armoured Mewtwo with "Legendary Armour"
    but this is not the same in others, It will evolve Mewtwo using Metal Vessel if it is holding Legendary Armour but in a silent mode.
     

    Joexv

    ManMadeOfGouda joexv.github.io
    1,037
    Posts
    11
    Years
  • Pokemon Item Checker + Silent Evolution Combination as an item effect
    This is my personal request that canbe a general feature.
    I wanted in my hack to make Mewtwo evolves into Armoured Mewtwo with "Legendary Armour"
    but this is not the same in others, It will evolve Mewtwo using Metal Vessel if it is holding Legendary Armour but in a silent mode.

    If you would read some of the older posts, Fbi Agent said he wasnt gonna do this cause daniilS has done it but hes working on it some more. aSk him is you would want to use it.
     

    Lance32497

    LanceKoijer of Pokemon_Addicts
    792
    Posts
    9
    Years
  • If you would read some of the older posts, Fbi Agent said he wasnt gonna do this cause daniilS has done it but hes working on it some more. aSk him is you would want to use it.

    No no no, Daniils is working for mega evolution, and it is definitely not the same in my request, Mega evolution occurs inside the battle while my request occurs in overworld.
     

    Joexv

    ManMadeOfGouda joexv.github.io
    1,037
    Posts
    11
    Years
  • No no no, Daniils is working for mega evolution, and it is definitely not the same in my request, Mega evolution occurs inside the battle while my request occurs in overworld.


    Yes I understnad that. He also made this. He shared the old version of the code with me, but I am no good at asm so it wasnt very useful in my hands.T.T
     
    Back
    Top