• 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

jiangzhengwenjzw

now working on katam
181
Posts
11
Years
    • Seen yesterday
    Although I do not know ASM, I use Ur hack "Trainer Capture toggle by Pokeball". The ball depending system works right but when I captured trainers' Pokemon the Pokemon changed into bad egg.
    Another question: What should be the reversed hex pointer? If the original pointer is 0x123456, then the reversed pointer plus one should be 573412 or 754321?

    If I mistake 754321 for 573412, that may be the reason why bad egg occurs.
    Forgive my terrible English.
     

    daniilS

    busy trying to do stuff not done yet
    409
    Posts
    10
    Years
    • Seen Jan 29, 2024
    Like promised, here's a routine to let Pokémon die from poison in the overworld:

    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global calltheexecutioner
    
    @flagcheck:
    @	mov r0, #0x__ /*flag/4*/
    @	lsl r0, r0, #0x2
    @	ldr r3, decryptflag
    @	bl jump2
    @	cmp r0, #0x0
    @	beq end
    main:
    	ldr r3, deletefaintedpokemon
    	bl jump
    end:
    	add sp, #0x4
    	pop {r4, r5, pc}
    jump:
    	push {r0-r5, lr}
    jump2:
    	mov pc, r3
    
    .align 2
    decryptflag:		.word 0x0806E6D0
    deletefaintedpokemon:	.word 0x________+0xA@+0xE /*offset of FBI's routine*/
    
    /*remove the last @ if you're using a flag check in FBI's routine.
    Remove all other @s if using a flag check in this routine.*/
    /*Insert anywhere. Then, at 080A04F2, type C0 46 00 4B 9F 46 XX XX XX XX,
    where XXXXXXXX is an inverted pointer to this routine.*/
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • sooo funny story...

    I kept getting errors when I tried to test if the pokemon menu item would appear. every time I gave the user a pokemon it would go all rainbow and freeze up... test after test after test... failure... turns out... I was using a text "'player' got the 'buffered name' from oak" and i forgot to buffer the name lol

    anyway. it works perfectly thanks so much ;)
    No problem.

    [RUN AWAY]
    Once I finish porting other abilities I'll make a brand new post for the
    Emerald version of this.

    Good work! I'll add it to the first post.

    So here's something you don't see here everyday: a port to EM!

    FBI's battle mode hacks are looking awesome, and it'd be a cardinal sin if EM didn't have these features.

    So here, have the Battle Routine by Move. (and the deletePokemon routine)
    [ROUTINES]

    eww, Emerald. I'm just joking, good work :P
    I'll add it to the first post.

    A routine that changes the pokemon nature/Ability through script

    Pokemon Nature and Ability are determined by it's PID. While it is possible to change the PID to match certain properties like ability and nature, you may end up changing other things like Shinyness and gender. That's why I'm going to say no to this.

    Although I do not know ASM, I use Ur hack "Trainer Capture toggle by Pokeball". The ball depending system works right but when I captured trainers' Pokemon the Pokemon changed into bad egg.
    Another question: What should be the reversed hex pointer? If the original pointer is 0x123456, then the reversed pointer plus one should be 573412 or 754321?

    If I mistake 754321 for 573412, that may be the reason why bad egg occurs.
    Forgive my terrible English.

    You missed a byte change. There's one for making the trainer Pokemon capturable, and another to make it so it's not a bad egg. Look at the first post and find capturing trainer Pokemon.

    Like promised, here's a routine to let Pokémon die from poison in the overworld:
    [routine]

    Nice work. I'll add it to the first post.


    Random Natural Number Generator


    There's a Random Number generator in scripting thats limited to [0, 255) results. This one is a routine that returns a random number from [0, 65535). So in some ways it's more "random" because it does have a larger domain. Well I'll let you think up of what you'll use it for. The reason I'm posting it seperately is because it does have standalone uses, AND I'll be using it for Roaming Pokemon and Swarming Pokemon. So you kinda need this for those :)

    How to insert:

    Simply compile into free space the following routine:
    Spoiler:


    Usage:
    Set variable 0x8000 to the amount of results you want in hex. It will do 0x0 to 0xFFFF exclusive. The resulting random (natural) number is placed is variable 0x8000. That's all :)


    I'm going to be making a few more of these "mini-functions" because Roaming Pokemon like in the new generation has a lot of mechanics in the background which I'm implementing. Also if you're posting routines please keep it in spoiler tags :x
     
    6,355
    Posts
    18
    Years
    • Seen Apr 16, 2020
    I love how this thread is progressing and how people are contributing their routines so I'm going to make it sticky. Everyone's contributions will be updated to the main post and organised properly. :) Keep it up!

    Aaand I'm also going to move this to Research & Development now as it fits there more.
     
    Last edited:

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Shiny Pokemon


    Brief-ish intro:

    Spoiler:


    How to insert:

    Before you can insert this routine you need to have inserted the Random number generating routine from before. Remember the offset which you inserted it because you're going to need to remember in a short while.

    Look at the Orange text in spoiled code below. Insert inside the brackets the location of where you compiled the random number generator code. Make sure to add an 0x8 prefix. So if I compiled the random number generator at 0x743210, I'd write:
    Code:
    ldr r4, =(0x8743210 +1)

    After you've fixed that line, compile the code and insert into free space.
    Spoiler:


    Now navigate to 0x3DB00 and insert the following byte changes:
    Code:
    00 48 00 47 XX XX XX 08
    Where XX XX XX is the reverse hex pointer of where you compiled the PID generating routine +1.

    Finally, go to 0x3DAF6 and insert the following byte changes:
    Code:
    00 00 02 E0

    Usage:
    setvar 0x8002 0xFF 'This line makes it so the next Pokemon you encounter, or are given is a shiny Pokemon with a properly generated PID. I've made it so the code sets 0xFF back to 0x0 so you don't have to disable it after. There's only an enable switch :)

    Here are two Tyranitars generated with the same hack (No EVs)
    QoqDajq.png
    viskQtV.png

    QELE4Xt.png
    DgUxgMp.png
     
    Last edited:
    416
    Posts
    11
    Years
    • Seen Feb 10, 2024
    setvar 0x8002 0xFF 'This line makes it so the next Pokemon you encounter, or are given is a shiny Pokemon with a properly generated PID. I've made it so the code sets 0xFF back to 0x0 so you don't have to disable it after. There's only an enable switch :)

    Did you put in functionality for more than 1 pokemon.
    like the shinyizer you can set it for a whole trainers belt (where some are shiny and others are not)

    ive got an item I use in some hacks called shiny spray, it gives you a 50% chance of seeing a shiny pokemon for the next 3 battles (guaranteed to see 1 shiny). so in order to utilize your "better" IV seed, your routine would need to be able to read (and apply) more than 1 poke in the future.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Did you put in functionality for more than 1 pokemon.
    like the shinyizer you can set it for a whole trainers belt (where some are shiny and others are not)

    ive got an item I use in some hacks called shiny spray, it gives you a 50% chance of seeing a shiny pokemon for the next 3 battles (guaranteed to see 1 shiny). so in order to utilize your "better" IV seed, your routine would need to be able to read (and apply) more than 1 poke in the future.

    No it doesn't work for trainers, only Pokemon the player encounters, or battles in a script, or is given. This routine is perfect for a single encounter, and isn't suited for opponent trainers with teams full of shiny Pokemon. For your shiny spray, I would change the item mechanics rather than the routine.
    Spoiler:


    Also it's not a better IV seed. It's an actually random shiny PID generator, which happens to be the determining factor for IVs :)
     
    16
    Posts
    9
    Years
  • I have had an idea for some time about creating a system where the levitate ability is not an ability but rather a toggle-able byte on each pokemon. For instance, one could feasibly create a Hydreigon with the ability intimidate that also has the benefits of levitate, (by virtue of the hack). It's always bothered me that I had to choose between giving pokemon that weren't flying-type like venomoth the ability levitate or a real ability.
     

    Trainer 781

    Guest
    0
    Posts
    A suggestion.
    Hey how about implementing an Ability Capsule from Gen VI which helps you to toggle between the primary and secondary abilities of a mon in the overworld.
     

    Turtl3Skulll

    Blue Turtl3
    76
    Posts
    10
    Years
  • How about an ability to add overworld Pokemon abilities, such as rock smash, surf, fly, sweet scent, etc. For custom made moves such as "Future Sight" in the celebi movie where it's used to find time warps, but not limited to just this move, but to any move one would choose to have a custom script activated for it. (I feel like this may have already been implemented but can't find where at, though I know you can do it FBI Agent :D )
     
    416
    Posts
    11
    Years
    • Seen Feb 10, 2024
    How about an ability to add overworld Pokemon abilities, such as rock smash, surf, fly, sweet scent, etc. For custom made moves such as "Future Sight" in the celebi movie where it's used to find time warps, but not limited to just this move, but to any move one would choose to have a custom script activated for it. (I feel like this may have already been implemented but can't find where at, though I know you can do it FBI Agent :D )

    This is done with a script that checks if a pokemon knows a move. In ultra violet version I used earthquake to clear some rocks...

    The only issue is its not usable from the start menu (like fly or flash) u use it by 'talking' to the target (like surf cut or rocksmash). It would require asm to make them show in the pokemon menu.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • 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 have had an idea for some time about creating a system where the levitate ability is not an ability but rather a toggle-able byte on each pokemon. For instance, one could feasibly create a Hydreigon with the ability intimidate that also has the benefits of levitate, (by virtue of the hack). It's always bothered me that I had to choose between giving pokemon that weren't flying-type like venomoth the ability levitate or a real ability.
    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 :)

    A suggestion.
    Hey how about implementing an Ability Capsule from Gen VI which helps you to toggle between the primary and secondary abilities of a mon in the overworld.
    Hi, I'll look into this. If I end up needing to adjust the PID, it may end up a little much :x

    How about an ability to add overworld Pokemon abilities, such as rock smash, surf, fly, sweet scent, etc. For custom made moves such as "Future Sight" in the celebi movie where it's used to find time warps, but not limited to just this move, but to any move one would choose to have a custom script activated for it. (I feel like this may have already been implemented but can't find where at, though I know you can do it FBI Agent :D )

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

    Errrr... Which one of the byte changes is about the bad egg?
    Here:
    Spoiler:


    To be able to see the enemy's hp in battle
    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.

    This is done with a script that checks if a pokemon knows a move. In ultra violet version I used earthquake to clear some rocks...

    The only issue is its not usable from the start menu (like fly or flash) u use it by 'talking' to the target (like surf cut or rocksmash). It would require asm to make them show in the pokemon menu.
    Thanks.
     

    Zehn

    [color=red][font=Foto Serif]Sacred[/font][/color][
    988
    Posts
    9
    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

    2: xp on catching pokemon

    3: xp needed for level up is doubled

    4: gen 6 style xp share

    5: everytime you re-enter a route, all the trainer battles are reset(eg when you step in front of them they will challenge you again

    Thanks in advance!
     

    Vivacity

    still learning
    6
    Posts
    9
    Years
    • Seen Jul 15, 2017
    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
     
    416
    Posts
    11
    Years
    • Seen Feb 10, 2024
    2: xp on catching pokemon

    5: everytime you re-enter a route, all the trainer battles are reset(eg when you step in front of them they will challenge you again

    Thanks in advance!
    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)
     

    daniilS

    busy trying to do stuff not done yet
    409
    Posts
    10
    Years
    • Seen Jan 29, 2024

    Delete save and reset game after whiteout

    Spoiler:

    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.
     

    Turtl3Skulll

    Blue Turtl3
    76
    Posts
    10
    Years
  • Overworld abilities can be added by scripting. Try decompiling the script on a cut tree and you'll see what I mean :)

    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
     
    Last edited:
    Back
    Top