• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
May 15, 2024, 06:02:49 am

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen, RetroArch, and Duckstation are recommended for playing/testing, pSX is recommended for debugging.


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - stuminator

1
Help! / Re: Damage calculation question (WOTL)
August 28, 2023, 03:30:19 pm
The zodiac compatibility modifier is applied only to the attacking character's XA, not the WP.  Ramza's attack against Lavian in your example should be calculated as (6 - [6*0.25])*7, which works out to 35.  And attacking Gafgarion would be (6 + [6*0.25])*7, which gives 49.

Also note that when applying compatibility you multiply by either 0.25 (good/bad) or 0.50 (best/worst), then add/subtract that number to the original XA to get the new value.  Using the Orbonne example vs Lavian again, the compatibility modifier changes Ramza's PA in the calculation to 5.  If you calculated 6*0.75 instead, you would get 4.5 (or 4, since FFT truncates nearly all non-integer values) which is incorrect.
2
PSX FFT Hacking / Re: stuminator's ASM hacks
January 15, 2023, 10:35:40 pm
Quote from: Zanbamon on January 15, 2023, 02:04:07 amSo I tried this and it didn't work, do I need to edit some of these values?

EDIT: When I'm moving my unit I can see tiles that would be normally unreachable be highlighted but if I try to move there it tells me I need to select a valid target, so its doing something.

So it looks like the game uses different offsets in the movement routine than it usually does.  0x10 appears to correspond to movement group 0x93, 0x11 is group 0x94, and 0x12 is group 0x95.  So change the first bolded 12 to the group you want, and the second bolded 20 for the ability's position within the group.  I tried 0x11 and 0x10 to tie it to Cannot Enter Water and it worked fine.

Use this version then to change what ability it is tied to.  This will stack with whatever the ability's vanilla function is though, unless you know how to disable it.


<Patch name="Move on Lava = Sidestep">
  <Description>
    Allows units to move through panels occupied by enemy units.
  </Description>
  <Location file="BATTLE_BIN" offset="10D530">
  1200A993
  </Location>
  <Location file="BATTLE_BIN" offset="10D53C">
  20002931
  </Location>
  <Location file="BATTLE_BIN" offset="10D9C8">
  05002015
  </Location>
