• Welcome to Freedom Reborn Archive.
 

utility to convert hero files to built-ins - version 1.3

Started by M25, April 26, 2007, 02:43:42 PM

Previous topic - Next topic

M25

It's a hassle creating characters in ffedit, so here's an easier way.

I've written up an in-game utility to convert hero files to built-ins.  In other words, given a hero file, it creates all of the entries necessary in the dat files.

Warning: this could mess up your files, so back up your mod before playing with it.  No, seriously.  Do it.


http://members.shaw.ca/m25/herodatatoolv13.zip

Many thanks to stumpy for his work on decoding the dat files in the first place.


Notes
[spoiler]
Hero file to .dat converter

Version 1.2
May 2, 2007
m25

What is it?

This package includes a rumble room mode and scripts for FFvTTR.  The scripts takes a hero file and adds it to the dat files of a mod, saving a lot of the tedious work in doing so.

You will still have to tweak the results, but the vast majority of the effort is done for you.



How to install it:

Unzip the file into your ffx3 directory or any mod based on ffx3.


How to use it:

Start the game, go to the rumble room and choose the 'Add To Dat' mode.

Pick the custom heroes you want to add to the dat files as your hero team.  You can add additional characters on the villain selection screen.

NOTE: if you select characters that are NOT custom heroes or that have not been branded by the ffx control centre, the tool will not add them (as they are already built-ins).

Start the rumble room session and wait for the session to end.

Restart the game, or look at the dat files with ffedit and you should see your characters as built-ins.


What to do in case of disaster:

If you find your files have become horribly mangled, look in your mod directory for .bak files.  Overwriting the damaged file with the most recent .bak file should restore your data.


My characters don't do anything after I convert them:

You may need to assign an AI to the built-in via the characters tab of ffedit, or you can run them through the AI generator that comes with ffx.

If the name of the built-in is the same as the name of a custom hero file, the custom AI will try to use the AI for the hero file, which won't work.  Rename the built-in or move the .m25ai file out of your hero file directory. 

Your hero file directory should be located here (or in a similar location).  The Application Data directory is hidden, so you should set Windows to show hidden directories.

C:\Documents and Settings\<USERNAME>\Local Settings\Application Data\Irrational Games\Freedom Force vs the 3rd Reich\Custom\Heroes



What it does:

1. Creates a name for the built-in character.  The name is limited to 16 characters, is lower-case and has all spaces changed to underscores (_).  The name can only be 16 characters long due to restrictions on the animportrait entry in res.dat.

2. Adds the character to characters.dat.  Powers are divided up and placed into the two tiers.  Half goes into tier a, and the other half into tier b.  They are divided up in order, so the powers in tier a should be the powers that are listed first on the hero editor screen.

3. Adds the character to objects.dat.  It creates a complex ID for the character so that it works with FFX and updates the HeroIndexData.txt file.

4. Adds all of the character's powers.  Powers are named <hero_name> <power name> so that all entries are placed together, are easy to find, and don't interfere with the same powers from other characters. 

5. Creates an entry in res.dat for the character's animated head.  The entry is named animportrait_<hero_name>. 

6. Copies the mesh for the character into the mod directory.  It is placed in <my mod>\Art\Library\Characters.  If there is anything already in that location it will be COMPLETELY REMOVED and replaced with the copied mesh.  If you make changes to the mesh in your mod and then re-import the hero, your changes will be wiped out.

7. If the mesh doesn't have a head.nif associated with it, Renegade's default head.nif file is copied into the mesh directory in the mod.

8. Entries are added to strings.dat, and strings.txt, for the character.  That includes the name and description of the hero, and the names and descriptions of all of the powers associated with the hero.  Most of these are just placeholders and you'll want to change them yourself.  Do a search for the hero name and you'll find them.  If the entries are already in strings.dat, they won't be overwritten.

9. If ffxcustom and ffxcustom2 are found and the character name had to be modified, any ffx customizations found on the hero file are copied over to the new character name.  This may not work very well for state swaps (carrier attacks) though.

10. If m25aidata.py is found, the tool will attempt to transfer the custom AI defined for the hero into m25aidata.py for the built-in character.  It will completely overwrite any existing custom AI for the built-in.


You have to restart the game to see the changes.

NOTE:  If you have a hero file and a built-in character with the same name, the game may use the hero file in the rumble room when you select the built-in. 



Credits:
default head.nif by Renegade
dat file format decoded by stumpy
[/spoiler]

Previsionary

I'm glad you made this, m25. It should make modding so much more bearable.

tommyboy

Thanks, another great utility.
But you just know I'm going to ask if theres a way to add more than four at a time.....
just kidding...sort of...

Previsionary

Change:

def OnSelectionRequiredCheck():
return 0 #disallows players to choose their opponents


Into:

def OnSelectionRequiredCheck():
return 1 #disallows players to choose their opponents



I believe that to be the correct way of doing it. Of course, I'm assuming since that's the way to add more than 4 AI entries at a time.

tommyboy

Thanks, that makes sense.
I'll have to re-install my eleventy billion hero files and try this out.

M25

Yes, changing the OnSelectionRequiredCheck() value to 1 should do it. 

HumanTon


Lunarman

OMG!!! Now making an FR mod will be so much easier, You are a lifesaver M25

TaskMasterX

Another great utility from M25! This was needed in a big way! Thanks!

yell0w_lantern

 :thumbup:
Yessssssssssssssssssss!
That's AWESOME!!!!

Xenolith

A really awesome idea.  I so badly wanted this.  yay

Epimethee

Amazing! Congrats to both of you! :thumbup:

P.S.: Since not everyone follows the Script forum, you may want to post this in the Releases forum. :)


M25

Quote from: Epimethee on April 27, 2007, 09:17:41 PM

P.S.: Since not everyone follows the Script forum, you may want to post this in the Releases forum.



I'm mostly waiting for some mod-makers to confirm that this isn't 'horribly mangling' their mods.   :mellow:

catwhowalksbyhimself

I'll probably be testing this soon, as there are two more recruitable characters that will enter the picture.  It may be a bit as one will get 3 new state swaps and the other, a new attribute.

UnkoMan

Well... For adding characters it certainly works. I was going to ask about special ffx3 state swaps and powers... They seem to work just fine though. And you can leave them blank, as with custom heroes, OR specify which powers should have them. So you could have one thing swapped out to numerous things. That's pretty neat.

One thing, though... The imported characters seem to have little to no AI (unlike their hero file versions who have all been through your AI adding system). What should I do for this? Just change their AI from zerocost to generichero in FFEdit?

M25


If you want them to have custom AI, you need to run them through the AI generator again.

It might be possible to automatically transfer the custom AI as well, but it doesn't do that right now. 

UnkoMan

I tried this and it helped quite a bit, but they still seem to be... not as bright as they were. Specifically summoned characters. They stand around for a long time doing nothing and only started to attack after they were attacked. I did, however, change their AI in FFEdit (to generichero) first. Would that interfear with your other AI?

