Basically, when you use special 0xA2, the party screen open and you can select a poke, the slot of the poke is stored in var 0x8004, so the routine check this slot.
If it is the the same species than 0x8005, then 0x8005 is set to 1, otherwise to 0
The routine has apparently some flaws.
They were fixed by @Squeetz in the community's Discord.
I don't know a single thing about ASM, but I thought someone needed to bring this up in case anyone wanted to use it.
Sorry for being dumb, but how do I actually implement this into the game?
I would suggest learning how to compile and insert assembly instead of relying on tools.
1. First, you'll want to download HackMew's thumb compiler, found on this page.
2. Then, save the files you quoted individually as [filename].asm, eg. attack.asm. Using the windows command prompt, type 'thumb [filename].asm [filename].bin' in the same directory as your .asm file and the compiler. Then, open the .bin file with a hex editor, and insert into free space, making sure the offset ends in a 0,4,8, or C. With these particular routines, you'll need to also insert [00 01 0A 00] for red font and [00 07 0A 00] for blue font, somewhere in your rom, and then change the pointer at the bottom of each routine to the location of each 4bytes string. So, if you inserted 00 07 0A 00 at 0x123456, 0x08BBBBBB would become 0x08123456.
3. At the top of each assembly routine you're trying to insert, there is an insertion instruction that has been commented out, eg. @ 00 49 08 47 XX XX XX XX at x137134 in the attack.asm routine. This means, at offset 0x137134 you type the above hex, where XX XX XX XX is a reverse pointer (+1) to the location of the attack.bin hex you inserted into free space from step 2. For example, if you inserted attack.bin at 0x987654, for example, XX XX XX XX will be 55 76 98 08.
Do this for each routine and you should be all set!
I hope this helps. let me know if you have any issues.
I would suggest learning how to compile and insert assembly instead of relying on tools.
1. First, you'll want to download HackMew's thumb compiler, found on this page.
2. Then, save the files you quoted individually as [filename].asm, eg. attack.asm. Using the windows command prompt, type 'thumb [filename].asm [filename].bin' in the same directory as your .asm file and the compiler. Then, open the .bin file with a hex editor, and insert into free space, making sure the offset ends in a 0,4,8, or C. With these particular routines, you'll need to also insert [00 01 0A 00] for red font and [00 07 0A 00] for blue font, somewhere in your rom, and then change the pointer at the bottom of each routine to the location of each 4bytes string. So, if you inserted 00 07 0A 00 at 0x123456, 0x08BBBBBB would become 0x08123456.
3. At the top of each assembly routine you're trying to insert, there is an insertion instruction that has been commented out, eg. @ 00 49 08 47 XX XX XX XX at x137134 in the attack.asm routine. This means, at offset 0x137134 you type the above hex, where XX XX XX XX is a reverse pointer (+1) to the location of the attack.bin hex you inserted into free space from step 2. For example, if you inserted attack.bin at 0x987654, for example, XX XX XX XX will be 55 76 98 08.
Do this for each routine and you should be all set!
I hope this helps. let me know if you have any issues.
Thank you! This kind of simple, easy to follow tutorial on how to insert ASM is exactly what I've been looking for! I'll try it now and see if it works.
EDIT: So when I try that, I get this error.
Quote:
attack.asm: Assembler messages:
attack.asm:0: Warning: end of file in comment; newline inserted
attack.asm:60: Error: junk at end of line, first unrecognized character is `R'
EDIT #2: nvm, I figured out that I had to insert the redfont and bluefont and change the .asm file to show where they are.
EDIT #3: So, if I put the hex for attack.bin at 0x71A6B0, XX XX XX XX would be B1 A6 71 08?
EDIT #4: It works! Thanks! Yours is the only tutorial for inserting ASM that I could actually follow and understand.
Having coloured stats based on natures. I don't know if this could be done by editing the ASM used to implement this into FireRed and changing the offsets or if they are just too different.
Either way, I think more work needs to be done on hacking 4th gen games, and I'd be happy to help (although I am very dumb). I'm currently looking into editing the hex of the 4th gen games but there doesn't seem to be any documentation on ASM for 4th gen and very little documentation on hex for 4th gen. If someone smarter than me can give me a good starting point as to where I could learn how to find out how to do this (if that makes any sense) I would be more than willing to learn.
Dumb question but what program is used to compile the ASM routines?
This easy to follow tutorial is what I used to be able to do it (with extremely little prior knowledge on the subject).
Quote:
Originally Posted by ghoulslash
I would suggest learning how to compile and insert assembly instead of relying on tools.
1. First, you'll want to download HackMew's thumb compiler, found on this page.
2. Then, save the files you quoted individually as [filename].asm, eg. attack.asm. Using the windows command prompt, type 'thumb [filename].asm [filename].bin' in the same directory as your .asm file and the compiler. Then, open the .bin file with a hex editor, and insert into free space, making sure the offset ends in a 0,4,8, or C. With these particular routines, you'll need to also insert [00 01 0A 00] for red font and [00 07 0A 00] for blue font, somewhere in your rom, and then change the pointer at the bottom of each routine to the location of each 4bytes string. So, if you inserted 00 07 0A 00 at 0x123456, 0x08BBBBBB would become 0x08123456.
3. At the top of each assembly routine you're trying to insert, there is an insertion instruction that has been commented out, eg. @ 00 49 08 47 XX XX XX XX at x137134 in the attack.asm routine. This means, at offset 0x137134 you type the above hex, where XX XX XX XX is a reverse pointer (+1) to the location of the attack.bin hex you inserted into free space from step 2. For example, if you inserted attack.bin at 0x987654, for example, XX XX XX XX will be 55 76 98 08.
Do this for each routine and you should be all set!
I hope this helps. let me know if you have any issues.
If you run into any problems, just look at the edits I made to my response to that message. It's probable that you may come across the same problems as I did.
Quote:
Originally Posted by Gameskiller01
EDIT: So when I try that, I get this error.
Quote:
attack.asm: Assembler messages:
attack.asm:0: Warning: end of file in comment; newline inserted
attack.asm:60: Error: junk at end of line, first unrecognized character is `R'
EDIT #2: nvm, I figured out that I had to insert the redfont and bluefont and change the .asm file to show where they are.
EDIT #3: So, if I put the hex for attack.bin at 0x71A6B0, XX XX XX XX would be B1 A6 71 08?
EDIT #4: It works! Thanks! Yours is the only tutorial for inserting ASM that I could actually follow and understand.
If you have free space from 0x270670-0x270741 (0xD2 bytes), use the IPS patch I provide here. ...It's a long story, so I will expand on this when I get the time. Fully working, I promise. You're gonna love it.
edit: A bit of explanation now: I took a look at an Emerald disassembly and found the routine that calls to check if the egg at the Day-Care is a pichu and if either of the parents are holding a Light Ball. I ported that exact routine into FR, but I had to make a copy of the routine at sub_80460D4 as to include the pichu check. Then I had to make special 0xB8 call the new routine instead of sub_80460D4. Since I had made a copy of the routine I also had to make sure the new routine used all the same offsets as before, and therefore I placed the routine at 0x270670, which I happened to have free space. I wanted to place the routine at something like 0x760000 or higher, but the old offsets wouldn't work any more. Down below are the uncompiled stuff:
This routine (located at 0x270670 in my patch) is a copy of the routine at 0x0460D4 but now includes the pichu egg check (in orange):
So, the mechanic for that is already implemented, we just have to repoint some tables. So let's get down to work.
First, there's a table at 0x085B2CF0. Each entry is a pointer to text to be displayed in the box. One set consist of 16 options. This is important. Anyway, repoint to free space and change pointers to this table. It ends at 0x085B3030.
Now, there's a jumptable at 0x813A156. It ends at 0x0813A19C. It has 12 entries, repoint it to free space. Now for every new set of options you want to add, you have to add a routine like this:
Spoiler:
Code:
.text
.thumb
.thumb_func
.align 2
main:
mov r0, #5
strh r0, [r3, #8] @how many are displayed
mov r0, #8
strh r0, [r3, #0xA] @how many are in total
mov r0, #1
strh r0, [r3, #0xC] @X coordinate
mov r0, #1
strh r0, [r3, #0xE] @Y coordinate
mov r0, #9
strh r0, [r3, #0x10] @unkown
mov r0, #0xA
strh r0, [r3, #0x12] @box height, should be displayed * 2
mov r0, #0
strh r0, [r3, #0x14] @unkown
strh r4, [r3, #0x26] @task id, don't change it
pop {r4}
pop {r0}
bx r0
Note that you can change parameters in those routines. Play with them and see which ones look the best for you. Now, every routine like that above, goes at the end of the repointed jumptable. There are 12-in game sets, so you'll start with 13. Change the byte at 0x813A148 to the amount of all sets.
One more thing, even though the table of pointers to text can only hold 16 pointers, it doesn't mean you're limited to only that many options. You can go to 126 max, because 127 is treated as hitting B. How? Well, in the routine above set how many in total to the amount you want and ignore occupied slots. For example if you want your set to have 50 options, divide it by 16, so you get 3 and some remainder. That means this set occupies 4 places in the jumptable, like this:
XX XX XX 08 00 00 00 00 00 00 00 00 00 00 00 00 NEW SET GOES HERE
Using it in a script is easy, just do this:
setvar 0x8004 slot in the jumptable (starts at 13, since 12 are already occupied in-game)
special 0x1BE
waitstate
Result is stored in the 0x800D. First option chosen is 0, second is 1, and so on. Hitting B be is 0x7F.
compare 0x800D 0x0
if 0x1 goto @first_option
....
compare 0x800D 0x7F
if 0x1 goto @chose_cancel
I hope everything's understandable. :)
I'm having a bit of trouble getting this to work. First of all, isn't the jumptable at 0x813A168 and not 0x813A156? I can repoint 0x813A168, but not your given 0x813A156. Second, I can only get the default choices to work. Anything above 12 (0xC) won't work for me. As soon as special 0x1BE is called ingame with a value of 0xD or more, the game freezes without the list showing up at all.
Here's the steps I did in order:
- repointed the first table located at 0x5B2CF0 to 0xDE43E0 and changed two pointers.
- repointed the jumptable located at 0x13A168 (instead of 0x13A156 as I couldn't find the pointers for it) to 0xDE4760 and changed one pointer.
- compiled your routine and inserted at 0xDE4794 (which is right after the repointed jumptable)
- added new entry (6 pre-existing pointers) to 0xDE4720.
- changed the byte at 0x813A148 from 0xC to 0xD.
XXXXXX is the pointer to AA AA AA 08 64 00
YYYYYY is the pointer to BB BB BB 08 64 00
where,
AA AA AA 08 is pointer to compressed male bag pallete
BB BB BB 08 is pointer to compressed female bag pallete
example:
Spoiler:
I insreted compressed pals at 900000 and 900030 and the routine at 800000,
so have a look at my rom data.
NOTE: you dont need to leave spaces between bytes, I did that just to make it easier to understand
In Generation V, a new way of determining the Experience Points gained after Battle was introduced. Previously, the Experience Formula was a flat one, which did not change based on Level Differences between your Pokemon and the other one.
In Black & White, they used a Scaled Experience Formula, which would cause your Pokemon to gain more experience if their opponent was a higher Level, and less if their opponent was a lower one.
Today, I am sharing a way to have this sort of Scaled Experience Points in Fire Red or Emerald. I have included the download link to a folder which contains four items.
The Instruction Manual explains how the routine works and any extra information that is necessary to know (particularly if you would like to modify this routine for your specific hack).
Important:
Considering I first uploaded the first version of this routine a long time ago, you may have an older version of it. This version may be preferable to that one, and it is smaller than the previous version is. Therefore, one can simply insert it over the old version and not have to repoint anything.
Extra Information
This routine is compatible with Think0028's Experience All Patch. His original download link is unfortunately broken, hence why I put it in the download folder. If it was still active, I would have linked directly to it.
If you inserted the Disable Experience Gain With Flag routine, originally by FBI, then you may wish to remove it, as this routine implements it. I am not sure if there is a conflict due to this, but at the very least there is a redundant check if you have two routines which both check the same Flag. It is also possible that this routine bypasses that one entirely, in which case you would want to remove it to avoid wasting space.
Thanks and credits to FBI for that original routine, as without it I would likely not have been able to find the correct branching address for this routine.
As I have nowhere else to post this information, I will say here that to remove the 1.5x Experience Boost you get for defeating a Pokemon in a Trainer Battle (like they did in Generation VII), do the following:
Put 07 E0 at 0x21DD8 (FireRed) or 0x4A698 (Emerald)
Put 1C E0 at 0x21E00 (FireRed) or put 28 E0 at 0x4A6C0 (Emerald)
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
The two requests I ever made over here were in vain.. allow me to try another one instead.
How about a port of JPAN's Overworld Hacks to Emerald?
I'm looking for a way to basically change a character's Front sprite, Back sprite and OWs to another one until I revert things back to how it was manually with another command.
I need help making an eeveelution evolution happen i need it made so when an eevee faints in battle and then you feed it a rare candy while its fainted after battle it evolves into a ghost type eeveelution
I need help making an eeveelution evolution happen i need it made so when an eevee faints in battle and then you feed it a rare candy while its fainted after battle it evolves into a ghost type eeveelution
This is just off the top of my head, so I haven't tested this or anything, but it should give you a head start.
First here's a link to a tutorial on how to add new evolution methods.
.FirstPoke is the first RAM offset in the lists I posted under the "Yours" heading. Basically what this little snippet does is it checks the current HP of the first Pokémon in your party and compares it to zero. If it's zero, the Pokémon is fainted and you can then branch to the next thing. You can change the party slot it checks, but ideally you would want a way for the code to know which Pokemon you selected.
It might help to look through the evolution routines posted in the tutorial and see how they're structured.
That's all I can really do without doing testing first, but that will have to wait until later because it's 2:30 in the morning as I'm posting this. PM me later if you still need help.
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
Hello, I would like to request a hook routine to be added to the original TM's routine.
The new routine would be activated when the TM's were used and deleted, so a new item would be created in the ITEN bag.
If possible, include checking if the bag is full. If yes, discard new item.
Thanks in advance.
Hello, I would like to request a hook routine to be added to the original TM's routine.
The new routine would be activated when the TM's were used and deleted, so a new item would be created in the ITEM bag.
If possible, include checking if the bag is full. If yes, discard new item.
Thanks in advance.
Hello,
I think reuable tms are already done, if thats what you need...
Hello,
I think reuable tms are already done, if thats what you need...
It looks like he wants an item to be created after a TM is used and naturally deleted.
He didn't mentioned if he wants the exact TM to be created yet again, so I'd say he's not looking for reusable TMs.
Hello,
I think reuable tms are already done, if thats what you need...
Quote:
Originally Posted by Lunos
It looks like he wants an item to be created after a TM is used and naturally deleted.
He didn't mentioned if he wants the exact TM to be created yet again, so I'd say he's not looking for reusable TMs.
In fact what I need is to maintain the original routine that deletes the TM after use and add the creation of an item along with the TM exclusion.
Example: After using any TM, it is deleted from TM CASE and creates a NUGGET in the player bag.
And if possible show the informed message where the new item will be in the bag.
Target will automatically dodge a thrown ball if it is off-screen (dig, fly, bounce, dive) or has a substitute out
Target will never dodge if it is asleep, frozen, or rooted in the ground (ingrain)
50% dodge rate for paralysis and 75% dodge rate if trapped by wrap effect
There are lots of other little dodge rate modifiers one could implement, such as speed/evasion stat modifiers, held item, ability, weather, etc. I have implemented some of these, so let me know if you want me to add these in!
-Big Edit: The routines have been completely rewritten from scratch to work properly now.
This has been done in bits and pieces over the years (I believe it's actually been done completely for Emerald), so I decided to rewrite the bag storage routine for Fire Red.
Insertion Instructions:
1. Change the .equ offset, 0xA00000 to the offset where you plan on inserting the routine.
2. Compile the asm file.
3. Open the .bin file and copy all the data from 0xD991E, 0xD995C, 0xD9EDC0x3FEC9A, and your insert offset (your offset's data will go to the end of the bin file) to those same offsets in your rom.
An updated Conversion attack routine:
Spoiler:
In the following routine, change the location of your attack data at the top if necessary (if you haven't added new moves to your game it probably isn't). Assemble the routine, copy the data from the .bin file, and then do a paste-write at 0x28604 in your rom.
Or if you don't understand ASM, copy and paste the compiled version to 0x28604 in your rom:
Some of the space from the old Conversion routine is used for the bag expansion. To free up this space, Conversion was rewritten to match its Gen 6+ effect.
The above code is written in such a way that if you were to insert it as is, you would have support for:
400 Regular Items
60 Key Items
28 Poke Balls
128 TMs/HMs
67 Berries
Obviously if you don't need this many items, you're free to change the ram locations and item amounts by modifying the lines at the top of the routine. If you try to expand any of these values, make sure you change the ram locations if necessary.
Important Note About Berries: If you plan on adding new berries to your game, each berry needs to modified in G3T's item editor. Under Mystery1/2, change the value in the second box (Mystery 2) to the berry number for that berry. For instance, the Oran Berry is number 7. All berry numbers can be found on Bulbapedia.
If you don't plan on expanding berries, in the code, change Berry_Num to 43 and remove the bolded section labeled BerryNumFixesHook. Otherwise all your berries will be displayed with a berry number of 0 (or, alternatively, you could assign each berry a number like mentioned above).
If you do expand the berries, they will remain in a sorted order based on their item id. In my upcoming battle engine, a fix will be provided for this (mainly because I didn't want to write a decent sorting algorithm in Assembly).
Insertion Instructions:
Customize to your liking
Assemble the routine
Copy the output bin file (so you should have a file called something like output.bin - Copy and fill this copy with FFs
Create a patch using your blank (filled with FFs) file as the unmodified file, and the output file as the modified file
Patch your rom
This has been confirmed to work with a vanilla Fire Red. However, I can't guarantee it will work with all roms in progress.
Alright I'm making a request!
Everyone has probably heard about Bank system...
On which can allow the player to store his money, loans, interest (ofc in support with primes RTC) and other cool banking stuff.
PS this thread has helped me a lot thanks "A free helper" Blah ;) !
Alright I'm making a request!
Everyone has probably heard about Bank system...
On which can allow the player to store his money, loans, interest (ofc in support with primes RTC) and other cool banking stuff.
PS this thread has helped me a lot thanks "A free helper" Blah ;) !
Aight, this request is similar to shinyquagsire's berry selection screen...
I need an asm which can show the party screen and on selecting the pokemon, exits and stores data in a var...
However theres a twist, im not talking about special 0x9f...
The mons need to be read from Ram where PSS stored the mons... So now y'all get it why its so complex...
If that is to be pulled off, it'd be amazing;)
Aight, this request is similar to shinyquagsire's berry selection screen...
I need an asm which can show the party screen and on selecting the pokemon, exits and stores data in a var...
However theres a twist, im not talking about special 0x9f...
The mons need to be read from Ram where PSS stored the mons... So now y'all get it why its so complex...
If that is to be pulled off, it'd be amazing;)
legit take the routine for special 0x9F
replace the part where it accesses your party with the new ram address. this likely just involves replacing an address from the routine, literally nothing more. callasm the new special and ezpz