</Patch>
3
PSX FFT Hacking / Re: stuminator's ASM hacks
January 13, 2023, 10:47:15 am
Quote from: RetroTypes on January 13, 2023, 05:21:17 amHas this Sidestep hack been tested? An initial look-over seems to tell me that the new andi you added will never succeed because you're doing it after another andi that's overwriting the value of r2. I do love the idea for this hack, though, and do plan on writing one myself that will use any RSM because of your inspiration! (I'll post it here when I'm done with it too if you'd like)

It seemed to work just fine on all the tests I did with it.  And it isn't storing the Move on Lava check in r2, but rather r9.  A search in the movement routine revealed that r9 isn't called anywhere so it seemed ok to store it there as it wouldn't be overwritten.
4
PSX FFT Hacking / Re: stuminator's ASM hacks
January 12, 2023, 06:44:02 pm
Quote from: Zanbamon on January 11, 2023, 11:02:37 pmThis is pretty cool, I'm still pretty new to ASM hacking so I would like to ask a question:
If I combined the code in the correct way, would it be possible to combine both new effects into one skill? I think the effects goes pretty well together.

<Patch name="Any Weather = Sonic Step">
  <Description>You can move and still get the 20 bonus CT for not moving</Description>
  <Location file="BATTLE_BIN" offset="10D774">
02004010
  </Location>
  <Location file="BATTLE_BIN" offset="11CC78">
1980013C
CC082324
21384300
21082200
CD082390
FF000234
1D006210
01000234
8601E290
9400E890
19004010
01000234
3900E690
5C00E390
8701E590
8801E490
02000831
2B280501
08006230
2528A200
04006330
5800E290
25186400
01004230
0200A014
25186200
1400C624
03006014
FFFFC230
1400C624
FFFFC230
3D00422C
02004014
01000234
3C000634
3900E6A0
0800E003
8601E0A0
  </Location>
</Patch>

This one is pretty easy to tie to any other RSM ability.  The Bolded 94 represents the group to search for, and the bolded 02 is the specific ability it's tied to.  See the Battle Stats page if you want to change the ability it is tied to:  https://ffhacktics.com/wiki/Battle_Stats

So if you wanted to tie it to Move on Lava, change those to 95 and 20.

Changing the "Sidestep" ability would need a few more lines of code added (unless you want to alter how Float works).  I chose Move on Lava for this because the game already does a check for it in the movement routine where it determines what panels are walkable.  And because Move on Lava is pretty worthless in the vanilla game.
5
PSX FFT Hacking / Re: stuminator's ASM hacks
January 09, 2023, 04:30:07 pm
Another new movement ability, taking the place of Any Weather.  This disables Any Weather's vanilla function, and allows its user to move and still keep the bonus CT you normally get when not moving. 

<Patch name="Any Weather = Sonic Step">
  <Description>You can move and still get the 20 bonus CT for not moving</Description>
  <Location file="BATTLE_BIN" offset="10D774">
02004010
  </Location>
  <Location file="BATTLE_BIN" offset="11CC78">
1980013C
CC082324
21384300
21082200
CD082390
FF000234
1D006210
01000234
8601E290
9400E890
19004010
01000234
3900E690
5C00E390
8701E590
8801E490
02000831
2B280501
08006230
2528A200
04006330
5800E290
25186400
01004230
0200A014
25186200
1400C624
03006014
FFFFC230
1400C624
FFFFC230
3D00422C
02004014
01000234
3C000634
3900E6A0
0800E003
8601E0A0
  </Location>
</Patch>
6
PSX FFT Hacking / Re: stuminator's ASM hacks
January 01, 2023, 05:08:59 pm
I made a new movement ability to take the place of Move on Lava: Sidestep.  It enables a unit to move through panels that are occupied by enemies.  Obviously not as useful as teleport or the like but should be helpful as a lower tier movement ability, especially for melee classes.  I didn't disable Move on Lava's vanilla function, but it's only useful on one optional map anyway.

<Patch name="Move on Lava = Sidestep">
  <Description>
    Allows units to move through panels occupied by enemy units.
  </Description>
  <Location file="BATTLE_BIN" offset="10D53C">
  20004930
  </Location>
  <Location file="BATTLE_BIN" offset="10D9C8">
  05002015
  </Location>
</Patch>
7
PSX FFT Hacking / Re: ASM Requests
October 30, 2021, 10:51:35 am
I know Emmy has made an Immortal Immune routine which checks if the target is flagged as Immortal and causes the ability to fail if so.  May want to check out Emmy's ASM thread for details on it.
8
Help! / Re: How to Increase Steal Gil Yields? (PSX)
October 22, 2021, 05:28:31 pm
This topic is well over a year old, but if you're still looking for this here's a quick patch that will multiply the amount of gil stolen by 8:

<Patch name="Gil stolen x 8">
  <Location file="BATTLE_BIN" offset="11F788">
  C0801000
  </Location>
</Patch>
9
As Glain predicted it might, a change in the unit's equipment does cause the weakness to disappear.  From what I could tell, any change to a unit's equipment causes elemental affinities to be reset to what is determined by the unit's job, then any additional modifications due to equipment are applied.  Not too surprising, since changing elemental affinities mid-battle (outside of what is caused by equipment) is something that was never intended to be included originally.

Quote from: Glain on October 20, 2021, 06:41:49 pmThe important difference with that code is that a variable is being set on the action as opposed to the unit.  Setting HP Damage on the action will cause the preview to show the damage, and the damage will take effect if and when the action is executed (and hits).

Makes perfect sense, now I see the difference here.  Since there are a limited number of action types the game recognizes, coding an action not originally intended will need the "only a preview" check to work properly.
10
Quote from: Glain on October 19, 2021, 09:41:06 pmWell, the issue is that you're directly affecting stats in the formula code, and the formula code is run during the attack preview.  You'll want to check for the preview by doing something like this:

lui r8, 0x8019
lbu r8, -0x0a04(r8)
li  r9, 2
beq r8, r9, skip

Ah, much appreciated.  I had noticed the offset -0x0a04 pop up a few times in other routines or formulas but didn't understand what it was doing.  Formula is now working as intended. 


Quote from: Glain on October 19, 2021, 09:41:06 pmAlso, I just want to point out a trick that can help out here... since you're taking the remainder of a division by a power of 2, you can just take the binary digits after that number and zero out the rest with a simple binary AND.
(Much like how doing modulus 100 on a base 10 number is the same as just taking the last two digits)

andi r6, r3, 0x07    # modulus division by 8

This is definitely an easier way to get random number if the range is a power of 2.


Quote from: Glain on October 19, 2021, 09:41:06 pmEdit:  As for not gaining EXP or JP, the action probably isn't flagged as doing anything (HP/MP damage, healing, or status infliction) and so the game doesn't see the action as anything that had an effect.

Still trying to get the XP/JP thing to work on this.  I thought flagging it as a pseudo status effect would do the job.  At least everything else related to the formula is working properly.

BTW, why do some formulas work ok without the check for "is it only an attack preview"?  Take a simple one like formula 45 (Target max HP - current HP):

00186e78: 3c028019 lui r2,0x8019
00186e7c: 8c422d98 lw r2,0x2d98(r2)
00186e80: 3c058019 lui r5,0x8019
00186e84: 8ca52d90 lw r5,0x2d90(r5)
00186e88: 9443002a lhu r3,0x002a(r2)
00186e8c: 94440028 lhu r4,0x0028(r2)
00186e90: 34020080 ori r2,r0,0x0080
00186e94: a0a20025 sb r2,0x0025(r5)      Set as HP Damage
00186e98: 00641823 subu r3,r3,r4      Damage is Target maxHP - curHP
00186e9c: 03e00008 jr r31
00186ea0: a4a30004 sh r3,0x0004(r5)      Store Damage

This is the entire routine, no jumps or branches. 
11
I have a couple formulas I'm working on where simply viewing the attack preview window causes the changes to actually occur, even if you back out before confirming that you want to execute the ability. 

Here is one I'm having an issue with:

00188f90: addiu r29,r29,0xffe8
00188f94: sw r31,0x0010(r29)
00188f98: jal 0x 00185e30 #  Loads SP and X
00188f9c: nop
00188fa0: jal 0x 001885f8 #  Zodiac Calculation
00188fa4: nop
00188fa8: jal 0x 0018659c #  Loads SP + X as X
00188fac: nop
00188fb0: jal 0x 00187510 #  Total Accuracy Check
00188fb4: nop
00188fb8: lui r3,0x8019
00188fbc: lw r2,0x2d90(r3)
00188fc0: nop
00188fc4: lbu r2,0x0000(r2)
00188fc8: nop
00188fcc: beq r2,r0,0x00189038 #  branch if attack fails
00188fd0: nop
00188fd4: jal 0x0002230c #  r3=random number
00188fd8: nop
00188fdc: lui r2,0x8019
00188fe0: ori r5,r0,0x0008 #  r5=8
00188fe4: divu r3,r5 #  divide random number by 8
00188fe8: lw r4,0x2d98(r2) #  load target's data pointer
00188fec: lw r1,0x2d90(r2)
00188ff0: ori r5,r0,0x0001 #  r5=1
00188ff4: mfhi r6 #  r6=remainder (random from 0...7)
00188ff8: lbu r7,0x006d(r4) #  load target's absorb element
00188ffc: lbu r8,0x006e(r4) #  load target's null element
00189000: lbu r9,0x006f(r4) #  load target's halve element
00189004: lbu r10,0x0070(r4) #  load target's weak element
00189008: sllv r6,r5,r6 #  shift 1 left by the remainder
0018900c: xori r11,r6,0xff #  r11=bit flip of r6
00189010: and r7,r7,r11 #  remove element from absorb elements
00189014: and r8,r8,r11 #  remove element from null elements
00189018: and r9,r9,r11 #  remove element from halve elements
0018901c: or r10,r10,r6 #  add element to weak elements
00189020: sb r7,0x006d(r4) #  store new absorb elements
00189024: sb r8,0x006e(r4) #  store new null elements
00189028: sb r9,0x006f(r4) #  store new halve elements
0018902c: sb r10,0x0070(r4) #  store new weak elements
00189030: sb r5,0x0000(r1) #  store as hit?
00189034: sb r5,0x0025(r1) # store as pseudo status?
00189038: lw r31,0x0010(r29)
0018903c: addiu r29,r29,0x0018
00189040: jr r31
00189044: nop

This is basically Edgar's debilitator tool from FFVI, which causes the target to be weak to a random element.  The code begins with a copy/paste of formula 3F (Mustadio's snipe), then most everything from 00188fd4 on down are the element roll and changes.  I'm clearly missing something I need since simply running the attack preview and backing out does make the target weak to a random element.  Also, if you follow through and confirm the attack, it doesn't yield any XP or JP like normal (but does add an additional weakness on top of the attack preview.) 

