Final Fantasy Hacktics

Modding => Help! => Topic started by: Mysfit on September 15, 2013, 07:43:07 pm

Title: Question/Request Regarding "Wish" (Formula 3C)
Post by: Mysfit on September 15, 2013, 07:43:07 pm
I'm wondering if anyone has considered the notion of editing the Wish formula in any way, if possible. What I myself had in mind was to have it heal MP instead of HP while the damage dealt to the caster is still resolved. The intention being for the creation of a sort of self-cast life tap ability that trades a measure of HP for a measure of MP.

Is this something doable?
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: Atma on October 07, 2013, 01:42:24 am
For some reason I thought this was possible... I was planning of doing something like this, too.  I just looked through the formulas and realized I can't think of a way of doing it. 
I'm not sure if there's an asm hack for editing that formula, if there is I'd definitely love to use it, if not... requesting any asm hacker to take it on.  Would really appreciate it.
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: Celdia on October 07, 2013, 07:39:56 am
I did something similar in CCP that exchanged HP for MP in the original formula and also changed it so it worked from Current MP instead of Max MP so that it didn't make the skill an infinite MP generator. I'll attach an XML that implements my changes to the formula here just to make the hunting for what you need to change a bit faster, as well as the code for Formula 3C which I stole from the spoiler over here: http://ffhacktics.com/smf/index.php?topic=6538.msg136032#msg136032

It's been too long since I did anything with this and my notes are terrible so I don't know off-hand exactly which byte change affects what but it shouldn't take too long for you to figure out with a little bit of effort. Really all you're looking for are which bytes that I changed that you want to leave as the original values so the damage is HP it sounds like. Probably only need to keep one byte change out of the whole thing.


[3c]
00186dbc: 3c028019 lui r2,0x8019
00186dc0: 8c422d94 lw r2,0x2d94(r2)
00186dc4: 3c03cccc lui r3,0xcccc
00186dc8: 9442002a lhu r2,0x002a(r2)      Set variable as maxHP
00186dcc: 3463cccd ori r3,r3,0xcccd
00186dd0: 00430019 multu r2,r3
00186dd4: 3c038019 lui r3,0x8019
00186dd8: 8c632d8c lw r3,0x2d8c(r3)
00186ddc: 34020080 ori r2,r0,0x0080
00186de0: a0620025 sb r2,0x0025(r3)      Set as HP Healing
00186de4: 00001010 mfhi r2
00186de8: 00021082 srl r2,r2,0x02
00186dec: a4620004 sh r2,0x0004(r3)      Damage is 1/5 of maxHP
00186df0: 3c038019 lui r3,0x8019
00186df4: 8c632d8c lw r3,0x2d8c(r3)
00186df8: 34020001 ori r2,r0,0x0001
00186dfc: a0620000 sb r2,0x0000(r3)      Guarantee Hit
00186e00: 3c028019 lui r2,0x8019
00186e04: 8c422d8c lw r2,0x2d8c(r2)
00186e08: 3c048019 lui r4,0x8019
00186e0c: 8c842d90 lw r4,0x2d90(r4)
00186e10: 84420004 lh r2,0x0004(r2)
00186e14: 34030040 ori r3,r0,0x0040
00186e18: a0830025 sb r3,0x0025(r4)      Add in HP Healing
00186e1c: 00021040 sll r2,r2,0x01     
00186e20: 03e00008 jr r31
00186e24: a4820006 sh r2,0x0006(r4)      Healing is 2/5 of maxHP
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: Choto on October 07, 2013, 08:17:46 am
Since Celdia conveniently posted the formula... Hocus Pocus:

<Patch name="Wish affects MP instead of HP">
<Location file="BATTLE_BIN" offset="11fe14">
10000334
250083A0
40100200
0800E003
060082A4
</Location>
</Patch>


but I encourage you to look at how this was done because it was very simple. If you download the resources in the "ASM starter kit" thread you should be able to figure out what was done.
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: Atma on October 07, 2013, 03:45:02 pm
Thanks for the hook up.  Definitely exciting.  I'm assuming it overwrites the original formula, so using both would require overwriting another formula?
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: Choto on October 07, 2013, 06:54:41 pm
yep, you are correct.
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: Celdia on October 08, 2013, 03:56:22 am
Thank you for the assist, Choto. Good work, as usual. ^_^
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: zinkBR1986 on June 23, 2023, 09:43:54 am
First thanks to the FFHacktics community, all the tutorials have helped me a lot and your work is incredible.
After reading some tutorials and videos I tried to change the wish formula, I'll put below the way I did it, with the aim of causing damage to the enemy and healing the mp of the unit that is attacking. (I developed this formula based on trial and error, with practically no knowledge of ASM and only later found this formula in this topic)

<?xml version="1.0" encoding="utf-8" ?>
<Patches>
 <Patch name="Wish 2">
    <Description>trocando hp damage 04 por mp healing 0A</Description>
    <Location file="BATTLE_BIN" offset="11FDC8">
2E004294
    </Location>
    <Location file="BATTLE_BIN" offset="11FDEC">
