Using Existing Unit Effects to Create Custom Units

Spoiler :




Hrm... I tried to follow your process, Nomad, but I'm running into problems. My plasma beams are coming in from off-screen, which suggests there's a problem with the bone I'm trying to connect to, but I'm not sure what the problem is. Can you take a look at my files?

I've included both my .blend file and the .gr2, .fxsxml, and .ftsxml files.
 

Attachments

  • Robotank.rar
    1.2 MB · Views: 185
Spoiler :




Hrm... I tried to follow your process, Nomad, but I'm running into problems. My plasma beams are coming in from off-screen, which suggests there's a problem with the bone I'm trying to connect to, but I'm not sure what the problem is. Can you take a look at my files?

I've included both my .blend file and the .gr2, .fxsxml, and .ftsxml files.

Your bones in the .gr2 file are not the same as in the .blend file. The .gr2 is missing the gun_right & gun_left bones. It looks like something went wrong with the export process. Try and apply changes to skeleton and re export. I applied and did a quick export and the bones are there now in the .gr2.
 
Spoiler :




Hrm... I tried to follow your process, Nomad, but I'm running into problems. My plasma beams are coming in from off-screen, which suggests there's a problem with the bone I'm trying to connect to, but I'm not sure what the problem is. Can you take a look at my files?

I've included both my .blend file and the .gr2, .fxsxml, and .ftsxml files.

I also saw the bone issue that Wolfdog mentioned. Hopefully that's the only problem, but could you send me the full mod? I want to see the .xml files that you defined for the base unit as well.
 
Your bones in the .gr2 file are not the same as in the .blend file. The .gr2 is missing the gun_right & gun_left bones. It looks like something went wrong with the export process. Try and apply changes to skeleton and re export. I applied and did a quick export and the bones are there now in the .gr2.

Hrm... I've tried re-exporting the model from the .blend file, but the new bones just won't show up in Granny. Wonder why it's acting up like that? All of the other bones from the base model show up...

Any chance you could send me the .gr2 that you made? ;__;

I also saw the bone issue that Wolfdog mentioned. Hopefully that's the only problem, but could you send me the full mod? I want to see the .xml files that you defined for the base unit as well.

I could... but the entire mod is currently 20 Mb when zipped up. I'll test it a bit tonight to make sure the most recent edits I made are working, then toss it up on dropbox for you to look at.
 
Are you exporting as .br2 or .fbx? I think from memory .br2 format does not overwrite bones only meshes. Attached is the gr2 but remember the rotation is not right due to the way .fbx export works but it will right itself when your animations are applied.

I also noticed the tank has 20,998 verts which is a lot and may bog down lower spec machine's.
 
That must be it -- I'm exporting the model to .br2 using the method in your old tutorial for converting Civ 4 models to Civ 5. So I export to .br2 and then import the .br2 mesh over the basic Tank skeleton.

Should I try exporting the model through .fbx as well? Import the .fbx file, then import the .br2 over it?
 
That must be it -- I'm exporting the model to .br2 using the method in your old tutorial for converting Civ 4 models to Civ 5. So I export to .br2 and then import the .br2 mesh over the basic Tank skeleton.

Should I try exporting the model through .fbx as well? Import the .fbx file, then import the .br2 over it?

Yes if you export the skeleton as .fbx and overwrite with .br2 gives the best results as the .fbx does not cleanly export meshes sometimes. This is the tutorial you will need to follow as you will need to export the animations as well given you now have a custom skeleton.
 
Yes if you export the skeleton as .fbx and overwrite with .br2 gives the best results as the .fbx does not cleanly export meshes sometimes. This is the tutorial you will need to follow as you will need to export the animations as well given you now have a custom skeleton.

Hmm... even if I'm using the tank animations (just with the extra bones for effects)? Or can I just skip step B in the tutorial, since I don't have custom animations...?

I should check and see what animations Nomad or What used for the Cobra...

