FF6 Hacking
Fun Weapon Effects - Printable Version

+- FF6 Hacking (https://www.ff6hacking.com/forums)
+-- Forum: Discussion Forums (https://www.ff6hacking.com/forums/forum-5.html)
+--- Forum: Magitek Research Facility (https://www.ff6hacking.com/forums/forum-9.html)
+--- Thread: Fun Weapon Effects (/thread-4309.html)



Fun Weapon Effects - DrakeyC - 06-18-2023

In my efforts to create more interesting effects for attacks and weapons for my mod, I made some neat discoveries that I decided to share - to tl;dr, you could have any weapon randomly cast any spell, or a range of spells.

You know the coding for the Tempest to cast Wind Slash? I copied it over the Ogre Nyx's effect because I don't use the random break effect in my mod, and with some additions to the code because the original uses some parts of the random Esper function that follows, it works! Here's what you need:

Code:
C2/3ECA

20 5A 4B     JSR $4B5A   (Random Number Function: 0 to 255)
C9 80        CMP #$80
B0 0B        BCS $3FB6   (50% chance exit function)
9C A6 11     STZ $11A6   (Clear Battle Power)
A9 XX        LDA #$65    (Spell number)
8D 00 34     STA $3400   (Save the spell number)
EE 70 3A     INC $3A70   (Increment the number of attacks remaining)
60           RTS

The major change from vanilla Wind Slash is the BCS, because in the vanilla it jumps into the random Esper coding to RTS and that's a different address here. The XX LDA is the Wind Slash spell number, change it to another spell and you're done, just test it in-game to make sure it works because not all spells will.

But I went a bit deeper - not only can Wind Slash be copied, but the random Esper effect can be copied too, and accordingly can be modified because it works by calling up spells within a certain range from a certain spell slot. In short - you could have a weapon that randomly casts one of any number of special effects!

Code:
A9 XX        LDA #$19
20 65 4B     JSR $4B65   (Range of spells to call)
18           CLC
69 YY        ADC #$36    (1st potential spell)
60           RTS
8D 00 34     STA $3400   (Save the spell number)
EE 70 3A     INC $3A70   (Increment the number of attacks remaining)
60           RTS

The XX is the number of spells it could call upon, and the YY is the 1st spell; the game basically looks at the 1st spell and counts up. So if you wanted a weapon that summoned a random Esper, you'd have 19 and 36. And since you can have any range and any spell number, that opens up worlds of possibilities: you could have a weapon for Shadow that randomly uses Fire Skean/Bolt Skean/Water Skean; you could have a weapon for Strago that randomly casts one of his Lores, and so forth. You could even have a universal weapon that uses a random Desperation Attack! Just look up the spell number in usME, convert to hex, and you're good.

The only exceptions I've found are Slots and Bushido - Setzer's Slot commands do not like being called up as weapon effects, not sure why but they don't, and Cyan's Bushido have an additional jump built into them that causes them to skip themselves basically. They can't be used for either Wind Slash or the random Esper mechanic.

Setzer's Slots aren't entirely without interest, though, because with what we've learned we could change the results of his Triple Bars. While his Slot commands don't like being used as weapon effects, changing the original "random Esper" mechanic to use them works just fine. Now be aware this will change the Magicite item too, if you've retained it in your hack, but if not, change C2/37DC to this, and Bar-Bar-Bar will randomly use Chocobop, H-Bomb, or 7-Flush.

Code:
A9 03 20 65 4B 69 7E 60

The one hiccup here is that if you use it this way, it must be consecutive spells. But there is a way to get around that, because of how the random Esper mechanic originally worked, where it would ignore Odin or Raiden.

Code:
C2/37DC: A9 19        LDA #$19
C2/37DE: 20 65 4B     JSR $4B65   (0 to $18)
C2/37E1: C9 0B        CMP #$0B
C2/37E3: 90 02        BCC $37E7   (Branch if A < $0B)
C2/37E5: 1A           INC         (Add 2 if over $0B)
C2/37E6: 1A           INC
C2/37E7: 18           CLC
C2/37E8: 69 36        ADC #$36
C2/37EA: 60           RTS

The branch at C2/37E3 basically says "if the result is the 11th or 12th spell in the range (which would be Odin and Raiden), skip them. So I suppose you could hypothetically use this code to check for multiple results you don't want and tell it to skip them. I didn't do that and am not gonna, and it may be a pain to skip lots of them, but if you want to do it, you could.

But wait, there's more - you'll have lots of spare room where the old Ogre Nyx mechanic has been wiped, why not use it to replicate this special effect for weapons a third time? If you find the "2x damage against humans" effect of the Man-Eater underwhelming, you can redirect its pointer to the empty space you have now. The pointer to the Man-Eater effect is at C2/3DD5, change the F2 38 to point to the empty space from Ogre Nyx, throw in the Wind Slash or Esper coding again there, and voila!

The only other thing to keep in mind is that the "use MP for critical hit" mechanic is built into the Ogre Nyx's breaking mechanic, since it has both, and other weapons with the MP critical hit effect jump partway into the Ogre Nyx's coding. So preserve the MP critical hit mechanic, DON'T blank out anything from C2/3F22 onward, this is where the MP critical hit subroutine jumps and you want to keep it, assuming you're keeping that mechanic of course. Or you could relocate it entirely, if you know how, why not?


RE: Fun Weapon Effects - Redlock - 07-19-2024

How do you access the code?


RE: Fun Weapon Effects - Gi Nattak - 07-19-2024

(07-19-2024, 01:28 PM)Redlock Wrote: How do you access the code?

With a tool called a hex editor, such as HxD or WindHex.