0A0062A4
    </Location>
    <Location file="BATTLE_BIN" offset="11FE10">
0A004284
    </Location>
    <Location file="BATTLE_BIN" offset="11FE24">
040082A4
    </Location>
  </Patch>
</Patches>

What I want to add in this formula:
1) The MP cure must be an exact Y value and not a % (Y that I will indicate later in FFTPatcher)
2) The damage will be based on (PA+WP+X)% (X that I will indicate later in FFTPatcher)
3) The enemy has the opportunity to evade

Another issue, even more important, and which prevents me from progressing in my studies, is understanding how asm is formatted like this:
 001896f4: 0c061e72 jal 0x001879c8       
It can become like this:
    <Location file="BATTLE_BIN" offset="11FE10">
0A004284
    </Location>

*From the observations, the jal byte is 0C, but I can't imagine how to complete the other digits.
And I'm actually interested in that, because my intention is not to change the wish formula, but to rewrite it in another empty formula.

Gratitude
Ps: Sorry for the google translator English =]
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: Xifanie on June 23, 2023, 02:34:09 pm
Are you using Wish's wiki page as reference?
https://ffhacktics.com/wiki/3C_Heal_(CasMaxHP*2/5)_DmgCas_(CasMaxHP/5)

You can use MassHexASM to convert your code into hex, but that's not necessary; just use mode="ASM" in your location tag and write ASM code instead, like so:
<Patch name="[QoL] Guests use AI inventory">
<Author>Xifanie</Author>
<Description>Non-controllable player team units will not check for, or consume the player's inventory.&#13;&#10;Instead they will have access to items based on their level, just like enemies.</Description>
<Location file="BATTLE_BIN" offset="19507C" offsetMode="RAM" mode="ASM">
j 0x80150B54 # Item/Draw Out Check
andi r2, r2, 0x0038 # Team + Control
</Location>
<Location file="BATTLE_BIN" offset="195174" offsetMode="RAM" mode="ASM">
j 0x80150B5C # Throw Check
andi r2, r2, 0x0038 # Team + Control
</Location>
<Location file="BATTLE_BIN" offset="17C958" offsetMode="RAM" mode="ASM">
j 0x80150B64 # Player Item Quantity decrement
andi r2, r2, 0x0038 # Team + Control
</Location>
<Location file="BATTLE_BIN" offset="150B54" offsetMode="RAM" mode="ASM">
j 0x80195084
xori r2, r2, 0x0008 # No Control = No Check
j 0x8019517C
xori r2, r2, 0x0008 # No Control = No Check
j 0x8017C960
xori r2, r2, 0x0008 # No Control = No Decrement
</Location>
</Patch>
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: zinkBR1986 on June 28, 2023, 08:27:03 am
Thanks Xifanie for your feedback and for teaching me that it is possible to use "mode=ASM".
I'm using the wish wiki and modified it to get what I want (deal HP damage on enemy and increase my character's MP). In a way I managed to accomplish this, I will leave the code below. However, currently it uses the MAX MP as a parameter, but I would like to use a certain value in X or Y in FFTPatcher. I've already researched this:
00184368: 3c068019 lui r6,0x8019
0018436c: 90c638f9 lbu r6,0x38f9(r6)
00184380: 00460018 mult r2,r6
But all my attempts to add in the formula did not give the expected result.

Below the current Formula Wish (causing giving HP to the enemy and healing the character's MP, using MAX MP)

lui r2,0x8019
lw r2,0x2d94(r2)
lui r3,0xcccc
lhu r2,0x002e(r2)
ori r3,r3,0xcccd
multu r2,r3
lui r3,0x8019
lw r3,0x2d8c(r3)
ori r2,r0,0x0010
sb r2,0x0025(r3)
mfhi r2
srl r2,r2,0x02
sh r2,0x000a(r3)
lui r3,0x8019
lw r3,0x2d8c(r3)
ori r2,r0,0x0003
sb r2,0x0000(r3)
lui r2,0x8019
lw r2,0x2d8c(r2)
lui r4,0x8019
lw r4,0x2d90(r4)
lh r2,0x000a(r2)
ori r3,r0,0x0080
sb r3,0x0025(r4)
sll r2,r2,0x01
jr r31
sh r2,0x0004(r4)
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: zinkBR1986 on July 17, 2023, 04:46:27 pm
I would be very grateful if you could help me with one question:

I would like to create a single-use ability. Could you help me with ASM how do I disable the ability after using it the first time?
Title: Re: Question/Request Regarding "Wish" (Formula 3C)
Post by: zinkBR1986 on July 18, 2023, 08:25:26 am
I was wondering if it would be possible, at the end of the execution of the first attack, to change its MP cost to (MAX MP + 1000), so the skill would be disabled. I have a doubt if it is possible and if in the next battle, the cost of MP will return to normal by itself, to be able to use it again, once?
===
I also thought of somehow using the "throw" and "Draw Out" skills, to cancel that skill mid-battle, but I don't know where to start.
===
I would be very grateful if you could help me please.