Users browsing this thread: 1 Guest(s)
Adding Lores in an event
01-12-2020, 01:57 AM
I have come up with a possible solution. You can assemble the code with xkas 0.06. It is untested but it does compile. Note that you need to put this in free space and change the pointer to command $8F if it's not already done. You event command will take as only parameter the spell ID and Strago will learn it. Trying to give a lore to a regular character as magic is absurd because there's only 54 spell slots, for spells 0 to 53.
Code:
hirom
;header
rep #$20 ; 16-bit accumulator
phx ; save X
phy ; save Y
tdc ; clear accumulator
tax ; clear X
tay ; clear Y
sep #$20 ; 8-bit accumulator
lda #$03 ; we have 3 lore bytes
sta $004206 ; save for division
lda $EB ; load spell ID
sec ; set carry
sbc #$8B ; subtract first lore spell ID
rep #$20 ; 16-bit accumulator
sta $004204 ; save index 0 to 23 for division
nop ; wait for division to complete
nop
nop
nop
nop
nop
nop
nop
lda $004214 ; load result of division (0-2)
tax ; transfer result to X
sep #$20 ; 8-bit accumulator
lda $004216 ; load division remainer
tay ; transfer remainer to Y
lda lut,Y ; load the bit to set
ora $1D29,X ; set the bit
sta $1D29,X ; save
rep #$20 ; 16-bit accumulator
ply ; restore Y
plx ; restore X
sep #$20 ; 8-bit accumulator
lda #$02
jmp $9B5C ; advance event code of 2 bytes
lut:
db $01
db $02
db $04
db $08
db $10
db $20
db $40
db $80
« Next Oldest | Next Newest »
|
||||
Users browsing this thread: 1 Guest(s)