• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 29, 2024, 07:22:54 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.


ASM Request: Stat Down Skills Accept Element

Started by Eternal248, January 22, 2012, 06:10:32 pm

Pride

Yeah its too late, that's why Oil doesn't work in vanilla. Its an easy enough fix.
  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

Glain

Hm... with the hack as it stands, weak and half can get reapplied (for a total of 1/4 * damage or 4 * damage).
  • Modding version: Other/Unknown

Pride

Can you post it here? We can take a look together and see if there's an easy way to fix it
  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

Glain

The only thing I did was change the formula-calling routine's return statement into a tail call of the apply elemental function.
(RAM 0x18b9f0: "jr r31" -> "j 0x00186ff8")

The problem is, various formulas do the half/weak calculation themselves, whereas other ones probably rely on 0x186ff8 to do it. I could hack 0x186ff8, but I'd have no way to know whether the half/weak has already been applied...
  • Modding version: Other/Unknown

Glain

All right. I nop'd out all other calls to the apply elemental routines and rewrote part of it to do absorption correctly. We shouldn't be seeing any more x4 or /4. This time I've got a patch... try it out? (Back up ISO, heh)


<Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">
      1980083C
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
  </Patch>
  • Modding version: Other/Unknown

Austin

Just tried testing this really fast, I made the knight break skills dark elemental and made my chemists immune to dark. It looks like it works mostly, you get a 00% hit chance and the chemists always dodge the attacks. However, when it would activate their reaction ability afterwards it would always miss. Like they could have sunken state and go to activate it, but it would say it missed and they wouldn't turn invisible.
  • Modding version: PSX

Glain

For some reason, the Sunken State reaction doesn't appear to reset the ability's element (0x801938f7), so since the attack was Dark elemental, it thought the reaction was also Dark elemental. I was under the impression the ability element was always set when an action was taken...

I'm not sure how Sunken State got around it... maybe it's hardcoded or something?
  • Modding version: Other/Unknown

Austin

Dunno, it's not just sunken state though. Any kind of reaction that would activate on the person being hit would miss. Not that I tried every single one, but I imagine that's the case from the few I did try.
  • Modding version: PSX

Glain

I think my strategy for fixing this is going to be to set the ability element byte back to 00 (non-elemental) after doing the apply elemental calculation; that way, if an ability sets its element, it'll get that element, otherwise it'll be non-elemental.

The other thing I'm curious about is whether weapon element is working for things like normal attacks, since I'm not checking the element of the weapon, but the element of the ability. If not, I might have to do something like the swordskill hack to determine the element to use. I may also be able to put strengthen in there and fix oil as well...
  • Modding version: Other/Unknown

Glain

All right, here's version 2 of the patch. I don't have strengthen in yet and oil isn't fixed, but weapon element on attack should work and counters shouldn't take the element of the attack that triggered them anymore.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">   
      1980083C               
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F3380995
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5A730508
      00000000
      25800C02
      0800E003
      F73800A1
    </Location>
  </Patch>
  • Modding version: Other/Unknown

Glain

All right... now I've got a patch that seems pretty good.

Strengthen/absorb/half/weak/cancel should all work and reactions shouldn't take the wrong element. Oil should also work (Fire damage is * 2). I don't modify XA for any of this stuff either; it all just straight-up modifies HP damage, so for example, strengthen is trunc((damage) * (5/4)) instead of trunc(XA*5/4)*Y. Since the truncation comes at the end, the math should be more accurate. I'm even making an attempt to round the division at the end in the case of strengthen.

e.g. Normally XA=6, WP=8 damage with strengthen on the caster and half on the target
Original FFT: 6 * (5/4) = 7 (truncated); 7 * 8 = 56; 56 / 2 = 28
This patch/Real math: 6*8=48; half=24; strengthen=24*(5/4) = 30

Anyhow, here it is.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">   
      1980083C               
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F3380995
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5A730508
      00000000
      25800C02
      043900A1
      0800E003
      F73800A1
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="11DF50">
      8073050C
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      8C2D0C8D
      2470C501
      0800C011
      04002A95
      05000B34
      18004B01
      12680000
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="1200FC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
  </Patch>


  • Modding version: Other/Unknown

Atma

i was thinking... having stats as a status is a pretty cool idea.  However, i kinda think it's kind of an odd effect.  It could stack, which is neat, but only until it runs out, or would it reapply and replace, or add up?
it's a little weird to me.  What would make sense is a status kind of like faith+innocent, but % based like magic attack up/magic defense up.  if it were possible to also make a negative effect, like magic attack -25%.  Of course the same for physical attack and defense.  I dunno if u'd have to replace existing statuses, but i could easily find a few i wouldn't mind replacing for cool buff/debuff skills. 
how possible is this?
My name is Atma... I am pure energy... and as ancient as the cosmos.

Pride

  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

Austin

Quote from: Glain on February 21, 2012, 09:52:15 pm
All right... now I've got a patch that seems pretty good.

