• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 28, 2024, 02:16:35 pm

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


Modifying Spell Effects [Warning! Image Heavy Post!]

Started by Celdia, March 25, 2012, 06:28:38 pm

Celdia

There has been another general outcry for a tutorial on how to edit spell effects lately, so here we are once again. Hopefully this tutorial will answer a lot of the basic questions when it comes to effect editing. First and foremost, what will be covered herein:

- Extracting and Importing Effect Files to and from your ISO.
- Modifying effect palettes. [Fancy way of saying changing the colors of spells.]
- Removing unwanted parts of effects.
- Replacing parts of effects with something new.

And a short list of what will NOT be covered and why:

- Screen/unit tinting effects: There are commands in the effect files that do things like tint the whole screen one color or fade to black for an effect. Others, like the example below, will tint an affected unit a specific color. To my knowledge, no one has dissected the effect files enough to know how this is done or if they have then I'm unaware of where it is documented. The instructions below will not cover anything that tints the whole screen or units.
- Sounds in spell effects: As with the screen tinting, as far as I know we just haven't discovered how sounds are controlled in the effect files.
- Making wholly new effects: Again, this comes down to a lack of detailed knowledge on how the effect files work. As of right now all we can do is modify existing effects into something else that will follow the same general pattern of motion on the screen. Until someone decides to start taking apart the effect files and decoding them into something we can understand and more easily modify, this is about as good as it gets folks.

With that out of the way, let's get down to it.

What you will need for the purposes of this tutorial: CDMage, GraphicsGale, TIMUtil, a HEX editor [I will be using HxD in my examples].

This tutorial will also assume that you know how to use FFTPatcher to choose your effects for the skills in your patch. I will not be covering anything involving FFTPatcher. I will also be assuming you have at least a basic working knowledge of how to use GraphicsGale or similar image editing programs. If you don't, just go play around with GG for a while. Its not too tough to figure out.

Step 1: Go here and get a BMP file of the effect you intend to modify. Xifanie has very graciously ripped the effect images from every spell effect in the game and made them readily available. We should thank her. Thanks, Xifanie! For our example today we will be modifying effect E052 "Faith/Face Up". As listed on the effects page we can see the filename for the effect is E052.BIN.

Step 2: Go into CDMage and open your ISO as "M2/2352 track".

Step 3: Open the EFFECT folder and locate your effect file on the right and right-click it to bring up the menu and select Extract Files. Make sure your effect filename matches the one from the effects page. Just save this to wherever you'll be keeping your working files. Also make a note of the number in the Size column for your file. We'll need that for Step 8. It has been cut off a bit in my example image but for this example our filesize is 46076.

~Removing Graphics~
Step 4: Open your downloaded BMP file in GraphicsGale. You are going to want to overwrite anything you don't want in the spell effect with pure Black. This has RGB values of 0 as you can see highlighted in the image below. This is usually the very first color in the image's palette as shown by the red arrow.

We will be removing the heart from the spell effect here. Now just save the BMP. If that was all you wanted to do then proceed to Step 7.

~Changing The Colors~
To change the colors of an effect you will need to change the palette. Palettes for spell effect are "indexed" which really just means each pixel in the image refers to a color in a specific place on the palette. If you only want to change a few colors of an effect then select the color you want to modify in the palette and use the value boxes [as highlighted in Step 4 above] to change the color. This example will be for changing the colors of the ENTIRE effect.

Step 5: For GraphicsGale you will want to go to All Frames and select Adjust Color. [In Photoshop this is usually called Hue/Saturation and can be found under Image > Adjustments. Your version may vary.]

This will bring up a new window with a lot of options. We're only interested in four of them: The RGB sliders and the Saturation slider. You can change other things there but I won't guarantee your effect will turn out as planned. Basic rule of thumb here: Do not increase Brightness ever and do not raise the RGB values over 0.

I want to change the pink colors of the effect to gold. As you can see here, the image changes to reflect my changes to the sliders. When you've got colors you like, click OK. If this is all you need for your effect, skip ahead to Step 7.

