what xml effects go with this unit?

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
I have borrowed a couple of units from FFH to use in another mod. I can easily cut/paste the needed bits out of the unitclass, unit, and artdefines_unit xml files. But, when I use the units in the mod, their effects are missing. For example, when a dragon attacks, he just yawns. There is no fire effect.

How can I tell what effects are needed out of the effects xml file for a particular unit? Once I know that, then I can find out which art directories to copy. I don't want to copy the whole effects file and all the effects directories, because that is huge.
 
You need to open up the animation .kf files in Nifskope to check which effects trigger when. You'll need to locate the NiTextKeyExtraData node and fully expand it.

There is a bit more detail on this under Unit Sounds and Effects in my Civ4Col migration tutorial.

It is also possible for unit to have ATTACHABLES which are permanent effects. These are specified in the NIF file itself.
 
Thanks for the answer. I want to do this in a batch mode on a number of units. Perhaps I will explore unix "strings" to dig any text out of the otherwise binary file. If that works, I will add a check to civchecker for missing effects.

EDIT: oh, also sounds. For those who speak unix, the following command is the closest I can get, but it does not really work:
Code:
strings *.kf | egrep 'SOUND|EFFECT' | sed 's/.*://g' | sed 's/[^A-Z_]//g' | sort -u
For the Abashi dragon unit, it prints:
Code:
ASD_UN_DRAGON_BREATH_IN
ASD_UN_DRAGON_BREATH_INB
ASD_UN_DRAGON_HURT
ASD_UN_DRAGON_HURTDD
ASD_UN_DRAGON_IMPACT
ASD_UN_DRAGON_ROAR
ASD_UN_DRAGON_SMOKEPUFF
ASD_UN_DRAGON_SNAP
ASD_UN_DRAGON_STEP
ASD_UN_DRAGON_STEP_LOW
ASD_UN_DRAGON_STRIKE
ASD_UN_DRAGON_TOXICBALL
ASD_UN_DRAGON_TOXICBURST
ASD_UN_DRAGON_WINGSFLAP
EFFECT_DRAGONFOOTDUST
EFFECT_DRAGONPRINT
EFFECT_DRAGON_TOXICBALL_PURPLE
EFFECT_SMOKECLOUD
EFFECT_SMOKECLOUDUU
EFFECT_TOXICBREATH_PURPLE

I am pretty sure that there will be no "EFFECT_SMOKECLOUDUU", but in the file there just happens to be some string-type stuff after the end of "EFFECT_SMOKECLOUD". So simply grabbing things that "look like" strings is not enough.

Is there any tool which actually understands kf files and writes them in some text format?


EDIT2: Esemjay's converter speaks kfm, but not kf. This doesn't help for my application; the data I need is inside the kf. I have come across PyFFI, the engine inside nifskope, but I am still hoping to find a standalone command line executable so I can run it in batch on many units.
 
I am pretty sure that there will be no "EFFECT_SMOKECLOUDUU", but in the file there just happens to be some string-type stuff after the end of "EFFECT_SMOKECLOUD". So simply grabbing things that "look like" strings is not enough.

Yeah, often the node the effect is attached to is called EFFECT_ something. I'm not aware of any automated way to be able to do this, but I can see it would useful. Even a single unit has several .kf files.
 
after a small look with a hex editor at a kf i think i found something you could use:

the text keys are at the end of the kf, so i would skip all entries before you found something start 'eventcode ...' in the kf, in front of each text key entry there are exact three '00', the number before the three '00' is the number of characters the following text key will have (see attached pic)

[theoretical there could be problems with non vanilla animation - not completely sure if the eventcode ... part is needed, but i think the rest will be still same / and of course you must read also the attachables from the nif itself]
 

Attachments

  • hex_kf_strings.jpg
    hex_kf_strings.jpg
    86.7 KB · Views: 60
Great, that was what I needed. Using some binary read routines and the info you dug up, I now have a short program which finds the effects and sounds in a kf. I will add it to civchecker and release an updated version.
 
Back
Top Bottom