EDIT: Man, I still feel like I'm hitting a wall -- I tried exporting the .blend file as both an .fbx and a .br2, and then loaded the .fbx file in and imported the .br2 mesh over it, and I still can't find the bone in Granny... I think for now I'm just going to have to stick with the model that I have that works, until I can figure out the exact steps I need to follow to add a bone and then get the proper model imported into a .gr2 the way Nomad or What did.
 
Hmm... even if I'm using the tank animations (just with the extra bones for effects)? Or can I just skip step B in the tutorial, since I don't have custom animations...?

I should check and see what animations Nomad or What used for the Cobra...

EDIT: Man, I still feel like I'm hitting a wall -- I tried exporting the .blend file as both an .fbx and a .br2, and then loaded the .fbx file in and imported the .br2 mesh over it, and I still can't find the bone in Granny... I think for now I'm just going to have to stick with the model that I have that works, until I can figure out the exact steps I need to follow to add a bone and then get the proper model imported into a .gr2 the way Nomad or What did.

I used existing CiV Helicopter Gunship animations for the Cobra. I understand your frustration; sometimes I get a unit to work perfectly and am inspired to do something similar and then totally hit a wall with it. I can't even imagine the countless hours I have wasted on half-baked projects. My advice is to put it on the back burner and come back to it later with a fresh perspective (I have a LOT of back burners apparently :lol: ). If I have a chance I will take a look at it but my time is limited and I am working on a custom animation project right now. Plus, we need to flying get angels/demons into the game and I am way past due on doing them.

Maybe you can use Wolfdog's .gr2 that he made? I thought he mentioned that he had a corrected model....
 
I used existing CiV Helicopter Gunship animations for the Cobra. I understand your frustration; sometimes I get a unit to work perfectly and am inspired to do something similar and then totally hit a wall with it. I can't even imagine the countless hours I have wasted on half-baked projects. My advice is to put it on the back burner and come back to it later with a fresh perspective (I have a LOT of back burners apparently :lol: ). If I have a chance I will take a look at it but my time is limited and I am working on a custom animation project right now. Plus, we need to flying get angels/demons into the game and I am way past due on doing them.

Maybe you can use Wolfdog's .gr2 that he made? I thought he mentioned that he had a corrected model....

I did try using his .gr2 file directly, but the models appeared sideways in the game. I'm wondering if I should try importing my mesh over his skeleton.... but the skeltin might still he sideways in orientation. I know it's an issue with exporting armatures, but I'm not sure how to fix it.

As you said, it's probably good to take a break for a bit - what I've got mostly works for my purposes, so I can work on some of the other code that needs doing. I do appreciate your and Wolfdog's help, though!
 
Hmm... even if I'm using the tank animations (just with the extra bones for effects)? Or can I just skip step B in the tutorial, since I don't have custom animations...?
I think you can from memory but you need to get the rotation right in the .fbx export which seems to be the problem you are having. Try exporting to .fbx with the -90 rotation enabled or you may have to rotate in blender before export as well. I remember it take a lot of experimenting to get the rotation right. Also an older version of the .fbx export script may help you to do this.
 
I think you can from memory but you need to get the rotation right in the .fbx export which seems to be the problem you are having. Try exporting to .fbx with the -90 rotation enabled or you may have to rotate in blender before export as well. I remember it take a lot of experimenting to get the rotation right. Also an older version of the .fbx export script may help you to do this.

Hmm... I've noticed that in my version of Blender, the .fbx doesn't show the same alignment options as in some of the tutorials:

Spoiler :




I'll have to try experimenting with the options and see if I can export a properly-aligned skeleton. Would exporting the mesh first, and then rotating the model to other orientations (so that the .fbx rotation lines it up properly) work?
 
Hmm... I've noticed that in my version of Blender, the .fbx doesn't show the same alignment options as in some of the tutorials:

Spoiler :




I'll have to try experimenting with the options and see if I can export a properly-aligned skeleton. Would exporting the mesh first, and then rotating the model to other orientations (so that the .fbx rotation lines it up properly) work?

Your .fbx script (and therefore possibly your .br2 script) look outdated to me. For v2.49 you should be using these. Details can be found in this tutorial.
 
