Users browsing this thread: 1 Guest(s)
Adding Lores in an event

#1
Posts: 22
Threads: 11
Thanks Received: 0
Thanks Given: 0
Joined: May 2019
Reputation: 2
Status
None
Hi all! While browsing around for different event-related subjects I came upon this old post:

https://www.ff6hacking.com/forums/showth...hp?tid=903

In it, Angelo26 shows a neat way for us to change the event code 8F that normally gives Cyan all of his Swdtech abilities into one that can teach characters Magic spells in an event. Pretty cool stuff! I tried it and it works like a charm. I guess it takes advantage of unused code in the game that performs the task but didn't have an event command associated with it.

My question is, can this be done with Lores instead of Magic spells? I tried by performing the directions from Angelo's post and using spell index 90 (Blowfish) as the spell to add, but it didn't work. Does anyone know another way? 

Here's the code the new 8F command points to when you make the changes in the aforementioned post (if it helps). Unfortunately I don't know any Assembly to understand it:
Code:
C0/AE0D:    A5EB        LDA $EB
C0/AE0F:    8D0242      STA $4202    
C0/AE12:    A936        LDA #$36      
C0/AE14:    8D0342      STA $4203    
C0/AE17:    A5EC        LDA $EC    
C0/AE19:    C221        REP #$21
C0/AE1B:    EA          NOP
C0/AE1C:    6D1642      ADC $4216      
C0/AE1F:    AA          TAX            
C0/AE20:    7B          TDC
C0/AE21:    E220        SEP #$20      
C0/AE23:    A9FF        LDA #$FF    
C0/AE25:    9D6E1A      STA $1A6E,X    
C0/AE28:    A903        LDA #$03      
C0/AE2A:    4C5C9B      JMP $9B5C
  Find
Quote  

#2
Posts: 3,966
Threads: 279
Thanks Received: 234
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Here's what the code does:

Code:
C0/AE0D:    A5EB        LDA $EB        ; load character ID
C0/AE0F:    8D0242      STA $4202      ; save it for multiplication
C0/AE12:    A936        LDA #$36       ; number of spell slots per character (54)
C0/AE14:    8D0342      STA $4203      ; save it for multiplication
C0/AE17:    A5EC        LDA $EC        ; load spell ID    
C0/AE19:    C221        REP #$21      
C0/AE1B:    EA          NOP            ; wait for multiplication to be done
C0/AE1C:    6D1642      ADC $4216      ; spell ID + (character ID * 54)      
C0/AE1F:    AA          TAX            ; transfer result to X
C0/AE20:    7B          TDC            ; clear accumulator
C0/AE21:    E220        SEP #$20      
C0/AE23:    A9FF        LDA #$FF       ; spell is learned
C0/AE25:    9D6E1A      STA $1A6E,X    ; set spell as learned
C0/AE28:    A903        LDA #$03          
C0/AE2A:    4C5C9B      JMP $9B5C      ; advance the event code of 3 bytes

Known Lore are at $1D29-$1D2B, meaning there is 1 bit per Lore on 3 bytes (24 Lores). You would need to set the good bit knowing your first Lore is spell ID $8B. The command would only need one parameter ($EB), the spell ID and with that you set the good bit in $1D29-$1D2B. You'd need to rewrite most of that function, I'm kinda unsure what would be a good way to do it though..
  Find
Quote  
[-] The following 3 users say Thank You to madsiur for this post:
  • C-Dude (01-11-2020), Morendo (01-12-2020), Robo Jesus (01-11-2020)

#3
Posts: 3,966
Threads: 279
Thanks Received: 234
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
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
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Morendo (01-12-2020)



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite