The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.3.33 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Users browsing this thread: 1 Guest(s)
Casting Spells Taught by Espers - RESOLVED!

#1
Posts: 89
Threads: 11
Thanks Received: 3
Thanks Given: 1
Joined: Dec 2015
Reputation: 3
Status
Debrave
I have reached my wit's end and humbly beg for a second pair of eyes.  But first, a lengthy prologue!

One of my major pet peeves about how Final Fantasy VI handled magic was that you had to wait  until the spell was learned 100% in order to cast it. Why not just let the spell be cast as long as the Esper was equipped, but also gain progress towards learning the spell?  That way, when it was fully learned, the Esper could be de-equipped but the spell would remain in the menu.

Years later FFIX and FFTA used the same ability learning system, except it was tied to equipment. I wanted this tweak for the Final Fantasy VI spell-learning system as well. However, I suspected that this would be impossible to accomplish, since no one had done this before. Furthermore, despite being at the periphery of ROM hacking for ages, I had no clue as to even what the framework was to making this change, let alone how to begin. In my ignorance, I assumed it just simply was as impossible as, say, having 5 characters in a party.

As I saw hack after hack being released, I slowly dipped my toe into the pool of modding, still thoroughtly confused. I didn't want to go the route of HatZen08's patch, which made magic usable only when the Esper was equipped and disabled the learning system. Through testing, I was able to get magic to appear in the menu without being learned, so this clearly was doable.  But how?

I decided to focus on C2 first, since I would rather get this feature working in battle rather than outside of battle. I worked at it, and I got precisely half the problem solved. I was able to figure out how to stop blanking out spells whether or not an Esper was equipped. Below is the new (albeit terrible) code for that part:

Code:
C2/55A3: EA              NOP
C2/55A4: EA              NOP
C2/55A5: EA              NOP
C2/55A6: EA              NOP
Code:
C2/5708: 4C 69 64        JMP $6469 ; Jump to the new code
C2/570B: EA
C2/570C: EA
C2/570D: EA
Code:
C2/6469: B1 F0           LDA ($F0),Y ; Loads the value of the spell learned
C2/646B: 1A              INC         ; Repositioned INC as it always happens
                                      in original code
C2/646C: F0 04           BEQ $6472   ; A will be 0 if the spell is known and if so,
                                      branch to the "blank out" code
C2/646E: A5 F7           LDA $F7     ; Gets the Esper ID from F7 register into A to
                                      check for Esper presence
C2/6470: 30 04           BMI $6576   ; Minus flag is set if no Esper equipped.
C2/6472: 7A              PLY         ; Pulls Y from the stack like the orginal code
C2/6473: 4C 16 57        JMP $5716   ; Jumps to the code for allowed spells
C2/6476: 7A              PLY         ; Pulls Y from the stack like the original code
C2/6473: 4C 0E 57        JMP $570E   ; Jumps to the code to blank out spell usage


Yes, I know I'm going to have to make changes to properly blank out spells for Lores and other adjusments, but this does work!

The problem? Trying to get only the spells an Esper teaches to show up in the menu for that character.

I thought I could simply modify the code existing for learning a spell and use it for a basis of comparing ether it was learned or not. I finally came up with this result.

Code:
C2/6469: B1 F0           LDA ($F0),Y     ;  Same as above
C2/646B: 1A              INC             ;  Same
C2/646C: F0 22           BEQ $6490       ;  Branch changes due to extra code
C2/646E: A5 F7           LDA $F7         ;  Same as above
C2/6470: 30 18           BEQ $648A       ;  Branch changes due to extra code
C2/6472: DA              PHX             ;  Pushes X to the stack
C2/6473: 5A              PHY             ;  Pushes Y to the stack
C2/6474: 20 93 62        JSR $6293       ;  Multiplication subroutine to point X to the
                                           correct value
C2/6477: A0 05 00        LDY #$0005      ;  Sets Y to 5 to begin the loop
C2/647A: 7B              TDC             ;  Clear A
C2/647B: BF 01 6E D8     LDA $D86E00,X   ;  Load the spell that is taught
C2/647F: D3 01           CMP ($01,s),y   ;  Compare to the Y value on the stack
C2/6481: F0 0B           BEQ $648E       ;  If the value is the same, break to regular
                                           spell availability code
C2/6483: E8              INX             ;  Push X up, once
C2/6484: E8              INX             ;  Push X up since the "space" between spells
                                           on an Esper is 2
C2/6485: 88              DEY             ;  Decrement to advance iteration of the loop
C2/6486: D0 F3           BNE $647B       ;  Branch to compare line if Y != 0
C2/6488: FA              PLX             ;  Loop is over, pull X from stack
C2/6489: 7A              PLY             ;  Loop is over, pull Y from the stack
C2/648A: 7A              PLY             ;  Do again to get previously stacked Y just
                                           like the original code
C2/648B: 4C 0E 57        JMP $570E       ;  Branch to "blank out" code
C2/648E: FA              PLX             ;  Loop is over, pull X from stack
C2/648F: 7A              PLY             ;  Loop is over, pull Y from the stack
C2/6490: 7A              PLY             ;  Do again to get previously stacked Y just
                                           like the original code
C2/6491: 4C 16 57        JMP $5716       ;  Branch to the code for allowed spells  

Of course, when I play the game and get a random encounter with an Esper equipped, the screen goes blank..and the battle never loads. Without an Esper equipped, battle loads normally, and I can isolate the problem to my "comparison" code, but I can't figure out what I'm doing wrong.

I've tried inserting breakpoints, but can't figure out where everything goes haywire, as the loops seem to be completing as intended.

What am I doing wrong?
  Find
Quote  



Messages In This Thread
Casting Spells Taught by Espers - RESOLVED! - by Turbotastic - 04-05-2017, 12:56 PM
RE: Troubleshooting Code - by B-Run - 04-05-2017, 09:39 PM
RE: Troubleshooting Code - by Turbotastic - 04-13-2017, 12:07 AM
RE: Troubleshooting Code - by madsiur - 04-13-2017, 12:38 AM
RE: Troubleshooting Code - by seibaby - 04-13-2017, 04:20 AM
RE: Troubleshooting Code - by B-Run - 04-13-2017, 06:50 AM
RE: Troubleshooting Code - by Turbotastic - 08-06-2017, 10:30 PM
RE: Troubleshooting Code - by seibaby - 12-10-2017, 10:09 AM
RE: Troubleshooting Code - by seibaby - 08-09-2017, 06:44 PM
RE: Troubleshooting Code - by Turbotastic - 08-10-2017, 07:02 PM
RE: Troubleshooting Code - by seibaby - 08-27-2017, 01:05 PM
RE: Troubleshooting Code - by Turbotastic - 08-28-2017, 07:08 PM
RE: Troubleshooting Code - by Turbotastic - 12-10-2017, 01:42 PM
RE: Troubleshooting Code - by Turbotastic - 03-25-2018, 07:50 AM
RE: Troubleshooting Code - by Turbotastic - 03-29-2018, 11:43 PM
RE: Troubleshooting Code - by madsiur - 03-30-2018, 01:08 AM
RE: Troubleshooting Code - by Turbotastic - 03-30-2018, 01:36 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite