Users browsing this thread: 1 Guest(s)
Espers teaching Stat gains

#4
Posts: 22
Threads: 11
Thanks Received: 0
Thanks Given: 0
Joined: May 2019
Reputation: 2
Status
None
I think I might be making some headway on how I might be able to do this. Here's what I've got. I'll try and explain it as best I can. I'm still new to this, and I probably misunderstand and misexplain a lot!

In the vanilla game, Ramuh looks like this:
Ramuh 
Bolt     x10
Bolt2   x2
Poison x5
At level up ... Stamina +1

In my romhack, I plan to make Ramuh look like this:
Ramuh
Vigor+1   x10
Speed+2  x2
Stam+1   x5
No level-up bonus

- Everything else is vanilla.
- Right now, each character has RAM assigned to which spells they've learned. ($1A6E-$1CF4 Spells Known (12 characters, 54 spells each, 1 byte per spell)
- My romhack will only use 24 spells. The other 30 spots in RAM can be devoted exclusively to these skill-ups.
- This way I need to touch as little code as possible from the vanilla game. You fight monsters. Monsters give Magic Point(s). They calculate the exact same way. They save to the exact same RAM. Everything is the same.
- I set Ramuh to teach Slow x10 instead of Bolt x10. Easy. FFusME can do that with no trouble.
- Slow is spell index 25. 

- When you learn a "spell" from an Esper (which will now actually be our skill-up), it checks to see if the spell you've learned reaches 100% ($C2604B). I can add a subroutine here. (see below)
- All I need this subroutine to do is to turn my spell index (25) into a value between $00 and $10. (Incidentally, the correct value for Vigor+1 is $09. You can see this here: https://www.ff6hacking.com/wiki/doku.php...fmt:espers)
- Why a number between $00 and $10? 
Because I can run a number between $00 and $10 through the Level-Up bonus subroutine at $C260C2. The vanilla game already knows what to do once I give it the correct value.

- So now I just need to turn the number 25 into $09.
- I... don't know how to do this... Moreover, if I plan on turning all spell indexes from 25-54 into these skill-ups, it would be more complex than just turning 25 into $09. I'd need 25, 26, 27 to turn into $09; 28, 29, 30 to turn into $0A, etc. This way Ramuh could teach Vigor+1, and Shiva could teach a *different* Vigor+1. Using spell index 25 on both Espers would just cause both Espers to teach the same bonus.

I suppose it would look something like this:
Code:
C2604B:            BEQ C2606C            ;branch if no learn rate, i.e. no spell to learn - This first part is vanilla code
                         XBA
                         LDA $FB                 ;Magic points gained from the battle
                         JSR C24781          ;Multiply by spell learn rate
                         STA $EE                  ;Store this amount in $EE
                         LDA ($F4),Y           ;what % of spell is known
                         CMP #$FF
                         BEQ C2606C            ;Branch if spell already known
                         CLC
                         ADC $EE                   ;Add amount learned to % known for spell
                         BCS C26064
                         CMP #$64
                         BCC C26066            ;branch if % known didn't reach 100 - Vanilla Code interrupted here by my skill1 subroutine
                        JSR skill1            ;new skill-up subroutine - this is the only line of code I'm adding
C26064:           LDA #$80                 ;this is vanilla code again
C26066:            STA ($F4),Y            ;if it did, mark spell as just learned - this is also vanilla code




skill1:     PHA            
             PHY            
             LDA $D86E01,X        ; Find out which skill-up we just leveled up to 100% (X from earlier code helps us find this)
                                        ; Skill-ups and spells come from a shared index. This will load the result to the Accumulator.
             CMP #$25                 ; Compare it to #$25. Anything lower than #$25 is a spell and not a skill-up.
                                        ; Maybe unneeded, but I've added this in case we get here by accident.
             BCC C261B0                ; If it IS less than #$25, pop everything back where we found it and RTS the heck outta here.
                                                       ; Now the accumulator has our spell index in it (25 if it's the slow spell from our example above)
                PHX
        ::Turn 25 into $09 somehow::
                 ASL                                 ; the level-up bonus code does this to prepare the bonus for calculation
                 TAX                                  ; Transfer Accumulator to X
                JSR (C2614E,X)               ; Calculate Skill-up as if we had leveled up while equipped with an esper that gives Vigor+1 as a level-up bonus
                PLX
                PLY
                 PLA
                 RTS

Sorry about the formatting. My typing got eaten somehow. Also, there might be more to it after the bonus is calculated. I honestly haven't gotten that far just in case the first part doesn't work.
Am I crazy? Misinformed? Misunderstanding how life works? Not explaining it well? Please let me know! Any help would be appreciated.
  Find
Quote  



Messages In This Thread
Espers teaching Stat gains - by Morendo - 09-09-2020, 04:28 PM
RE: Espers teaching Stat gains - by Turbotastic - 09-17-2020, 12:42 AM
RE: Espers teaching Stat gains - by Morendo - 09-25-2020, 12:00 PM
RE: Espers teaching Stat gains - by Morendo - 11-12-2020, 05:09 AM
RE: Espers teaching Stat gains - by Everything - 11-12-2020, 03:28 PM
RE: Espers teaching Stat gains - by Bropedio - 12-10-2020, 05:38 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite