• Our software update is now concluded. You will need to reset your password to log in.
  • Welcome to PokéCommunity! Register now and join one of the best places on the 'net to talk Pokémon and more! Community members will not see the bottom screen advertisements.
  • Want to share your adventures playing Pokémon?
    Check out our new Travel Journals forum for sharing playthroughs of ROM Hacks, Fan Games, and other Pokémon content!
  • IMPORTANT: Following a takedown request, the following hacks have been delisted from PokéCommunity:

    • Pokémon Glazed
    • Pokémon: Giratina Strikes Back
    • Pokémon Flora Sky
    • Pokémon Stranded
    The downloads and discussion threads for these hacks will no longer be accessible, and staff will be unable to return questions regarding accessing this content.

Code: ASM Resource Thread

Tlachtli

Crit happens.
267
Posts
12
Years

Check Pokemon Gender


This is a simple routine to check a certain Pokemon in your party's gender given a slot number.

[...]

This is really great! I've been trying forever to figure out how to implement Rivalry in my little project, and this may have just helped me crack it. It shouldn't take much to modify it to read values in-battle ^^

(If I do get it working in-battle I'll be sure to credit you for it)
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
Tool is better than patch, but its not bad to make a patch for it. The disadvantages are it might overwrite the datas that are already consumed and it may cause a bug for edited rom. Tool is much better, it allows us to use free spaces.
Well, Im looking forward for tht kind of tool, FBIs awesome projects conpiler(FAPC), or Advance FBI Routines inserter(AFRI)
Lelz, just kidding
 

Blah

Free supporter
1,924
Posts
11
Years
I can't believe my little scheme worked{D:}
Jokes aside glad to hear you accepted the request, I look forward to seeing what you do with it :)

Thank you, It's like a Christmas present... Kinda x3

:)

-stuffs-
And my request is an ASM code to Check the number of ribbons a Pokemon has from a particular contest. I'm not sure if Emerald has anything like Special 0x9F from Fire Red so if the code is only able to read the first Pokemon in the party I'm okay with that as I can check a Pokemon's ribbons from a particular contest and have that be output to LASTRESULT or something. I could probably do this on my own actually, but, I don't know where the game stores ribbon data, unfortunately.

Yes, I am a contest nut.

Err, this is unfortunate, but I don't hack Emerald. Before the thread was stickied it was practically only me writing the routines (so I had a few personal rules one which included that I only work on FireRed). These mini-rules were removed at the assumption that other ASM hackers would be able to fill in and do requests from other ROM bases. So I'm afraid I will have to personally reject your request for a ribbon counter, however, maybe someone else can help you :)

And the minute checker routine can execute scripts? Ie. I loaded my scripts location in r0 and branch(exchange) to r0? Is it possible?
You need to make a routine which runs scripts. Then call that routine in Minute Routines to have the script run every minute.

A bit late, but actually, the gender of a Pokemon is determined by the "trainer gender" if and only if the Pokemon has a 50-50 gender. Other than that, it goes to the one that has a higher chance, like for example, a trainer's Torchic will always be male unless edited.
Thanks

[FONT=&quot]Thank you so much for all of your work. So many conveniences we can easily add to our hacks! Really, thank you![/FONT]

[FONT=&quot]I do have some requests, mostly for those who seek to make battle facilities (i.e. tournaments) and the like into their hacks.[/FONT]
[FONT=&quot]…The ability to turn off experience gain upon setting a flag (and [FONT=&quot]on upon clearing it[/FONT]). This could also work well with the set level routine you've made, especially in parts where the team is temporarily set to a level to match the opponents (to avoid having the slightest advantage over them (gaining a level [FONT=&quot]during the[/FONT] fight.))[/FONT]
[FONT=&quot]…The ability to change battle styles (Shift, Set) via script. The battle style in battle facilities is always Set. In addition to that, this can be useful to people who want to make the important fights in their hack more chal[FONT=&quot]lenging and [FONT=&quot]perhaps "fairer"[/FONT][/FONT] -- by eliminating that one huge advantage the player has over the opponent temporarily.[/FONT]
[FONT=&quot]…Givepokemon with custom attacks. Like Extremespeed Dratini in Crystal and event Pokémon.[/FONT]

Hi, I'll look into some of these. Though I'm not a fan of battle routines :X

How about some requests to actually break some trainers?

Can you add a battle mode like Battle Frontier battles? (You can't use items, battle is turned to set, you don't get XP during the battle.)
Let's say you use this battle style for certain trainers like Gym Leaders and Rivals. It would ramp up the difficulty of a hack without needing for some crazy stuff like giving Brock a lv.100 Diancie for the player's first gym battle.

Another suggestion I think that it would be interesting is expanded trainer sight.
For example, a trainer can spot you from a wider range (I always thought it was weird seeing the player at a diagonal spot close to the trainer and the trainer not even noticing.

How about a player detection system? Let's say the player is captured by team rocket.
The player needs to get out of the rocket base and there are no allied pokémon or cardboard boxes, so he needs to avoid the grunts patrolling. If he gets caught, he gets locked in again. That would be interesting to use with the expanded trainer sight I mentioned earlier.

A NPC that explicitly tells a pokémon's current IV and EV spread would be cool too, but I don't know if that can be done just with scripting.

Another NPC that tells what moves a pokémon can learn via level-up would be very useful too, since most hacks mess up with movepools, and since most hackers don't post their movepool changes the players are often left in the dark. And that's terrible.

And just some personal curiosity here. Is there a limit to how many Move Tutors you can have in the game?
Edit: More random curiosity. Since apparently there's no simple tool to edit some move effects of MrDollSteak's Rom Base, could you explain how I can edit the moves manually? I wanted to get more moves boosted by Mega Launcher, but I really have no idea on how to do that. Since it could require ASM, I figured that you might know something.

Good luck with your hack. Considering how much you've done just in this thread, I know that it's something to look forward to.

I'll look into battle frontier like battles. For the can't use items one, you can use the temporary bag deletion and delete the bag and restore it later. EXP during battles and set mode battling will be something I'll look into.


I feel like the only issue with patches is that they don't adjust well to existing ROMs. If you patch the ROM with the routine at 800000, then it could mess up someone else's hack by causing existing data to be overwritten. It would actually be kinda interesting (and maybe worthwhile as a personal project) to have a patcher which adjusts properly to different offsets and freespace, ie it could contain the binary data for the routine and a list of offsets to modify, and then just relocate the data as needed.

Finish wizard d/n patch first please :D


That's a really good idea, I've already written down areas of free space compatible with Jpan and Mrsteakdolls Rom-bases so I will definitely get looking into a more organized way of using these patches. Compatibility is my main concern with these patches, I had already made plans to make them modular as best I could.

I totally agree though, it's about time patches got more love.
Once I get a bit of planning done, I will look to collaborate with someone around the forum who can make a tool.
The idea now, based off what you've said, is to create a table of offsets leading to the actual routines which the program would locate the space for. However if I cannot get assistance from anyone with knowledge I will work my best to replicate a system using data near the end of the 16mb rom (ie. 80EB0000+) and one for a 32mb rom.
The new idea would be an easy way to add and remove patches, like a mod system. The program would look at the table of offsets, were you could then have the choice to delete, add, or edit. I understand some routines require hooks into vanilla stuff, but I imagine someone with programming skills can have it save a backup of all edits made in case deletion is required.

I actually think I may make a new thread on this, this will get more attention that way. But before I do I will make some form of a mockup.

The patching problem isn't as simple to solve as it may seem. Some of the routines require editing before being compiled, some of them use custom-sizable tables and the largest problem of all is that I note certain things in the comments about limiters in the routines. Those limiters for the most part are things which most people may find interest in changing.

I agree patches are a bad idea... a tool is a far better idea... maybe someone should get on that... hrmm that locksmitharmy guy might be tempted to make one. ;)

Im just worried about how adjustible they should be. I could make a tool that is expandible to add more stuff later...

What would we call it... the "awesome asm adder tool"?
Call it... ASMAGIX Inserter. Nvm, I was never good with names :P

While it seems pretty obvious most people are against a patch, I'd also like to say that I think that a patch would be a bad idea. It gets rid of the whole customisation aspect, as well as having quite a few logistical issues to work.



What about naming it something to do with FBI, such as FBI's Babies Inserter. Something like that.
(Babies cause y'know these routines are his babies).

pls no. That's just embarrassing lol.

This is really great! I've been trying forever to figure out how to implement Rivalry in my little project, and this may have just helped me crack it. It shouldn't take much to modify it to read values in-battle ^^

(If I do get it working in-battle I'll be sure to credit you for it)
I'm glad to hear it!


On a side note:
Do we really need patches/tools for insertion? I think I've made the insertion instructions rather simple and honestly the most complicated thing in the process is knowing how to reverse hex a pointer and then add 1 to it :X
Well, I don't really mind if people make tools/patches. These routines are for public use, and can be used/modified in whatever way you wish.

On a more side side note:
Recently I've been working on chain fishing. FireRed's super rod Fishing Routines are actually rather limited. They don't support the suction cups or stick hold abilities, they don't cancel the fishing sequence if you hit A early and they don't let the Pokemon get away if you press A too late either. Anyways, I've got the chain fishing part and abilities working. For the pressing A too early and pressing A too late, I made my own routines for detecting key presses and such, everything works fine, but the game freezes afterwards. I'm not sure why that's happening, nor do I really want to investigate longer than the 3 days-ish I have been. I think I'm going to just post what I have, and maybe if I find myself with some extra time I'll add to it later.
 

Blah

Free supporter
1,924
Posts
11
Years

Chain Fishing


This is a semi-complete port of the ORAS chain fishing feature onto FireRed. There are a few pre-requisite routines that you need to insert first as well, so make sure you've inserted those.

Prerequisites:
Random Number Generator
Shiny Generator



Reset Chain if fishing spot changes


This is simply a routine that's run every step. Every time you take a step it sets variable 0x8002 to 0x0. This is completely save unless you're using 0x8002 for something long term (which you shouldn't because it IS a temporary variable).

How to insert:
Compile and insert the following routine into free space:

Spoiler:


Now navigate to 0x6D5F6 and insert the following byte changes:
Code:
01 4A 10 47 00 00 XX XX XX 08
Where XX XX XX is where you inserted this routine +1.

Usage:
The routine is run automatically once a step is taken (i.e tile displacement occurs)


Ability Number getter


Very simply, just gets the abilityID of the first Pokemon in your party.

How to insert:

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


Usage:
This one is a standalone routine actually. It will store into variable 0x8000 the ID number of the ability of your first Pokemon. It becomes needed for Sticky Hold and Suction Cups later!



Fixing the Suction cup/Sticky Hold abilities


This routine just takes into account suction cups and stick hold for the fishing rod routines. It is also expandable, so you can add your own things to increase catch rate. If you have questions about that feel free to ask later (I'm a little lazy to type out everything :D).

How to insert:

You need to have inserted the Random Number Generating routine and the ability number routine before you can continue and insert the main one. Once you've done that, look at the last line in the following routine and replace the ".word 0x8[OFFSET +1]" with the pointer to the RNG routine (not in reverse hex). Finally there's an all caps comment. It requires you to set the pointer there to the ability ID routine from before.

After that compile and insert into free space:

Spoiler:


Finally, navigate to 0x5D316 and insert the following byte changes:
Code:
00 00 00 49 08 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you inserted this routine +1.

Usage:
It's automated. There isn't a usage :)



Increment Counter on Successful Chain


It simply increments 0x8002 by one if a Pokemon is hooked.

How to insert:

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


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

Usage:
The increments are automated...actually everything here will be automated. I'm just keeping this section here for consistency :)



Increased Shiny Encounter Chance


This feature isn't very documented at all. There's no numbers on it in any site I've tried, so I just kinda made up my own algorithm to create an increased chance-based shiny encounter with the amount of successful chains greatly swaying the chances. I'll explain how all the math comes together in a later section.

How to insert:

Before inserting this routine you need to have inserted my RNG routine from the prerequisites section. Once you've done that change the last line of this routine to match where you inserted the RNG routine (not reversed). After that, you can compile and insert into free space.

Spoiler:


Finally, navigate to 0x5D2C2 and insert the following byte changes:
Code:
00 00 00 4D 28 47 XX XX XX 08


Usage:
None, it's automated every time you use your rod.



Explanation of Functionality


First of all, a successful chain is defined as every time the player hooks a Pokemon.

The chain counter starts at 0 and is increased by 0x1 once the Rod is used and again by 0x1 once a Pokemon is hooked. This means chainCounter%2 != 1 is a successful chain. Everytime the Rod is used this calculation is confirmed, and the chain counter is reset if the condition isn't matched.

How big of a margin does the chainCounter affect shiny encounters?

32640/65535 = approx 50% chance at max chains
The numerator starts at 0, and increases to by 128 per successful chain.

I've also done a little "pity" thing for the unlucky souls like me out there. Basically after 255 successful chains, you're guaranteed a shiny. The chance of this occurring is:
Sum of (i=0 to 255) {PR(x = (128 * i)/ 65535) : [rand (y = 65535) && y < 128 * i] } ; currentSum < 1

It's very very unlikely unless your the bad luck god like myself. Also, you'll have to forgive my dirty notation.

Happy Fishing :D
JY3Xj2M.png
 
Last edited:
33
Posts
10
Years
  • Age 28
  • Seen Sep 23, 2022
:)
Hi, I'll look into some of these. Though I'm not a fan of battle routines :X



I'll look into battle frontier like battles. For the can't use items one, you can use the temporary bag deletion and delete the bag and restore it later. EXP during battles and set mode battling will be something I'll look into.

Call it... ASMAGIX Inserter. Nvm, I was never good with names :P

Nice. It's going to be fun to see hacks where trainers can't overlevel or bribe their way to victory via healing item spam. Thanks for the hard work.
Now if we could block saving in certain areas like the Elite 4 rooms...

I vote for ASMAGIX Inserter. Despite the fact that I'm terrible with naming too.
 

klingt

Living Poetry
13
Posts
9
Years
  • Age 37
  • Seen Jan 15, 2015
I'm looking for a way to turn multichoice scrollable and have 102 entries to make a standings list of sorts in FR
 

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years
I like ASMAGIX lol ...

Ill have to work on it in segments since there is sooo much here.

I could help you out with it. I've finally got your class working so we could each do a chunk and then share code and merge.
 
416
Posts
11
Years
  • Age 34
  • Seen Feb 10, 2024
I could help you out with it. I've finally got your class working so we could each do a chunk and then share code and merge.

Let me get the main selector area finished and well split up how the asm insertions will work ok. Ill put it on git hub.
 

Blah

Free supporter
1,924
Posts
11
Years
Nice. It's going to be fun to see hacks where trainers can't overlevel or bribe their way to victory via healing item spam. Thanks for the hard work.
Now if we could block saving in certain areas like the Elite 4 rooms...

I vote for ASMAGIX Inserter. Despite the fact that I'm terrible with naming too.

I made a routine to remove the save option from the start menu temporarily and restore it afterwards. Take a look at that.

I'm looking for a way to turn multichoice scrollable and have 102 entries to make a standings list of sorts in FR

I'm afraid you're late to the party, I'm not taking anymore requests right now. Though this could be quite interesting to have, so hopefully someone else will help you.

I could help you out with it. I've finally got your class working so we could each do a chunk and then share code and merge.

Let me get the main selector area finished and well split up how the asm insertions will work ok. Ill put it on git hub.

Depending on the language I can help too.


On a side note I've decided to drop these requests:
- Battle style set/shift toggling
- Other battle script related stuff

Battle style set/shift was done in a battle script as far as I could tell. I was hoping there'd be a byte in RAM I could just find and manipulate, but I couldn't find one (though I'm 65% sure it's probably done like this).

Also for this one
someone's request said:
Givepokemon with custom attacks. Like Extremespeed Dratini in Crystal and event Pokémon.
It looks like my custom attacks for wild Pokemon routine is shared with given Pokemon :)
Link: http://www.pokecommunity.com/showthread.php?p=8509300#8509300

I'll post what I've done so far soon. Progress has been rather slow because I got sick and spent pretty much most of the last couple of days in bed X_X
 

Blah

Free supporter
1,924
Posts
11
Years

Temporarily disabling EXP gains from battle


It was brought to my attention by some requesters that for their battle/tournament events they wouldn't want their Pokemon leveling up. This routine disables the exp gains in battle. Note that the player can still use stuff like Rare Candy to level. The fix to that is exactly the same as this, but with slight modifications. I hope you don't give the player a chance to rare candy in battle though or I will go to your hack's thread and severly criticize your lack of common sense :c


How to insert:

Compile and insert the following routine into free space:

Spoiler:


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

Usage:

If flag 0x202 is set, the EXP gains will be disabled. Obviously, to re-enable just clear the flag.
Currently the way I'm doing this is by making the game act like the player's party is already max level, so therefore they don't gain exp :)
 

Blah

Free supporter
1,924
Posts
11
Years

Adjusting Shiny encounter chance


Pre-requisites:
- Shiny Pokemon Generator
- Random Number Generator


How to insert:

Before compiling the routine look at the last line. There is a .word 0x8[RANDOM +1]. Change the content after the 0x8 to be a pointer to where you inserted RANDOM +1.

Once you've done that, look for the line that says "mov r0, #0x1 @item ID". Change 0x1 to the Item ID for your Shiny charm item. If you don't have one implemented, delete these lines:
Code:
	mov r0, #0x1 @item ID
	mov r1, #0x1
	ldr r2, =(0x8099F40 +1)
	bl linker
	cmp r0, #0x0
	beq normal
	ldr r0, =(1365) @1/1365 chance with shiny charm
	b calcChance

After you've done that, compile and insert the following routine into free space:

Spoiler:


Now navigate to 0x3DACE and insert the following byte changes:
Code:
00 00 00 4F 38 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer +1 to where you inserted this routine.


Usage:

It's Automagic, also happens to give the shiny chance to Pokemon in wild, trainer Pokemon, given Pokemon ect.

Right now encounter chance is 1/4096 without shiny charm, and 1/1356 with it.
 
Last edited:

Blah

Free supporter
1,924
Posts
11
Years
i work mainly in c#... if youd prefer another language i know a few and would enjoy the challenge, but progress would be quite a bit slower.

It would probably be best for you to work on it in your language of preference then. I'm feeling a little lazy all of a sudden :D
 
416
Posts
11
Years
  • Age 34
  • Seen Feb 10, 2024
It would probably be best for you to work on it in your language of preference then. I'm feeling a little lazy all of a sudden :D

Youve done so much work already... i dont blame you at all for not adding more to your plate.
 

TheRabbit

Banned
69
Posts
9
Years
  • Age 31
  • Seen Jan 1, 2015

Adjusting Shiny encounter chance


Pre-requisites:
- Shiny Pokemon Generator
- Random Number Generator


How to insert:

Before compiling the routine look at the last line. There is a .word 0x8[RANDOM +1]. Change the content after the 0x8 to be a pointer to where you inserted RANDOM +1.

Once you've done that, look for the line that says "mov r0, #0x1 @item ID". Change 0x1 to the Item ID for your Shiny charm item. If you don't have one implemented, delete these lines:
Code:
	mov r0, #0x1 @item ID
	mov r1, #0x1
	ldr r2, =(0x8099F40 +1)
	bl linker
	cmp r0, #0x0
	beq normal
	mov r0, #0xA
	lsl r0, r0, #0x7
	add r0, r0, #0x55 @1/1365 chance with shiny charm
	b calcChance

After you've done that, compile and insert the following routine into free space:

Spoiler:


Now navigate to 0x3DACE and insert the following byte changes:
Code:
00 00 00 4F 38 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer +1 to where you inserted this routine.


Usage:

It's Automagic, also happens to give the shiny chance to Pokemon in wild, trainer Pokemon, given Pokemon ect.

Right now encounter chance is 1/4096 without shiny charm, and 1/1356 with it.

You don't know how long I've wanted this. You're the man.
 

Trainer 781

Guest
0
Posts
Black Sludge Implementation:

-> Insert at x1BE18: 00 49 08 47 XX+1 XX XX 08 00 00

-> Routine at XXXXXX:
Spoiler:


-> Battle Script at GGGGGG:
Spoiler:


(OPTIONAL) Update the Leftovers message to latest Generation (used for positive Black Sludge too):
-> At 1C0F4: HH HH HH 08 (In reverse hex)

-> Battle Script at HHHHHH:
Spoiler:
 
Last edited:

jAvAcOlA

Banned
152
Posts
15
Years
  • Seen Feb 22, 2015
I'll look into battle frontier like battles. For the can't use items one, you can use the temporary bag deletion and delete the bag and restore it later. EXP during battles and set mode battling will be something I'll look into.

Kind of ties into this as well:

Do you have any kind of experience into implementing a battle frontier into FR? Not totally sure how many and what kind of ASM routines would be needed. Sort of a general question.
 

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years
Hey fbi how would I go about making the battle by move asm to use a different flag for each routine? Cause I dont want the prevent whiteout and the delete pokemon on at the same time.:(
 

Blah

Free supporter
1,924
Posts
11
Years
Youve done so much work already... i dont blame you at all for not adding more to your plate.
Thanks :)

You don't know how long I've wanted this. You're the man.
I'm glad you find use for it!

Black Sludge Implementation:
-stuffs-
Jeez KDS, I don't wanna have to update the first post this often :P
Good job, lol.

Kind of ties into this as well:

Do you have any kind of experience into implementing a battle frontier into FR? Not totally sure how many and what kind of ASM routines would be needed. Sort of a general question.
Hi, most of the hard Battle Frontier ones are also very stupid (like the random attack one). There are fun ones which are hard to do, like the rent a party/swap it with opponents party one. Some of the good ones like battle pyramid are easy though. I should mention I'm done writing public routines atm. There won't be more unless I'm very very bored on an eventless evening.

Hey fbi how would I go about making the battle by move asm to use a different flag for each routine? Cause I dont want the prevent whiteout and the delete pokemon on at the same time.:(

Hi FBI here, I'll answer this in place of fbi. You would put the flag check in the separate routines. If you've got more questions about how, you can ask in the ASM help thread.
 
Back
Top