~Replacing Graphics~
For this section we will be using the heart-less version of the effect we made in Step 4 as well following the palette changing instructions in Step 5. The reason I chose gold is because the graphics I want to paste into the effect file are mostly gold and anything you paste into your BMP will attempt to match itself colors to the existing palette. Because what I want to paste into the effect uses white but the palette does have a white color, I have changed the very last and brightest color to white.
Step 6: This is really just as simple as Copy and Paste or just drawing your new graphics over what you want to replace. If you want to know how to make nice graphics, go read a spriting tutorial. Or you can just be like me and steal some graphics from another game. As shown below, I've replaced the hearts with a clock I stole from one of the Castlevania games. Looks kind of unimpressive here compared to the heart but it will serve for this example.

Step 7: A few of the previous steps will may directed you here. That's because this part is required no matter what you're changing or how. You will need to convert your BMP into a TIM file. Open TIMUtil and load your modified BMP file. Now the important part - you MUST click both of the checkboxes for 'Translucent except black' AND 'Transparent for black'. This is why we removed existing graphics with a pure black color. If you don't do this, your effect will look all wrong. Once you've got that done, click Convert and save your TIM file.

Now here is where I think a lot of people get lost trying to make things work. Open your HEX editor and open both your extracted BIN file and your TIM file you just created. If you're not familiar with HEX editing you're going to see a lot of numbers and letters that won't mean a lot to you. We are only concerned with all of the little pairs of numbers and letters in the middle of the window.
~Importing Your New Colors~
Step 8: Click on the tab at the top of the window that is your TIM file then bring your cursor to Offset: 14 as displayed in the bottom left of the window. This is the beginning of the palette data for your spell effect.

Now highlight down to Offset 213. The status bar at the bottom should read Block: 14-213 and Length: 200. Offset 213 is the very end of the palette information. You want to Copy this block of data.

Now remember that filesize number I had you make note of back in Step 3? This is where we need it. We now have to figure out where in the BIN file we have to Paste-Write this data for the palette.

Step 9: Read what's in the following spoiler.

If the effect file is larger than 70KB (71,680B)...
-the last 64KB (65,536B) of the file is a raw image 256x256 pixels.
-the palette is 1028B before the start of the raw image.
-the offset for the palette = the size of the file in bytes minus 66,564 bytes.

If the effect file is larger than 34KB (34816B) but smaller than 70KB...
-the last 32KB (32,768B) of the file is a raw image 128x256 pixels.
-the palette is 1028B before the start of the raw image.
-the offset for the palette = the size of the file in bytes minus 33,796 bytes.

If the effect file is smaller than 34KB (34816B)...
-the last 15,872B of the file is a raw image 128 pixels wide.
-the palette is 512B before the start of the raw image.
-the offset for the palette = the size of the file in bytes minus 16KB (16384B).

You got all that? Our example effect is larger than 34KB but smaller than 70KB, so we are going to take the filesize [46076] and subtract 33796 from that: 46076 - 33796 = 12280. That gives us the where but its in decimal. We want that in hexidecimal. After a quick conversion we get 2FF8, as in Offset: 2FF8. So you need to click on the tab for your BIN file now and you want to Goto that offset. You can find it manually or use the Goto function built into your hex editor to find it. I opt for the latter.

Step 10: Now you don't want to just Paste normally here. You want to Paste Write or Paste Overwrite, depending on your HEX editor. If you just Paste or Paste Insert you will increase the filesize. This will ruin your effect. You want to see this:

That data that shows up in red is only like that to show that you've changed something from the original file.

Not this:


If you EVER get this message, Cancel your action and try what you were doing again.

If all you're doing is putting in new colors, then you're done here. Save your BIN file and skip ahead to Step ###. If you are removing or otherwise modifying the graphics, read on.