Anyone know what I'm missing on this?
12
PSX FFT Hacking / Re: stuminator's ASM hacks
October 19, 2021, 10:18:52 am
I didn't try testing it with checking multiple statuses within the same group, but this SHOULD work if more than one status is specified by the elemental box and the target has at least one of them.

When it compares the current status of the target to the status specified by the elemental field, it ANDs the values and considers it a success if it is nonzero.  So it should allow for multiple statuses, as long as they are in the same group. 

And no, I don't think there's a way to combine from different groups.  Maybe one of the vets here would know more about this, but I don't see any way to do it.
13
PSX FFT Hacking / stuminator's ASM hacks
October 16, 2021, 04:27:58 pm
Here is a compilation of the hacks I've developed.

<Patch name="Set individual proc rates for weapons and abilities">
  <Description>
    For weapons, set the unknown value to the right of the range from 00-7F to make that the proc rate.  If set from 80-FF, the default proc rate will be used.
    For abilites, check the box between Hit Allies and Follow Target, and the X value will become the proc rate.  Uses default proc rate if unchecked.
    Also includes a support ability to nullify procs, defaulted to Gained XP up, and an ability to double proc rate, defaulted to Train.
  </Description>
    <Location file="BATTLE_BIN" offset="121888">
      1980023C
      FCF5428C
      E8FFBD27
      26004014
      1000BFAF
      64000434
      1980063C
      982DC88C
      942DC98C
      90000891
      91002991
      20000831
      80002931
      25280000
      10000015
      2A480900
      D638C794
      0139C890
      0600E014
      80000A31
      02004015
    </Location>
    <Variable name="Default weapon proc rate" file="BATTLE_BIN" offset="1218DC" default="13"/>
    <Location file="BATTLE_BIN" offset="1218DD">
      000534
      25280800
      41220608
      00000000
      F438C790
      F938C690
      2000E730
      0200E010
    </Location>
    <Variable name="Default ability proc rate" file="BATTLE_BIN" offset="1218FC" default="13"/>
    <Location file="BATTLE_BIN" offset="1218FD">
      000534
      25280600
      3378010C
      04282501
      08004014
      00000000
      1980033C
      902D638C
      00000000
      10006294
      00000000
      00024234
      100062A4
      1000BF8F
      1800BD27
      0800E003
      00000000
    </Location>
