Inserting a .kf animation into a .nif body?

Post » Mon May 07, 2012 11:45 pm

Is it possible to get the animations stored inside a .kf animation file into the very .nif file it is created for?

Also is it possible to combine many .nif files containing animations into a single .nif file containing all of those???
User avatar
stevie trent
 
Posts: 3460
Joined: Thu Oct 11, 2007 3:33 pm

Post » Mon May 07, 2012 9:16 pm

No. Morrowind expects kf files to be separate. You can, however, combine multiple kf files into one using LizTail's animation kit.

No, because the nif files don't contain any animation information, they only contain skeletal information. You should only need one nif and one xnif file. If you want multiple animations, combine the kf files into one and make sure it has the same name as the nif files. E.g. base_anim.nif, xbase_anim.kf, and xbase_anim.nif.
User avatar
Rachell Katherine
 
Posts: 3380
Joined: Wed Oct 11, 2006 5:21 pm

Post » Mon May 07, 2012 10:07 pm

No. Morrowind expects kf files to be separate. You can, however, combine multiple kf files into one using LizTail's animation kit.

No, because the nif files don't contain any animation information, they only contain skeletal information. You should only need one nif and one xnif file. If you want multiple animations, combine the kf files into one and make sure it has the same name as the nif files. E.g. base_anim.nif, xbase_anim.kf, and xbase_anim.nif.

That means suppose i want to add an animation file to an npc in construction set i add the .nif file containing only skeleton but in same directory its .kf files with the animations so wud the animations be added to the npc??
User avatar
Susan
 
Posts: 3536
Joined: Sun Jun 25, 2006 2:46 am

Post » Tue May 08, 2012 2:04 am

Yes. As long as all three files share the same name, adding the nif file (not the one with the x in front of it: xbase_anim.nif, the other one: base_anim.nif), your NPC should have the new animations. I believe you can use the default base_anim.nif and xbase_anim.nif files for your skeleton, just rename them to something else.
User avatar
Alyce Argabright
 
Posts: 3403
Joined: Mon Aug 20, 2007 8:11 pm

Post » Tue May 08, 2012 2:54 am

Yes. As long as all three files share the same name, adding the nif file (not the one with the x in front of it: xbase_anim.nif, the other one: base_anim.nif), your NPC should have the new animations. I believe you can use the default base_anim.nif and xbase_anim.nif files for your skeleton, just rename them to something else.

Thnx for the help Jac will try it out straight forward whenever i am able to arrange up my Bethesda Softworks folder into a good state.
User avatar
Zosia Cetnar
 
Posts: 3476
Joined: Thu Aug 03, 2006 6:35 am

Post » Mon May 07, 2012 10:20 pm

If they don't work, I'm sure I have a copy of the blank skeletons I can send to you. I'm not an animator, so I can't help with the finer points of it, but I have done some work adding custom animations to NPCs.
User avatar
Antony Holdsworth
 
Posts: 3387
Joined: Tue May 29, 2007 4:50 am

Post » Mon May 07, 2012 8:45 pm

Yes. As long as all three files share the same name, adding the nif file (not the one with the x in front of it: xbase_anim.nif, the other one: base_anim.nif), your NPC should have the new animations. I believe you can use the default base_anim.nif and xbase_anim.nif files for your skeleton, just rename them to something else.
That's correct. Further, you can use only the ....nif file (the one without the X in front) all by itself, and the game will run it using time data from Xbaseanim.kf. In other words, if you are willing to change the time at which different animations sequences occur to match the time data in Xbaseanim.kf (by hand in NifSkope or some other way I'm not aware of), you don't need any Xanim.kf or X...nif files at all. I've been doing this successfully ever since I accidentally learned it works that way. Also, this is *not* true for animations involving the player - for that you have to change the actual movement/rotation data in the Xbaseanim.kf file as well as the baseanim.nif file. To make it a little clearer, the time stamps (in seconds) in baseanim are idle1: 0.0 - 2.7 idle2:2.7 - 17.7 idle3: 29.8 - 35 (yep all that time in between 17.8 - 29.7 is just skipped over, never understood that) idle4: 35.4 - 40.7 etc. (to see the rest just open Xbaseanim.kf in nifskope and read all the NiTextExtraData entries). So, now if you open any ....nif animation file and you craft your animations to fall within those time periods, your actors (again not the player) will perform those animations simply using scripted AiWander commands, or if you don't need to control them with a timer, just add a wander package to the AI button and change the idle %s as desired - and without having to fool around with the X files at all. Not only that, but you can conceivably create hours-long animation sequences by creating a mess of .nif animation file following the above rules, make a bunch of NPCs that are copies of each other, apply the animation files to each copy in sequence, and script their appearance in game with timers, using Disable and Set Delete 1 to get rid of the one who has finished the previous animation and PlaceItem to drop in the replacement. I'm very enthused because I just the other day started implementing one of these sequences and am on the 3rd replacement now - it all works smooth as silk in-game with barely a stutter when the replacement occurs.
User avatar
Spencey!
 
