Using Existing Unit Effects to Create Custom Units

Um, this is embarrassing but please forget my previous post. It turns out that I made a syntax error in my sql, causing the relevant ArtDefine_UnitMemberCombats and _UnitMemberCombatWeapons to not be inserted. :blush: Ahem.

I never saw your previous post before you edited it out.... :)

What matters is that they work correctly; feel free to show off your work here and let us know how you did it!
 
I'm pretty sure we've all made silly mistakes like that. I can't count the number of times I've forgotten to turn on the Unit Reload system. <.<;;

I'm curious to see what you were working on too!
 
I never saw your previous post before you edited it out.... :)

What matters is that they work correctly; feel free to show off your work here and let us know how you did it!
I've now put the mod in question on CivFanatics. The thread for it is over here. It's a bit bothersome to screenshot in mid-attack, but this picture should give you a quick idea of what it does:
Spoiler :

Copying the game's base .fxsxml and .ftsxml and replacing the bones with ones I actually have, I've reused Civ5 effects for as many of the units in that mod as I could. One tip I can give for if your animations stutter is to look at the timing of the effect compared to the length and timing of your animations. If you run out of animation before one of your effects is scheduled to take place, it will (in the best case scenario) keep running the animation until the appointed time. So if you have imported short animations, you'll want to adjust the effect timings to fit. If the effects include a sound effect that lasts longer than the animation (this can happen with Great People) there's not much you can do.

I was asking for help earlier because I had some trouble getting the redone archers to work, but I've now successfully redone them at the proper size, making the arrows the proper size as well. If you're importing CivIV units, the way to get it right the first time is to use the Scale Correction value when importing the .nif. As a rule of thumb, assuming the unit is properly sized in CivIV, you'll want this value to be 10 times the Scale value of the corresponding Civ5 unit in ArtDefines_UnitMemberInfos. Then use the base Scale value as your own Scale value for the new unit, thereby keeping the effects at the appropriate scale. (Example: regular Civ5 Archers have Scale 0.14000... in the ArtDefines_UnitMemberInfos table, so you'll want to import custom archers with Scale Correction 1.4 and give their entry Scale 0.14 in the database.)
 
I've now put the mod in question on CivFanatics. The thread for it is over here. It's a bit bothersome to screenshot in mid-attack, but this picture should give you a quick idea of what it does:
Spoiler :

Copying the game's base .fxsxml and .ftsxml and replacing the bones with ones I actually have, I've reused Civ5 effects for as many of the units in that mod as I could. One tip I can give for if your animations stutter is to look at the timing of the effect compared to the length and timing of your animations. If you run out of animation before one of your effects is scheduled to take place, it will (in the best case scenario) keep running the animation until the appointed time. So if you have imported short animations, you'll want to adjust the effect timings to fit. If the effects include a sound effect that lasts longer than the animation (this can happen with Great People) there's not much you can do.

I was asking for help earlier because I had some trouble getting the redone archers to work, but I've now successfully redone them at the proper size, making the arrows the proper size as well. If you're importing CivIV units, the way to get it right the first time is to use the Scale Correction value when importing the .nif. As a rule of thumb, assuming the unit is properly sized in CivIV, you'll want this value to be 10 times the Scale value of the corresponding Civ5 unit in ArtDefines_UnitMemberInfos. Then use the base Scale value as your own Scale value for the new unit, thereby keeping the effects at the appropriate scale. (Example: regular Civ5 Archers have Scale 0.14000... in the ArtDefines_UnitMemberInfos table, so you'll want to import custom archers with Scale Correction 1.4 and give their entry Scale 0.14 in the database.)

Brilliant! I never even thought about using Scale Correction when importing the .nif; will definitely be giving that a try. Up until now I was completely resizing everything in Blender before exporting. Good grief what a pain that was!

Totally agree with you about matching the timings; I spend much of my time tweaking animations before exporting them to try to match CiV effects timings. For those that don't know how to animate in Blender the only alternative is to reduce the effect timing to match the animation.
 
Copying the game's base .fxsxml and .ftsxml and replacing the bones with ones I actually have, I've reused Civ5 effects for as many of the units in that mod as I could. One tip I can give for if your animations stutter is to look at the timing of the effect compared to the length and timing of your animations. If you run out of animation before one of your effects is scheduled to take place, it will (in the best case scenario) keep running the animation until the appointed time. So if you have imported short animations, you'll want to adjust the effect timings to fit. If the effects include a sound effect that lasts longer than the animation (this can happen with Great People) there's not much you can do.

That's actually quite interesting. So as long as all the effects and sounds end before the animation does, it won't repeat?

It also reminded me that I didn't post an update on whether altering the timings made the Yoko model animate correctly.

I at least got her to fire the railgun round at the right time for the Musketman's firing animation, but often she would sit around going through the motions until eventually she fired it - and in many cases she would fire multiple rounds at once, despite me (as I said before) removing three of the GDR's railgun animations.

I don't know what the Transfer is supposed to do but I set its timing for one of the Musketman's original effects. Would that be causing her to "go through the motions" somehow? Or is it simply the issue that Harald up there observed? I don't really have time right now to check if using a different shorter sound might help (not that I thought the sound I was using was that long...).
 
That's actually quite interesting. So as long as all the effects and sounds end before the animation does, it won't repeat?
Yeah, basically. Though sometimes ranged units just attack multiple times, especially when bombarding cities and when a heavily damaged ranged unit (with just one model left, say) still deals heavy damage to the enemy (picking off multiple models one attack at a time).

And now for just a bit of showing off:


Trebuchet effects work out really nicely when the size is fixed.
 
Yeah, basically. Though sometimes ranged units just attack multiple times, especially when bombarding cities and when a heavily damaged ranged unit (with just one model left, say) still deals heavy damage to the enemy (picking off multiple models one attack at a time).
Oh, this was the case too, since I generally tested against weak barbarian units and my test unit only used one member. It was just that often after the first shot, the model animation would play without the railgun effect, and then I'd eventually get a load of them being fired from the one gun at once.
 
Yeah, basically. Though sometimes ranged units just attack multiple times, especially when bombarding cities and when a heavily damaged ranged unit (with just one model left, say) still deals heavy damage to the enemy (picking off multiple models one attack at a time).

And now for just a bit of showing off:

Not a fan of ponies generally, but those are some very nice animations!

I actually have a unit that I need help with animations on, would you be willing to help me?
 
Not a fan of ponies generally, but those are some very nice animations!

I actually have a unit that I need help with animations on, would you be willing to help me?

Are you talking about the torch-bearing unit from a while back? I also would really like to put an end to the scaling issue. Hopefully this is the solution we have been waiting for.... :please:
 
Not a fan of ponies generally, but those are some very nice animations!

I actually have a unit that I need help with animations on, would you be willing to help me?
Wait, are you talking about animations or effects? If you mean effects then I could take a look, but I wonder what I would be doing that you couldn't fiddle around with yourself. If you do mean the animations then you'd have to ask clanky4. He animated the ponies for CivIV and I converted them.
 
Not sure if Nomad or What is around to answer a question, but... how hard/easy would it be to rig a civilian unit's animations to a combat unit? I've been having some success lately with rigging some fantasy models to the Missionary, which works fine for civilian unit replacements... but given that the Missionary has a nice "open the book and do stuff" build animation, I was wondering if it'd be possible to use that for an attack animation. However, the Missionary doesn't have the various attack/combat event codes... so would these have to be added in manually?

Alternatively, could I use the fxsxml file for a combat unit, and replace the animations with Missionary animations to work with the model?
 
The former. The ec="" fields in the .fxsxml are a comma-separated list. You can put any event code in the list, and it'll play it in the appropriate place if the unit is capable of taking the action. You want to make sure it's a ranged attack and not a melee attack though, otherwise I suspect he'll float along the ground toward the enemy whilst opening his book...
 
If you're replacing a base file, it's VFS=true, not UpdateDatabase. SQL won't help, because XML and SQL accomplish the same thing, i.e., updating the SQLite database (XML has to be parsed and converted into SQL by the game).

Depending on when the file is loaded, it may not be possible without a Reload Effects checkbox that Firaxis didn't provide. (And before you ask, the one DLL we have access to isn't the right one to fix this.)

If that's the case, overwriting an existing file or making a fake DLC is necessary, both requiring the user to copy files by hand (or at least to run a batch file or something).

Well the way I named the effects XML file wouldn't have replaced the effects base files, although I tried the VFS=true anyway, and it's still not working. I mainly brought up SQL because if we can get it to work, SQL would most likely be a more elegant solution, especially if all you want to do is copy an existing effect and change the scale.



Right, I was starting to suspect that we would need a 'Reload Effects' checkbox or a fake DLC as well...

