øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.msg20261e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index22d6.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1883.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index22d6.html.zxg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈÐ=ìOKtext/htmlISO-8859-1gzip@øÕ=ìÿÿÿÿÿÿÿÿTue, 10 Mar 2020 05:00:08 GMT0ó°° ®0®P®€§²ð®g^ÿÿÿÿÿÿÿÿËJ=ì Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)

Author Topic: Grimoire LD's Notes, Patches, and Hacks (Dark Knight/Paladin Swap In Battle!)  (Read 78645 times)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
« Reply #240 on: January 15, 2014, 04:38:33 PM »
My thoughts exactly LordGarmonde, that said when in battle you can switch commands on the fly (I'm not 100% sure on displayed name yet though). So you could potentially make a mod with a Command called "(Sword-symbol)Skil" with the Sword only meaning "Battle" and have that routine look at the weapon you have equipped and give you a skill regarding that...

For instance, you have Claw equipped, you get Kick. Rod-Boast, Staff-Pray, Sword/Hammer-Focus (couldn't think of any default choice better), Maybe the normal swords would impart Dark Wave, while the Light Swords would give Focus, Spears-Jump, Katana/Boomerangs-Throw, Knife-Steal, Whip-Recall, Axe-Gird, Harp-Sing, Bow-Aim...

Granted these would all be going to a special character and hopefully not one of the normal characters who would already have one of these skills.

Maybe I'll think about that down the line.


Well I am pleased to announce that Magic Weapons is complete! A full routine that only ended up being 38 bytes when all was said and done.

I know I say this a lot but This is my Finest work yet. With the most applications in any normal sense.

Now there are a few... oddities... to this whole process.

First, the damage you deal is not 100% accurate to what you're Actually dealing. It's ordinarily a little more. and I'm not sure how it is calculated. I know that it's not ignoring the Weapon Damage or the Spell.(though for curing or buffing spells things get a little strange.)

Second, when a Spell Misses its target the normal weapon damage swing may show elsewhere, most likely on another enemy. However the damage will show on the enemy you are properly aiming towards.

Thirdly, this is only Single Target enemies. Anything more would have been a bit too powerful in my opinion.

Fourthly - Curing Spells will Not Work Period. They are turned into Damage, even spell formulas that don't ordinarily do damage deal a small amount of damage, interestingly enough. This does have interesting applications... say you combine my Sing-Harp Dependent Hack with this patch, you would see that yes, Edward is casting beneficial spells on the foe, but what you might find interesting, especially with the Dream Harp in particular. Instead of recovering 1/10 of their Max HP, you're actually Dealing 1/10 of their Max HP. This also applies to Party Members. Granted you Can attack say... Kain with the Madhura Harp and cast Protect on him (if you're lucky), you would hurt him a bit and Protect would deal an extra damage or 2, but it would effect him as if he were hit by the spell.

Fifthly - The damage dealt is dependent on your own Wisdom and Will. The Weapon's Spell Power itself is not taken into account. This means that attacking with the Ice Rod for instance may be more beneficial in the hopes of activating the Magic Weapon  instead of a mediocre spell multiplier from the Weapon itself, as shown here...





With this all in mind, let's get to the code!

Magic Weapons Routine

Code: [Select]
$03/FF33 AD 80 26 LDA $2680  [$7E:2680] A:0000 X:0680 Y:001A P:envMxdiZC - Load Handedness into A.
$03/FF36 C9 60 CMP #$60 A:0085 X:0680 Y:001A P:eNvMxdizC - Is it Left Handed?
$03/FF38 90 26 BCC $26    [$FF60] A:0085 X:0680 Y:001A P:envMxdizC - If so branch to Left Hand portion.
$03/FF3A AD B3 26 LDA $26B3  [$7E:26B3] A:0085 X:0680 Y:001A P:envMxdizC - Load Weapon in Right Hand into A.
$03/FF3D F0 1B BEQ $1B    [$FF5A] A:0044 X:0680 Y:001A P:envMxdizC - If 00 branch to End.
$03/FF3F C2 20 REP #$20 A:0044 X:0680 Y:001A P:envMxdizC - Reset Processor Statues (Very Important! It allows A to hold 2-byte values which was Crucial to this)
---------------------------------------------(Looping Point)---------------------------------------------------
$03/FF41 0A ASL A A:0044 X:0680 Y:001A P:envmxdizC - x2 A
$03/FF42 0A ASL A A:0088 X:0680 Y:001A P:envmxdizc - x2 A
$03/FF43 0A ASL A A:0110 X:0680 Y:001A P:envmxdizc - 2x A
$03/FF44 69 03 00 ADC #$0003 A:0220 X:0680 Y:001A P:envmxdizc + 0003 (This all allows it to reach the Weapon, than the Weapon Spell.)
$03/FF47 AA TAX A:0223 X:0680 Y:001A P:envmxdizc - Transfer A to X.
$03/FF48 7B TDC A:0223 X:0223 Y:001A P:envmxdizc - Clear A
$03/FF49 E2 20 SEP #$20 A:0000 X:0223 Y:001A P:envmxdiZc - Set Processor Status to 20 (Changes A back to one byte.)
$03/FF4B BF 00 91 0F LDA $0F9100,x[$0F:9323] A:0000 X:0223 Y:001A P:envMxdiZc - Load the Location of the Weapons +.
$03/FF4F F0 14 BEQ $14    [$FF65] A:0005 X:0223 Y:001A P:envMxdizc - If the end result is 00 branch to End.
$03/FF51 48 PHA A:0005 X:0223 Y:001A P:envMxdizc - Push A onto Stack (To keep the value for after the RNG Calculations
$03/FF52 20 79 83 JSR $8379  [$03:8379] A:0005 X:0223 Y:001A P:envMxdizc - RNG Routine
$03/FF55 C9 3F CMP #$3F A:00D6 X:0000 Y:001A P:eNvMxdizc - is it 3F (of FF, 25%) or more
$03/FF57 68 PLA A:00D6 X:0000 Y:001A P:eNvMxdizC - Pull A from Stack.
$03/FF58 D0 0D BCS $0D    [$FF66] A:0005 X:0000 Y:001A P:envMxdizC -If so  Branch to End.
$03/FF5A 8D D2 26 STA $26D2  [$7E:26D2] A:0005 X:0000 Y:001A P:envMxdizC - Store A in Next Action.
(Add a Weapon Swing Loading Routine)
$03/FF5D 4C 10 FF JMP $FF10  [$03:FF10] A:0005 X:0000 Y:001A P:envMxdizC - Jump to New Part of Routine.
--------------------------------------------------------------------------------------
(Left Hand Portion)
$03/FF60 AD B5 26 LDA $26B5  [$7E:26B5] A:0042 X:0680 Y:001A P:eNvMxdizc - Load Left Handed Weapon into A.
$03/FF63 D0 03 BNE $03    [$FF68] A:0023 X:0680 Y:001A P:envMxdizc - Branch if not 00 to next portion
----------------------------------------------------------------------------------
$03/FF65 E2 20 SEP #$20 A:0000 X:011B Y:001A P:envMxdiZc - Set Processor Status to 20 (Makes A one byte again)
$03/FF67 60 RTS A:0000 X:011B Y:001A P:envMxdiZc - Return
-------------------------------------------------------------------------------
$03/FF68 80 D5 BRA $D5    [$FF3F] A:0023 X:0680 Y:001A P:envMxdizc - Loop back to Weapon Finding Routine above.


Code: [Select]

And that's the code. Short, sweet, and to the point. To improve my Sing-Harp Dependent hack I'll want to take this routine, get rid of the RNG dealings and plug it in right there. A very simple process. (Watch me still not have enough room to make it look at other characters...)

This hack is very easy to utilize. Nothing other than targeting in it is hardcoded, so you can have it use any spell you like.

Here's a few more pictures of it in action.









And here's the patch!

As always, any complaints, comments, or questions regarding my patches, post them here.

 :edit: Update! I decided to revisit this since I planned on expanding its use in my hack and I noticed that it didn't work properly with Summons.

Instead of a jump to the magic routine at the end there I have it jump to a new section where it will load the full magic routine then add the weapon swing afterwards. So while it won't look as clean as it did prior. It will work effectively with every kind of spell. Instead now the character will go into their spellcasting pose, then after the effect is done, use their weapon to attack.

If I could just think of someway to have the initial spell start one byte over I could add a C0 and be perfectly fine, but alas...

And I did just that! I've finally got everything looking the way it should and it looks great!

Here is the new code that is now mentioned above...

New Code for Magic Weapons

Code: [Select]
$03/FF10 C9 31 CMP #$31 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Is it Imp or Lower?
$03/FF12 90 04 BCC $04    [$FF18] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - If so branch to part-way through Magic Routine
---------------------------------------------------------------------------
$03/FF14 C9 40 CMP #$40 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Is it lower than Bahamut?
$03/FF16 90 03 BCC $03    [$FF1B] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - If so branch to Full Magic Routine
----------------------------------------------------------------------
$03/FF18 4C 3E CD JMP $CD3E  [$02:CD3E] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Jump and stay with part way through Magic Routine.
-------------------------------------------------------------------
$03/FF1B 20 46 CC JSR $CC46  [$02:CC46] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Jump to Full Magic Routine
$03/FF1E A9 C0 LDA #$C0 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Load Weapon Swing into A.
$03/FF20 8D C2 33 STA $33C2  [$7E:33C2] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Store A in First Visual cue.
$03/FF23 A9 00 LDA #$00 A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Load 00 into A.
$03/FF25 8D C3 33 STA $33C3  [$7E:33C3] A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Store A in Second visual cue.
$03/FF28 60 RTS A:00F0 X:01CF Y:0006 P:eNvMxdIzc - Return
« Last Edit: February 04, 2014, 10:20:49 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #241 on: January 15, 2014, 06:38:32 PM »
And Sing-Harp Dependent has been renewed and finished! The new one, while working better functionally still is not 100% what I wanted, but I like it a Lot better than what was originally there. (as the code is very similar to the Magic Weapons hack I'll leave it be). This will add +5 Attack Power to characters in the First, Second, and Third Slot, +the Singer (meaning if the Singer is occupying any of those spots he would get a +10 Boost). Nothing happens with the Fourth and Fifth Slot though if the Singer isn't occupying either. It's not perfect, but it is interesting at least.

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
« Reply #242 on: January 15, 2014, 06:47:53 PM »
My thoughts exactly LordGarmonde, that said when in battle you can switch commands on the fly (I'm not 100% sure on displayed name yet though). So you could potentially make a mod with a Command called "(Sword-symbol)Skil" with the Sword only meaning "Battle" and have that routine look at the weapon you have equipped and give you a skill regarding that...
For instance, you have Claw equipped, you get Kick. Rod-Boast, Staff-Pray, Sword/Hammer-Focus (couldn't think of any default choice better), Maybe the normal swords would impart Dark Wave, while the Light Swords would give Focus, Spears-Jump, Katana/Boomerangs-Throw, Knife-Steal, Whip-Recall, Axe-Gird, Harp-Sing, Bow-Aim...
:childish: <--- that's me! I think that's an awesome strategy!
As for the name if Square really gives you some lip I can think of a low-brow attack that might work: What about having it next to the Character Name like a Status Effect. Granted - that list is obvious enough that even if I didn't remember I'd know what's going on - I wouldn't think rod => dark-wave (I'd need even less sleep still to be that wrong!)

I know I say this a lot but This is my Finest work yet.

If each effort surpasses the last then it is always true - and aptly demonstrates a string of fine work: fine job! I was a little amused (if you'll forgive me) at your statement about not being 100% satisfied -btw you redoing that to further satisfaction I think is about as certain as my post-length stretching the limits of imagination :P - but your's is a much better, and more fruitful, compulsion (for lack of a better term) - which I typed out as you were posting your update about Edward :wink:

Now there are a few... oddities... to this whole process...

1) Why do you have to tease me like that?  I almost quit reading to go look into it - one half of my brain is still screaming at the  "NO-NO: STOP THE CAR - WE CAN SOLVE THIS ONE - STOP!!!"
2) I'm sure I'll see it (since I'll provoke it!) - but until then quick question: is it on another enemy or in between a few?
3) Agreed!
4) What about zombies? If I remember correctly damage inversion for the undead is last in the calculation - but that may not be so when that routine returns back to you.
5) Nice!

This is pretty rad, dude; kudos!

I know you have a list of your routines at the beginning of this thread - but do you have reference for your patches somewhere? I thought of something during the discussions about individual vs consolidated patching but totally spaced-it: While I love the freedom of singles, it can get annoying if someone builds from a new copy of the ROM and the has to apply 10 patches again - also, even though I trust you to do your homework so installation order won't matter; I'll still be paranoid if I run into trouble amidst testing. I had tried a program out a while back to pull sections out of IPS patches:


IPSelect 1.0 - Selective file patcher
=====================================
Copyright 2000 James Churchill/Naruto
http://optera.net/~pelrun/
Overview
--------
IPSelect is a utility for only applying parts of an IPS patch to a file. It is
intended to help in tracking down which of hundreds of edits may be causing a
bug in a game patch.

Usage
-----
1) Use the Browse buttons to select the source, patch and destination files.
2) A list of patch hunks (the discrete sections of a patch) will be displayed
   in the Hunk List box. Use the checkboxes beside each entry to enable/disable
   hunks as required.
3) Click the Patch file to apply the enabled patch hunks to the source file, and
   write it out to the destination file.

Version History
---------------
1.0 - Initial release.
----
James Churchill
Naruto
pelrun@hotmail.com
27/06/2000
-----------------------------------------------------

The link is broken but just Google IPSelect10 (or I can send it to you) - It's from the guy who built DisPel so he seems to know what's what

If you had a list of the patches and the sections they replace (or probably just where they each start) that program might compliment a larger build nicely - just a thought :)
"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Patch-FFIII Style Sing in FFIV!)
« Reply #243 on: January 15, 2014, 07:19:09 PM »
My thoughts exactly LordGarmonde, that said when in battle you can switch commands on the fly (I'm not 100% sure on displayed name yet though). So you could potentially make a mod with a Command called "(Sword-symbol)Skil" with the Sword only meaning "Battle" and have that routine look at the weapon you have equipped and give you a skill regarding that...
For instance, you have Claw equipped, you get Kick. Rod-Boast, Staff-Pray, Sword/Hammer-Focus (couldn't think of any default choice better), Maybe the normal swords would impart Dark Wave, while the Light Swords would give Focus, Spears-Jump, Katana/Boomerangs-Throw, Knife-Steal, Whip-Recall, Axe-Gird, Harp-Sing, Bow-Aim...
:childish: <--- that's me! I think that's an awesome strategy!
As for the name if Square really gives you some lip I can think of a low-brow attack that might work: What about having it next to the Character Name like a Status Effect. Granted - that list is obvious enough that even if I didn't remember I'd know what's going on - I wouldn't think rod => dark-wave (I'd need even less sleep still to be that wrong!)

That would require quite a bit of... know how, which I'm afraid I don't possess, heh. The easiest thing to do is to look at how its done, my only concern in that regard is space. You may notice in most of my routines the first thing I've done is get rid of Messages, because they use up valuable space. And everybody knows they're using the Ability they just Used. They don't have to be reminded when they Use it!

I know I say this a lot but This is my Finest work yet.

If each effort surpasses the last then it is always true - and aptly demonstrates a string of fine work: fine job! I was a little amused (if you'll forgive me) at your statement about not being 100% satisfied -btw you redoing that to further satisfaction I think is about as certain as my post-length stretching the limits of imagination :P - but your's is a much better, and more fruitful, compulsion (for lack of a better term) - which I typed out as you were posting your update about Edward :wink:

Haha, well I think its with every routine that makes me delve into newish territory I learn another useful tool to utilize. For this one I've learned that A: You can attach a routine to any code you like as long as you have your pointers straight.

Now there are a few... oddities... to this whole process...

1) Why do you have to tease me like that?  I almost quit reading to go look into it - one half of my brain is still screaming at the  "NO-NO: STOP THE CAR - WE CAN SOLVE THIS ONE - STOP!!!"
2) I'm sure I'll see it (since I'll provoke it!) - but until then quick question: is it on another enemy or in between a few?
3) Agreed!
4) What about zombies? If I remember correctly damage inversion for the undead is last in the calculation - but that may not be so when that routine returns back to you.
5) Nice!

I never tried it out on Zombies, but I don't think that's the offender here.

It is on another enemy (ordinarily the furthest one back). Though the damage will still show properly.

This is pretty rad, dude; kudos!

I know you have a list of your routines at the beginning of this thread - but do you have reference for your patches somewhere? I thought of something during the discussions about individual vs consolidated patching but totally spaced-it: While I love the freedom of singles, it can get annoying if someone builds from a new copy of the ROM and the has to apply 10 patches again - also, even though I trust you to do your homework so installation order won't matter; I'll still be paranoid if I run into trouble amidst testing. I had tried a program out a while back to pull sections out of IPS patches:

Near the bottom of the post at the start of the thread there is a Patches section... above of Miscellaneous. Do you think I should move that up to the top?

IPSelect 1.0 - Selective file patcher
=====================================
Copyright 2000 James Churchill/Naruto
http://optera.net/~pelrun/
Overview
--------
IPSelect is a utility for only applying parts of an IPS patch to a file. It is
intended to help in tracking down which of hundreds of edits may be causing a
bug in a game patch.

Usage
-----
1) Use the Browse buttons to select the source, patch and destination files.
2) A list of patch hunks (the discrete sections of a patch) will be displayed
   in the Hunk List box. Use the checkboxes beside each entry to enable/disable
   hunks as required.
3) Click the Patch file to apply the enabled patch hunks to the source file, and
   write it out to the destination file.

Version History
---------------
1.0 - Initial release.
----
James Churchill
Naruto
pelrun@hotmail.com
27/06/2000
-----------------------------------------------------

The link is broken but just Google IPSelect10 (or I can send it to you) - It's from the guy who built DisPel so he seems to know what's what

If you had a list of the patches and the sections they replace (or probably just where they each start) that program might compliment a larger build nicely - just a thought :)

That is a neat program! I'll have to keep that in mind for later, thanks!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #244 on: January 15, 2014, 09:09:41 PM »
Near the bottom of the post at the start of the thread there is a Patches section... above of Miscellaneous. Do you think I should move that up to the top?

Nah - now I know - I think I missed it because by that point the list was so extensive that I was just wowed beyond comprehension. I mean that too - like damn...wow!

Maybe a a list of all the subheadings at the top - I'm still playing around with a Table of Contents of the Drawing Board - I don't know - either way really
"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #245 on: January 16, 2014, 05:55:42 PM »
That's not a bad idea. "Table of Contents" so to speak? A lot of FAQ's have those after all.

Alright, so I made one slight error in my Magic Weapons code, unless you activate it specifically it is fairly unnoticeable. When you have no weapon equipped and you attack and you are Right Handed, (monsters all count as Left Handed because they are 00) the game cast a "Nothing Happened" spell. This is only really noticeable with Rydia in the Project II Patch if you attacked without a weapon. It happened because I forgot to change one branch that, while working, did not work appropriately (it branched to the loading and magic running routine rather than an RTS) The original patch will be fixed and uploaded in its original post.

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #246 on: January 16, 2014, 09:01:30 PM »
That's not a bad idea. "Table of Contents" so to speak? A lot of FAQ's have those after all.