<Location file="BATTLE_BIN" offset="1214C8">
      2222060C
    </Location>
    <Location file="BATTLE_BIN" offset="122174">
      A122060C
    </Location>
  </Patch>

To change the support abilities used to something else, change the bolded digits for the proc nullifying ability, and change the underlined digits for the proc doubling ability.

I also placed the code for this ability into the Golem success code, and instead reassigned Golem to use (MA+X)% success rate.  Since Golem is basically 100% anyway unless your faith is under 48 or so, I hope nobody finds this to be an inconvenience if you decide to use this.

There are a few abilities that you won't be able to set a rate for since they already use the X value like Truth/Untruth/Triple Flame/Demi.


<Patch name="Formula 0F = Absorb HP or MP_Y% Hit_F(MA+X)% accepts procs">
    <Description>
      Uses the space for both formulas 0F and 10.  Formula 0F now accepts procs.  HP absorb is the default.  To absorb MP, check any box in the element field.     
    </Description>
    <Location file="BATTLE_BIN" offset="122084">
      E8FFBD27
      1000BFAF
      00000000
      00000000
      6E21060C
      00000000
      1D004014
      00000000
      7322060C
      00000000
      19004014
      19800A3C
      F7384B91
      00000000
      07006015
      00000000
      8919060C
      00000000
      921C060C
      00000000
      3F240608
      00000000
      A319060C
      00000000
      19800A3C
      902D438D
      00000000
      08006494
      1B1D060C
      040062A4
      3021060C
      00000000
      03004014
      00000000
      AD1F060C
      00000000
      1000BF8F
      1800BD27
      0800E003
      00000000
    </Location>
  </Patch>

I slightly changed the Formula 0F code from the one I had in the ASM request thread to not conflict with my Individual proc rate hack.


<Patch name="Formula 3F = Hit (SP+X)%, can require target to have certain status">
  <Description>
    Overwrites the space of the existing 3F and 40 formula routines.  Also adds physical evasion if evadable is checked.
    Allows you to require an already present status on the target as follows:
    Fill in the Y value in FFTPatcher with 88, 89, 90, 91, or 92 depending on which group the status is in, and check the element field in FFTPatcher corresponding to the status's position in the group.
    If you want the ability to work on any target without requiring an existing status, leave Y=0.  Don't use values for Y other than the ones listed here!
    Remember that the existing Seal Evil ability will need to be updated to the new format to work (Formula 3F, Y=88, element=Wind), and don't assign formula 40 to anything.
    Group 88
      0x80
      0x40 Crystal
      0x20 Dead
      0x10 Undead
      0x08 Charging
      0x04 Jump
      0x02 Defending
      0x01 Performing
    Group 89
      0x80 Petrify
      0x40 Invite
      0x20 Darkness
      0x10 Confusion
      0x08 Silence
      0x04 Blood Suck
      0x02 Cursed
      0x01 Treasure
    Group 90
      0x80 Oil
      0x40 Float
      0x20 Reraise
      0x10 Transparent
      0x08 Berserk
      0x04 Chicken
      0x02 Frog
      0x01 Critical
    Group 91
      0x80 Poison
      0x40 Regen
      0x20 Protect
      0x10 Shell
      0x08 Haste
      0x04 Slow
      0x02 Stop
      0x01 Wall
    Group 92
      0x80 Faith
      0x40 Innocent
      0x20 Charm
      0x10 Sleep
      0x08 Don't Move
      0x04 Don't Act
      0x02 Reflect
      0x01 Death Sentence
    Elements:
      0x80 Fire
      0x40 Lightning
      0x20 Ice
      0x10 Wind
      0x08 Earth
      0x04 Water
      0x02 Holy
      0x01 Dark
    For example, to require that the target be in critical, Y=90 and check the Dark element.
  </Description>
    <Location file="BATTLE_BIN" offset="12302C">
      E8FFBD27
      1000BFAF
      4421060C
      00000000
      23004014
      00000000
      8C17060C
      00000000
      7E21060C
      00000000
      6719060C
      00000000
      441D060C
      00000000
      1980023C
      902D428C
      00000000
      00004290
      00000000
      14004010
      00000000
      19800A3C
      982D4B8D
      FA384991
      F7384D91
      0C002011
      00000000
      21086901
      00002590
      00000000
      2418AD00
      00000000
      05006014
      00000000
      C310060C
      00000000
      33280608
      00000000
      C91F060C
      00000000
      1000BF8F
      1800BD27
      0800E003
      00000000
    </Location>
  </Patch>

