This thread is for the development and sharing of new ability routines and battle scripts for Fire Red and Emerald. Requests made by users can definitely be considered just make sure you follow the posting guidelines. Abilities are one of the things that I and other hackers are often asked to share, and make tutorials for, sadly the way in which abilities work, there is no real tutorial that can assist in making an ability outside of general ASM and battle scripting knowledge. For this reason I have decided to create this thread. It also makes it far easier for people to discover bugs or errors in routines, allowing for them to be fixed far more easily.
Extra Information
Before you get started, refer to the following threads for information about the procedure of expanding the relevant tables, inserting ASM and understanding how battle scripts work:
People do not have to fulfil your requests, they do it because they want to! Not only are those posts annoying, they also are completely pointless! If such a post is found, it will probably be deleted.
Wrap your abilities and routines in [SPOILER]spoiler tags[/SPOILER].
This is here to keep the thread as easy to browse as possible, as most routines and whatnot tend to take up multiple lines and this can make scrolling through the thread a chore.
Be reasonable with your requests!
This thread is for mostly small ability routines or battle scripts: don't be greedy! No-one is going to make an entire hack for you.
Give credit when requested!
If and when you use any of the routines posted here, give credit to the original creator if they ask for it. If they don't explicitly ask for credit, assume they do. Theft won't be tolerated and if you're caught the moderators will request you add credits to your hack threads, and if not your thread may be deleted.
State the base game for which your requests / abilities are for.
This is mostly to avoid confusion, and to allow for easier organisation of the thread. Please try not to request abilities for Ruby or Sapphire: these games are very difficult to code for and Emerald tends to be far better in nearly every way.
Read the thread before making a request!
Again for organisational reasons, it is a waste of space and time to request abilities which have already been created.
New Abilities
All the routines here are for abilities from Gen 4 and above. They are treated in the index order of the most recent games ORAS +1. This is because Cacophony no longer exists in those games, and therefore does not take an index slot. For this reason while Tangled Feet is listed as ability number 77 on Bulbapedia, if you have expanded your ability table, it will in fact be ability number 78. Remember also that this is the decimal index number, so the routines themselves will be listed with their indexes in hex.
Additionally because some abilities are tied to the same routine, or have prerequisites please look at the ability routines themselves, because you may not need to insert it multiple times, or will need to have inserted other routines to get them to work.
.SlowStartLoc is a free ram location that you can use to have the counter for slow start.
It has come to my attention that Technician can apply some unwanted boosts to Revenge and a few other moves, so the code will be amended in the future.
.SlowStartLoc is a free ram location that you can use to have the counter for slow start.
It has come to my attention that Technician can apply some unwanted boosts to Revenge and a few other moves, so the code will be amended in the future.
It should be noted that this doesn't work fully with Multi-hit moves, in that they do not break Sturdy. I am planning on rewriting the entire Multi-hit system to make Parental Bond.
It should be noted that this doesn't work fully with Multi-hit moves, in that they do not break Sturdy. I am planning on rewriting the entire Multi-hit system to make Parental Bond.
It is an excellent thing that someone finally made this kind of thread. Keep it up dude!
It is kinda bit complicated for me about how abilities are triggered when in need. Well, I'm off to study them. :)
EDIT: One good question: if two routines (one is old and one is latest but different abilities) collides when "insert this at whatever offset", will you rewrite the asm? I don't know if you understand this question and I don't also know if this will possible in progress.
EDIT2: Ported the new Sturdy... there is a bug/error at: In the same turn, if the faster one attacks the enemy then enemy activates sturdy then the enemy uses a status move that affects with snatch, there will be a message appear that is snatch related. I don't know if you can understand this but do a battle in the same turn that you attack first that makes that sturdy effect on the enemy and the enemy uses a status move that affects snatch so you will see what I mean. It snatched itself. A status move used in the next turn after sturdy's turn still works fine (no snatch message). Noted that I have applied expansion of pokemon, types, attacks, abilities, and the pss patch and icons whenever I'm going to post some errors dude.
There was a report mentioning problems with the Magic Bounce Ability in MrDS's Rombase, so I decided it to implement this myself from scratch, and it is working fine in Trainer Battles and Doubles.
Here it is posted with Moxie.
Magic Bounce
Spoiler:
Fire Red
For MrDS's base 1.5a at x1D8D6 insert, 18 01 80 18 00 78 C0 06 88 46 before applying the new routines to remove branch to the old routine.
+ If for some stupid reason, Magic Coat is used on a Magic Bounce pokemon, then Magic coat activates before Magic bounce.
+ Magic Bounce does not activate, if the mon with Magic Bounce is in a semi-invulnerable state (fly, dive etc.).
+ Added a special Flag to ensure that Magic Bounce does not re-reflect a move reflected by Magic Bounce/Magic Coat. Otherwise, a infinite ping-pong loop happens between two Magic Bounce pokemon.
+ A free RAM location is used for this Flag. Initially, it is set to 0. When the condition for Magic Coat or Magic Bounce is met, it is set to 1 (e.g, always the case in singles, reflected spore in doubles) or 2 (e.g reflected growl in doubles), according to the no. of mons the rebounded Move can affect, and then the Rebound is executed.
+ If the value of the Flag is non-zero, the Magic Bounce and Magic Coat checks are automatically skipped to avoid the re-reflection situation and the Flag is decremented by 1 and this Step is repeated until the Flag is cleared to 0.
+ This to try to ensure that during the Rebound itself, the Flag is successfully cleared to 0.
+ The free RAM location refered in the 3 routines MUST BE SAME.
+ Will port to Emerald soon.
E3 01 ZZ ZZ ZZ 08
20 01 00 01 0C ZZ ZZ ZZ 08
39 20 00
2E 8F 44 02 02 00
48 01 02 00
2E 8E 44 02 02 11
89 41 ZZ ZZ ZZ 08
FB 20 E3 03 02 SS SS SS 08 //Assuming that setword command is at FB, and the RAM location for the string pointer is at 0x203E320. If not, then change this line accordingly
10 84 01
12 40 00
3C
Scrollbar appears
Please review and fix the issues by reading the signature rules.
You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.
Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Originally Posted by RaileysXerilyasRX
[ Original Post ]
It is an excellent thing that someone finally made this kind of thread. Keep it up dude!
It is kinda bit complicated for me about how abilities are triggered when in need. Well, I'm off to study them. :)
EDIT: One good question: if two routines (one is old and one is latest but different abilities) collides when "insert this at whatever offset", will you rewrite the asm? I don't know if you understand this question and I don't also know if this will possible in progress.
EDIT2: Ported the new Sturdy... there is a bug/error at: In the same turn, if the faster one attacks the enemy then enemy activates sturdy then the enemy uses a status move that affects with snatch, there will be a message appear that is snatch related. I don't know if you can understand this but do a battle in the same turn that you attack first that makes that sturdy effect on the enemy and the enemy uses a status move that affects snatch so you will see what I mean. It snatched itself. A status move used in the next turn after sturdy's turn still works fine (no snatch message). Noted that I have applied expansion of pokemon, types, attacks, abilities, and the pss patch and icons whenever I'm going to post some errors dude.
That's a bug MrDS and I encountered when we were making sturdy. It's fixed in the FR version, but not EM's for some reason (probably a goof on Dollsteak's part). At DisplayEndureMessage, change mov r1, #0x32 to mov r1, #0x2.
Alright, I tried implementing the Sturdy for FireRed with MrDollSteak's patch applied to it, but the game froze when I tried the opposing Tepig used Overheat on my Turtwig. At first I thought it was an issue with Overheat, so I tried changing it to Blast Burn, but same thing happened. Note that both times I used Withdraw on the first turn. I tried again, but I used Tackle, and it froze. I wondered if it was an issue with the Rombase and not being compatible, so I went to a clean FireRed ROM, inserted it there, and it happened again. Am I doing something wrong, or can someone else verify that the Sturdy routine is messed up?
Alright, I tried implementing the Sturdy for FireRed with MrDollSteak's patch applied to it, but the game froze when I tried the opposing Tepig used Overheat on my Turtwig. At first I thought it was an issue with Overheat, so I tried changing it to Blast Burn, but same thing happened. Note that both times I used Withdraw on the first turn. I tried again, but I used Tackle, and it froze. I wondered if it was an issue with the Rombase and not being compatible, so I went to a clean FireRed ROM, inserted it there, and it happened again. Am I doing something wrong, or can someone else verify that the Sturdy routine is messed up?
When you placed the hook in, did you add 1 to the routine's pointer? Because you need to do that. If you did, I'm not sure what the problem is.
3DS Friend Code: 5069-3944-3902
IGN: Peter; (X, Y, OR, AS, S, M, US, UM)
Friend Safari: (Fighting) Throh, Meditite, Breloom
Living Pokedex Complete: Y, C, R, LG, E, D, Pl, HG, B, B2, X, Y, OR, AS, M, UM, LGP, Sw, LA
Big thanks especially to DestinedJagold, Xerneas_X, Elements1, ~RNC~ and ThePoke Man
There was a report mentioning problems with the Magic Bounce Ability in MrDS's Rombase, so I decided it to implement this myself from scratch, and it is working fine in Trainer Battles and Doubles.
Here it is posted with Moxie.
+ If for some stupid reason, Magic Coat is used on a Magic Bounce pokemon, then Magic coat activates before Magic bounce.
+ Magic Bounce does not activate, if the mon with Magic Bounce is in a semi-invulnerable state (fly, dive etc.).
+ Added a special Flag to ensure that Magic Bounce does not re-reflect a move reflected by Magic Bounce/Magic Coat. Otherwise, a infinite ping-pong loop happens between two Magic Bounce pokemon.
+ A free RAM location is used for this Flag. Initially, it is set to 0. When the condition for Magic Coat or Magic Bounce is met, it is set to 1 (e.g, always the case in singles, reflected spore in doubles) or 2 (e.g reflected growl in doubles), according to the no. of mons the rebounded Move can affect, and then the Rebound is executed.
+ If the value of the Flag is non-zero, the Magic Bounce and Magic Coat checks are automatically skipped to avoid the re-reflection situation and the Flag is decremented by 1 and this Step is repeated until the Flag is cleared to 0.
+ This to try to ensure that during the Rebound itself, the Flag is successfully cleared to 0.
+ The free RAM location refered in the 3 routines MUST BE SAME.
+ Will port to Emerald soon.
E3 01 ZZ ZZ ZZ 08
20 01 00 01 0C ZZ ZZ ZZ 08
39 20 00
2E 8F 44 02 02 00
48 01 02 00
2E 8E 44 02 02 11
89 41 ZZ ZZ ZZ 08
FB 20 E3 03 02 SS SS SS 08 //Assuming that setword command is at FB, and the RAM location for the string pointer is at 0x203E320. If not, then change this line accordingly
10 84 01
12 40 00
3C
If I may make a suggestion? I think it would be very useful to upload the codes for Mega Launcher and Reckless, because those abilities (boost moves if they are in a certain table) could be very useful in making "new" abilities. Just a thought.
Sorry the for the late reply. The callasm command and battle string loader hack are posted in the Quick R&D thread and these things are already installed in MrDS' Patch.
Re: AtecianCorp.
Lol, you just the need to make the byte changes mentioned the post in a Hex Editor and install Jambo's battle string and setword command.
Insert this table if your ROM has Ability Indices in the same order as that mentioned in the OP (Otherwise you need to modify the table using the Info given below)
There are 256 entries in this table which equal to the maximum No. of abilities that can be accommodated in a GBA rom.
An entry for each ability takes one byte of space and there are entries for every ability. The entry is set to 00 if Mold Breaker does not negate the Ability, 01 (or a non-zero value) if Mold Breaker is able to negate it and 02 if the Ability is negated by Mold Breaker to simulate the Gen V hazard effect.
For e.g, the first entry is for Ability ID 0x0, the Blank Ability, so it does not need to be checked against Mold Breaker and therefore its entry should be set to 00. The second entry is for Stench (ID = 0x1) so set to 00. The 6th entry is set to 01 because MB negates Sturdy (ID = 0x5).
There are some abilities that are not supported by this implementation and require specific explicit Mold Breaker checks. Hence, their entry is set to 00 to avoid wastage of time.
Spoiler:
1. Damp (It checks the whole battle field for presence of Damp rather than a single target, so the 'faintifnotdamp' battlescript command needs to be modified for this. I'm leaving this for now because I'm lazy
2. Lightning and Storm Drain (Mold Breaker should allow redirection of move).
3. Friend Guard, Aroma Veil, Sweet Veil, Flower Veil (The target's boosts are sometimes by virtue of its Ally's Ability).
Modify the table accordingly if there is a need to.
Step II
Spoiler:
1a. Replace x8TTTTTT in the routines with the offset of the Mold breaker table. 1b. Insert these routines with byte changes in the respective code comments.
Routine I (Checks for user's Mold Breaker prior to move execution and then disables Abilities that are negated by Mold Breaker)
Routine III and its associated Battle Script (Generation V effect. Makes the foe affected by entry hazards even if it has an ability to negate the hazards effect (except Magic Guard))
This only works with Doesntknowhowtoplay's DPSS patch.
LL is the move effect ID for Sacred sword effect (Set the Pointer to the Basic Damaging Battle Script as an entry in the Move Effect Table).
Fire Red:
Spoiler:
Just insert these routines and make bytes changes mentioned their comments.
There is an existing one made that has been used for implementing abilities like Download etc.
But there is one problem with that switch-in manager. It performs an OR logic with status byte of the banked pokemon with x00000200 (so that the switch-in script does not execute repeatedly at the start of a turn) which causes a nasty side effect. The nasty side effect is that pokemon possessing an ability which uses that switch-in logic becomes totally immune to non-volatile status conditions (e.g burn, poison, sleep etc.).
A battling banked mon's status condition is stored in a Word and the functions responible for inflicting these status have a check that the content of status Word should be absolute zero otherwise no status infliction happens. So when the switch-in ability mon is inflicted with a Status Move, the Status Word of the banked mon would always atleast consist of x00000200 (i.e 1 in its 9th bit) and hence fails to be inflicted with the status.
The new system in this post hooks with the Intimidate ability and ORs special status flag with x800000 to avoid the repetitive problem instead of ORing with the status byte to avoid the statusimmunity problem. This also uses a similar table system compared that previous switch-in one but uses custom Battle Scripts instead of custom ASM as entries.
Also, there is logic added to solve inconsistencies due to Trace, Skill Swap and Role Play on switch-in abilities while simultaneously updating Intimidate to latest Generation (activation due to copying by Trace, RolePlay etc.)
Fire Red:
Spoiler:
Step I
Spoiler:
1a. One custom table of the size ((No. of Switch-in Abilities)*8 bytes) is going to be used for this system, so select suitable starting offsets for the table according to the requirements. 1b. In the routine, replace x8TTTTTT (near the last line) with the table's starting offset, 1c. Insert the routine somewhere. Routine
// Pressure Message Hex: FD 13 FE DD E7 00 D9 EC D9 E6 E8 DD E2 DB 00 E4 E6 D9 E7 E7 E9 E6 D9 AB FF
The bolded part will be the crux of every switch-in script using this system, so make sure to start your switch-in battle script using these lines. Also, in case if you want to understand the need for this part:
Spoiler:
'pause 0x20' - Pauses for half a second 'setbyte 0x2023D6C 0x0 - Sets the content of 0x2023D6C to 0x0. This must be set to zero for command e1 to work properly. 'cmd e1 0x81D936A' - This sets the user buffer (0x2023FDB not 0x2023D6B in this case) and target buffer (0x2023D6C) and is used in Target Iteration for Intimidate in doubles. The second parameter is an offset to branch after the Iteration finishes, the offset '0x81D936A' just contains a script containing the command '3C' (i.e a return command).
Similarly, message scripts can be created for Mold Breaker, Terravolt and Turboblaze.
Abilities like Download, Imposter and Frisk would require some extra logic.
Now compile them and also note down the table pointer of the script
Step III
Spoiler:
Now fill the table in the format: (Ability ID) 00 00 00 (the pointer to the associated script).. Hence, each ability entry will use 8 (1+1+1+1+4) entries per table for this implementation.
Only include those abilities in the tables that have switch-in logic. Also make sure that the table is terminated by a FF.
Step IV
Spoiler:
This adjusts Trace, Skill Swap and Role Play to the latest standards while simultaneously solving the inconsistencies due to the routines.
Insert these custom ASM and corresponding battle scripts.
Sorry the for the late reply. The callasm command and battle string loader hack are posted in the Quick R&D thread and these things are already installed in MrDS' Patch.
Yeah, would the routines (for both the Magic Coat/Bounce fix and the fixed Ability Switch-In routines) still work if I compile and put them in a rom currently using the MrDS patch? Because I'm pretty sure the MrDS patch still uses the erroneous original routines.
Yeah, would the routines (for both the Magic Coat/Bounce fix and the fixed Ability Switch-In routines) still work if I compile and put them in a rom currently using the MrDS patch? Because I'm pretty sure the MrDS patch still uses the erroneous original routines.
You need to remove the old ones before inserting the new ones.
I have a question. How do you insert those abilities? I mean, I know how to insert ASM routine but what am I supposed to do later? How to write these abilities' effect into one that exists?
Where can I even find the old routines to remove in the first place?
For Magic Bounce at x1D8D6 insert, 18 01 80 18 00 78 C0 06 88 46 before applying the new routines.
For the switch-in one, I advise to wait till the next version of the base since MrDS will be making many switch-in abilities using this system.
The code for Fire Red's Sturdy is impossible to compile. Errors that I get:
Sturdy.asm:22: Error: invalid offset, value too big <0xFFFFFFFC>
Sturdy.asm:31: Error: invalid offset, value too big <0xFFFFFFFC>
Could someone correct it?
The code for Fire Red's Sturdy is impossible to compile. Errors that I get:
Sturdy.asm:22: Error: invalid offset, value too big <0xFFFFFFFC>
Sturdy.asm:31: Error: invalid offset, value too big <0xFFFFFFFC>
Could someone correct it?
There were errors in the case on lines 22 and 31. The fixed version is below
Even though it compiles now, there is another problem. This code doesn't work for me. After inserting it when I select a move in a battle and use it, the whole game freezes. On a modified rom it actually resets and on a clean rom it just freezes. Now, am I just doing something incorrectly or is this the code that is wrong?
Even though it compiles now, there is another problem. This code doesn't work for me. After inserting it when I select a move in a battle and use it, the whole game freezes. On a modified rom it actually resets and on a clean rom it just freezes. Now, am I just doing something incorrectly or is this the code that is wrong?
After a quick glance I can't see anything obviously wrong with the logic. Did you follow the instruction telling you to put 01 48 00 47 00 00 xx xx xx 08 1A 4A at 01F1E2. Remember the offset has to be little-endian and plus 1 (since it's THUMB code). If you did this, I can only assume it's broken.
After a quick glance I can't see anything obviously wrong with the logic. Did you follow the instruction telling you to put 01 48 00 47 00 00 xx xx xx 08 1A 4A at 01F1E2. Remember the offset has to be little-endian and plus 1 (since it's THUMB code). If you did this, I can only assume it's broken.
Yes, it was my fault. Apparently I didn't add 1 to my offset. Thanks for your help!
Hi,
how am I suppose to do if I want to make technician not the number 0x66 ability but rather the 0x4D ability ? Because in the routine, if I replace the "cmp r4, #066" with "cmp r4, #04D" the assembler doesn't want to assemble my routine.
Any clue ? Tell me if I'm not clear
Hi,
how am I suppose to do if I want to make technician not the number 0x66 ability but rather the 0x4D ability ? Because in the routine, if I replace the "cmp r4, #066" with "cmp r4, #04D" the assembler doesn't want to assemble my routine.
Any clue ? Tell me if I'm not clear
"cmp r4, #0x66"
"cmp r4, #0x4D"
Don't forget to have x those kind of digits because that means a hex digit otherwise your routine doesn't want to assemble at all.