Posts: 3221
Joined: Thu Aug 17, 2006 12:18 am

Post » Mon May 07, 2012 7:32 pm

That's correct. Further, you can use only the ....nif file (the one without the X in front) all by itself, and the game will run it using time data from Xbaseanim.kf. In other words, if you are willing to change the time at which different animations sequences occur to match the time data in Xbaseanim.kf (by hand in NifSkope or some other way I'm not aware of), you don't need any Xanim.kf or X...nif files at all. I've been doing this successfully ever since I accidentally learned it works that way. Also, this is *not* true for animations involving the player - for that you have to change the actual movement/rotation data in the Xbaseanim.kf file as well as the baseanim.nif file. To make it a little clearer, the time stamps (in seconds) in baseanim are idle1: 0.0 - 2.7 idle2:2.7 - 17.7 idle3: 29.8 - 35 (yep all that time in between 17.8 - 29.7 is just skipped over, never understood that) idle4: 35.4 - 40.7 etc. (to see the rest just open Xbaseanim.kf in nifskope and read all the NiTextExtraData entries). So, now if you open any ....nif animation file and you craft your animations to fall within those time periods, your actors (again not the player) will perform those animations simply using scripted AiWander commands, or if you don't need to control them with a timer, just add a wander package to the AI button and change the idle %s as desired - and without having to fool around with the X files at all. Not only that, but you can conceivably create hours-long animation sequences by creating a mess of .nif animation file following the above rules, make a bunch of NPCs that are copies of each other, apply the animation files to each copy in sequence, and script their appearance in game with timers, using Disable and Set Delete 1 to get rid of the one who has finished the previous animation and PlaceItem to drop in the replacement. I'm very enthused because I just the other day started implementing one of these sequences and am on the 3rd replacement now - it all works smooth as silk in-game with barely a stutter when the replacement occurs.


Thnx for the reply the upper part of what you told sure wud take some time to understand.
Well about that NPC replacement Technique even i have thought about frequent times but just that i havent been able to get me any time to test that but glad to know something like that will work coz it creates limitless possiblities to add animation not just 9.

btw do you also use Antares Blender file to create animation or something else?
User avatar
sara OMAR
 
Posts: 3451
Joined: Wed Jul 05, 2006 11:18 pm

Post » Tue May 08, 2012 4:21 am

Just remember that you are limited to the available idle slots - the game will ignore anything after idle9. You can only replace existing animations, you can't add additional ones.
User avatar
Dan Wright
 
Posts: 3308
Joined: Mon Jul 16, 2007 8:40 am

Post » Tue May 08, 2012 1:43 am

Is it possible to get the animations stored inside a .kf animation file into the very .nif file it is created for?