I decided to give this a try myself while experimenting with an MMD model import:
Spoiler :
She used the Musketman animations initally. While it's great that I can have Yoko shoot railgun rounds rather than the Musketman's usual muzzle effect, it's not synced properly with her model animation. The model will continuously perform the firing animation but the railgun rounds appear sporadically and rarely when they actually should, except for the first time.

While it's not important right now (this is just a test, after all), would tweaking with the timings make it work with the model animation properly?

For reference, here's the original Musketman animations for event code 1100:
Code:
      <trigger type="FTimedTriggerAction" id="54" time="0.392593" duration="0" repeat="0" ec="1100" track="4" tier="0" action="1" />
      <trigger type="FTimedTriggerEffect" id="8" time="0.303704" duration="0.0666667" repeat="0" ec="1100" track="2" tier="0" event="ART_DEF_VEFFECT_MUSKET_IGNITE" bone="b_RIFLE" />
      <trigger type="FTimedTriggerEffect" id="1" time="0.37037" duration="0" repeat="0" ec="1100" track="2" tier="0" event="ART_DEF_VEFFECT_MUSKET_SMOKE_02" bone="b_RIFLE" />
      <trigger type="FTimedTriggerSound" id="11" time="0.37037" duration="0" repeat="0" ec="1100" track="1" tier="0" event="AS3D_UNIT_MUSKETMAN_MUSKET_FIRE" bone="" />
      <trigger type="FTimedTriggerSound" id="33" time="0.118519" duration="0" repeat="0" ec="1100" track="1" tier="0" event="AS3D_UNIT_MUSKETMAN_SOLDIER_FOLEY" bone="" />
      <trigger type="FTimedTriggerSound" id="15" time="0.364814758" duration="0" repeat="0" ec="1100" track="1" tier="1" event="AS3D_UNIT_MUSKETMAN_MUSKET_FIRE_T1" bone="" />
      <trigger type="FTimedTriggerSound" id="45" time="0.364814758" duration="0" repeat="0" ec="1100" track="1" tier="2" event="AS3D_UNIT_MUSKETMAN_MUSKET_FIRE_T2" bone="" />

And here's what I put instead, based on the GDR (essentially the same as the GDR's railgun except I reduced it to one round rather than four, and I used a custom sound):
Code:
      <trigger type="FTimedTriggerTransfer" id="100" time="0.112613671" duration="0" repeat="0" ec="1100" track="3" tier="0" refid="111" speed="3.34995" tangent.x="0.0338858142" tangent.y="-0.9204834" tangent.z="-0.389309883" />
      <trigger type="FTimedTriggerEffect" id="104" time="0.04629628" duration="0.0333333" repeat="0" ec="1100" track="2" tier="0" event="ART_DEF_VEFFECT_MECH_GUN_MUZZLE" bone="b_RIFLE" />
      <trigger type="FTimedTriggerEffect" id="111" time="0.05754753" duration="0.07" repeat="0" ec="1100" track="7" tier="0" event="ART_DEF_VEFFECT_TRAIL_RAILGUN_PROJ" bone="b_RIFLE" />
      <trigger type="FTimedTriggerSound" id="114" time="0.03518518" duration="0" repeat="0" ec="1100" track="1" tier="-1" event="AS3D_UNIT_SUPERCONDUCTOR_RIFLE_FIRE" bone="" />
To be fair, it might not have helped that I used the same set for all attack event codes (1160, 1180 and 2100 as well) and this is a ranged unit rather than a melee unit. But I just thought I'd ask in case anyone knows what's going on. :)
 
I decided to give this a try myself while experimenting with an MMD model import:
Spoiler :
She used the Musketman animations initally. While it's great that I can have Yoko shoot railgun rounds rather than the Musketman's usual muzzle effect, it's not synced properly with her model animation. The model will continuously perform the firing animation but the railgun rounds appear sporadically and rarely when they actually should, except for the first time.

While it's not important right now (this is just a test, after all), would tweaking with the timings make it work with the model animation properly?