Strengthen/absorb/half/weak/cancel should all work and reactions shouldn't take the wrong element. Oil should also work (Fire damage is * 2). I don't modify XA for any of this stuff either; it all just straight-up modifies HP damage, so for example, strengthen is trunc((damage) * (5/4)) instead of trunc(XA*5/4)*Y. Since the truncation comes at the end, the math should be more accurate. I'm even making an attempt to round the division at the end in the case of strengthen.

e.g. Normally XA=6, WP=8 damage with strengthen on the caster and half on the target
Original FFT: 6 * (5/4) = 7 (truncated); 7 * 8 = 56; 56 / 2 = 28
This patch/Real math: 6*8=48; half=24; strengthen=24*(5/4) = 30

Anyhow, here it is.


  <Patch name="All formulas apply elemental">
    <Description>All formulas apply elemental</Description>
    <Location file="BATTLE_BIN" offset="1249F0">
      FE1B0608
    </Location>
    <Location file="BATTLE_BIN" offset="11FFE0">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121794">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="121E2C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="122D20">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12361C">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5C78">
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF1C">
      1980083C
      902D098D
      8C2D0A8D
      04002B95
      00000000
      43580B00
      04002BA5
      06004BA5
      00000000
      00000000
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11DF64">   
      1980083C               
      902D098D
      8C2D0A8D
      10002395
      04002485
      00086334
      40200400
      100023A5
      040024A5
      060044A5
    </Location>
    <Location file="BATTLE_BIN" offset="120010">
      4C73050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5D30">
      1980083C
      F3380995
      F7381091
      04390C91
      D6380D91
      04200A34
      24582A01
      05006A11
      00000000
      0300A011
      00000000
      5A730508
      00000000
      25800C02
      043900A1
      0800E003
      F73800A1
    </Location>
    <Location file="BATTLE_BIN" offset="11DEB8">
      1980033C
      902D638C
      6873050C
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="F5DA0">
      1980083C
      902D0E8D
      8C2D098D
      40000F34
      80000A34
      0400CD95
      06002B95
      0400C0A5
      2500CFA1
      0600CDA5
      060020A5
      25002AA5
      0800E003
      04002BA5
    </Location>
    <Location file="BATTLE_BIN" offset="11DF50">
      8073050C
    </Location>
    <Location file="BATTLE_BIN" offset="F5E00">
      1980083C
      942D0E8D
      902D098D
      7100CE91
      8C2D0C8D
      2470C501
      0800C011
      04002A95
      05000B34
      18004B01
      12680000
      0200AD21
      83680D00
      04002DA5
      06008DA5
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="12002C">
      1980033C
      902D638C
      00000000
      04006284
      00000000
      40100200
      040062A4
      22006290
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="1200FC">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="11EFA4">
      0800E003
      00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120060">
      00000000
      25008890
      00000000
      08000835
      250088A0
    </Location>
  </Patch>





Awesome! I'm gonna be trying this out real soon. & you're saying this fixes oil in addition to the other stuff right(so I can get rid of the other asm for that)?
  • Modding version: PSX

Glain

Well, the oil code should multiply fire damage by 2 and then remove the Oil status. I actually think it may be possible to get x4 damage this way (x2 weak to Fire, x2 Oil), as opposed to the other ASM where I think having Oil status simply makes you weak to fire (and they wouldn't stack).
  • Modding version: Other/Unknown

Rfh

Glain, when I used your ASM in a ISO turned in to EBOOT.PBP and I make any atack, the game freezes. Could you do something to make it work on EBOOT.PBP? I am really interested in your hack!
  • Modding version: PSX
  • Discord username: rfh

Glain

Hm... I'll check to see if there are any load/branch delay problems that stand out or anything like that. Unfortunately I don't seem to get this error on pSX, so it will be hard for me to recreate the problem.
  • Modding version: Other/Unknown

Glain

I can't find a trace of the problem, unfortunately. I don't see any load/branch delay problems, and both emulators (ePSXe and pSX) seem to run the patch fine on an otherwise clean ISO. Was the ISO you used to create the eboot using any other ASMs?
  • Modding version: Other/Unknown

Rfh

February 26, 2012, 12:07:39 pm #38 Last Edit: February 26, 2012, 04:08:07 pm by Rfh
I tried it on a clean ISO  with your hack, and the game was freezing when I make any attack. Why it happens only on EBOOT.PBP? 

EDIT: Your first hack works on EBOOT.PBP. What are the basic differences between the first and third hack?
  • Modding version: PSX
  • Discord username: rfh

Glain

The first hack doesn't take the weapon element into account and doesn't zero out the element, so the reaction still has the same element as the ability; strengthen and absorb don't work and oil isn't fixed. The third hack should fix all that stuff.

It's helpful to know the first hack works and the third hack doesn't... that helps to try to zero in on the problem. If it's not too annoying to do, would you mind testing if the second hack works? That way I can examine the differences.
  • Modding version: Other/Unknown