Actually animation data can be stored in nifs: check e.g. "main" (without "x") nif file of creatures. However, it could be properly used by the game engine as far as I remember now only is some cases of activators (for NPCs Jac's explanations are valid).
For certain cases you can "borrow" sneak animations sequences names (e.g. particular NPC never sneaks), in this case it would be necessary to script them with PlayGroup and use MCP. I prefer to clone such NPCs (with many custom animations) and use idles.
User avatar
Philip Rua
 
Posts: 3348
Joined: Sun May 06, 2007 11:53 am

Post » Mon May 07, 2012 6:49 pm

Just remember that you are limited to the available idle slots - the game will ignore anything after idle9. You can only replace existing animations, you can't add additional ones.

I understand that but what i meant to say was that the limit can be bypassed with help of some good scripting techniques i mean one can create a cloned npc in construction set containing the new animations not in its counterpart and used to play those animations while the original one transported to some unaccessible cell for that particular time. Havent tried it myself much but its surely gonna work

btw one more thing to ask, Suppose i have two .kf files containing animation datas i combine them using mergekf of Animkit but now i want to have both of em in a single .nif to apply on any npc So what should I do??
User avatar
Nick Tyler
 
Posts: 3437
Joined: Thu Aug 30, 2007 8:57 am

Post » Mon May 07, 2012 11:38 pm

LizTails kit can split as well, check his explanations/readme.
We cannot add new animation sequences in MW, so "to apply on any npc" you have to replace one of the idels in xbase_anim.kf/xbase_anim_female.kf.
User avatar
Dean Brown
 
Posts: 3472
Joined: Fri Aug 31, 2007 10:17 pm

Post » Tue May 08, 2012 12:50 am



btw do you also use Antares Blender file to create animation or something else?

No, to get new animations I open one someone else made in Nifskope and hand-edit every quaternion key value individually, playing the animation as I go to check my work. I'm sure that makes some go 'ewwwww' but it works for me. I've gotten pretty fast at it. I will admit the edited animations can be a bit stiff at times and I go back and do them again.

I understand that but what i meant to say was that the limit can be bypassed with help of some good scripting techniques i mean one can create a cloned npc in construction set containing the new animations not in its counterpart and used to play those animations while the original one transported to some unaccessible cell for that particular time. Havent tried it myself much but its surely gonna work

It works great. The basic technique goes like this: create an NPC, lets say you named him 'Joe'. So I would set up an NPC Joe in the CS with race, class, spells, etc. Now I copy that NPC 2 times, making 'Joe1' and 'Joe2' - they are all exactly the same copies of the same guy. Now I attach my different animation nifs, Joesanim to Joe, Joesanim1 to Joe1, Joesanim2 to Joe2, etc etc. Now I write and attach individual scripts to each Joe. Place Joe (the very 1st one you made in CS) where he belongs in-game and don't put the copies in. Now your first Joe script, when Joe has performed all his animations, will Disable, then next frame PlaceItem "Joe1" and SetDelete1. This deletes Joe from the game just after his script places the new Joe, Joe1 in the game (in the same cell). Now Joe1 takes over from there and when he is done, he places Joe2 and deletes himself. Thats all there is to it and it works for sure I've put it my project, on the 3rd replacement now and moving on.

Fun bonus technique: Just yesterday I found that you can take a head + hair (+ ears if needed) and put em all together in Nifskope and save as one mesh. Now make a (full) helmet using that mesh. This 'helmet' appears just like a head would in-game, and keeps its blinking and mouth animation, but it just loops every 2 seconds. Now, with this, you can fiddle with the morph data to create facial expressions (pain in the neck to set up but works). Now lets say you made a lot of heads with laughing, crying, surprised, angry, etc for any given NPC. Now, you can script in head replacement to provide facial expression. Hours of good times! For even more fun you can put this 'head helmet' on a shelf or table and your player can wear it - great for a laugh as it does indeed put that NPCs head and hair on your neck.
User avatar
Toby Green
 
Posts: 3365
Joined: Sun May 27, 2007 5:27 pm

Post » Tue May 08, 2012 12:31 am

No, to get new animations I open one someone else made in Nifskope and hand-edit every quaternion key value individually, playing the animation as I go to check my work. I'm sure that makes some go 'ewwwww' but it works for me. I've gotten pretty fast at it. I will admit the edited animations can be a bit stiff at times and I go back and do them again.



It works great. The basic technique goes like this: create an NPC, lets say you named him 'Joe'. So I would set up an NPC Joe in the CS with race, class, spells, etc. Now I copy that NPC 2 times, making 'Joe1' and 'Joe2' - they are all exactly the same copies of the same guy. Now I attach my different animation nifs, Joesanim to Joe, Joesanim1 to Joe1, Joesanim2 to Joe2, etc etc. Now I write and attach individual scripts to each Joe. Place Joe (the very 1st one you made in CS) where he belongs in-game and don't put the copies in. Now your first Joe script, when Joe has performed all his animations, will Disable, then next frame PlaceItem "Joe1" and SetDelete1. This deletes Joe from the game just after his script places the new Joe, Joe1 in the game (in the same cell). Now Joe1 takes over from there and when he is done, he places Joe2 and deletes himself. Thats all there is to it and it works for sure I've put it my project, on the 3rd replacement now and moving on.

Fun bonus technique: Just yesterday I found that you can take a head + hair (+ ears if needed) and put em all together in Nifskope and save as one mesh. Now make a (full) helmet using that mesh. This 'helmet' appears just like a head would in-game, and keeps its blinking and mouth animation, but it just loops every 2 seconds. Now, with this, you can fiddle with the morph data to create facial expressions (pain in the neck to set up but works). Now lets say you made a lot of heads with laughing, crying, surprised, angry, etc for any given NPC. Now, you can script in head replacement to provide facial expression. Hours of good times! For even more fun you can put this 'head helmet' on a shelf or table and your player can wear it - great for a laugh as it does indeed put that NPCs head and hair on your neck.

Exactly thats what i meant but if its an important npc or older animations are required again instead of deleting one may shift him to some temporary place till the other one finishes his job.

As far as creating animations with nifskope is considered u might surely not getting any orientaion problems when i create with Antares belnd file though creation becomes easier tiime gets consumed to get the orientation correct due to morrowind itself dont know why.What i mean is what is meant to be facing front in my animation file shifts through different angles in 3d axis for every animation while it shows correctly in Nifskope still could not find the reason for this.

btw you should checkout Antares Blender File For animations it wud save a lot of time,allow you to create better animations and who knows it might be only me getting that orientaion problem coz as far as i know Antares didnt got any problem like that while creating Animated Morrowind.
User avatar
Ebony Lawson
 
Posts: 3504
Joined: Fri Feb 16, 2007 11:00 am

Post » Tue May 08, 2012 3:15 am

Exactly thats what i meant but if its an important npc or older animations are required again instead of deleting one may shift him to some temporary place till the other one finishes his job.

As far as creating animations with nifskope is considered u might surely not getting any orientaion problems when i create with Antares belnd file though creation becomes easier tiime gets consumed to get the orientation correct due to morrowind itself dont know why.What i mean is what is meant to be facing front in my animation file shifts through different angles in 3d axis for every animation while it shows correctly in Nifskope still could not find the reason for this.

btw you should checkout Antares Blender File For animations it wud save a lot of time,allow you to create better animations and who knows it might be only me getting that orientaion problem coz as far as i know Antares didnt got any problem like that while creating Animated Morrowind.

Think I might have some info of use to you:

Yes, you can just move the NPC to a temporary place, but I make it easy on myself by just deleting it. Here's why: don't think of it as 'deleting' that's not really true. The NPC still exists in the 'NPC' tab and can be replaced at any time after 'deletion'. As an aside, you can use PlaceItem to put that NPC a bunch of times, as many times as you want anywhere you want at any time, and you can delete any given instance the same way, and then replace it again at any time as desired. The last advantage you get by 'deleting' instead of moving is, when you replace it after deletion, the NPC's script restarts from the beginning - I find this so much easier to follow because if you just move the NPC, the script keeps activating as game time continues, and you probably don't really know where the script is at progress-wise at any given time that you need him again. If you need the script advanced to a certain point after reactivation, use a global variable that passes some value from one script to another.

About orientation problems: it's fate I guess because just the other day I noticed a glitch and made a workaround. I'll bet it applies to your problems. So let's say you have your mesh done for the NPC and you have the animation file(s). Now you have placed the NPC in game and all is working *except* he is facing the wrong way. OK concept time - have you also noticed that you can see your NPC sort of 'floating around' (moving randomly just a bit in X/Y) as he/she is animating? If not, go in-game and get right up close and watch and you will see it; use 'TCL' (toggle collison console command) if you need to get really close. My guess is the NPC is colliding just a bit with the floor or surface he has dropped onto at game initialization and therefore being moved just a tad by the collison features of MW. Another concept: if your animation file contains translations (i.e. the whole mesh is moving in X/Y/Z from time to time), these translations will be honored regardless of collision features as long as they execute every frame - and, (stay with me) the engine 'adds' the translation values to any static position values from the CS placement or scripting. I'm not saying this very understandably but my point is that you can safely add a fixed SetPos and/or Position value that executes every frame in a script to 'fix' your NPC in one spot relative to your animation translations and stop the floating around effect. Please return to this paragraph and reread if what follows does not make sense to you.

Initial placement glitch: Let's say you placed your animated NPC in the world, but when you go in-game to view him/her, he's facing the wrong way. This applies only to NPC's with a custom animation file attached to them. The Position X, Y, Z, angle function can be used to correct facing problems. Here's the glitch: the angle in the CS and the angle argument in PlaceItem (and probably other script functions that initially place an object) are not the same as the angle argument in Position. Example: I write a script to put my animated NPC in the world using PlaceItem 100, -150, 30, 16200 (as a DoOnce) and then have Position 100, -150, 30, 16200 execute every frame to lock him in place (relative to animation translations - I say that because this does not 'root' the NPC in one spot, animation translations still execute - please reread about orientation problems above paragraph now if does not make sense). Well, the 16200 (the facing direction in minutes - see MWSFD for fundamentals on this) argument in PlaceItem is *different* by 90 degrees from the 16200 in Position. Now for the point of all this: try applying a Position X, Y, Z, angle script command to your NPC that is facing the wrong way. Look in-game, and change that angle until he is facing the right way. Now he will keep that facing throughout the all animations, and it doesnt need to execute every frame (only do that if the floating around effect bothers you). Lastly, you can DoOnce the Position X, Y, Z, angle and then use SetPosX and SetPosY every frame to stop the floating around effect.

Hats off to the talented people who make animations in blender or max or however they do it. Without them I'd be going nowhere because I can only edit animation files made by them. That said, it's not for me so I wont be using anything but NifSkope and scripting to get animations done.

The thread 'animations exist' in the MW construction set forum area has more details about this topic. I feel awkward discussing this nitty-gritty stuff here in mods so I'll be looking at that thread from time to time to answer further questions or with questions of my own. Also its much easier to find threads in construction set area. Cheers

PS - to reiterate, it most certainly is possible to create your own animations using only NifSkope and scripting, and only needing to edit the anim....nif file, and not touch at all the Xanim....kf file or the Xanim....nif file or even have them exist at all. You do have to accept certain minor limitations (really only that your idle times are fixed), but it has been done repeatedly by myself and the details for how to do it can be found in 'animations exist' (see above). It is also most certainly possible to have unlimited animation sequences by scripting in replacement NPCs using seperate animation files, again having been done repeatedly by myself. As always I am your servant in helping you understand how to get it done, all questions welcome - just please ask in 'animations exist'.
User avatar
sarah taylor
 
Posts: 3490
Joined: Thu Nov 16, 2006 3:36 pm

Post » Mon May 07, 2012 9:32 pm

Someone said something to the effect that animations are not stored in the kf, but that doesnt appear to be the case. Of the 3 files you need for an animated model, the animated base mesh, the static 'x-nif' and the kf, the base mesh can be replaced with the unanimated version and still work in-game.

I have a related question. Isnt it possible to apply the animations from one creature to another? Id like to try that.
User avatar
Leah
 
Posts: 3358
Joined: Wed Nov 01, 2006 3:11 pm

Post » Tue May 08, 2012 12:46 am

I believe you can provided the new skeleton will accept them. For example: you can't take an Ogrim's animations and add them to a nix hound because the former walks on two legs while the later on four. I could be wrong though.
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Tue May 08, 2012 2:30 am

NetImmerse/Gamebryo/LightSpeed stores animation data (translations for a root bone and rotation of others) as well as note tracks (sequences names like "idle9" and timing) in kf files, x.nif stores skeleton structure (bones paraneters, thier namining, additional nodes like collision geometry -"Binding Box", etc.), not used in MW kfm files contain animation transitions/blending settings, MW main nif (skeleton + animations) is used in KS and therefore can be without animations. Therefore, kf file is linked to a specific skeleton: creatures with different skeletons cannot use the same kf.
However, Pyxlmxz have found that in some cases (careful timing) main nif animation data can be used by the game engine. Advantages of this discovery are not clear to me at the moment.
User avatar
Alan Whiston
 
Posts: 3358
Joined: Sun May 06, 2007 4:07 pm


Return to III - Morrowind