For reference, here's the original Musketman animations for event code 1100:
Code:
      <trigger type="FTimedTriggerAction" id="54" time="0.392593" duration="0" repeat="0" ec="1100" track="4" tier="0" action="1" />
      <trigger type="FTimedTriggerEffect" id="8" time="0.303704" duration="0.0666667" repeat="0" ec="1100" track="2" tier="0" event="ART_DEF_VEFFECT_MUSKET_IGNITE" bone="b_RIFLE" />
      <trigger type="FTimedTriggerEffect" id="1" time="0.37037" duration="0" repeat="0" ec="1100" track="2" tier="0" event="ART_DEF_VEFFECT_MUSKET_SMOKE_02" bone="b_RIFLE" />
      <trigger type="FTimedTriggerSound" id="11" time="0.37037" duration="0" repeat="0" ec="1100" track="1" tier="0" event="AS3D_UNIT_MUSKETMAN_MUSKET_FIRE" bone="" />
      <trigger type="FTimedTriggerSound" id="33" time="0.118519" duration="0" repeat="0" ec="1100" track="1" tier="0" event="AS3D_UNIT_MUSKETMAN_SOLDIER_FOLEY" bone="" />
      <trigger type="FTimedTriggerSound" id="15" time="0.364814758" duration="0" repeat="0" ec="1100" track="1" tier="1" event="AS3D_UNIT_MUSKETMAN_MUSKET_FIRE_T1" bone="" />
      <trigger type="FTimedTriggerSound" id="45" time="0.364814758" duration="0" repeat="0" ec="1100" track="1" tier="2" event="AS3D_UNIT_MUSKETMAN_MUSKET_FIRE_T2" bone="" />

And here's what I put instead, based on the GDR (essentially the same as the GDR's railgun except I reduced it to one round rather than four, and I used a custom sound):
Code:
      <trigger type="FTimedTriggerTransfer" id="100" time="0.112613671" duration="0" repeat="0" ec="1100" track="3" tier="0" refid="111" speed="3.34995" tangent.x="0.0338858142" tangent.y="-0.9204834" tangent.z="-0.389309883" />
      <trigger type="FTimedTriggerEffect" id="104" time="0.04629628" duration="0.0333333" repeat="0" ec="1100" track="2" tier="0" event="ART_DEF_VEFFECT_MECH_GUN_MUZZLE" bone="b_RIFLE" />
      <trigger type="FTimedTriggerEffect" id="111" time="0.05754753" duration="0.07" repeat="0" ec="1100" track="7" tier="0" event="ART_DEF_VEFFECT_TRAIL_RAILGUN_PROJ" bone="b_RIFLE" />
      <trigger type="FTimedTriggerSound" id="114" time="0.03518518" duration="0" repeat="0" ec="1100" track="1" tier="-1" event="AS3D_UNIT_SUPERCONDUCTOR_RIFLE_FIRE" bone="" />
To be fair, it might not have helped that I used the same set for all attack event codes (1160, 1180 and 2100 as well) and this is a ranged unit rather than a melee unit. But I just thought I'd ask in case anyone knows what's going on. :)

Yes, absolutely. Since we only have an idea of the timing for CiV units based on the numbers used in the .ftsxml file (we cannot open the animations unfortunately), you should try to match the length of your custom sound to that of the effect. Alternately, you can transform an existing effect to create a custom one that fits the length of your sound like Skajaquada did for his WH40K mod:

Code:
<!--  _______ Mech Projectile Trail _______   -->
	<VisEffectArtInfo>
		<Row>
			<Name>ART_DEF_VEFFECT_TRAIL_PLASMA_CANNON_PROJ</Name>
			<Transform>
				<Translation x="0.0" y="0.0" z="0.0"/>
				<Rotation x="90.0" y="0.0" z="0.0"/>
				<Scale>0.02</Scale>
			</Transform>
			<fBaseDuration>0.01</fBaseDuration>
			<fBaseDurationScale>1.0</fBaseDurationScale>
			<ParticleEffects>
				<ParticleEffect>
					<Name>ART_DEF_PEFFECT_TRAIL_PULSE_PROJECTILE_01</Name>
					<!--       
