Author Topic: How character stats work?  (Read 2407 times)

Chrono45

  • Earthbound (+15)
  • *
  • Posts: 32
  • Just a guy who likes CT ALOT.
    • View Profile
How character stats work?
« on: December 18, 2019, 05:50:32 am »
In trying to hack character stats, I found that on level up they all reset (except for health). Is the game hardcoded to set, for example, stamina to a specific value every level. And if so, does the game keep trackers for using tabs, so that the math is level specific value + number of specific tabs used on that character? Also, I thought it might be cool to create the tabs for every stat. anyone who knows more about the code than me think that would be possible?

IHBP

  • Architect of Kajar
  • Chronopolitan (+300)
  • *
  • Posts: 379
    • View Profile
Re: How character stats work?
« Reply #1 on: December 18, 2019, 12:54:04 pm »
Basically there is a stat growth formula that is recalculated every level, Hp is just a simple addition of the increase allotted for that level.


There are ways to permanently add to stats, are you making a hack in temporal flux?

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1764
  • Nu-chan
    • View Profile
    • Maurtopia
Re: How character stats work?
« Reply #2 on: December 18, 2019, 03:04:33 pm »
I've been meaning to expand the tab code. At one point tabs were set up to have stat offset and amount increase stored in their data, but by the final it wasn't used, and speed tabs weren't done correctly.

The final code checks the item index. 0xCD is a Power Tab, 0xCE is a Magic Tab, and anything else is a Speed Tab.

Chrono45

  • Earthbound (+15)
  • *
  • Posts: 32
  • Just a guy who likes CT ALOT.
    • View Profile
Re: How character stats work?
« Reply #3 on: December 18, 2019, 04:33:18 pm »
No I don't know too much about how the game code works or the tools offered here to change it. I was simply messing around with the memory states. I wanted to adjust some stats to "balance" out some of the characters in the new chrono trigger + mod. It's interesting to know they are recalculated every level though. I've been playing this game a long time and never knew that.

Chrono45

  • Earthbound (+15)
  • *
  • Posts: 32
  • Just a guy who likes CT ALOT.
    • View Profile
Re: How character stats work?
« Reply #4 on: December 18, 2019, 04:47:42 pm »
Mauron, I saw that you created a stat growth editor for TF, I am going to give that a go. I assume it would work on an already patched rom?

Chrono45

  • Earthbound (+15)
  • *
  • Posts: 32
  • Just a guy who likes CT ALOT.
    • View Profile
Re: How character stats work?
« Reply #5 on: December 18, 2019, 04:51:10 pm »
Holy shit, this thing is a masterpiece. I don't know a ton about how hard it is to make something like this. But damn, this is very easy to walk right into. Thanks for making some of these plugins.

IHBP

  • Architect of Kajar
  • Chronopolitan (+300)
  • *
  • Posts: 379
    • View Profile
Re: How character stats work?
« Reply #6 on: December 18, 2019, 04:54:40 pm »
Ya it'd work for that you'll need the temporal flux editor and the warrier workshop plugin.

Use this version of the CT+ mod though, it's way more polished.

https://www.dropbox.com/s/rzqr1g8mb2bbus7/New%20WinZip%20File.zip?dl=0

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1764
  • Nu-chan
    • View Profile
    • Maurtopia
Re: How character stats work?
« Reply #7 on: December 18, 2019, 05:13:54 pm »
Warrior Workshop can handle starting stats. For events and state save hacking, you'd need to work with the PC data in RAM.

Code: [Select]
Battle 0B FF 1 power (PC only)
Battle 0C FF 1 stamina (PC only) 
Battle 0D FF 1 speed (PC only)
Battle 0E FF 1 magic (PC only)
Battle 0F FF 1 hit (PC only)
Battle 10 FF 1 evade (PC only)
Battle 11 FF 1 magic defense (PC only)

Battle 2F FF 1 Power Adder + tabs. (PC only)
Battle 30 FF 1 Stamina Adder (PC only)
Battle 31 FF 1 Speed adder + tabs (PC only)
Battle 32 FF 1 Hit Adder + tabs (PC only)
Battle 33 FF 1 Evade Adder (PC only)
Battle 34 FF 1 Magic Adder (PC only)
Battle 35 FF 1 Magic Defense Adder (PC only)

The initial version of the second set is listed as Growth2 in the editor.

Chrono45

  • Earthbound (+15)
  • *
  • Posts: 32
  • Just a guy who likes CT ALOT.
    • View Profile
Re: How character stats work?
« Reply #8 on: December 18, 2019, 09:09:01 pm »
Thanks for the help gang, got everything I wanted to figured out. well except for that hit tab situation. But I believe that is probably a little ways above my pay grade.

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1764
  • Nu-chan
    • View Profile
    • Maurtopia
Re: How character stats work?
« Reply #9 on: December 18, 2019, 10:02:54 pm »
I'll probably rig something up soonish. Here's the relevant code:

Code: [Select]
$C2/B202 A2 01 LDX #$01 // load value for power
$C2/B204 AD C9 04 LDA $04C9  [$7E:04C9]
$C2/B207 C9 CD CMP #$CD // check if power tab
$C2/B209 F0 08 BEQ $08    [$B213]
$C2/B20B A2 06 LDX #$06 // load value for magic
$C2/B20D C9 CE CMP #$CE // check if magic tab
$C2/B20F F0 02 BEQ $02    [$B213]
$C2/B211 A2 02 LDX #$02 // load value for speed
$C2/B213 8E BD 0D STX $0DBD  [$7E:0DBD] // store last checked value.

Code: [Select]
$C2/B2E4 AE BD 0D LDX $0DBD  [$7E:0DBD] // stat offset
$C2/B2E7 BF 15 B3 C2 LDA $C2B315,x[$C2:B317] // load adder offset
$C2/B2EB C2 31 REP #$31
$C2/B2ED 65 6F ADC $6F    [$00:006F] // add current PC stat offset
$C2/B2EF 85 00 STA $00    [$00:0000]
$C2/B2F1 BF 2B CF FF LDA $FFCF2B,x[$FF:CF2D] // load stat offset
$C2/B2F5 29 FF 00 AND #$00FF
$C2/B2F8 18 CLC
$C2/B2F9 65 6F ADC $6F    [$00:006F] // add current PC stat offset
$C2/B2FB AA TAX
$C2/B2FC FE 0B 00 INC $000B,x[$7E:000D] // add one to the stat
$C2/B2FF E2 20 SEP #$20
$C2/B301 A6 00 LDX $00    [$00:0000]
$C2/B303 BD 2F 00 LDA $002F,x[$7E:0031] // load the adder
$C2/B306 C9 63 CMP #$63 // if 99, don't increase
$C2/B308 B0 04 BCS $04    [$B30E]
$C2/B30A 1A INC A // add one to adder.
$C2/B30B 9D 2F 00 STA $002F,x[$7E:0031]

That first section can be replaced with a check on tab type 0 (default speed tab compatibility) and load the proper index based on the stat.

For the second section, I'd like to replace the INC instructions with an ADC using the second byte of tab data. Doing this would allow for all primary stat tabs, and more than +1 stat bonuses. Possibly HP/MP tabs too.

Actually, there's another piece of code I need to find first.