<Patch name="Monster type check routine">
    <Description>
      This creates a monster type check routine that uses the element fields and Y value to allow any formula calling it to only work on whatever monster types you want.
      Monster types are divided into an element group and Y group as follows:
      Element Group:
        Fire=Eyeball
        Lightning=Ghoul
        Ice=Skeleton
        Wind=Squid
        Earth=Panther
        Water=Bomb
        Holy=Goblin
        Dark=Chocobo
      For this group, simply check the element box if you want the ability to be able to target this monster type.
      Y Group:
        128=Hydra
        64=Dragon
        32=Behemoth
        16=Morbol
        8=Minotaur
        4=Woodman
        2=Pig
        1=Bird
      For this group, add up all the values you want the ability to target, and put the sum into the ability Y value.  These values are in decimal.
    </Description>
    <Location file="BATTLE_BIN" offset="FA180">
      19800A3C
      982D428D
      E8FFBD27
      1000BFAF
      5E014390
      01000434
      13006010
      00000000
      22186400
      0800652C
      0800A010
      00000000
      F7384591
      04186400
      24186500
      0A006010
      00000000
      7C840508
      00000000
      FA384591
      08000634
      22186600
      04186400
      24186500
      03006014
      00000000
      C310060C
      00000000
      1000BF8F
      1800BD27
      0800E003
      00000000
    </Location>
  </Patch>

<Patch name="Dragon formulas use monster type check routine">
    <Description>
      This replaces the Dragon check in abilities 5A,5B,5C,5D with a monster type check allowing you specify the types of monsters these abilities work on.
      Note on formulas 5C and 3B:  In order to work with the monster check routine, this makes the status effect field the SP/PA/MA+ value instead of the Y field.
      Both Scream and Dragon Power Up use the same routine, so remember this adjustment if you plan on using either formula.
    </Description>
    <Location file="BATTLE_BIN" offset="123988">
      6084050C
    </Location>
    <Location file="BATTLE_BIN" offset="1239CC">
      6084050C
    </Location>
    <Location file="BATTLE_BIN" offset="123A18">
      6084050C
    </Location>
    <Location file="BATTLE_BIN" offset="123A5C">
      6084050C
    </Location>
    <Location file="BATTLE_BIN" offset="11FD74">
      FB
    </Location>
  </Patch>


  <Patch name="Dragon formulas affect all monsters, easy version">
  <Description>
    Use in place of the previous two hacks if you just want to make the dragon formulas affect all monsters regardless of monster type.
  </Description>
    <Location file="BATTLE_BIN" offset="1205D4">
      00000000
      00000000
    </Location>
  </Patch>

<Patch name="Immortal units can be knocked back">
    <Location file="BATTLE_BIN" offset="11D428">
      00000000
    </Location>
  </Patch>

<Patch name="Move on Lava = Sidestep">
  <Description>
    Allows units to move through panels occupied by enemy units.
  </Description>
  <Location file="BATTLE_BIN" offset="10D53C">
  20004930
  </Location>
  <Location file="BATTLE_BIN" offset="10D9C8">
  05002015
  </Location>
</Patch>

<Patch name="Any Weather = Sonic Step">
  <Description>You can move and still get the 20 bonus CT for not moving</Description>
  <Location file="BATTLE_BIN" offset="10D774">
02004010
  </Location>
  <Location file="BATTLE_BIN" offset="11CC78">
1980013C
CC082324
21384300
21082200
CD082390
FF000234
1D006210
01000234
8601E290
9400E890
19004010
01000234
3900E690
5C00E390
8701E590
8801E490
02000831
2B280501
08006230
2528A200
04006330
5800E290
25186400
01004230
0200A014
25186200
1400C624
03006014
FFFFC230
1400C624
FFFFC230
3D00422C
02004014
01000234
3C000634
3900E6A0
0800E003
8601E0A0
  </Location>
</Patch>
14
PSX FFT Hacking / Re: ASM Requests
October 08, 2021, 10:09:24 pm
Thanks for the help Glain.  I was trying to save some space by checking for the unknown flag while the evade/accuracy checks were running, but I guess this is a big no-no.

I redid this and just barely had enough room to fit everything in, seems to be working fine now:

