• 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

Blah

Free supporter
1,924
Posts
11
Years
  • Actually I just though of a bunch more stuff after messing around my hack.

    1: enemy pokemon to be able to have custom stats eg a ho-oh with 300 attack or a lugia with 500hp
    Thanks in advance!
    I'll look into doing number 1. The rest you've mentioned are already done, or in battle routines (which I don't like doing unless it's for something I want to do :3).

    Hi FBI! Just wanted to say THANK YOU SO MUCH for your help with calling a different event after snagging a Trainer's Pokémon! I now have a fully functioning script template I can reuse into infinity for loads of awesome snag battles. So yeah, that's awesome, and I couldn't have done it without you :)

    ...That sort of leads into my request, which I really hope is a quick'n'easy one - might there be a way to preserve the Original Trainer's name in the stats of a snagged Pokémon?

    I know it seems like a small thing to be bothered about, but I just really like the idea of a player being able to look back at their party at various points during the game and see which Trainers they stole their team from. It'd make the whole thing a lot more personal and just plain cool - plus it doesn't make an awful lot of sense for the stats to display a different ID number with the Player's OT name. :) Um, as always, please don't bother with it this if it's not your thing, though :)

    Along the same sort of lines, it'd be nice to be able to do the same thing with the givepokemon command. Hang on, I can explain this better:

    1) Pokémon snagged in Trainer battles always have the Trainer's ID number but the Player's OT.
    2) Pokémon given in scripts always have the Player's ID number and the Player's OT.

    So essentially, what I'm asking is whether it's possible to retain the Trainer's OT in snagged Pokemon, and also whether it's possible to temporarily force the givepokemon command to encode a different ID number and Trainer's OT - for events where I want to show the Player 'stealing' a Pokémon without battling a Trainer.

    Um, I know the second one might be harder because it has to deal with extra stuff like whether the Pokémon goes to the party, the PC or the boxes are full, so I'm really sorry if it sounds like I'm asking too much. But hey, if you don't ask you'll never know ;) so I figured I'd throw it out there just in case.

    Thanks so much again, and mega-super-ultra-kudos on all the routines you've churned out since my last visit! Keep on rockin' :D

    I can do all of those. I'll put it on my list (I've got quite a few things I'm doing atm :X).

    2 has already been done... id put it here but its not my work. Just search the forum for it. Real simple to insert.

    5 can be done with a level script, just reset each trainer flag and battle flag on that map... this is nice cause u can do it for only certain maps (not every map)

    Thanks.

    I tried getting it to delete the save file and to return to the titlescreen afterwards, but I couldn't get a brief flash of the pokécenter to disappear. I might fix it later, but as for now, here's a much more simple version using SoftReset:
    Code:
    Type 5F F1 53 FC 00 DF at 0807F5B6 and F1 E7 at 0807F5D0.
    Great work! I'll add it to the front post (or maybe the kind Spherical Ice will :3).

    Sorry, I guess I wasn't as specific as I thought, I wanted the abilities to be accessible through the pokemon menu, such that I could call the move at any point rather than on signpost/person event.
    I specifically mean like when you use fly from any place on a map, where it runs the animation and then the action happens, though as long as it runs to a script for the action, I don't necessarily need the animation

    Oh man, the BRM (bottom right menu). I looked into the BRM when I was trying to remove fly, and ultimately gave up. It was very much a large amount of confusing code which wasn't made very organised. I'm going to have to turn down your request, simply because of how hard it is. Making a move come up in the BRM is actually a lot of work, lots of repointing and code that needs reworking.
     
    199
    Posts
    12
    Years
    • Seen Jul 18, 2016
    I'll look into doing number 1. The rest you've mentioned are already done, or in battle routines (which I don't like doing unless it's for something I want to do :3).

    If you do end up making the custom stats for enemies work then would it be possible to give it "auto-buffs"? As in, You start a battle with say - Zapdos. You can set it to have stage +4 Special Attack and stage +2 Speed. Or you could perhaps make it start with the Safeguard status or something.
     

    Turtl3Skulll

    Blue Turtl3
    76
    Posts
    10
    Years
  • Oh man, the BRM (bottom right menu). I looked into the BRM when I was trying to remove fly, and ultimately gave up. It was very much a large amount of confusing code which wasn't made very organised. I'm going to have to turn down your request, simply because of how hard it is. Making a move come up in the BRM is actually a lot of work, lots of repointing and code that needs reworking.

    I understand, thanks for explaining the why, it makes me feel better about not getting the hack XP lol Honestly thanks :)
    Last thing, did you (during the research) find out how to possibly replace an action from one, like 'sweet scent' like maybe the offset for it & I can try looking up a repointing of it maybe??

    Gotta say I love the hacks I've tried out & definitely are changing the way I'm doing my hack :D
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Roaming Pokemon!


    Brief introduction:
    This is probably the longest and maybe complicated chunk of ASM implementation I've done. It's a 100% reproduction of the new generation roaming mechanics. I've also expanded a little bit to include customization of the maps the Pokemon can roam in (which is designed for expandibility for disjoint map selections). There is also other smaller customizations for the user like encounter chance, and time taken before the wild Pokemon moves on to a new map. The whole system is rather expandable, so you CAN have multiple Pokemon Roaming at once, and even multiple roaming the same map!

    There IS a lot of work that went into this, and I do hope that a lot of people may end up using it. I'll maybe make a patch for it later, simply because of the sheer amount of insertions you need to do (maybe 15 mins worth. It took me much longer to make, lol).


    Before inserting these routines, you need to insert BattleByMove and my Random routine


    BattleByMove:
    You need to change the table offset on the last line (and write it down).
    Spoiler:


    Random
    Spoiler:




    Roaming Pokemon Routines


    Here's a run down video of what the routines actually do:
    Spoiler:




    Create Roaming Pokemon


    I call this roam for short. It's a routine which handles the creation of a roaming Pokemon. If you've inserted my shiny Pokemon hack, it is compatible with my routine, and you can create a shiny legendary roamer.
    Pokemon who roam will have 4 perfect IVs.

    To insert:

    Before compiling look at the orange text in the following routine and fill in the XXXXXX with a pointer to where you inserted the random number routine from before (add 1 to the pointer, but don't put it in reverse hex).
    After that, compile into free space (and write down the offset).

    Spoiler:


    Usage:

    This is the routine that creates your roaming Pokemon in RAM. It takes in variables a few paramaters and outputs a Pokemon in the RAM region of 0203D000s. If you want to make a Pokemon roam this is the routine you call.

    In a script:
    Code:
    setvar 0x8000 0x[Species ID]
    setvar 0x8001 0x[Level]
    setvar 0x8003 0x[Map table index (to be explained in a later section)]
    callasm 0x[this routine +1]



    Purge Roamer


    I called this delete roamer in the video. Basically it just deletes a currently roaming Pokemon. It is standalone, so you can use it in your scripts. Though it's main use is within another routine which will be introduced later.

    How to insert:

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


    Usage:

    Code:
    setvar 0x8000 0x[Which roaming Pokemon you want to delete (slot #)]
    callasm 0x[this routine +1]



    Cancel Roam


    In the video I called this possible deletion. It basically makes it so the Pokemon won't be encountered again if the player makes it faint or captures it.

    How to insert:

    Before compiling the routine, look at the orange text. Set the XXXXXX to the pointer to where you inserted purge roamer +1 (once again, not in reverse hex).
    Spoiler:


    Now navigate to 0x6D5F8 and insert these byte changes:
    Code:
    00 4A 10 47 XX XX XX 08
    Where XX XX XX is the reverse hex pointer to where you inserted this routine +1.

    Usage:
    There is no use. It's run internally inside the game. I mean...magical use :3



    Inject into Map


    In the video I called this routine modEncounter. This routine checks if there is a Pokemon roaming in the map you're in. If there is, it will generate a random number and if the random number is zero the roaming Pokemon will appear instead of the normal Pokemon. You can set the "encounter chance" inside this routine.

    To insert:

    Before attempting to insert look for the orange text again. There are two occurrences. One is to control the encounter chance and the second should be a pointer. The pointer, is ofcourse, going to be where you inserted my random routine +1 (not in reverse hex). The encounter chance is going to control how many possible numbers we will get. The roaming Pokemon only shows if we get a zero. So that means the greater r1 is, the less of a chance we encounter the Pokemon. 1/r1 chance to be precise. By default I've left r1 as 0x1 = 1/1 = 100% chance. After the modifications compile and insert into free space.

    Spoiler:


    Once you've modified the orange text, and have compiled the routine, navigate to 0x82A10 and insert the following byte changes:
    Code:
    00 48 00 47 XX XX XX 08

    Usage:
    Silly human, there is no usage! It's all done by the power of ASMAGIX.



    Quick Roam map table mechanics overview


    Here's a video explanation (instructions on how to make the table as well..which is kinda very important):
    Spoiler:


    Watch the video. When you see .TABLE being referenced, you should know it follows the above table format. In case you don't understand my words (sorry!) I'll explain rather briefly again.
    The table is a table of pointers. Each pointer leads to another table. The second table contains
    [1 byte (amount of maps)] [1 byte (Map bank)] [1 byte (Map number)]. Make sure when you're making the tables, the first one needs to be word aligned -1, and the second needs to be "half-word aligned" minus 1.



    Map Change


    Every X minutes, the maps which the roaming Pokemon are roaming change. What they change are randomized based on the table with the map's contents.

    To insert:

    Before inserting there's a bit of orange text that needs editing again. The first one is how often roaming Pokemon change maps. I have it set to 0x2 which is two minutes. You can change it to however long you want. Must be between 1 and 59 minutes. This is also the duration it will take once you've set the roamer, for it to actually appear in game. Realistically, I would think anywhere between 5-10 minutes (0x5 - 0xA) is ideal.

    The second orange text, is just a pointer to where you inserted the random number generator +1 (not in reverse hex).
    Finally the last orange text is a pointer to the table of map tables (basically a pointer to the main table). Once you've fixed the orange letters, compile the routine into free space.

    Spoiler:


    Next you need to insert my minuteRun routine as well. But, at the bottom of the routine there's a pointer called Table which you need to change. Change this pointer table to be some new free ROM space you haven't used and won't be using. Make sure the offset is divisible by four and don't add 1.

    Spoiler:


    Once you've fixed that pointer, compile and insert the minuteRun routine into free space.

    Now navigate to 0x548A8 and insert the following byte changes:
    Code:
    00 48 00 47 XX XX XX 08
    Where XX XX XX is the reverse hex pointer to where you inserted the minuteRun routine +1.

    Next, go to the table offset you changed in minute run. Insert there a reverse-hex pointer to the map change routine +1 there.

    Usage:

    Dear user, there isn't a usage for making the Pokemon move maps every x minutes. The game's clock determines that, not you [insert non-spoink gif here]. :3



    Flee battle


    This is a large routine and that does A LOT of work.
    1) Checks if the Roamer is trapped by trapping moves (block, mean look, ect..)
    2) Checks if the Roamer is trapped by ability (arena trap, shadowtag, ect..)
    3) Checks if the Roamer is trapped by duration move (wrap, fire spin, ect..)
    4) Check if it's the Roamer's turn (i.e if the player is faster roamer will get hit before fleeing)
    5) Saves any battle damage or status changes appied in battle (HP dmg, poison/paralyze)
    6) Once the Roamer flees, change it's current roaming map location

    How to insert:

    There are two occurrences of orange text. The first one requires you to set the pointer to the random number generating routine +1 (not in reverse hex). The second one is a pointer to the table I've talked about prior. Once you've done those changes, compile the routine into free space.

    Spoiler:


    This is indeed a battle modes, Battle by move add-on routine. It's inserted as such too. Remember that offset I told you to write down?
    BattleByMove:
    You need to change the table offset on the last line (and write it down).
    I'm glad you listened and wrote it down, because now we need it :P
    The table line which we edited at the bottom of the routine, is the specific line that we need. Navigate to that table location and insert the reverse hex pointer +1 of the flee routine there. That's it, the rest is handled by the Battle by move routine, luckily!

    Usage
    That's it, the rest is handled by the Battle by move routine, luckily!
    Please understand user, you don't really need to do anything :D


    Bugs/Oddities


    - If you make a Pokemon with explosion roam, trap it, and make it kill itself. It'll stick around roaming with the health it had before using explosion/suicide move. Try to avoid suicide roamers.

    - Right before the "Wild X has fled" text appears, it says, "Wild X used Y move". Though the move isn't used, it's just said and then the flee text/fleeing action follows. It's a rather minor bug as it effects nothing, but an oddity anyways.

    Demonstration


    Sorry, I had to talk over this video too. There were some things that I wanted to make clear :P


    Updates:
    - Fixed a bug where levitate and flying types couldn't get away from arena trap
     
    Last edited:

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • If you do end up making the custom stats for enemies work then would it be possible to give it "auto-buffs"? As in, You start a battle with say - Zapdos. You can set it to have stage +4 Special Attack and stage +2 Speed. Or you could perhaps make it start with the Safeguard status or something.

    This is a battle script hack, which is against my normal policies. However, maybe someone else will pick it up for you :)

    I understand, thanks for explaining the why, it makes me feel better about not getting the hack XP lol Honestly thanks :)
    Last thing, did you (during the research) find out how to possibly replace an action from one, like 'sweet scent' like maybe the offset for it & I can try looking up a repointing of it maybe??

    Gotta say I love the hacks I've tried out & definitely are changing the way I'm doing my hack :D
    Research on field moves was done too by Touched, so you can always check that out. Though, for the BRM making the move appear is the problem, rather than making it do something. Back when I looked for it, I couldn't find the chunk of code that actually did the move check. I did find the text generation, but that's useless without knowing the location of the code that generates the text values. I might look at it again, the research I did do on the BRM was back when I was still very new the ASM, so maybe now I can figure it out :)


    My to-do list:

    1) Swarming Pokemon
    2) Capturing trainer Pokemon with retained OT name
    3) Giving Pokemon with different OT names
    4) Enemy Pokemon custom stats (err...maybe if I feel like it :P)
    5) Research on the menu option "Option"
    6) Work on my own things
     
    199
    Posts
    12
    Years
    • Seen Jul 18, 2016
    This is a battle script hack, which is against my normal policies. However, maybe someone else will pick it up for you :)

    Ah, my mistake. Thanks anyway. :D
    --
    Also about that last video you posted... I thought Arena Trap wasn't meant to actually work on Flying types like Lugia?
     

    Trainer 781

    Guest
    0
    Posts
    Updated light ball to raise Pikachu's attack:

    Spoiler:
     

    daniilS

    busy trying to do stuff not done yet
    409
    Posts
    10
    Years
    • Seen Jan 29, 2024
    In regards to Aruaruu's request: can't you update the battle framework to include the battle initialisation as well? This could result in lots of interesting things, including stat boosts since those are just values in the RAM.
     

    Lance32497

    LanceKoijer of Pokemon_Addicts
    792
    Posts
    9
    Years
  • o.O I am waiting for that feature! Youre Great!

    Request ^_^
    Skipping Titlescreen when youll play a new game
    So, when you are about to start new game, instead of bootscreen will play, it starts in Prof. Oak intro.
    so the pattern will be
    the screen where Gamefreak and Nintendo appears»Oak Tutorial
    Then if theres a saved game...
    It will be normal
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Ah, my mistake. Thanks anyway. :D
    --
    Also about that last video you posted... I thought Arena Trap wasn't meant to actually work on Flying types like Lugia?

    OMG! I don't play the Pokemon games, so I don't actually know how arena trap works ( or 90% of these abilities actually). I thought it just trapped people. Anyways, I fixed the rooutine. Thanks for pointing that out :)

    Updated light ball to raise Pikachu's attack:

    Spoiler:

    Nice job!

    In regards to Aruaruu's request: can't you update the battle framework to include the battle initialisation as well? This could result in lots of interesting things, including stat boosts since those are just values in the RAM.
    Is that directed to me? I'm not interested in Pokemon battles much anymore. Most of the abilities and stuff can be done in BS n' stuffs.

    Knight Of Duty said:
    Can you create a move checker which would search the whole party for a pokemon with a move?
    There's a scripting command for this. Also my partychecker can do it too.


    Ability switching:


    Very simple, it turned out to not have to adjust the PID.

    How to insert:

    Just compile the following routine into free space:

    Spoiler:


    Usage:

    Set in variable 0x8004 the slot number of the Pokemon who's ability you want to swap. Note that Pokemon with only 1 ability won't have their abilities swapped. I've made it so it's easy to use with special 0x9F in your ability swap item script.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Buffering Pokemon Abilities in the Overworld


    Someone in the beginner's lounge ASM help thread didn't know how to do this. It's kinda of technical and not very easy for a beginner. I wrote this routine out to help him, though it's probably useful to some other people too. All it does is convert a Pokemon's ability bit into a string which represents the Pokemon's ability name. There were two tables which I had to "surf" to fetch it.

    How to insert:

    Just compile and insert the following routine into free space:

    Spoiler:


    Usage:

    The routine requires variable 0x8004 to be the slot number of the Pokemon who's ability you want to buffer. The buffered string is placed in the script buffer which is at RAM offset 0x2021D18. The rest is automagic. It can be called in a script like this:

    PKSV:
    Spoiler:


    XSE:
    Spoiler:


    Here's a present with a lot of heros:
    KYTNcRt.png
     
    Last edited:
    416
    Posts
    11
    Years
    • Seen Feb 10, 2024

    Roaming Pokemon!


    Map Change


    Every X minutes, the maps which the roaming Pokemon are roaming change. What they change are randomized based on the table with the map's contents.

    Usage:

    Dear user, there isn't a usage for making the Pokemon move maps every x minutes. The game's clock determines that, not you [insert non-spoink gif here]. :3

    I am concerned about this small section... what if the hack does not have a DNS inserted. or is not using RTC at all. just vanilla red. could this still work? or is there a change that makes it pick a new map every time you change maps (like it did in original GS)

    I would be very interested in making this into a tool for quick insertion. but I would want it to be usable as a standalone tool if the user did not have a RTC, if they did however, they could use this tool aswell (with a time limit like it currently is).
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • I am concerned about this small section... what if the hack does not have a DNS inserted. or is not using RTC at all. just vanilla red. could this still work? or is there a change that makes it pick a new map every time you change maps (like it did in original GS)

    I would be very interested in making this into a tool for quick insertion. but I would want it to be usable as a standalone tool if the user did not have a RTC, if they did however, they could use this tool aswell (with a time limit like it currently is).

    It's using the ingame timer. So the play time timer, which imo is the best and only timer you'll ever need. There's no RTC you would need for this :)
     
    416
    Posts
    11
    Years
    • Seen Feb 10, 2024
    It's using the ingame timer. So the play time timer, which imo is the best and only timer you'll ever need. There's no RTC you would need for this :)

    VERY COOL!

    since you brought up the in game timer (which i never knew was accessible) could you make it accessible in script.

    so if I wanted to give the player 30 seconds to get through a door I could get the timer value and store it, then at the door, compare the current value to the stored value value + 30seconds and if the current value is later than that, slam the door in their face...

    now that thats done, would you be terrably upset if I made a tool/program to insert your roaming hack. since its awesome and difficult lol (of course all the credits go to you)
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Using Playtime as a Clock


    A breif intro to those who don't know, there is an ingame timer in Fire Red which counts a little over to 41 days worth of play time. The timer can be cleverly manipulated to behave like a clock or timer because it has proper incrementations at every second, minute and hour. I wrote a few routines which you can use for timing routines and to return the current ingame Hours, mins and seconds.



    Current Time into variables


    This routine basically takes the current ingame hours, minutes, and seconds and places the three into the variables 0x8000 = hours(2 bytes), 0x8001 = mins(1 byte), 0x8002 = seconds(1 byte). I suppose you can merge into 0x8001 both the minutes and seconds, but this way is easier to access.

    How to insert:

    Compile and insert the following routine into free space.

    Spoiler:


    Usage:
    In a script callasm 0x[where you inserted this routine +1]. The variables 0x8000, 0x8001, 0x8002 will be updated with the current hours, minutes and seconds respectively.



    Minutes Played


    This routine will return your total play time in the form of total minutes played. The resulting number of minutes is a half word stored in variable 0x800D (lastresult)

    To insert:

    Simply compile and insert into free space the following routine:

    Spoiler:


    Usage:

    In a script callasm 0x[This routine's offset +1]. The amount of minutes played will be inserted into the lastresult or variable 0x800D. That's it.



    Seconds Played


    This one is a little special in the sense that I use the Minutes Played routine to help save some work generating the amount of seconds played.

    How to insert:

    To insert this routine you first need to have inserted the Minutes Played routine (one above this one). After that, look at the text in orange. You need to replace that with a pointer to where you inserted the routine +1.

    Spoiler:


    Usage:

    The pointer to the number of seconds is at RAM location 0x20370B8 and is 4 bytes long (though the first byte is 00 always). So to use in a script, you would callasm 0x[this routine +1] and then the value will be in 0x20370B8 and extend to 0x20370BC. It's accessed the same way as you would access a variable.

    How to use these to make timed events:

    This section is basically for noobs, so if you know what you're doing, carry on :P

    If the timer for the event is less than 1 minute use the seconds played. Before starting the event, call seconds played, store the values it returns. Then at the end of the event call the seconds routine again. Subtract the new return with the return from the first time calling the routine. The resulting number is the amount of seconds which have passed since the start of the event.

    If your timer is more than or equal to 1 minute, use the minutes timer. It's much easier to use because the return is in 0x800D (lastresult). Take the return and copy it into a variable. Then at the end of the event call it again and subtract the new one with the old one. The amount of time passed in minutes is the result.

    If for some reason, you wanted to display start time in the format Hours, minutes, seconds, you would use the first routine where certain variables contain these values.


    since you brought up the in game timer (which i never knew was accessible) could you make it accessible in script.

    now that thats done, would you be terrably upset if I made a tool/program to insert your roaming hack. since its awesome and difficult lol (of course all the credits go to you)
    Yes I can make it accessible in a script :P
    I don't mind if you make a tool at all.
     

    Turtl3Skulll

    Blue Turtl3
    76
    Posts
    10
    Years
  • Mini-update (not really mini kinda a big deal)
    I've upgraded the original party level set function to work in constant time. Now it's quite instantaneous regardless of the level difference. Anyways, for the guy who was talking about skipping the introduction and saving the game afterwards, I've talked to both Touched and Bela. Bela gave me permission to post it, and Touch gave me the code (I forgot to ask him, but he loves me so it's probably OK).

    Here are the byte changes he wants you to do in order to achieve an intro skip similar to Pokemon Rose (which you guys should all checkout, Bela's it's quite an awesome project).

    Assuming you want to just use the Oak intro, but want to skip the naming of the player and the rival, which bytes would you change, and which ones would stay??
     
    Back
    Top