Quote:
Originally Posted by Koople
Maybe I didn't explain it well enough, but my last post describes the difference here. Again, the code has nothing to do with assigning the ability to the pokemon. The game has a list of abilities (eg. Wonder Guard is ability 25 (or 0x19) ) that are ordered by their positions in the ability description/name tables. These bytes are assigned to the 22nd/23rd bytes in the base stats data structure. This byte is loaded during battle and used to check for unique ability effects. The code you are inserting is checking for this byte as a way of implementing the ability, so you just need to insert the code, insert your new ability description/pointer in an unused table entry, and assign that index to your pokemon. For example, if you add your ability name right after Air Lock, your ability ID would be 77 (0x4D).
|
Thank you for the help! I've decided to post screenshots of a step by step process I will do beginning from the insertion of the Thumb Script up to testing it in game so that it might be easier to identify where I am having an issue.
First, I begin by inserting this code
Code:
.text
.align 2
.thumb
.thumb_func
.global typechangeabilities
BufferAbility:
mov r0, r6
add r0, #0x20
ldrb r1, [r0]
NormalCheck:
mov r0, r10
cmp r0, #0x0
bne NormalizeCheck
RefrigerateCheck:
cmp r1, #0xAF
bne PixilateCheck
Refrigerate:
mov r0, #0xF
b StoreType
PixilateCheck:
cmp r1, #0xB7
bne AerilateCheck
Pixilate:
mov r0, #0x17
b StoreType
AerilateCheck:
cmp r1, #0xB9
bne Return
Aerilate:
mov r0, #0x2
StoreType:
mov r10, r0
ldr r0, .ChangeTypeLoc
ldr r1, [r0]
add r1, #0x13
ldrb r1, [r1]
mov r2, #0x3F
and r2, r1
cmp r2, #0x0
bne Return
mov r2, r10
strb r2, [r1]
Boost:
mov r0, r8
mov r1, #0xA7
mul r0, r1
lsr r0, #0x7
mov r8, r0
mul r7, r1
lsr r7, #0x7
b Return
NormalizeCheck:
cmp r1, #0x61
bne Return
Normalize:
mov r0, #0x0
mov r10, r0
Return:
ldr r0, [sp, #0x4]
ldrh r0, [r0, #0xA]
str r0, [sp, #0x1C]
ldrh r0, [r6, #0x2E]
cmp r0, #0xAF
bne NoEnigmaBerry
ldr r1, .Return
bx r1
NoEnigmaBerry:
ldr r0, .Return2
bx r0
.align 2
.ChangeTypeLoc: .word 0x0202449C
.Return: .word 0x0806961B
.Return2: .word 0x08069635
(NOTE: my game does not have the Fairy type however I am assuming if I ignore the Pixiliate ability this will be harmless as the routine to check for the Fairy type should only be run if a Pixilate Pokemon is on the field)
https://i.imgur.com/YJwHeNZ.png
Here I can see that the test compile is successful and there are no issues in the script
https://i.imgur.com/ifpwEcW.png
Then, using the THUMB Editor and Assembler, I insert the code into my rom at free space offset 0xFE3E00
Now, here's part of where I'm stumped. This code is inserted but how do I assign it to an ability number? Do I need to edit a value in the actual Thumb script itself that is deciding what number each ability is? If so, where even is that? What am I supposed to change to get, say, empty ability slots 78-82 to be these abilities?
https://i.imgur.com/cAgRPxF.png
Here is the location of the bytes I have changed according to the footnote at the bottom of the Thumb script
Also, in this script at the bottom he says "01 48 00 47 00 0 xx+1 xx xx 08 at 0806960E" Is the single 0 a typo? bytes are always supposed to be two digits. Am I supposed to infer this is 00 or am I supposed to simply put one 0 and then the beginning of the offset as the second digit?