<Patch name="Formula 0F = Absorb HP or MP_Y% Hit_F(MA+X)% accepts procs">
    <Description>
      Uses the space for both formulas 0F and 10.
      Formula 0F now accepts procs.  HP absorb is the default.  To absorb MP, check the box between Hit Allies and Follow Target.
    </Description>
    <Location file="BATTLE_BIN" offset="122084">
      E8FFBD27
      1000BFAF
      6E21060C
      00000000
      1F004014
      00000000
      7322060C
      00000000
      1B004014
      00000000
      19800A3C
      F4384B91
      00000000
      20006B31
      07006015
      00000000
      8919060C
      00000000
      921C060C
      00000000
      3F240608
      00000000
      A319060C
      00000000
      19800A3C
      902D438D
      00000000
      08006494
      1B1D060C
      040062A4
      3021060C
      00000000
      03004014
      00000000
      AD1F060C
      00000000
      1000BF8F
      1800BD27
      0800E003
      00000000
    </Location>
  </Patch>

And everything with comments:

[0x00189084] addiu r29,r29,-0x0018
[0x00189088] sw r31,0x0010(r29)
[0x0018908c] jal 0x001885b8 # Magic evade
[0x00189090] nop
[0x00189094] bne r2,r0,0x00189114 # Branch to end if evaded
[0x00189098] nop
[0x0018909c] jal 0x001889cc # magic accuracy check
[0x001890a0] nop
[0x001890a4] bne r2,r0,0x00189114 # Branch to end if accuracy check fails
[0x001890a8] nop
[0x001890ac] lui r10,0x8019
[0x001890b0] lbu r11,0x38f4(r10)
[0x001890b4] nop
[0x001890b8] andi r11,r11,0x0020 # Checks for unknown flag above Follow Target
[0x001890bc] bne r11,r0,0x001890dc # Branch ahead to MP section if unknown flag checked
[0x001890c0] nop
[0x001890c4] jal 0x00186624 # calculate HP% damage
[0x001890c8] nop
[0x001890cc] jal 0x00187248 # HP absorption
[0x001890d0] nop
[0x001890d4] j 0x001890fc # jump to proc roll
[0x001890d8] nop
[0x001890dc] jal 0x0018668c # mp damage
[0x001890e0] nop
[0x001890e4] lui r10,0x8019
[0x001890e8] lw r3,0x2d90(r10)
[0x001890ec] nop
[0x001890f0] lhu r4,0x0008(r3)
[0x001890f4] jal 0x0018746c # mp recovery routine
[0x001890f8] sh r2,0x0004(r3)
[0x001890fc] jal 0x001884c0 # conditional proc roll
[0x00189100] nop
[0x00189104] bne r2,r0,0x00189114 # branch if status effect fails
[0x00189108] nop
[0x0018910c] jal 0x00187eb4 # apply status to action
[0x00189110] nop
[0x00189114] lw r31,0x0010(r29)
[0x00189118] addiu r29,r29,0x0018
[0x0018911c] jr r31
[0x00189120] nop

15
PSX FFT Hacking / Re: ASM Requests
October 08, 2021, 03:15:19 pm
Quote from: JadeKnightblazer on July 09, 2021, 11:19:57 amRequest: Formulas 0F and 10 (AbsMP/AbsHP) allow Status infliction.

I've been playing around with this and have something that's mostly working:


<Patch name="Formula 0F = Absorb HP or MP_Y% Hit_F(MA+X)% accepts procs">
    <Description>
      Uses the space for both formulas 0F and 10.
      Formula 0F now accepts procs.  HP asborb is the default.  To absorb MP, check the box between Hit Allies and Follow Target.
    </Description>
    <Location file="BATTLE_BIN" offset="122084">
      E8FFBD27
      1000BFAF
      6E21060C
      19800A3C
      1A004014
      F4384B91
      7322060C
      20006B31
      16004014
      00000000
      07006015
      00000000
      8919060C
      00000000
      921C060C
      00000000
      3A240608
      00000000
      A319060C
      00000000
      902D438D
      00000000
      08006494
      1B1D060C
      040062A4
      3021060C
      00000000
      03004014
      00000000
      AD1F060C
      00000000
      1000BF8F
      1800BD27
      0800E003
      00000000
    </Location>
  </Patch>

This is working most of the time, but sometimes absorbs 0 MP, even at 100% and the target having plenty of MP.  Maybe someone could figure out what the deal is on this?

Here is the code in ASM format with comments:

[0x00189084]   addiu r29,r29,-0x0018         
[0x00189088]   sw r31,0x0010(r29)         
[0x0018908c]   jal 0x001885b8         Magic evade
[0x00189090]   lui r10,0x8019         
[0x00189094]   bne r2,r0,0x00189100         Jump to end if evaded
[0x00189098]   lbu r11,0x38f4(r10)         
[0x0018909c]   jal 0x001889cc         magic accuracy check
[0x001890a0]   andi r11,r11,0x0020         Check for unknown flag
[0x001890a4]   bne r2,r0,0x00189100         Jump to end if accuracy fails
[0x001890a8]   nop         
[0x001890ac]   bne r11,r0,0x001890cc         Jump ahead to MP section if unknown flag checked
[0x001890b0]   nop         
[0x001890b4]   jal 0x00186624         calculate HP% damage
[0x001890b8]   nop         
[0x001890bc]   jal 0x00187248         HP absorption
[0x001890c0]   nop         
[0x001890c4]   j 0x001890e8         jump to proc roll
[0x001890c8]   nop         
[0x001890cc]   jal 0x0018668c         mp damage
[0x001890d0]   nop         
[0x001890d4]   lw r3,0x2d90(r10)         
[0x001890d8]   nop         
[0x001890dc]   lhu r4,0x0008(r3)         
[0x001890e0]   jal 0x0018746c         mp recovery routine
[0x001890e4]   sh r2,0x0004(r3)         
[0x001890e8]   jal 0x001884c0         conditional proc roll
[0x001890ec]   nop         
[0x001890f0]   bne r2,r0,0x00189100         branch if status effect fails
[0x001890f4]   nop         
[0x001890f8]   jal 0x00187eb4         apply status to action
[0x001890fc]   nop         
[0x00189100]   lw r31,0x0010(r29)         
[0x00189104]   addiu r29,r29,0x0018         
[0x00189108]   jr r31         
[0x0018910c]   nop      


16
PSX FFT Hacking / Re: ASM Requests
October 04, 2021, 03:51:51 pm
Here are the monster type check codes:

<Patch name="Monster type check routine">
    <Description>
      This creates a monster type check routine that uses the element fields and Y value to allow any formula calling it to only work on whatever monster types you want.
      Monster types are divided into an element group and Y group as follows:
      Element Group:
        Fire=Eyeball
        Lightning=Ghoul
        Ice=Skeleton
        Wind=Squid
        Earth=Panther
        Water=Bomb
        Holy=Goblin
        Dark=Chocobo
      For this group, simply check the element box if you want the ability to be able to target this monster type.
      Y Group:
        128=Hydra
        64=Dragon
        32=Behemoth
        16=Morbol
        8=Minotaur
        4=Woodman
        2=Pig
        1=Bird
      For this group, add up all the values you want the ability to target, and put the sum into the ability Y value.  These values are in decimal.
    </Description>
    <Location file="BATTLE_BIN" offset="FA180">
      19800A3C
      982D428D
      E8FFBD27
      1000BFAF
      5E014390
      01000434
      13006010
      00000000
      22186400
      0800652C
      0800A010
      00000000
      F7384591
      04186400
      24186500
      0A006010
      00000000
      7C840508
      00000000
      FA384591
      08000634
      22186600
      04186400
      24186500
      03006014
      00000000
      C310060C
      00000000
      1000BF8F
      1800BD27
      0800E003
      00000000
    </Location>
  </Patch>

<Patch name="Dragon formulas use monster type check routine">
    <Description>
      This replaces the Dragon check in abilities 5A,5B,5C,5D with a monster type check allowing you specify the types of monsters these abilities work on.
      Note on formulas 5C and 3B:  In order to work with the monster check routine, this makes the status effect field the SP/PA/MA+ value instead of the Y field.
      Both Scream and Dragon Power Up use the same routine, so remember this adjustment if you plan on using either formula.
    </Description>
    <Location file="BATTLE_BIN" offset="123988">
      6084050C
    </Location>
    <Location file="BATTLE_BIN" offset="1239CC">
      6084050C
    </Location>
    <Location file="BATTLE_BIN" offset="123A18">
      6084050C
    </Location>
    <Location file="BATTLE_BIN" offset="123A5C">
      6084050C
    </Location>
    <Location file="BATTLE_BIN" offset="11FD74">
      FB
    </Location>
  </Patch>

Make sure to see in the description of assigning the Dragon formulas to use the new routine that I needed to make a slight change to both the Dragon Power up and Scream formulas.

17
PSX FFT Hacking / Re: ASM Requests
October 02, 2021, 07:01:33 pm
Actually, this wasn't anywhere near as tough as I thought it would be.  I came up with a monster type check routine that utilizes the element flags and the Y field of an ability to let you mix and match all 16 monster classes so the ability can only target any combination you want.  Only 1 of the existing vanilla Dragon formulas actually uses the X and Y values anyway, 5C, and I was able to create a workaround here by moving the Y value to the status effect field (not a problem since this particular formula doesn't have status effects anyway.)

It uses 32 lines of code so I'd just need some free space to put this.  From looking at the Allocated Space on the wiki, it appears that maybe this could go at 0x000F929C, just after Pride's last formula.  Is this OK, or is there somewhere else this should go?
18
PSX FFT Hacking / Re: ASM Requests
October 01, 2021, 01:34:47 pm
Making the dragon formulas work on any monster would be a really quick fix I think - could probably just change the 2 lines of code at 001875d4 and 001875d8 in the dragon check to nops and it should work on anything with a monster graphic.