Spell Routine Offsets
Command Routine Offsets
Specialty Routine Offsets
Bug Fixes
Custom (aka KICK-ASS!) Routine Offsets (& Replacements)
Spells
Patches
Miscellaneous


I just saved a copy of that post (if you don't mind) - Lot of good stuff!

I expect you'll change one of those headings back - but I'll always know! :wink:
"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #247 on: January 17, 2014, 12:01:33 AM »
That's not a bad idea. "Table of Contents" so to speak? A lot of FAQ's have those after all.

Spell Routine Offsets
Command Routine Offsets
Specialty Routine Offsets
Bug Fixes
Custom (aka KICK-ASS!) Routine Offsets (& Replacements)
Spells
Patches
Miscellaneous


I just saved a copy of that post (if you don't mind) - Lot of good stuff!

I expect you'll change one of those headings back - but I'll always know! :wink:

Pasted and (for the most part) used. Thanks for that LordGarmonde. I'm not 100% sure what I want for my next patch. I was fiddling around with an ability which would somehow teach spells to the chosen character, but that might be a little too tricky to implement. The theory behind it is simple and sound. Take a specific event in battle, learn spell (using the Summon Orb learning as a base) the problem is I'm not sure who to give it to or to what purpose it would hold. I originally thought of giving it to Kain. The idea was that he could "speak" to Dragons and if a Dragon was knocked into Critical he would gain a spell from the Dragon, gain a few extra max MP (Level/8) and the Dragon would retreat. But what spells even fit Kain, and how many more normal spells can I afford to take away? I guess Flare and Comet (there's no reason for them to be in the castable section) are up for grabs, but beyond that there's very few worthless spells left. Well let's see... Warp and Venom could also be turned into something else. Weak is a little bit abusable. That would give four spells to use for custom spells, since the 5 worthless White Magics were turned into Break Skills. Hmm...

Does anyone have any suggestions what I can do with the "spells earned in battle" concept? And where it could be applied?

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #248 on: January 17, 2014, 12:37:05 AM »
We talked a while ago about a Learn ability for my Blue Mage. I got it working.
I don't have a commented disassembly, but here it is:
Code: [Select]
$03/E876 A2 00 00    LDX #$0000              ;load 0000 into X
$03/E879 AD 52 27    LDA $2752  [$7E:2752]   ;load last (sub) ability used by target into A
$03/E87C C9 60       CMP #$60               
$03/E87E 90 2B       BCC $2B    [$E8AB]     
$03/E880 C9 78       CMP #$78               
$03/E882 B0 27       BCS $27    [$E8AB]      ;specifies valid range of learnable spells. In this code, it's 60 through 77
$03/E884 DD 60 15    CMP $1560,x[$7E:174C]   ;specifies first slot of interested spell set
$03/E887 F0 22       BEQ $22    [$E8AB]      ;if the spell to learn is in this slot already, jump to (fail)
$03/E889 E8          INX                     
$03/E88A E0 18 00    CPX #$0018             
$03/E88D D0 F5       BNE $F5    [$E884]      ;loop 17 hex more times. If the spell is not in this spell set, then...
$03/E88F A2 00 00    LDX #$0000              ;load 0000 into X
$03/E892 BD 60 15    LDA $1560,x[$7E:174C]   ;load spell set's first slot again
$03/E895 F0 03       BEQ $03    [$E89A]      ;now we're looking for an empty slot. If we found one, move on, otherwise...
$03/E897 E8          INX                     
$03/E898 80 F8       BRA $F8    [$E892]      ;loop until you find an empty slot
$03/E89A AD 52 27    LDA $2752  [$7E:2752]   ;load the spell to learn back into A
$03/E89D 9D 60 15    STA $1560,x[$7E:174C]   ;store A into the empty slot
$03/E8A0 8D 9A 35    STA $359A  [$7E:359A]   ;store A into the parameter for the "learned [spell]" message
$03/E8A3 A9 23       LDA #$23               
$03/E8A5 8D CA 34    STA $34CA  [$7E:34CA]   ;load "learned [spell]" into next battle message
$03/E8A8 4C 5A FF    JMP $FF5A  [$02:FF5A]   ;jump to a portion in my mime code that activates battle message
$03/E8AB 4C 55 FF    JMP $FF55  [$02:FF55]   ;jump to a portion in my mime code that displays "nothing happened."
       
Essentially, this ability specifies a valid range of spells. If the enemy has just cast one of them, then the game checks to see if the spell is already in the spell list specified. if not, then it puts the spell in the first empty spot in the list, and displays the message "Learned [spell]."
The spell is not available until the next battle, though.
Feel free to use this however you like.
I can comment on the disassembly, but it'll take a while to look at it again and figure it all out.
« Last Edit: January 17, 2014, 01:27:45 AM by chillyfeez »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #249 on: January 17, 2014, 01:09:55 AM »
That is really cool Chillyfeez! I think I understand what's going on...

Load Action Taken. If it is between 60 and 78 (24 slots exactly) . Load it into Magic Slot if applicable, search through the 24 slots for a 00, several messages and two jumps to custom code.

One thing I don't understand is how the Magic Check has a value of x7E174C, when you specifically loaded 0000 into X at the start of the routine.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #250 on: January 17, 2014, 01:31:39 AM »
This wasn't a live disassembly, so geiger's just uses whatever values are currently in X, A, and Y. Sorry for the confusion.
The code above is commented now, but yeah, you seem to have figured it out.  :edit: I also removed a few lines of nonpertinent code originally included. Oops.
Not as cool in a practical sense as my Mime command, but a great example of "if you can think it, you can do it."

You may have noticed by the offset that this code replaces Hide. That's not an accident. Before I started making Limits, I toyed with the idea of making this an automatically-activated ability (pending specific parameters). That is theorhetically possible.
« Last Edit: January 17, 2014, 01:51:22 AM by chillyfeez »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #251 on: January 20, 2014, 07:14:02 PM »
Alright, so I decided to expand upon my Dragon Speak idea and have everything set up from a planning portion.

There will be three new dragons added that each can give Kain a unique spell that only he can use. (Warp/Weak/Twin Spells/Smoke was sacrificed for it), along with the MecDragon and RedDragon teaching Kain. The other Dragons throughout the game teach Kain White Magic if he speaks with them.

Once the Dragon (Only pure Dragons, not undead dragons) is weakened to Critical, it will listen to Kain with his Dragon Speech ability and will impart part of its knowledge to Kain before Retreating.

Because two of these spells will use custom routines, I'll post those now. One is a simple "Add Weapon Elemental" routine to do the best I can in mimicking Lancet/Dragon Sword (Absorb HP/MP) this will obviously only cure HP the other is a Flourish to add to spells.


Add Elemental Weapon Attack/Fancy Flourish - (Replaces Count)

Code: [Select]
$03/DBB5 AD 9D 28 LDA $289D  [$7E:289D] A:0003 X:003A Y:0000 P:envMxdizc - Load Spell Power into A.
$03/DBB8 D0 1B BNE $1B    [$DBD5] A:0000 X:003A Y:0000 P:envMxdiZc - If above 00 branch to Fancy Flourish.
$03/DBBA A9 C0 LDA #$C0 A:0000 X:003A Y:0000 P:envMxdiZc - Load Weapon Swing into A.
$03/DBBC 8D C4 33 STA $33C4  [$7E:33C4] A:00C0 X:003A Y:0000 P:eNvMxdizc - Store A in Audiovisual Cue
$03/DBBF AD 99 26 LDA $2699  [$7E:2699] A:00C0 X:003A Y:0000 P:eNvMxdizc - Load Caster's Weapon Elemental into A.
$03/DBC2 0D A2 28 ORA $28A2  [$7E:28A2] A:0020 X:003A Y:0000 P:envMxdizc - Check to see if the Spell Elemental is applicable.
$03/DBC5 8D 99 26 STA $2699  [$7E:2699] A:0060 X:003A Y:0000 P:envMxdizc - Store A in Caster's Weapon Elemental
$03/DBC8 20 99 C4 JSR $C499  [$03:C499] A:0060 X:003A Y:0000 P:envMxdizc - Jump to Fight Routine
$03/DBCB AD 99 26 LDA $2699  [$7E:2699] A:0000 X:0680 Y:001A P:envMxdiZC - Load Caster's Weapon Elemental into A.
$03/DBCE ED A2 28 SBC $28A2  [$7E:28A2] A:0060 X:0680 Y:001A P:envMxdizC - Subtract Weapon Elemental from Spell Elemental.
$03/DBD1 8D 99 26 STA $2699  [$7E:2699] A:0020 X:0680 Y:001A P:envMxdizC - Store A in Caster's Weapon Elemental.
$03/DBD4 60 RTS A:0020 X:0680 Y:001A P:envMxdizC - Return
-------------------------------------------------------------------------------------------------------------
(Fancy Flourish)
$03/DBD5 A9 C6 LDA #$C6 A:0046 X:0038 Y:0000 P:envMxdizc - Load Jump into A.
$03/DBD7 8D C4 33 STA $33C4  [$7E:33C4] A:00C6 X:0038 Y:0000 P:eNvMxdizc - Store A in Audiovisual Cue.
$03/DBDA 20 88 D3 JSR $D388  [$03:D388] A:00C6 X:0038 Y:0000 P:eNvMxdizc - Jump to Spell Damage Routine
$03/DBDD A9 DE LDA #$DE A:0000 X:0110 Y:0000 P:envMxdizc - Load Jump Return into A.
$03/DBDF 8D C8 33 STA $33C8  [$7E:33C8] A:00DE X:0110 Y:0000 P:eNvMxdizc - Store A in Further Audiovisual Cue (right after the spell's own so one is not replacing the other)
$03/DBE2 60 RTS A:00DE X:0110 Y:0000 P:eNvMxdizc - Return.

When used from a "Spell Sense" curiously the Drain Elemental will only Absorb 50% of the damage done from this special "spell strike".

The way it is set up, the routine looks at the Spell's Element and applies it to the Weapon for this single attack, then immediately removes it. For my purposes that was Drain Elemental. Because there is no second check in this routine (only the first) say you have a skill called "(Sword)Fire" and you're already using the Flame sword, this would actually remove the Fire Elemental from your sword for that attack, so it can be used in those certain strategies where non-Elemental attacks may be the best idea.

Now the Fancy Flourish is just to add a bit of flavor to attacks. I have an attack called "Sky Rave" that Kain has in Dissidia 012 which makes Kain jump into the Air, Lightning strikes around the area and he returns back from his jump as if he threw down the Lightning.

I'll post these first. Even if the Dragon Speech idea doesn't pan out, (I see no reason it should fail, especially with Chillyfeez's help above) Kain will still be getting these spells.

Sky Rave









Lancet

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #252 on: January 20, 2014, 08:36:57 PM »
Hmm, Chillyfeez, I just tried to make messages appear in my custom routine and no matter what I tried, no message would appear. It seems you put something special in your code to activate the battle message to appear. I haven't found anything akin to that. Would you share what that address or method is?

 :edit:

$03/EADE   A9 12   LDA #$12   A:0022   X:0000   Y:0000   P:eNvMxdizc - Load 12 into A (D)
$03/EAE0   8D CA 34   STA $34CA  [$7E:34CA]   A:0012   X:0000   Y:0000   P:envMxdizc - Store A in Battle Message Data.
$03/EAE3   4C A6 85   JMP $85A6  [$03:85A6]   A:0012   X:0000   Y:0000   P:envMxdizc - Jump to Routine (Leaves Routine from here)

Oh... right.
« Last Edit: January 20, 2014, 08:44:45 PM by Grimoire LD »

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #253 on: January 20, 2014, 09:37:41 PM »
In addition to loading the message into the "battle message" byte of RAM, you have to activate otherbytes of RAM (that I don't fully understand). I don't exactly know why, but adding these four instructions will make it work:
Code: [Select]
$03/FF73 A9 F8       LDA #$F8               
$03/FF75 8D C6 33    STA $33C6  [$00:33C6]   
$03/FF78 A9 03       LDA #$03               
$03/FF7A 8D C7 33    STA $33C7  [$00:33C7]
For my hack, I have this at the end of one command (Mime, right before the RTS), and anytime I need to display messages in a command, I make the end of the command jump there, to save code space.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Grimoire LD's Notes, Patches, and Hacks (Magic Weapons from FFV in FFIV!)
« Reply #254 on: January 20, 2014, 09:46:13 PM »
Hmm, it seems the address that I had in my edit also accomplishes successful showing of a message with no issues as far as I can see.