03-10-2014, 08:57 PM
(This post was last modified: 03-10-2014, 08:59 PM by GrayShadows.)
Okay, so this isn't tested yet, but at a glance this code should work. I've used 6D, which looks to be one of several unused general event commands (there are a number that point to C0/B91A, which is just an RTS), and it takes two parameters: first, the character ID, and second, the ID of the command you want to give the character. It just straight-up replaces the second command in the character's list, since in a normal game you're probably not wanting to mess with Fight/Magic/Item.
So, if you wanted to give Edgar the Magitek ability, you'd use: 6D 04 1D, where 6D is the event command, 04 is Edgar's character ID, and 1D is Magitek's command ID.
I haven't checked this against any free-space allocations, so if you're using other patches, or if you've got other code already added in, you may need to change the location of the new code (and subsequently where the 6D pointer points to).
So, if you wanted to give Edgar the Magitek ability, you'd use: 6D 04 1D, where 6D is the event command, 04 is Edgar's character ID, and 1D is Magitek's command ID.
Code:
org $C09934 ; General action 6D
DW $D613 ; New action is being placed at C0/D613
org $C0D613
LDA $EB ; Grab first parameter (character ID)
STA $4202 ;
LDA #$25 ; Multiply by length of character block (37/#25 bytes)
STA $4203 ;
LDA $4216 ; Load result...
TAX ; ...and transfer to X
LDA $EC ; Grab second parameter (Command ID)
STA $1617,X ; Character's second command is at byte 23/#17 of the block
LDA $03 ; Set accumulator to number of bytes to advance event queue
JMP $9B5C ; ...and jump and advance.
I haven't checked this against any free-space allocations, so if you're using other patches, or if you've got other code already added in, you may need to change the location of the new code (and subsequently where the 6D pointer points to).
Current Project: FF6: Tensei | Discord ID: TristanGrayse