<Name>ART_DEF_PEFFECT_TRAIL_RAILGUN_PROJ</Name> -->
				</ParticleEffect>
			</ParticleEffects>
			<ChildEffects>
				<ChildEffect trigger="ProjectileEnd">
					<Name>ART_DEF_VEFFECT_RAILGUN_IMPACT_$(TERRAIN)</Name>
				</ChildEffect>
			</ChildEffects>
		</Row>
	</VisEffectArtInfo>

Before this tutorial was written, there was a lot of discussion about the use of custom effects in my Gandalf thread which you may find useful.

If you look closely at the the original Musketman definitions you will notice that the base sound (id="11") and effect (id="1") have the same length (time="0.37037"). There is also a second effect (id="8") that is a bit shorter in length (one is the muzzle fire, the other is smoke). Both of these effects exist on the same tier (tier="0") so they will occur simultaneously. CiV uses .dge (DataGraph element) files defined in the .ftsxml file (which to my knowledge we cannot control) to randomly assign a sound and/or effect from the available tiers (id="15" and id="45" are alternate sounds on tier="1" and tier="2"). This adds variety to the sounds and/or effects of a unit so that it is not constant. In the case of the Musketman, 2 alternate sounds are available but only one effect/action sequence (tier="0") in the definitions for that action. So you may hear three distinct sounds for the unit but it will always perform the same action for ec="1100" (although many units have Attack_A and Attack_B animations as well on ec="1100" and ec="2100" respectively, which are also controlled by the .dge DataGraphs).

For your GDR railgun effect, change your sound for id="114" to be on tier="0" instead of tier="-1" and your effect for id="111" to track="2" instead of track="7" since track="7" is likely not defined at the top of the .ftsxml file for the ec="1100" sequence (only "1" through "4" are; 1=sound, 2=effect, 3=transfer, 4=action per the tutorial). Fiddle around with the timings a bit and see if that helps.
 
Oh my. I might have saved myself some time if I had come across this thread a couple of months ago. (I reused all the Civ5 effects I could in this mod, which I might put up on CivFanatics at a later date.) So if I understand what you're saying about scaling correctly, the reason my arrows and other projectile effects are too big is that their scale is determined by the same value used to scale the model? (mostly 0.5 in my case, and things do seem roughly three times too large)
That's... unfortunate. I don't like the idea of upsizing and re-exporting everything just to get the effects to work out. Hm.

Something I've found that may help: In the ArtDefine_UnitMemberCombatWeapons table, there are HitEffectScale and ProjectileChildEffectScale entries. I've found these to be worthless for archers, but somewhat effective for cannons; presumably HitEffectScale affects the impact effect listed under HitEffect.
 
Oh my. I might have saved myself some time if I had come across this thread a couple of months ago. (I reused all the Civ5 effects I could in this mod, which I might put up on CivFanatics at a later date.) So if I understand what you're saying about scaling correctly, the reason my arrows and other projectile effects are too big is that their scale is determined by the same value used to scale the model? (mostly 0.5 in my case, and things do seem roughly three times too large)
That's... unfortunate. I don't like the idea of upsizing and re-exporting everything just to get the effects to work out. Hm.

Something I've found that may help: In the ArtDefine_UnitMemberCombatWeapons table, there are HitEffectScale and ProjectileChildEffectScale entries. I've found these to be worthless for archers, but somewhat effective for cannons; presumably HitEffectScale affects the impact effect listed under HitEffect.

I just don't think we have discovered how to scale effects relative to original model size yet. It was hoped that Skajaquada's effect transforms could affect the scaling, but I believe Hangman tried to use this method before with no success. I haven't tried myself, but you could give it a shot and see what happens.

Hmmm, I never noticed those entries before. Perhaps they have to do with projectiles that are .gr2 files themselves? Many are (catapult rocks, mech rockets, etc.); they are designated with a "proj_" prefix in the \Resource directory of CiV (once extracted).
 
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.
 
Top Bottom