• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
February 05, 2023, 03:53:27 am

News:

Please use .png instead of .bmp when uploading unfinished sprites to the forum!


stuminator's ASM hacks

Started by stuminator, October 16, 2021, 04:27:58 pm

stuminator

October 16, 2021, 04:27:58 pm Last Edit: January 09, 2023, 04:25:58 pm by stuminator
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>
  • Modding version: PSX
  • Discord username: stuminator

Ansehelm

Nice, these look awesome!
Question about the 3F formula hacks - does this work with multiple statuses within a group?  I.e. an ability that targets both cursed and blood suck units?  I assume there's no way to combine statuses from different groups.
  • Modding version: PSX

stuminator

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.
  • Modding version: PSX
  • Discord username: stuminator

stuminator

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>
  • Modding version: PSX
  • Discord username: stuminator

stuminator

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>
  • Modding version: PSX
  • Discord username: stuminator

Zanbamon

Quote from: stuminator on January 01, 2023, 05:08:59 pmI 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>

This 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.
  • Modding version: PSX
  • Discord username: Zanbamon

stuminator

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.
  • Modding version: PSX
  • Discord username: stuminator

RetroTypes

Quote from: stuminator on January 01, 2023, 05:08:59 pmI 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>

Has 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)
  • Modding version: PSX

stuminator

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.
  • Modding version: PSX
  • Discord username: stuminator

RetroTypes

January 13, 2023, 10:55:59 am #9 Last Edit: January 21, 2023, 02:28:24 pm by RetroTypes
Oh, no I meant the andi two lines prior to where you put yours, but I was mistakenly thinking that it was changing r2 to 1, not to 0x20 if Lavawalking was equipped. I may just leave it the way you did it then! haha thanks for your contributions, btw!

Edit: actually upon further inspection, I bet it can still be written to use any RSM, using one additional line of code in a nop a couple lines up. Lemme try it real quick

Edit2:
    <Patch name="Sidestep">
        <Description>Allows units to move through panels occupied by enemy units.
        Subtract 0x83 from the RSM set number to get the proper value for this routine (so set 0x95 becomes 0x12)</Description>
       
        <Variable name="Sidestep RSM Set" bytes="1" default="12" symbol="true"/>
        <Variable name="Sidestep RSM Bit" bytes="1" default="20" symbol="true"/>
       
        <Location file="BATTLE_BIN" offset="174530" offsetMode="RAM" mode="ASM">
        lbu   r9,  %SidestepRSMSet(r29)
        andi  r2,  r2,  0x0028                  #Float, Move on Lava check
        beq   r2,  r0,  0x00174548              #Branch if unit doesn't have Float or Move on Lava
        andi  r9,  r9,  %SidestepRSMBit
        </Location>
       
        <Location file="BATTLE_BIN" offset="1749c8" offsetMode="RAM" mode="ASM">
        bne   r9,  r0,  0x001749e0              #Branch if Sidestep is equipped
        </Location>
       
    </Patch>
  • Modding version: PSX

Zanbamon

Quote from: stuminator on January 12, 2023, 06:44:02 pm
<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.

So from what I'm understanding is that to create a ability like Side Step I gotta use another ability that checks for movement routine right?
Thanks for the link! I wanted to replace one of the water related abilities instead.
  • Modding version: PSX
  • Discord username: Zanbamon

Zanbamon

January 15, 2023, 02:04:07 am #11 Last Edit: January 15, 2023, 08:13:46 pm by Zanbamon
Quote from: RetroTypes on January 13, 2023, 10:55:59 amOh, no I meant the andi two lines prior to where you put yours, but I was mistakenly thinking that it was changing r2 to 1, not to 0x20 if Lavawalking was equipped. I may just leave it the way you did it then! haha thanks for your contributions, btw!

Edit: actually upon further inspection, I bet it can still be written to use any RSM, using one additional line of code in a nop a couple lines up. Lemme try it real quick

Edit2:
    <Patch name="Sidestep">
        <Description>Allows units to move through panels occupied by enemy units.</Description>
       
        <Variable name="Sidestep RSM Set" bytes="1" default="95" symbol="true"/>
        <Variable name="Sidestep RSM Bit" bytes="1" default="20" symbol="true"/>
       
        <Location file="BATTLE_BIN" offset="174530" offsetMode="RAM" mode="ASM">
        lbu   r9,  %SidestepRSMSet(r29)
        andi  r2,  r2,  0x0028                  #Float, Move on Lava check
        beq   r2,  r0,  0x00174548              #Branch if unit doesn't have Float or Move on Lava
        andi  r9,  r9,  %SidestepRSMBit
        </Location>
       
        <Location file="BATTLE_BIN" offset="1749c8" offsetMode="RAM" mode="ASM">
        bne   r9,  r0,  0x001749e0              #Branch if Sidestep is equipped
        </Location>
       
    </Patch>
So 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.
  • Modding version: PSX
  • Discord username: Zanbamon

stuminator

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>
  • Modding version: PSX
  • Discord username: stuminator

Zanbamon

January 16, 2023, 08:16:40 am #13 Last Edit: January 16, 2023, 10:10:55 am by Zanbamon
Quote from: stuminator on January 15, 2023, 10:35:40 pmSo 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>
It worked with Any Weather, thank you so much dude! :D :D
All of you Hacktics lads are awesome!
  • Modding version: PSX
  • Discord username: Zanbamon

RetroTypes

Quote from: stuminator on January 15, 2023, 10:35:40 pmSo 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.

Ah, of course, I forgot those weird offset group numbers haha thanks for the correction! (edited my other post to reflect this)
  • Modding version: PSX