~Importing Modified Graphics~
This part is pretty much the same as importing the palette information, functionally speaking. You're just going to be looking for more data in a different place in the TIM file. However, this is a lot easier to find where you want to Paste Write it to.
Step 11: Once again you will need to open your HEX editor and open both your extracted BIN file and your TIM file. If they're still open from Step 10, that's fine. This time however, we're going to use our IMAGE size to find out where we need to copy from in the TIM file.

Step 12: Click on the tab for your TIM file again and go to Offset: 220 and then just select everything to the very end of the file. Make a note of the Length value here and Copy.

Step 13: Click on your BIN file tab once more and bring up the Goto window again. This time you want to change the 'Offset relative to' from 'Begin' [default] to 'end (backwards)' because we'll be telling it to count backwards from the end of the file.
All of the graphics data is at the very end of the BIN file. Your image is going to be one of three sizes: 128x128, 128x256 or 256x256. Our example here is 128x256. You need to multiply the dimensions by each other [128 * 256 = 32768] and then convert the total to Hex [32768 in Hex is 8000]. As noted from the last step, 8000 is the Length copied out of the TIM file. That's exactly what you want to see. [If you're doing a 128x128 image the Length should read 4000. If doing a 256x256 image then the Length should read 10000. Remember, these are Hex values.]


As you can see above, I've set the Offset to 7FFF, 1 less than 8000 in Hex. This is to compensate for how HxD is going to count backwards. The goal is to bring us to the offset in the file that will let us Paste Write that Length 8000 block of data and end at the very last byte of the file. [If doing a smaller image you'll want your Offset to be 3FFF. If larger, Offset should be FFFF.]
Step 14: Paste Write in your data from the TIM file here. The data should come to the very end of the file, no more and no less.
If you get this error then you're not exactly Length 8000 from the end of the file:

If you see black numbers left after the red/changed values like this then you're not exactly Length 8000 from the end of the file:

You'll need to adjust where you're pasting your data from accordingly, but if you followed these steps properly then you should be right on target. Once everything is in place correctly, save your BIN file.

Step 15: This is the last and easiest part. Go back to your ISO in CDMage and right-click your effect file in the EFFECT folder again, but this time select Import File. Go find your newly modified BIN file and load it in. That's it! You've just created your own custom spell effect.


A fun note: Since this effect uses exactly the same graphics as the Innocent effect you can actually import the graphics data to E053.BIN [after adjusting for the different filesize] and get another new effect there but using that effect's special code which makes for another interesting looking spell. I've done that and applied the other three changes done in the tutorial here into a video.


The first questions I would expect is "Why is it green like that? What happened to the gold?" and the best I have is a theory and it goes back to the list of what isn't covered in this tutorial. The effect file has instructions in it to modify the colors of the palette to make that green color. If you note on the original/heartless version [top left] there is that burst of blue color, but our palette has no blue in it. I believe the effect file for Faith has instructions to apply a modification to the graphics based on existing colors in the palette, giving us green where once there was blue. This marks a great example of some of the limitations of effect editing right now. Simpler effects, like Esuna, take palette modifications beautifully as you can see here:

Other effects will just ignore any changes you make to their palette [I'm looking at YOU, Stigma Magic. >_< ] So for right now some of this is still a little hit and miss. Try your own edits, see what you come up with and as always...happy hacking! ^_^
  • Modding version: PSX
  • Discord username: Celdia#0

Celdia

Oh, if anyone wants those edits I made, they're all right here in this 7z file. Help yourself.
  • Modding version: PSX
  • Discord username: Celdia#0

3lric

Amazing Celdia!

Gonna try this out later tonight  :mrgreen:
  • Modding version: PSX

Taichii

weeeeee~~ amazing and well said boss celdia :)

tony.. are you talking about skill effects like this? because i think this will be suited at the help section again based on FFTPATCHER :)
check bow's double sword/ dual wield = double shot.
Please do share your ideas and suggestion for my project:
FINAL FANTASY TACTICS : LEGEND OF MANA

Join our RP :)
"Desperation"

