Final Fantasy Hacktics

Modding => Help! => Topic started by: Neophyte Ronin on July 23, 2019, 02:12:04 pm

Title: Regarding Formula 38 (duplicate of another segment of code?)
Post by: Neophyte Ronin on July 23, 2019, 02:12:04 pm
Perusing the Wiki's Formula lists, I noticed Formula 38 (100% Set Status) is claimed to be a duplicate of "Apply Status (to Action)" code, which implies it exists elsewhere in the program code.  Abilities that utilize 38 have balance issues (e.g. Boss Status checks are "either you're immune or you die") and I seek to amend them by tying the Abilities with other more suitable Formulas.

So, if I outsource all Abilities, can Formula 38 be pruned, or will it spell doom to "Apply Status (to Action)" also?

EDIT: Solved
(see Glain's first post below for specifics).  0x38 points to an existent formula; to change what 0x38 does (i.e. Set Status 100%), the pointer must be changed to another region in the "Free/Kanji" data space.
Title: Re: Regarding Formula 38 (duplicate of another segment of code?)
Post by: Xifanie on July 23, 2019, 03:37:16 pm
Each formula has its own function. They usually call for the same subroutines if they calculate some of the same things, but each formula routine is independent and can be altered as you want.
Title: Re: Regarding Formula 38 (duplicate of another segment of code?)
Post by: Glain on July 24, 2019, 07:14:42 pm
Formula 0x38 is actually unique in that it doesn't have its own function and the formula table links directly to the status applying routine instead.  If you want to alter what the formula does without changing the status application routine, you have to change where it points.

At address 0x8018f610 in RAM (0x128610 in BATTLE.BIN) is the formula table.  Each entry is a 4-byte pointer to the function to call when that formula is used.  Entry 0x38 is at address 0x8018f6f0 in RAM and offset 0x1286F0 in BATTLE.BIN.  You would need to change that entry (from 0x80187f24) to the address of your custom function in free/kanji space.
Title: Re: Regarding Formula 38 (duplicate of another segment of code?)
Post by: Xifanie on July 24, 2019, 08:56:26 pm
Wow, my bad o.o
Title: Re: Regarding Formula 38 (duplicate of another segment of code?)
Post by: Neophyte Ronin on July 25, 2019, 03:48:57 pm
Thank you.  I was wondering what the deal was with the duplication.  So, in future reference, 0x38 points to an existent routine and changing the pointer elsewhere.  I'll be sure to set this thread as a favorite!   :D