1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Getting Civ 4 Units into Civ 5 - Full Conversion

Discussion in 'Civ5 - Modding Tutorials & Reference' started by Deliverator, Jan 20, 2014.

  1. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    Has anyone ever made a unit and no matter what you put into NumMembers only 1 unit appears on screen?
     
  2. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    693
    Location:
    Wherever the winds take me
    If what you are describing is using mixed models, then yes it has happened when using certain models with custom animations that were originally done improperly. See this thread.
     
  3. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    Thanks Nomad but I am not using mixed models. It was first attempt at custom animations so I probably did not make them properly. The animations however work fine in game but I have noticed the unit is not centralized on the tile.

    I made the unit probably a year ago now, before Deliverator found a way to work with Civ5 animations so if I get some time I guess I will try the new method.
     
  4. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    693
    Location:
    Wherever the winds take me
    The actual problem was not with mixed models per se, but with custom animations that were converted to .gr2 improperly. For example, the scorpion unit that I converted when I was still a noob at modeling was done improperly because I was importing the .fbx into NexusBuddy and then doing a .br2 overwrite before saving it as an animation. I didn't realize at the time that animations don't retain mesh data so by doing the .br2 overwrite I was adding mesh data to an animation file. This, among other problems, creates an issue when using multiple models for unit NumMember formations. If you happen to be using customs that were done this way or with an older method you might encounter this problem. Not sure if it has anything to do with the issue that you are having but it is presented here just in case.
     
  5. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    Thanks Nomad I appreciate all your help and did not mean to sound as if you had not helped me. On the contrary that thread gave me some ideas and I was able to get the unit centered on the tile (did not get the bone names right in the ftsxml file). However there is still only one unit.:(

    I am pretty sure although not with 100% certainty that I did not overwrite the animations with .br2 mesh.

    It also got me thinking, I wonder if the root bone name has anything to do with it. For instance if the AnimGraph files are looking for a certain root bone name.
     
  6. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    693
    Location:
    Wherever the winds take me
    That may be possible; I am presently confounded with custom animations that do not display effects properly. I converted a troll unit from Atlantica Online and tried to add catapult rock throwing effects to it but it doesn't display at all. Civitar used a CiV unit as a troll rig doing this effect and it works beautifully. I copied his .fxsxml and.ftsxml files virtually verbatim for my unit and even matched the bone name in my troll unit and animations to that of the actual catapult and it still won't work. The root bone is the only other thing I can think of that might cause this problem. So, I am not certain what is going on with your issue but you may be on the right track thinking that the root bone is somehow the culprit. If I ever figure out what is causing my issue I will let you know.

    If you want, send me your files and I will give them a second set of eyes. I can't guarantee I will find anything (because custom animations are very unpredictable and very likely the source of your problem) but I have mitigated a lot of crazy pitfalls when tweaking custom animations, so it couldn't hurt.
     
  7. allypower

    allypower Warlord

    Joined:
    May 26, 2010
    Messages:
    161
    Hello, I've just came back to Civfanatics after a 6 years break from the game :D. I have been reading these tutorial threads but I still have a really difficult converting my custom graphics to .gr2. In fact blender would give me an error when I try to convert my model to .nb2

    I think the sole reason is my models do not have a skeleton nor rigged at all. There is no vertex group but I have not found a tutorial to be able to do so. I have read though that skeleton isn't necessary because I would use a civ 5 animation anyway??? So how does it work. I can upload my model here so you can see what's wrong with it.

    Please help I really want to get into the civ 5 modding.
     
  8. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    693
    Location:
    Wherever the winds take me
    OK, it sounds like you want to do a simple rig to an existing CiV unit. In that case, you should follow Wolfdog's tutorial (Option A) referenced in the original post. You will also need a CiV unit template to rig your mesh; see line 4. of Wolfdog's tutorial on how to either make one or download one that is already prepped.

    If you are not importing a .nif you can disregard the import process and copy and paste to/from buffer into the template rig you wish to use. I usually import from the.obj format which keeps material data but no vertex groups, but as long as you have the mesh in Blender already then it really doesn't matter.

    If you are getting errors exporting to .br2 the usual cause is that some (or all) of your mesh is not assigned to vertex groups. Mesh is assigned to vertex groups so that they can deform to the appropriate bone(s) when animated (which is also why you are rigging it to an existing CiV unit's bones). Usually the best way to do this is with Ekmek's tutorial on bone weight copying. This will guarantee that all of the mesh data is assigned to at least one vertex group, but you may still have to tweak it a bit if it doesn't animate properly since this process is not perfect.

    This should get you started; hope this helps and welcome back. :)
     
  9. allypower

    allypower Warlord

    Joined:
    May 26, 2010
    Messages:
    161
    Thanks for the quick response. My model is already in .blend file and already have a texture. Do I start from step D. of the Wolfdog tutorial?

    Also does the rotation of my model matter? I think Num 1 is the front of my model but it might not be the same as the standard for civ 5.

    Edit: nice. I'm starting to understand the idea. I will work on it for the next few hours :D
     
  10. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    693
    Location:
    Wherever the winds take me
    This may sound tricky, but start at the "Stage 2 – Apply mesh to Civ 5 template" part of Wolfdog's tutorial and do steps 1, 2, and the first part of 3. BEFORE you use Ctrl-J to join the objects, however, use Ekmek's tutorial to bone weight copy the mesh from your unit to match that of the mesh in the existing unit (paying close attention to line the two meshes up as closely as possible). Then, finish Wolfdog's tutorial; you shouldn't need to worry about resizing, aligning, etc. because that will be done in Ekmek's tutorial before the bone weight copy.

    Keep the rotation the same as the unit to which you will be rigging, which is almost always -Y forward, Z up (i.e., NumLock 1 displaying the model front and upright in Blender as you apparently already have it).

    If you are still having trouble, just follow the tutorials a couple of times to get the feel for the different concepts involved. Mistakes will be made; it's part of the learning process.... :D
     
  11. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    Thanks Nomad, I will try renaming the root bone and see how that goes. If that does not work I will post my files and maybe you can see something I missed.
     
  12. allypower

    allypower Warlord

    Joined:
    May 26, 2010
    Messages:
    161
    Thank you so much, this has, i have to say been more helpful and I have a breakthrough that I wouldn't even imagined I could thanks to your help. Interesting I could use a tank??? skeleton for a humanoid shape unit?? But hey that's cool too. Here's a picture :D
     

    Attached Files:

  13. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,671
    Location:
    London, UK
    Cool! Once you get your hear around rigging/vertex groups you are pretty much away with 3d modelling. :D
     
  14. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    Hey Nomad it worked. I renamed the root bone to the same as the CiV chariot archer that I was using as the template and multiple units. Still have to tweak the spacing but apart from that. Thanks for your help.:)
     

    Attached Files:

    • RHA.png
      RHA.png
      File size:
      489.8 KB
      Views:
      209
  15. Nomad or What

    Nomad or What Wayfarer Supporter

    Joined:
    Nov 25, 2012
    Messages:
    693
    Location:
    Wherever the winds take me
    Whoa, brilliant! Now I am inspired to see if it will work for this pesky Troll....
     
  16. KingErikII

    KingErikII Chieftain

    Joined:
    Apr 28, 2015
    Messages:
    52
    Gender:
    Male
    Location:
    Norway
    I know this is an old thread, but is this tutorial still possible to follow?
    I tried to do it, but I do not see where I can open the Blender NIF Scripts (Installed all related programs on my laptop, since I want to keep Blender 2.79 on my desktop).
     
  17. KingErikII

    KingErikII Chieftain

    Joined:
    Apr 28, 2015
    Messages:
    52
    Gender:
    Male
    Location:
    Norway
    No options show up if I try to import/export something. Maybe the current versions of the needed plugins are too new for Blender 2.49.

    upload_2020-8-22_18-20-6.png
     

    Attached Files:

  18. Wolfdog

    Wolfdog Unit Butcher

    Joined:
    Jun 29, 2012
    Messages:
    659
    Location:
    Australia
    You need to download the nif import/export scripts.
    With 2.49b, the scripts need to be put here:
    C:\Program Files\Blender Foundation\Blender.blender\scripts
     
  19. KingErikII

    KingErikII Chieftain

    Joined:
    Apr 28, 2015
    Messages:
    52
    Gender:
    Male
    Location:
    Norway
    I got the scripts to load properly, but I have another issue. When I try to import the .nif file with the recommended settings shown in this tutorial, I get this error:
    upload_2020-8-29_17-31-9.png


    This is what the console contains:
    Code:
    Blender NIF Scripts 2.5.9 (running on Blender 249, PyFFI 2.1.11)
    pyffi.toaster:INFO:--- fix_mergeskeletonroots ---
    pyffi.toaster:INFO:  ~~~ NiNode [Scene Root] ~~~
    pyffi.toaster:INFO:--- fix_sendgeometriestobindposition ---
    pyffi.toaster:INFO:  ~~~ NiNode [Scene Root] ~~~
    pyffi.toaster:INFO:    sending geometries to bind position
    pyffi.toaster:INFO:--- fix_senddetachedgeometriestonodeposition ---
    pyffi.toaster:INFO:  ~~~ NiNode [Scene Root] ~~~
    pyffi.toaster:INFO:    sending detached geometries to node position
    pyffi.nif.ninode:INFO:moving Editable Mesh@#0 to node position
    pyffi.nif.ninode:INFO:moving Editable Mesh@#1 to node position
    pyffi.toaster:INFO:--- fix_scale ---
    pyffi.toaster:INFO:  scaling by factor 0.200000
    pyffi.toaster:INFO:  ~~~ NiNode [Scene Root] ~~~
    pyffi.toaster:INFO:    ~~~ NiVertexColorProperty [] ~~~
    pyffi.toaster:INFO:    ~~~ NiZBufferProperty [] ~~~
    pyffi.toaster:INFO:    ~~~ NiTextureEffect [Environment Light] ~~~
    pyffi.toaster:INFO:      ~~~ NiSourceTexture [] ~~~
    pyffi.toaster:INFO:    ~~~ NiNode [MD] ~~~
    pyffi.toaster:INFO:      ~~~ NiStringExtraData [UserPropBuffer] ~~~
    pyffi.toaster:INFO:      ~~~ NiMultiTargetTransformController [] ~~~
    pyffi.toaster:INFO:        ~~~ NiTransformController [] ~~~
    pyffi.toaster:INFO:      ~~~ NiNode [MD NonAccum] ~~~
    pyffi.toaster:INFO:        ~~~ NiNode [BIP] ~~~
    pyffi.toaster:INFO:          ~~~ NiNode [BIP Footsteps] ~~~
    pyffi.toaster:INFO:          ~~~ NiNode [BIP Pelvis] ~~~
    pyffi.toaster:INFO:            ~~~ NiNode [BIP L Thigh] ~~~
    pyffi.toaster:INFO:              ~~~ NiNode [BIP L Calf] ~~~
    pyffi.toaster:INFO:                ~~~ NiNode [BIP L Foot] ~~~
    pyffi.toaster:INFO:            ~~~ NiNode [BIP R Thigh] ~~~
    pyffi.toaster:INFO:              ~~~ NiNode [BIP R Calf] ~~~
    pyffi.toaster:INFO:                ~~~ NiNode [BIP R Foot] ~~~
    pyffi.toaster:INFO:            ~~~ NiNode [BIP Spine] ~~~
    pyffi.toaster:INFO:              ~~~ NiNode [BIP Spine1] ~~~
    pyffi.toaster:INFO:                ~~~ NiNode [BIP Neck] ~~~
    pyffi.toaster:INFO:                  ~~~ NiNode [BIP Head] ~~~
    pyffi.toaster:INFO:                  ~~~ NiNode [BIP L Clavicle] ~~~
    pyffi.toaster:INFO:                    ~~~ NiNode [BIP L UpperArm] ~~~
    pyffi.toaster:INFO:                      ~~~ NiNode [BIP L Forearm] ~~~
    pyffi.toaster:INFO:                        ~~~ NiNode [BIP L Hand] ~~~
    pyffi.toaster:INFO:                  ~~~ NiNode [BIP R Clavicle] ~~~
    pyffi.toaster:INFO:                    ~~~ NiNode [BIP R UpperArm] ~~~
    pyffi.toaster:INFO:                      ~~~ NiNode [BIP R Forearm] ~~~
    pyffi.toaster:INFO:                        ~~~ NiNode [BIP R Hand] ~~~
    pyffi.toaster:INFO:                          ~~~ NiNode [Maceman_Mace Handle] ~~~
    pyffi.toaster:INFO:                            ~~~ NiNode [Bone_Mace Chain_001] ~~~
    pyffi.toaster:INFO:                              ~~~ NiNode [Bone_Mace Chain_002] ~~~
    pyffi.toaster:INFO:                                ~~~ NiNode [Bone_Mace Chain_003] ~~~
    pyffi.toaster:INFO:                                  ~~~ NiNode [Bone_Mace Chain_004] ~~~
    pyffi.toaster:INFO:                                    ~~~ NiNode [Bone_Mace Chain_Ball] ~~~
    pyffi.toaster:INFO:                            ~~~ NiTriShape [Editable Mesh] ~~~
    pyffi.toaster:INFO:                              ~~~ NiMaterialProperty [maceman_128_NotSkinned_TeamColor] ~~~
    pyffi.toaster:INFO:                                ~~~ NiAlphaController [] ~~~
    pyffi.toaster:INFO:                              ~~~ NiAlphaProperty [] ~~~
    pyffi.toaster:INFO:                              ~~~ NiTexturingProperty [] ~~~
    pyffi.toaster:INFO:                                ~~~ NiSourceTexture [] ~~~
    pyffi.toaster:INFO:                                ~~~ NiSourceTexture [] ~~~
    pyffi.toaster:INFO:                                ~~~ NiSourceTexture [] ~~~
    pyffi.toaster:INFO:                              ~~~ NiTriShapeData [] ~~~
    pyffi.toaster:INFO:        ~~~ NiNode [SOUND] ~~~
    pyffi.toaster:INFO:          ~~~ NiStringExtraData [UserPropBuffer] ~~~
    pyffi.toaster:INFO:        ~~~ NiNode [Maceman_Ball and Chain] ~~~
    pyffi.toaster:INFO:          ~~~ NiTriShape [Editable Mesh@#0] ~~~
    pyffi.toaster:INFO:            ~~~ NiMaterialProperty [maceman_128_Skinned_NoTeamColor] ~~~
    pyffi.toaster:INFO:              ~~~ NiAlphaController [] ~~~
    pyffi.toaster:INFO:            ~~~ NiTexturingProperty [] ~~~
    pyffi.toaster:INFO:            ~~~ NiTriShapeData [] ~~~
    pyffi.toaster:INFO:            ~~~ NiSkinInstance [] ~~~
    pyffi.toaster:INFO:              ~~~ NiSkinData [] ~~~
    pyffi.toaster:INFO:              ~~~ NiSkinPartition [] ~~~
    pyffi.toaster:INFO:        ~~~ NiNode [EFFECTS] ~~~
    pyffi.toaster:INFO:          ~~~ NiStringExtraData [UserPropBuffer] ~~~
    pyffi.toaster:INFO:        ~~~ NiNode [LeftFoot] ~~~
    pyffi.toaster:INFO:          ~~~ NiStringExtraData [UserPropBuffer] ~~~
    pyffi.toaster:INFO:        ~~~ NiNode [RightFoot] ~~~
    pyffi.toaster:INFO:          ~~~ NiStringExtraData [UserPropBuffer] ~~~
    pyffi.toaster:INFO:        ~~~ NiNode [Maceman_body] ~~~
    pyffi.toaster:INFO:          ~~~ NiTriShape [Editable Mesh@#1] ~~~
    pyffi.toaster:INFO:            ~~~ NiMaterialProperty [maceman_128_Skinned_TeamColor] ~~~
    pyffi.toaster:INFO:              ~~~ NiAlphaController [] ~~~
    pyffi.toaster:INFO:            ~~~ NiTriShapeData [] ~~~
    pyffi.toaster:INFO:            ~~~ NiSkinInstance [] ~~~
    pyffi.toaster:INFO:              ~~~ NiSkinData [] ~~~
    pyffi.toaster:INFO:              ~~~ NiSkinPartition [] ~~~
    niftools.blender.import:WARNING:Texture 'TeamColor.bmp' not found or not supported and no alternate available
    niftools.blender.import:WARNING:Texture 'Environment_FX_BlueMetal.dds' not found or not supported and no alternate available
    Traceback (most recent call last):
      File "C:\Program Files\Blender\.blender\scripts\bpymodules\nif_common.py", line 1235, in gui_button_event
        self.gui_exit()
      File "C:\Program Files\Blender\.blender\scripts\bpymodules\nif_common.py", line 1598, in gui_exit
        self.callback(**self.config)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 3771, in config_callback
        importer = NifImport(**config)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 274, in __init__
        self.import_root(root)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 356, in import_root
        b_obj = self.import_branch(root_block)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 551, in import_branch
        n_child, b_armature=b_armature, n_armature=n_armature)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 447, in import_branch
        b_obj = self.import_mesh(niBlock)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 2129, in import_mesh
        bsShaderProperty, extra_datas)
      File "C:\Program Files\Blender\.blender\scripts\import\import_nif.py", line 1840, in import_material
        mbase_texture.varfac = alpha
    ValueError: expected int argument in [0.000000,1.000000]


    Edit: This error still appears after I remove the warnings related to TeamColor.bmp and Environment_FX_BlueMetal.dds.

    Edit 2: It seems the issue is caused by the Civ 4 default Maceman. I can import a unit like the default SAM Infantry just fine.

    Edit 3: Funnily enough, the Maceman skeleton appears, but not the mesh:
    upload_2020-8-29_19-32-48.png

    I am unsure how to fix this.
     
    Last edited: Aug 29, 2020
  20. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,671
    Location:
    London, UK
    @KingErikII Try either deleting the offending texture nodes in the NIF file or disabling the options to import materials. You really only need the UV map data imported rather than Materials and Textures.
     

Share This Page