øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=printpage;topic=1853.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index9530.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1853.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index9530.html.zx™:g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ`¦DdnOKtext/htmlISO-8859-1gzip8:ÖdnÿÿÿÿÿÿÿÿTue, 10 Mar 2020 07:14:57 GMT0ó°° ®0®P®€§²ð®™:g^Ýdn Print Page - Can the "life" effect be achieved on arbitrary spells?

Board of Slick

Library of the Ancients => Final Fantasy IV Research & Development => Topic started by: Pinkpuff on August 16, 2013, 11:34:32 AM

Title: Can the "life" effect be achieved on arbitrary spells?
Post by: Pinkpuff on August 16, 2013, 11:34:32 AM
It appears as though changing any given spell's effect to "raise" (revive a KO/dead character) does not seem to have the effect you'd expect. Or, if I understand correctly, any effect at all. Only the Life, Life 2, and Asura spells can actually achieve the effect of raising a fallen character. Why?

Presumably there is some kind of index check going on where the game is like "only spells with these indexes can raise people" but the questions then are:
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on August 16, 2013, 01:12:42 PM
Hmm, I just tested this, I switched Protect to a Raise spell and it worked fine, Cecil revived with 15 HP (I did not know there was a set formula to the healing done by Raise, interesting.) It may be a White Magic Spell only thing, let me check...

Nope, worked perfectly fine as a Black Magic Spell as well...


Alright, well I found the Life2 check, but it is Only a single spell. When a spell (possibly only healing) is cast it gets put into its own small section of RAM at 7E26D2 and is checked against a lot of variables, one of those variables are...

03D6CD - C9 14   CMP #$14   A:001D   - Comparing Current Spell with Life2?

Where it is in RAM is... right there, where it is in ROM is at...

0x01D8CD - C9 14 - Change the 14 to any value you like And be a !Reviving Spell! to have this Life Spell to bring the fallen back to full life.

I am still searching for the Vit * 5 Formula base, that one has been a little bit trickier to find than I expected.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Pinkpuff on August 16, 2013, 01:34:58 PM
Hmm perhaps I'm getting confused with something else.

Does the life effect work as multi-targetting when it isn't Asura?
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Dragonsbrethren on August 16, 2013, 01:47:30 PM
Here's the thread where Phoenix was looking into Life2/Asura:

http://slickproductions.org/forum/index.php?topic=442.0 (http://slickproductions.org/forum/index.php?topic=442.0)

I don't think he ever found what allows her multi-target Life to work.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on August 16, 2013, 02:37:10 PM
Yeah, that part is the real problem with Life spells. I recall that Phoenix looked in vain for the reasoning behind why that would be. I have to wonder why it works like that myself.

Also I've cracked Vit * 5 I think and you can change it to look at any stat now you like...

At least it seemed that way. Finding that 5 was a lot trickier than it ought to be, in the end it's placed All the way at the start of RAM at 0xAB.

...Well that was fruitless. As far as I could figure this Formulaic 5 is comprised of several rotated bytes until it becomes a 5 making it very difficult to change.

Code: [Select]
$03/843C CA DEX A:0008 X:0002 Y:0010 P:envmxdizc
$03/843D D0 DE BNE $DE    [$841D] A:0008 X:0001 Y:0010 P:envmxdizc
$03/841D 2E 45 39 ROL $3945  [$7E:3945] A:0008 X:0001 Y:0010 P:envmxdizc
$03/8420 2E 4B 39 ROL $394B  [$7E:394B] A:0008 X:0001 Y:0010 P:envmxdiZc
$03/8423 38 SEC A:0008 X:0001 Y:0010 P:envmxdizc
$03/8424 AD 4B 39 LDA $394B  [$7E:394B] A:0008 X:0001 Y:0010 P:envmxdizC
$03/8427 ED 47 39 SBC $3947  [$7E:3947] A:0010 X:0001 Y:0010 P:envmxdizC
$03/842A 8D 4B 39 STA $394B  [$7E:394B] A:0000 X:0001 Y:0010 P:envmxdiZC
$03/842D B0 0A BCS $0A    [$8439] A:0000 X:0001 Y:0010 P:envmxdiZC
$03/8439 2E 49 39 ROL $3949  [$7E:3949] A:0000 X:0001 Y:0010 P:envmxdiZC
$03/843C CA DEX A:0000 X:0001 Y:0010 P:envmxdizc

So I don't think we can change the 05 without a lot of modification. However you can change the stat or value that you want the character to use. So it could be Str * 5 or Will * 5, or anything in the character data, as long as its in the mirrored dead character data. As before you may use the Stat Sheet that is in the Dark Wave thread.

$03/D6D9    AD 16 27   LDA $2716  [$7E:2716]   A:001D   X:0002   Y:0005   P:envMxdizc - Looks at 7E2716 which is a copy of the fallen character's stats. This is the fallen character's Modified Vitality.

----------------------------------------

In ROM this is at...

0x01D8D9 - AD 16 27   LDA $2716  [$7E:2716]   A:001D   X:0002   Y:0005   P:envMxdizc - Looks at 7E2716 which is a copy of the fallen character's stats. This is the fallen character's Modified Vitality, you may change it accordingly using the character stat sheet.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Pinkpuff on August 16, 2013, 02:53:25 PM
That's awesome!

I don't suppose... could it be modified to use the spell power of the spell? 5 * SP? So like, if the spell power was 5 it would heal 25 HP, or if the spell power was 20 it would heal 100 HP or whatever.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on August 16, 2013, 03:09:24 PM
That... is a little trickier to say. I've never dealt with magic in RAM or ROM for that matter, only being content to use editors to deal with that. Do you happen to know where that data is in ROM? With that I can easily find where it would be in RAM and see if it is loaded in that manner in battle.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on September 02, 2013, 05:48:09 PM
A small update. While it seems difficult to get multi-targetted life spells to work under ordinary circumstances using Edward's Salve command to use Phoenix Downs works Perfectly. All fallen characters are revived at the same time. The only issue appears to be that it takes the Vitality of the closest fallen character to the top of the list. But that's a minor manner.

Though I think I'm starting to understand why that is somewhat difficult... Magic, by-and-large targets the living and Only the living, therefore when you put a live target into the targetting range of any Spell (not command apparently) the game will assume that is only the ones who are alive are being cast upon. Asura's Life spell is the exception to this.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on September 06, 2013, 11:16:31 AM
That's awesome!

I don't suppose... could it be modified to use the spell power of the spell? 5 * SP? So like, if the spell power was 5 it would heal 25 HP, or if the spell power was 20 it would heal 100 HP or whatever.

I figured it out! I was looking through the Tower of Bab-il Docs and saw this...

"At the time this subroutine is called, the target's data has been copied to
2700-277F in RAM. The caster's data has been copied to 2680-26FF. The
subroutines modify this data. The relevant spell/item table entry has been
copied to 289C-28A1. 28A2-28A4 "

That tells me exactly where the spell data is in RAM at the exact time I need it. 289C was what you were looking for. For just a Brief second the game puts the spell's power and accuracy into 289D, but that brief second is all the time the Life formula needs to grab its spell power and revive an ally using its spell power as a base.

You would change this...

$03/D6D9    AD 16 27   LDA $2716  [$7E:2716]   A:001D   X:0002   Y:0005   P:envMxdizc - Looks at 7E2716 which is a copy of the fallen character's stats. This is the fallen character's Modified Vitality

To this...

$03/D6D9    AD 9D 28   LDA $289D  [$7E:289D]   A:001D   X:0002   Y:0005   P:envMxdizc - Looks at 7E289D's value which is the where the power of Life and Phoenix Down will be stored. Then this becomes the fallen character's HP * 5. This also effects anything else that may bring a fallen one back to life (ironically though this should fix the enemy vitality = 0 glitch from the original game.

This change also appears to have the strange effect of taking hit percentage into account, since it uses Spell Power as its base.

And with this you can make Phoenix Downs and Life Spells heal different amounts.

In ROM just change...
0x01D8D9 - AD 16 27

To....

0x01D8D9 - AD 9D 28
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Deathlike2 on September 06, 2013, 12:25:35 PM
Life can actually "miss".

Try "forcing" the Rubicante battle with the ultimate party and kill off a character. See what happens when you use a Fire elemental spell on him.

It is noted as it is being used as an "offensive magic attack" so magic evasion is applied. It is actually possible to miss with that spell in any case and it is most apparently related to having poor accuracy while being Blind. Try it, you will be surprised.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on September 11, 2013, 12:30:43 PM
Also I've cracked Vit * 5 I think and you can change it to look at any stat now you like...

At least it seemed that way. Finding that 5 was a lot trickier than it ought to be, in the end it's placed All the way at the start of RAM at 0xAB.

...Well that was fruitless. As far as I could figure this Formulaic 5 is comprised of several rotated bytes until it becomes a 5 making it very difficult to change.

Yeah... um...  :isuck:

Only a couple of bytes away from where I found the Vitality check I missed the LDA 05 which is the true x5 that the game uses to calculate how to restore the dead.


$03/D6D9   AD 16 27   LDA $2716  [$7E:2716]   A:0013   X:0002   Y:0006   P:envMxdizc - Load Target's Modified Vitality.
$03/D6DC   85 DF   STA $DF    [$00:00DF]   A:0006   X:0002   Y:0006   P:envMxdizc - Store A in DF.
$03/D6DE   A9 05   LDA #$05   A:0006   X:0002   Y:0006   P:envMxdizc - Load 05 into A (How did I miss this?!)
$03/D6E0   85 E1   STA $E1    [$00:00E1]   A:000F   X:0002   Y:0006   P:envMxdizc - Store A in E1
$03/D6E2   20 E0 83   JSR $83E0  [$03:83E0]   A:000F   X:0002   Y:0006   P:envMxdizc - Jump to Subroutine. (Cleaning Routine)
$03/D6E5   A6 E3   LDX $E3    [$00:00E3]   A:0000   X:0000   Y:0006   P:envMxdiZc - Load X from E3 (where the end result of multiplying DF and E1 must have taken place)
$03/D6E7   8E 07 27   STX $2707  [$7E:2707]   A:0000   X:005A   Y:0006   P:envMxdizc - Store X in Character's HP.
$03/D6EA   60    RTS   A:0000   X:005A   Y:0006   P:envMxdizc - End of Routine.

So there you go. You can now change the stat it looks at for healing and the amount it multiplies to reach a final HP value.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: chillyfeez on November 21, 2013, 10:20:19 AM
Hey - did you guys know that if you force-target only dead party members, multi-targeting life spells works? It's true. For instance, if the characters in slots 1 and 2 are dead, another character casts Life1, and during the "chanting" portion of the cast you manually change the targeting byte ($2054, x) to C0, Life1 will successfully revive both characters.
Now, how to make this work without cheating...
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on November 21, 2013, 10:59:36 AM
I've written above that multi-targetted Life effects work when combined with Salve because it seems that it looks past the "are they dead?" check. I've also suggested that the Asura code should have something special involved that you likely hit upon in your research.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: chillyfeez on November 21, 2013, 05:14:13 PM
I thought so, and I actually tried multi-targeting salve with Life as its effect and it didn't work for me, so I assumed I had misunderstood what you were saying.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on November 21, 2013, 05:22:37 PM
Really? It worked fine for me when I tried it. I take it you changed it to use the Life item and made the effect the Life item as well?
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: chillyfeez on November 21, 2013, 05:34:59 PM
Yeah... and while we're at it, I don't recall ever seeing Asura's multitarget working in the SNES version of the game... I mean ever. What am I missing that everybody else in the world seems to have been seeing since forever?
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Deathlike2 on November 21, 2013, 06:53:29 PM
Yeah... and while we're at it, I don't recall ever seeing Asura's multitarget working in the SNES version of the game... I mean ever. What am I missing that everybody else in the world seems to have been seeing since forever?

It always works... it's that most of the time it occurs when you least want it to occur (and the reverse is true).
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on November 21, 2013, 07:03:14 PM
Now that is bizarre...

I'll take a look just to reassure myself that I'm not crazy.



(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-FullRevivefromSalve_zps97117552.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-FullRevivefromSalve_zps97117552.png.html)

(http://i112.photobucket.com/albums/n198/LastingDawn/FFIV-AsuraFullPartyRevive_zps8f51789e.png) (http://s112.photobucket.com/user/LastingDawn/media/FFIV-AsuraFullPartyRevive_zps8f51789e.png.html)

Seems to work fine for me.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: chillyfeez on November 22, 2013, 09:35:03 AM
OK, so I just tested Asura for myself and I was clearly mistaken... I'm wondering, any chance she was broken in v1.0 but fixed in v1.1?

As for Salve, though, Still no luck:
(http://memberfiles.freewebs.com/22/01/115500122/photos/undefined/SalveFailCecil.jpg)

I swear I'm not making this up. All I did was take a clean 1.1 ROM, change Salve from Cure1/Cure1/Cure1 to Life/Life/Life and give it to Cecil. And no, it's not just Cecil. Tried it with Kain, too... Maybe try it with a natural magic user?
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on November 22, 2013, 10:10:02 AM
Now that makes next to no sense, hmm... let me take a look...

Okay, now I'm confused. It's not working for me in a clean rom either. Only in my modified rom does it seem to actually work.

Whoa. Okay, I solved the mystery and let me tell you it is Bizarre.

Set the power of the Life item to 5. That should ?make it work with Salve?. Very Bizarre, extraordinarily bizarre...
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on July 23, 2014, 08:41:07 PM
Did this work for you Chillyfeez? Because in Combat Boost I've noticed that I'm having this problem crop up with Item Lord in using Life Potions (Replacing Salve, looks at the first usable item and then splits it or keeps it single according to targeting) which would be one of its best uses.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: chillyfeez on July 23, 2014, 09:43:20 PM
I... Don't remember, tbh.
I think I may have just taken your word for it that it worked at the time, because I was looking for a way to make Phoenix work, and parsing your disassembles I found the necessary change to be made in RAM to actually revive fallen characters, at which point I stopped being concerned with whether this would work.
I can't really look into it tonight, but I should have some time tomorrow to test it out. I'll let you know.

 :edit: Sorry, Grimoire, this fell by the wayside today in favor of Shadow Party R&D. I've got a three day weekend coming up tomorrow, though, so I should have plenty of time to look into this.
Title: Re: Can the "life" effect be achieved on arbitrary spells?
Post by: Grimoire LD on July 24, 2014, 12:49:16 PM
You understand how important the Shadow Party R&D is compared to this trifling little matter, right? Haha! Don't worry about it too much. If it doesn't work I can just create an exception for the Life item to force party targeting as you've talked about before.