• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

[Tutorial] Modifying the Visibilty of Weapons

Coyote - I think I followed your instructions but it just seemed to shrink and move the mesh. The animation still has the scrunched up posture:

I've attached my amended KF file so you can see if I did something wrong.
 
:wallbash: typo from my side, should be scale 1.5 and not 0.5, sorry for this (and yes the models move also there, therefore the translation)
 
I've used this tutorial to add the animation of the pikeman to the rifleman (http://forums.civfanatics.com/showthread.php?t=353426). To do this successfully, I had to add a bone to the rifleman unit, because it lacks the BIP R Clavicle bone that is needed for the pikeman animation. I think the way to do this with NifSkope isn't covered anywhere else, so I want to give here a short explanation about how I did it. I don't know if this is the absolute right way to do it and if it always works this way, but at least it did for the rifleman. Also I expect that everyone who reads this already has some experience with NifSkope, so I will not cover every detail.

As I said the pikeman animation uses the BIP R Clavicle. Using the animation with a rifleman unit that lacks this bone leads to strange behavior. Thus the first thing that has to be done is to add the needed bone to the rifleman bone set. The BIP R Clavicle is (if present) located between the BIP Neck (parent) and the BIP R UpperArm (child). Adding the bone is pretty simple, just go to the BIP Neck in NifSkope, add a NiNode to it, rename this NiNode to BIP R Clavicle, give the BIP R Clavicle the BIP R UpperArm as child (don't copy & paste! Use the BIP R UpperArm that is already present) and 'unchild' the BIP R UpperArm from the BIP Neck. After this is done, the NifSkope should look like this:
Spoiler :

attachment.php


Next point is to make the new bone a target for the .kf files. This way this file can alter the bone's position during the animation. To do so, just click on the NiMultiTargetTransformController (entry 5 in the picture above) and open the Extra Targets List at the bottom of the Block Details. Here you should see all the bones of the rifleman unit, except for the newly made BIP R Clavicle. Change the Num Extra Targets to 23, refresh the Extra Targets and put the number of the BIP R Clavicle in the new entry that is called 'none'.

Believe it or not, now the pikeman animation will work with no problems for the rifleman unit. It might look a bit odd in NifSkope, but looks fine in the game. Everything seems well now, but there is still a problem. Similar to the visibility of the extra items or weapons the position of the bones will always be locked to the last change that was made to it. This means for the rifleman, that at the time that a normal rifleman animation is played on it, the right arm will twisted in the wrong direction, because the rifleman animations don't have an entry for the BIP R Clavicle. To make the rifleman be able to use both sets of animation, the rifleman animations will have to be modified. I will explain what to do for the rifleman_md_ranged_idle.kf, but in fact these changes will have to be done for all animations that might have a pikeman animation before them.

After opening the rifleman_md_ranged_idle.kf with NifSkope search in the NiControllerSequence for a node that is called NiTransformInterpolator that has a childnode called NiTransformData. This Node stores the change of the position, rotation and scale of a bone during the animation. Because the BIP R Clavicle we added to the rifleman has to be resetted to zero for the rifleman animations, we need a new NiTransformInterpolator that does exactly this. So, copy branch the NiTransformInterpolator and paste it at the bottom of the node list. Click on the NiTransformData of that new node change the number of Num Rotation Keys and Num Keys in Translations to 2. Refresh Quaterion Keys and Keys in Translations. Now open the 2 Quaterion Keys in Quaterion Keys and the 2 Keys in Keys and change the Time of the first Key to 0 and the time of the second Key to a high number, 40 worked fine for me. Then change all entries of the Value in all Keys to zero. The result should look like this:
Spoiler :

attachment.php


This it the finished NiTransformInterpolator that we need for the BIP R Clavicle in the rifleman animation. Now all that is left is to add the BIP R Clavicle to the animation an give it this NiTransformInterpolator. To do so click on the NiControllerSequence (entry 1) and open Controlled Blocks in the Block Details. Here can be seen all the bones that are controlled by the animation sequence. Add one to the Num Controlled Blocks, refresh the Controlled Blocks and go to the new entry called <empty>. Open this entry. In the now open list change the Interpolator entry to the number of the newly created NiTransformInterpolator, the String Palette to the number of the NiStringPalette in the node list of the NiControllerSequence, the Node Name Offset to BIP R Clavicle and the Controller Type Offset to NiTransformController. The result should look like this:
Spoiler :

attachment.php


Save the file and that's it. If everything went well, the animation should now work in the same way it used to before the addition of the BIP R Clavicle bone to the rifleman unit.
I hope this works for you, and thanks for the attention. :)

Edit:
After reading this very helpful tutorial: http://forums.civfanatics.com/showthread.php?t=271331 I learned that it is also very important to set the flag of the added node in the units nif to 6. Otherwise you might run into problems.
 

Attachments

  • AddBoneTutorial01.jpg
    AddBoneTutorial01.jpg
    137 KB · Views: 457
  • AddBoneTutorial02.jpg
    AddBoneTutorial02.jpg
    143.4 KB · Views: 413
  • AddBoneTutorial03.jpg
    AddBoneTutorial03.jpg
    158.3 KB · Views: 517
Okay, I'm running into a few problems. What I'm trying to do is give this Warrior Monk model a shotgun from the NextWar_Cyborg, and use the Cyborg's animations. The resulting unit is to be called the Padre. I have done the following:
  • Added the Cyborg's box2 tree (which contains the shotgun) to the Padre's right hand node.
  • Added the Cyborg's masktube tree to the Padre's head node. Doesn't do anything for the Padre, but it means all the Cyborg's bones are in place.
  • Moved the Padre's L Upper Arm bone from his L Clavicle to his Spine1, which is where the Cyborg's left arm is attached for some reason. This puts his arm bones in the right place when running Cyborg animations.
  • The Padre has a BIP skeleton and the Cyborg Bip1, so I changed all the Cyborg's .kf files using "String Palette -> Replace Entries" to make the Bip1s BIPs. Saved them as Padre_[animation].kf in my Padre art folder.
  • Decoded the Cyborg's .kfm, changed all its references to Padre_[animation].kf, and reencoded it as Padre.kfm in my Padre art folder.
  • Changed the unit artdefines to Padre.nif and Padre.kfm.
When I try to add an animation in NifSkope, there is no error message. Here's what I see:

attachment.php


As you can see, the skeleton animates, and so do the Padre's weapons (both the shotgun and the sword I haven't yet removed). But the Padre himself does not appear to.

And when I load the unit in-game, neither the Padre nor the weapons are animated; they're just stuck in "Cristo Redentor" pose.

I'd suspect this means that the Padre model is not attached to his skeleton properly. But curiously, when I look at a vanilla Warrior Priest in NifSkope and animate it with a melee unit's .kf (the Charlemagne_LightSwordsman's), I see the same skeleton-only phenomenon:

attachment.php


And yet when I load this unit in-game, the whole thing looks and moves perfectly.

So does anyone have any idea what's going wrong, and how I can fix it?
 

Attachments

  • Padre in NifSkope.jpg
    Padre in NifSkope.jpg
    13.9 KB · Views: 458
  • Melee Padre in NifSkope.jpg
    Melee Padre in NifSkope.jpg
    15.4 KB · Views: 376
Someone please can put the link to this program to make units and civilizations?I realy want try use this.Thanks guys !!!!!
 
So does anyone have any idea what's going wrong, and how I can fix it?

Sorry, I somehow missed that question. Do you have solved the problem? If not, can you upload the unit, I could try to take a look at it.
 
How do you get the color to show in NIFskope?
 
Back
Top Bottom