"PAIN. THAT'S WHAT KEEPS YOU HUMAN"

Valkirst

GAH!! Hey Celdia, what can I use instead of CDmage I keep getting an error trying to open WotL. I know that most people modify the PSX version, but I was wondering if there was something else that would get me to the M2/2352 track, thanks!
  • Modding version: PSX
Completed Sprites
  • Discord username: Valkirst

Celdia

Sadly, WotL is outside of my realm of expertise. I don't know of an equivalent program to CDMage for it.
  • Modding version: PSX
  • Discord username: Celdia#0

Valkirst

So I am trying to replace Zodiark with Terra and yeah, I go through all the motions. I even found what I thought was a work around using UMDGen and nope. I extract it to look at the bin and sure enough the 80.bin Zodiark is Terra but when I use it, it just doesn't change at all, still Zodiark doing his thing.
  • Modding version: PSX
Completed Sprites
  • Discord username: Valkirst

Angel

I was going to point to UMDGen, but it looks like you've already found it. So I have no idea. Still, this thread is the single most relevant to the topic at hand, and if it doesn't work, it isn't currently known how it can be done. Those experienced and knowledgeable tend to patently hate WotL, and many look down upon WotL modders as noobs who can't appreciate an original work and are ostracized as a result. That's just the way it is. If you don't know the appropriate ASM and are intimately familiar with PSP at an esoteric level, give up on WotL. Seriously.

The only way I will personally touch WotL is if someone gives me the Android version of the game, which honestly does not exist in a tangible sense for people not living in Japan with a DoCoMo account. Get me the Android version, and I'll hack that shit to pieces.

I'll say it a bit louder now: SOMEONE FUCKING GET ME THE ANDROID VERSION FOR THE LOVE OF FUCK. I'VE BEEN WAITING A YEAR AND SOME CHANGE FOR THIS AND IT IS INEXCUSABLE. FUCK I hate Squeenix for fucking me over on this, my prized treasure. >:I
  • Modding version: PSX
* Angel should quit being a lazy bitch
<@Elric> I agree to that as well

nyanyame nyanyajuu nyanyado no nyarabide nyakunyaku inyanyaku nyanyahan nyanyadai nyannyaku nyarabete nyaganyagame
At the end of the day, are we not all trapped inside lemons?

Valkirst

Yeah, that is essentially what I tried to do using UMDgen, but somehow it seems that it is hardcoded. However I also found that I was unable to figure out where the palette was on the BIN file which is probably the real issue. Anywho...

As to the whole patching which is which. I find that it doesn't really lend it self to who is better at modding. Essentially I imagine that one could get WotL to work the same way but in fact it would take more work... that being the case that if it is more challenging that, that in fact proves that modding WotL takes more skill. Regardless, I guess the reason I stuck to WotL is because the level of modding I wanted to do was not to the whole effect of creating a whole new other game or writing fan fiction. Changing classes or changing abilities or adding things to that affect are all simply on the technical aspect. I having been playing FFT since the first day it came out in the states, so to say that I can't appreciate the original is laughable at best, though understanding that those that become introduced I can see why they would prefer WotL over the Original. It simply is a slightly upgraded product.

I can see now though that if I do want the desired affect with Terra, simply for the sake of seeing her as the complete version I have in my head, it would simply be easier at this point to switch over. besides, I have other ideas with other characters that seem at the end to probably only work with the PSX version. Like replacing Golem with with Shadow's dog Interceptor and the hand of Golem with an interceptor sprite. 
  • Modding version: PSX
Completed Sprites
  • Discord username: Valkirst

Celdia

When you go to change the Golem hand animation, make a complete backup of your working copy first. I tried doing that once and for some reason it completely fucked up the animation to be somehow unfixable. I couldn't find any logical reason for the glitch and trying to load an old WEP2 [I think it's in WEP2 anyways] did nothing to fix it, the ISO was just plain fucked. Maybe you'll have better luck than I did though.
  • Modding version: PSX
  • Discord username: Celdia#0