So I am getting more and more frustrated with the limitations of being able to do effect transformations. Skajaquada's WH40K teaser mod required overwriting or adding additional lines to the civ5artdefines_viseffects.xml and that isn't an acceptable/stable solution for me. So in order to push the envelope of creating effects I think that a workaround needs to be devised if possible. Nutty and Hangman, you have both mentioned creating a fake DLC. How feasible is this? Is there already a tutorial? If either of you have an opportunity, please shed some light on how to go about doing this. Thanks!
 
It's actually pretty easy. You just need to make a .Civ5Pkg xml file. Look at the ones for the DLC and Expansions.

Enhanced UI is a fake DLC. MPMM is really just a fake-DLC maker tool.
 
It's actually pretty easy. You just need to make a .Civ5Pkg xml file. Look at the ones for the DLC and Expansions.

Enhanced UI is a fake DLC. MPMM is really just a fake-DLC maker tool.

That is an improvement, since you are not appending or overwriting existing CiV files, but you will effectively have to manually install it, right? I suppose that the likelihood of it ever creating any conflicts with the base game or any other mods is rare in this case because for me it would basically be a bunch of newly-defined effect transformations.

Maybe I should begin a thread that creates a fake DLC specifically for fantasy effect transformations? That way, any new effects devised by others could be appended occasionally to generate a latest iteration for all fantasy mods out there that want to use any of my (or anybody else's) effects. I could probably begin by adding in all of Skaja's unique transformations so that anybody wanting those units could install the DLC. All mods requiring it could point to the download location so that they could always download the latest version. Any advice?
 
Yes, it has to be copied into your Assets folder, though an idiot-proof installer could be made. (Seems overkill for 2 files, but perhaps it could also be a sneaky way of enabling logging for prospective beta testers, while we're at it.) [...and a smaller minimum zoom level]

If you're going to make a community viseffects file (a great idea, and I'm excited to see the effects you come up with!), do note that danrell has some additions for his rocket launchers:
Spoiler :
Code:
  <!--  _______ Katyusha Firing Smoke  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_LAUNCH_SMOKE</Name>
    <Transform>
      <Translation x="0.0" y="9.0" z="0.0"/>
      <Rotation x="-90.0" y="0.0" z="0.0"/>
      <Scale>0.35</Scale>
    </Transform>
    <fBaseDuration>0.4</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_ROCKET_LAUNCH_SMOKE_01</Name>
      </ParticleEffect>
    </ParticleEffects>
  </VisEffectArtInfo>
  <!--  _______ Katyusha Firing Smoke Front  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_LAUNCH_SMOKE_FRONT</Name>
    <Transform>
      <Translation x="0.0" y="-5.0" z="0.0"/>
      <Rotation x="90.0" y="0.0" z="0.0"/>
      <Scale>0.375</Scale>
    </Transform>
    <fBaseDuration>0.4</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_ROCKET_LAUNCH_SMOKE_FRONT</Name>
      </ParticleEffect>
    </ParticleEffects>
  </VisEffectArtInfo>
  <!--  _______ Katyusha Rocket No Trail  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_ROCKET_NO_TRAIL</Name>
    <Transform>
      <Translation x="0.0" y="10.0" z="0.0"/>
      <Rotation x="0.0" y="0.0" z="-90.0"/>
      <Scale>0.75</Scale>
    </Transform>
    <fBaseDuration>0.001</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ModelEffects>
      <ModelEffect>
        <Name>ART_DEF_MEFFECT_PROJ_ROCKET_ARTILLERY</Name>
      </ModelEffect>
    </ModelEffects>
  </VisEffectArtInfo>
  <!--  _______ Katyusha Rocket Projectile  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_ROCKET_PROJECTILE</Name>
    <Transform>
      <Translation x="0.0" y="10.0" z="0.0"/>
      <Rotation x="0.0" y="0.0" z="-90.0"/>
      <Scale>0.75</Scale>
    </Transform>
    <fBaseDuration>0.001</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_TRAIL_ROCKET_PROJ</Name>
      </ParticleEffect>
    </ParticleEffects>
    <ModelEffects>
      <ModelEffect>
        <Name>ART_DEF_MEFFECT_PROJ_ROCKET_ARTILLERY</Name>
        <!--<Animation>1000</Animation>-->
      </ModelEffect>
    </ModelEffects>
    <ChildEffects>
      <ChildEffect trigger="ProjectileEnd">
        <Name>ART_DEF_VEFFECT_TANK_IMPACT_$(TERRAIN)</Name>
      </ChildEffect>
    </ChildEffects>
  </VisEffectArtInfo>
  <!--  _______ Katyusha Rocket Projectile _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_LG_PROJ</Name>
    <Transform>
      <Translation x="0.0" y="10.0" z="0.0"/>
      <Rotation x="0.0" y="0.0" z="-90.0"/>
      <Scale>0.75</Scale>
    </Transform>
    <fBaseDuration>0.1</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_TRAIL_ROCKET_PROJ</Name>
      </ParticleEffect>
    </ParticleEffects>
    <ModelEffects>
      <ModelEffect>
        <Name>ART_DEF_MEFFECT_PROJ_ROCKET_ARTILLERY</Name>
        <!--<Animation>1000</Animation>-->
      </ModelEffect>
    </ModelEffects>
    <ChildEffects>
      <ChildEffect trigger="ProjectileEnd">
        <Name>ART_DEF_VEFFECT_ROCKET_ARTILLERY_IMPACT_$(TERRAIN)</Name>
      </ChildEffect>
    </ChildEffects>
  </VisEffectArtInfo>

To complicate matters, a second version is necessary if R.E.D. scaling has been applied, with a couple of changes to two of the effects:
Spoiler :
Code:
  <!--  _______ Archer Arrow From Quiver to Hand to Bow  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_PROJ_ARROW_ARCHER_HAND</Name>
    <Transform>
      <Translation x="0.0" y="-5.0" z="0.0"/> <!-- <Translation x="0.0" y="-8.0" z="0.0"/> -->
      <Rotation x="0.0" y="0.0" z="-90.0"/>
      <Scale>1.2</Scale> <!-- <Scale>1.3</Scale> -->
    </Transform>
and
Code:
  <!--  _______ Bomber Propeller Blades _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_BOMBER_BLADES_01</Name>
    <Transform>
      <Translation x="0.0" y="-2.2" z="0.0"/> <!-- <Translation x="0.0" y="-0.3" z="0.0"/> -->
      <Rotation x="0.0" y="90.0" z="0.0"/>
      <Scale>0.50</Scale> <!-- <Scale>0.35</Scale> -->
    </Transform>
 
Yes, it has to be copied into your Assets folder, though an idiot-proof installer could be made. (Seems overkill for 2 files, but perhaps it could also be a sneaky way of enabling logging for prospective beta testers, while we're at it.) [...and a smaller minimum zoom level]

If you're going to make a community viseffects file (a great idea, and I'm excited to see the effects you come up with!), do note that danrell has some additions for his rocket launchers:
Spoiler :
Code:
  <!--  _______ Katyusha Firing Smoke  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_LAUNCH_SMOKE</Name>
    <Transform>
      <Translation x="0.0" y="9.0" z="0.0"/>
      <Rotation x="-90.0" y="0.0" z="0.0"/>
      <Scale>0.35</Scale>
    </Transform>
    <fBaseDuration>0.4</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_ROCKET_LAUNCH_SMOKE_01</Name>
      </ParticleEffect>
    </ParticleEffects>
  </VisEffectArtInfo>
  <!--  _______ Katyusha Firing Smoke Front  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_LAUNCH_SMOKE_FRONT</Name>
    <Transform>
      <Translation x="0.0" y="-5.0" z="0.0"/>
      <Rotation x="90.0" y="0.0" z="0.0"/>
      <Scale>0.375</Scale>
    </Transform>
    <fBaseDuration>0.4</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_ROCKET_LAUNCH_SMOKE_FRONT</Name>
      </ParticleEffect>
    </ParticleEffects>
  </VisEffectArtInfo>
  <!--  _______ Katyusha Rocket No Trail  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_ROCKET_NO_TRAIL</Name>
    <Transform>
      <Translation x="0.0" y="10.0" z="0.0"/>
      <Rotation x="0.0" y="0.0" z="-90.0"/>
      <Scale>0.75</Scale>
    </Transform>
    <fBaseDuration>0.001</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ModelEffects>
      <ModelEffect>
        <Name>ART_DEF_MEFFECT_PROJ_ROCKET_ARTILLERY</Name>
      </ModelEffect>
    </ModelEffects>
  </VisEffectArtInfo>
  <!--  _______ Katyusha Rocket Projectile  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_ROCKET_PROJECTILE</Name>
    <Transform>
      <Translation x="0.0" y="10.0" z="0.0"/>
      <Rotation x="0.0" y="0.0" z="-90.0"/>
      <Scale>0.75</Scale>
    </Transform>
    <fBaseDuration>0.001</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_TRAIL_ROCKET_PROJ</Name>
      </ParticleEffect>
    </ParticleEffects>
    <ModelEffects>
      <ModelEffect>
        <Name>ART_DEF_MEFFECT_PROJ_ROCKET_ARTILLERY</Name>
        <!--<Animation>1000</Animation>-->
      </ModelEffect>
    </ModelEffects>
    <ChildEffects>
      <ChildEffect trigger="ProjectileEnd">
        <Name>ART_DEF_VEFFECT_TANK_IMPACT_$(TERRAIN)</Name>
      </ChildEffect>
    </ChildEffects>
  </VisEffectArtInfo>
  <!--  _______ Katyusha Rocket Projectile _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_KATYUSHA_LG_PROJ</Name>
    <Transform>
      <Translation x="0.0" y="10.0" z="0.0"/>
      <Rotation x="0.0" y="0.0" z="-90.0"/>
      <Scale>0.75</Scale>
    </Transform>
    <fBaseDuration>0.1</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_TRAIL_ROCKET_PROJ</Name>
      </ParticleEffect>
    </ParticleEffects>
    <ModelEffects>
      <ModelEffect>
        <Name>ART_DEF_MEFFECT_PROJ_ROCKET_ARTILLERY</Name>
        <!--<Animation>1000</Animation>-->
      </ModelEffect>
    </ModelEffects>
    <ChildEffects>
      <ChildEffect trigger="ProjectileEnd">
        <Name>ART_DEF_VEFFECT_ROCKET_ARTILLERY_IMPACT_$(TERRAIN)</Name>
      </ChildEffect>
    </ChildEffects>
  </VisEffectArtInfo>

To complicate matters, a second version is necessary if R.E.D. scaling has been applied, with a couple of changes to two of the effects:
Spoiler :
Code:
  <!--  _______ Archer Arrow From Quiver to Hand to Bow  _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_PROJ_ARROW_ARCHER_HAND</Name>
    <Transform>
      <Translation x="0.0" y="-5.0" z="0.0"/> <!-- <Translation x="0.0" y="-8.0" z="0.0"/> -->
      <Rotation x="0.0" y="0.0" z="-90.0"/>
      <Scale>1.2</Scale> <!-- <Scale>1.3</Scale> -->
    </Transform>
and
Code:
  <!--  _______ Bomber Propeller Blades _______   -->
  <VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_BOMBER_BLADES_01</Name>
    <Transform>
      <Translation x="0.0" y="-2.2" z="0.0"/> <!-- <Translation x="0.0" y="-0.3" z="0.0"/> -->
      <Rotation x="0.0" y="90.0" z="0.0"/>
      <Scale>0.50</Scale> <!-- <Scale>0.35</Scale> -->
    </Transform>

Excellent! I could probably just add separate respective .Civ5Pkg files depending on whether or not Danrell's R.E.D. mod is enabled. If someone were interested in creating an installer (hopefully GUI-based) it could be a radio button selection; the installer would delete the existing DLC directory (necessary for updates) and replace it including whichever .Civ5Pkg file and folders were required based upon the user's selection. An installer could make a lot of things easier and more powerful - but unfortunately there is no such thing as idiot-proof as long as I am around.... :p
 
Repeating this here as it's the more relevant place:

You'll be pleased to hear that I've got a workaround for decoupling the scaling of units from scaling of effects! I've added a new feature to Nexus Buddy 2 that will insert an additional scaling bone into the skeleton of a GR2 model. This allows you to scale the model independently of the effects. So you can, for example, increase the size of the unit effects using the <Scale> in the Art Define xml, and offset that increase adding a scaling bone that reduces the model size by a proportionate amount.

The only thing that is different between these two fiery T-Rexs is the scale of the scaling bone in the model .gr2 and the <Scale> value in the Art Define xml. The one the right has model scaled to 0.14 and <Scale>1.05</Scale> in the Art Defines; the one on the left has the model scaled to 0.7 and <Scale>0.21428</Scale> in the Art Defines. The result is that the visual effects for the unit are rescaled without affecting anything else. :)



This should save us time in getting effects matching the units scale! :cool:

Will release the nexus version of NB2 shortly.
 
Top Bottom