Setting any 2 sprites with patcher seems a bit more daunting.  Since the x and y fields are already used in some of Reis's abilities, maybe the element field could be used to specify the monster types.  There are 16 monster types, so the first 4 elements could be a bitwise representation of the first sprite, the next 4 elements the second sprite.  This wouldn't be too user friendly, having to convert the monster graphic index # into the appropriate elements checked but it should work.

This would also use lots more lines of code than are normally in the dragon check routine.  How is everyone determining what free space to use and making sure that nobody's hacks conflict with one another?
19
PSX FFT Hacking / Re: ASM Requests
September 30, 2021, 06:04:36 pm
I've been working on my own request I made earlier and believe I've figured it out. 

<Patch name="Formula 3F Hit (SP+X)%, can require target to have certain status">
  <Description>
    Overwrites the space of the existing 3F and 40 formula routines.  Also adds physical evasion if evadable is checked.
    Allows you to require an already present status on the target as follows:
    Fill in the Y value in FFTPatcher with 88, 89, 90, 91, or 92 depending on which group the status is in, and check the element field in FFTPatcher corresponding to the status's position in the group.
    If you want the ability to work on any target without requiring an existing status, leave Y=0.  Don't use values for Y other than the ones listed here!
    Remember that the existing Seal Evil ability will need to be updated to the new format to work (Formula 3F, Y=88, element=Wind), and don't assign formula 40 to anything.
    Group 88
      0x80
      0x40 Crystal
      0x20 Dead
      0x10 Undead
      0x08 Charging
      0x04 Jump
      0x02 Defending
      0x01 Performing
    Group 89
      0x80 Petrify
      0x40 Invite
      0x20 Darkness
      0x10 Confusion
      0x08 Silence
      0x04 Blood Suck
      0x02 Cursed
      0x01 Treasure
    Group 90
      0x80 Oil
      0x40 Float
      0x20 Reraise
      0x10 Transparent
      0x08 Berserk
      0x04 Chicken
      0x02 Frog
      0x01 Critical
    Group 91
      0x80 Poison
      0x40 Regen
      0x20 Protect
      0x10 Shell
      0x08 Haste
      0x04 Slow
      0x02 Stop
      0x01 Wall
    Group 92
      0x80 Faith
      0x40 Innocent
      0x20 Charm
      0x10 Sleep
      0x08 Don't Move
      0x04 Don't Act
      0x02 Reflect
      0x01 Death Sentence
    Elements:
      0x80 Fire
      0x40 Lightning
      0x20 Ice
      0x10 Wind
      0x08 Earth
      0x04 Water
      0x02 Holy
      0x01 Dark
    For example, to require that the target be in critical, Y=90 and check the Dark element.
  </Description>
    <Location file="BATTLE_BIN" offset="12302C">
      E8FFBD27
      1000BFAF
      4421060C
      00000000
      23004014
      00000000
      8C17060C
      00000000
      7E21060C
      00000000
      6719060C
      00000000
      441D060C
      00000000
      1980023C
      902D428C
      00000000
      00004290
      00000000
      14004010
      00000000
      19800A3C
      982D4B8D
      FA384991
      F7384D91
      0C002011
      00000000
      21086901
      00002590
      00000000
      2418AD00
      00000000
      05006014
      00000000
      C310060C
      00000000
      33280608
      00000000
      C91F060C
      00000000
      1000BF8F
      1800BD27
      0800E003
      00000000
    </Location>
  </Patch>

All my tests with this have worked, hopefully others will find this useful and not have any problems implementing it.  A big thanks to Emmy for this formula that I used as a template to help me figure out how to code my own formula:

<Patch name="Formula 31 - Physical elemental damage, 2x damage + status inflict if unit is affected by indexed status">
    <Description>Requires physical elemental inner routine. Use x = 88, 89, 90, 91, 92 for status effect group 1, 2, 3, 4, 5 respectively.  Ability status effect byte is the status you want the ability to check for and inflict (on the group indexed by x)</Description>
    <Location file="BATTLE_BIN" offset="122cd0">
E8FFBD27
1000BFAF
4421060C
00000000
1A004014
00000000
1B79050C
00000000
19800A3C
942D4B8D
F9384991
902D4C8D
FB384D91
21086901
00002290
04008395
24284D00
0D00A010
00000000
06008495
40180300
40200400
040083A5
060084A5
3D000534
25008491
23182501
21088301
000022A0
08008434
250084A1
1000BF8F
1800BD27
0800E003
00000000
    </Location>
  </Patch>
20
PSX FFT Hacking / Re: ASM Requests
September 23, 2021, 06:06:21 pm
This is pretty much it, but how would I adjust the offsets to have multiple copies of the formula each checking for a different status?

<Location file="BATTLE_BIN" offset="128674">B89F1580<!--Formula 19--></Location>
<Location file="BATTLE_BIN" offset="F2FB8">

I know how to change the first part, the offset 128674, by looking it up from the formula table, but I'm not sure how I'd need to adjust the F2FB8.