Also, would they get new AI files somewhere? The ones in my hero folder are the old ones for the custom characters (which I'd like to keep there anyhow). Or is there somewhere I could just copy the text from the old AI files to?

I'd like to thank you for this tool, by the way. This makes things so much easier.

Lunarman

When you add them they don't have custom ai, so for heroes give them generichero AI and villains (and summons) have got to have AI suitable to their attack layout. For example a villain with a ranged attack first and a melee attack second (and nothing else) can have generic gun thug AI. Otherwise I'd generate AI for them and leave the ffedit AI box empty or as defualt.

M25

I've updated the tool (see the first post) to version 1.1. 

It will now try to transfer any custom AI from the hero file to the built-in.

Hopefully this version will also work with ffx 3.0 and up (not just ffx 3.2).


UnkoMan: the custom AI is compatible with any built-in AI, so it doesn't matter which one you choose.  The generichero AI is not a good choice as Lunarman said, since I believe it is meant to be used with characters that the player is controlling.

The custom AI for built-ins is in /Missions/Scripts/m25aidata.py, but doing a copy and paste won't work since the power names change.

If you had a character summoning a custom hero and you want them to summon the built-in, you'll have to manually change the attribute in the ffx control centre to summon the built-in, if the name of the built-in is not the same as the custom hero. 

UnkoMan

Ah, thank you. That should take care of that. I'll try this all out later tonight.

BentonGrey

D'oh!  How did I miss this!  Haha, this is just plain ironic.  It seems my needs are running a month or two ahead of the community.  I was working on voices, and had to adjust volumes individually, but once I finished Cat found a utility for doing them en mass.  I was adding in a bizallion herofiles into FF2, and now that I'm almost done M25 writes this awesome utility!  Man, I just need to go on vacation, and by the time I get back, I won't even need to put out my mod anymore, y'all will have done all the hard stuff already! :D

M25

Quote from: UnkoMan on April 30, 2007, 10:43:43 AM
I tried this and it helped quite a bit, but they still seem to be... not as bright as they were. Specifically summoned characters. They stand around for a long time doing nothing and only started to attack after they were attacked.

I think I've found the cause of this.  I'll release a new version in the next couple of days that should fix it.

UnkoMan

I actually retested from scratch using the latest version, and something crazy happened. It changed all the grenade projectiles to proximity. And when I opened FFEdit to check it out, I noticed that, in the characters tab, the powers and attributes list was all blank. Thus I couldn't add any to anybody. Which was alright.

Anyhow, I went back and switched all the grenades backed, and changed a couple other things, and then the AI seemed to work fine. But I just checked FFEdit and I can see the powers and attributes lists now. So I dunno what happened there. I will test whatever new versions you do from scratch too, most likely.

I have a question though. Is there a way to alter the level of a power? With custom characters I never set a power higher than 1. I don't know why. Just a habit. But when there's built in, they've got that some at 3 setting, you know? Granted that's fine if you're making a mod where characters level up, but if you wanted something where they stay the same throughout? Not that it's a big deal, I'm just curious.

catwhowalksbyhimself

With built ins, unless you are playing a campaign and adding points, the levels are always 3 if the power can be leveled up, and if there's another power on the tier after it, otherwise, the level's always 1.

M25

The tool has been updated to version 1.2 - see the first post.

There is a constant hidden in characters.dat that stops the character from moving correctly if it isn't there.  The tool will now add it in, but you will have to re-convert any characters you've already converted.

The Attack Flags and Defence Flags should now transfer correctly too.


Epimethee

Quote from: M25 on May 02, 2007, 01:57:16 PMThere is a constant hidden in characters.dat that stops the character from moving correctly if it isn't there.
Interesting. Could it be related to turrets? Or to an abandoned terrain allowance system?

tommyboy

Just thought I'd let you know I used the 1.2 version to add 30+ characters to my Mod in one go.
It worked.
The only problems I had were caused by the length of the hero file names which made powers and heads over 29 characters, which is hardly the fault of your utility.
Other than that, everything went fine.
I didn't even back up my Dats, because I'm a nidiot, but luckily they weren't damaged.
Thanks for a(nother) great tool.

M25

Glad it, er mostly, worked.

I thought I had the length of the heads capped correctly.  I'll have to look at it again.  Didn't consider the powers though.

The tool creates a single backup of your dats when you run it, so there is some chance of recovery if things go wrong. 

UnkoMan

I also had super long power names. No big deal, I just went back and fixed it.

I had a character with too long a name, and the end of the name was chopped off. This is fine for characters, but I wouldn't sugest doing it for powers. As it stands, things are probably easier to fix this way. A better solution might be removing all but the first letter or two of the hero's name in the power name, if that's even possible... Or even makes sense.

joemama

Love the utility M25.  Great job as usual.

I got around the 29 characters issue by abbreviating the heroes' names and then putting the correct (expanded) name into the strings file.  All my powers were fine after that.

It's a little effort, but it was easier than trying to change the individual powers themselves.

IMHO, of course.

JM