Exploring the FTSXML

Skajaquada

Crazy Engineer
Joined
Mar 4, 2007
Messages
134
I want to share what I've found out about the FTSXML-file during the week and see if anyone can help me with a problem that seem to be a dead-end.

It's really simple, if we use the gunship as an example you need to define bones to use as markers for the effects in the FSXML-file, like this:

Code:
<BoneUsage>
		<Bone name="First propeller07"/>
		<Bone name="Box02"/>
		<Bone name="Landing gear01"/>
		<Bone name="fx_MachineGun"/>
		<Bone name="base"/>
		<Bone name="Airplane tail"/>
		<Bone name="Cabin door02"/>
		<Bone name="fx_PROJECTILE_02"/>
		<Bone name="fx_PROJECTILE_03"/>
		<Bone name="fx_PROJECTILE_01"/>
		<Bone name="fx_PROJECTILE_04"/>
		<Bone name="WORLD_center"/>
	</BoneUsage>

Those bones can then be accessed through that name in the FTSXML-file. If they're not defined there only the skeleton-root can be used.

Then the FTSXML-file, for the gunship, looks something like this:

Code:
<trigger_system type="FGrannyTimedTriggerSystem">
  <event_tracks>
    <event_track ec="1000">
      <track id="1" name="Sound"/>
      <track id="2" name="Effect"/>
      <track id="3" name="Transfer"/>
      <track id="4" name="Action"/>
      <track id="5" name="Effect"/>
    </event_track>
    .
		.
		.
    <event_track ec="1180">
      <track id="1" name="Sound"/>
      <track id="2" name="Effect"/>
      <track id="3" name="Transfer"/>
      <track id="4" name="Action"/>
    </event_track>
  </event_tracks>
  <triggers>
    <trigger type="FTimedTriggerAction" id="146" time="1.15414" duration="0" repeat="0" ec="1140" track="4" tier="0" action="1"/>
    .
		.
		.
    <trigger type="FTimedTriggerAction" id="153" time="3.11654" duration="0" repeat="0" ec="1140" track="4" tier="0" action="1"/>
    <trigger type="FTimedTriggerAction" id="89" time="1.0403173" duration="0" repeat="0" ec="1160" track="4" tier="0" action="1"/>
    <trigger type="FTimedTriggerTransfer" id="217" time="4.53703642" duration="0" repeat="0" ec="1160" track="3" tier="0" refid="214" speed="0" tangent.x="0.0244559254" tangent.y="-0.981143057" tangent.z="-0.191729456"/>
    <trigger type="FTimedTriggerTransfer" id="91" time="1.428115" duration="0" repeat="0" ec="1100" track="3" tier="0" refid="190" speed="0" tangent.x="-0.037577223" tangent.y="-0.988899" tangent.z="-0.1437589"/>
    <trigger type="FTimedTriggerTransfer" id="277" time="1.908078" duration="0" repeat="0" ec="1180" track="3" tier="0" refid="282" speed="0" tangent.x="-0.000254473678" tangent.y="-0.9844668" tangent.z="-0.175570861"/>
    .
		.
		.
    <trigger type="FTimedTriggerEffect" id="97" time="0.334052" duration="1.15" repeat="0" ec="2100" track="5" tier="0" event="ART_DEF_VEFFECT_GUNSHIP_MACHINE_GUN_MUZZLE" bone="fx_MachineGun"/>
    <trigger type="FTimedTriggerEffect" id="182" time="1.64865685" duration="0.12" repeat="0" ec="2100" track="5" tier="0" event="ART_DEF_VEFFECT_GUNSHIP_ROCKET_PROJECTILE" bone="fx_PROJECTILE_01"/>
    .
		.
		.
    <trigger type="FTimedTriggerSound" id="139" time="0.09680498" duration="0" repeat="0" ec="2200" track="1" tier="-1" event="AS3D_UNIT_HELICOPTER_GUNSHIP_TANK_HIT_B" bone=""/>
    <trigger type="FTimedTriggerSound" id="130" time="2.87927" duration="0" repeat="0" ec="1200" track="1" tier="-1" event="AS3D_UNIT_HELICOPTER_GUNSHIP_TANK_HIT_B" bone=""/>
  </triggers>
</trigger_system>

There's not much to it. The event_tracks-set seem to be purly for the Nexus-GUI as removing them does nothing, however I've found that they're good for reminding what the track 1, 2, 3 and 4 means. The triggers-set contains definitions for effects, sounds, transfer and something called action (I've no idea what "action" is, I assume it's something that's referenced in the FSMXML-file that I haven't dug to deep into yet, though removing them does nothing, perhaps it's something to do with the Nexus GUI).

Then for each row you can set a ID (only used to reference other rows in the same file it seems), start-time (relative to the animation-file), duration (0 seem to be for playing the entire effect), repeat, ref-ID to reference ID, ec (the ID of the animation like 1100 for attack and so on, set in the FSXML-file), track (seem to refer to the event_tracks-set used for the Nexus-GUI), tier (it's says "priority" and is set to always in Nexus but I don't really know what it is), event (referes to the effect- or sound-names like ART_DEF_VEFFECT_AIR_DEATH_02 in civ5artdefines_viseffects.xml) and bone (it's the marker or bone in your 3D-file where the effect will show).

There are also tangent.x, tangent.y and tangent.z as well as speed for the transfer-event. Speed 0 is the fastest and catapult seem to have around 15 or 20, to get a reference. The tangent-coordinates are about the shape of the curve of the projectile's path. As you can see in any FTSXML-file for a unit using proectiles the ID in the effect-events refere to a transfer ref-ID. I don't fully understand how they use the tangent-coordinates, but tangent-coordinates are usually the direction on a point of a curve. It might be worth something imagining it as the direction the projectile is fierd in. It's probably best to just use the tangent-coordinates for a catapult if you want a projectiles that roughly follows that path and the gunship's tangent-coordinates if you want a more straight going projectile :)

That's that, I've tried these things and I've managed to get the effects to be used by my units in game, got the projectiles to follow different paths and so on.

What I've snagged in is finding a way to adjust the scale of the effect. They're all defined in civ5artdefines_viseffects.xml as this;

Code:
<VisEffectArtInfo>
    <Name>ART_DEF_VEFFECT_ANTI_TANK_MUZBLAST_01</Name>
    <Transform>
      <Translation x="0.0" y="0.0" z="0.0"/>
      <Rotation x="-90.0" y="0.0" z="0.0"/>
      <Scale>0.6</Scale>
    </Transform>
    <fBaseDuration>0.1</fBaseDuration>
    <fBaseDurationScale>1.0</fBaseDurationScale>
    <ParticleEffects>
      <ParticleEffect>
        <Name>ART_DEF_PEFFECT_ARTILLERY_MUZBLAST_01</Name>
      </ParticleEffect>
    </ParticleEffects>
  </VisEffectArtInfo>

I'm not sure how to change that scale-attribute. Doing this didn't work:

Code:
<VisEffectArtInfo>
		<Update>
			<Set Transform.Scale="2"/>
			<Where Name="ART_DEF_VEFFECT_ANTI_TANK_MUZBLAST_01"/>
		</Update>
	</VisEffectArtInfo>

Or any variations of set scale. I also couldn't find VisEffectArtInfo in the database, to base one of those XML-queries on that. It would be nice if someone had a solution for that, though it was really my backup-plan as I really think there should be a way to change the scale of an effect when it's used. I couldn't find any reference to it so I've spent some time now just trying to put "scale" a little here and there in the unit-files and FTSXML.

There're two things that I think could be clues in the civ5artdefines_unitmembers.xml, these two entries:

Code:
<Weapon>
        <fProjectileSpeed>0.8</fProjectileSpeed>
        <fVisKillStrengthMin>100.0</fVisKillStrengthMin>
        <fVisKillStrengthMax>100.0</fVisKillStrengthMax>
        <bIsDropped>1</bIsDropped>
        <fAreaDamageDelay>0.5</fAreaDamageDelay>
        <WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
        <WeaponTypeSoundOverrideTag>ATOMICBOMB</WeaponTypeSoundOverrideTag>
        <bWaitForEffectCompletion>1</bWaitForEffectCompletion>
        [B]<fProjectileChildEffectScale>1.0</fProjectileChildEffectScale>[/B]
      </Weapon>

Code:
<Weapon>
          [B]<ID>ART_DEF_VEFFECT_MECH_ROCKET_PROJECTILE</ID>[/B]
          <fVisKillStrengthMin>5.0</fVisKillStrengthMin>
          <fVisKillStrengthMax>12.0</fVisKillStrengthMax>
          <fProjectileSpeed>5.3</fProjectileSpeed>
          <WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
          <WeaponTypeSoundOverrideTag>EXPLOSION20POUND</WeaponTypeSoundOverrideTag>
        </Weapon>

The first makes a reference to a scale-attribute apparently for the child-effect of something. Many effects have child-effects for the impacts. I believe it's there for the same reason fHitEffectScale is. One thing that confuses me about that entry is that I can't find it in the database. That mainly lead me to try putting in "scale" a little here and there, like fFireEffectScale and so on.

The second I think is important because the ID is the name of an effect. I don't know if it's a coincident since the only other IDs used are just "PROJECTILE". I was hoping you could declare IDs there and maybe the fHitEffectScale would apply to them. But I don't know, a scale-attribute there wouldn't make much sense since the effects in the FTSXML aren't really linked to the weapon. It's more the animation-files if anything.

Can anyone help with these last two? My only backup-plan after this is changing the scale of my models before I export them in 3DS Max but that will put a lot of limitations on me, plus it'll be tedious work. It really seem to me there should be something in the FTSXML-file like "scale" like "speed" and "tangent.x". Wouldn't that make sense?
 
Isn't what FSXML? In the FSXML-files there are usually entries like these:

<TimedTrigger file="FX_Triggers_HelicopterGunship.ftsxml"/>
 
Isn't what FSXML? In the FSXML-files there are usually entries like these:

<TimedTrigger file="FX_Triggers_HelicopterGunship.ftsxml"/>
I was just checking I knew what you were talking about - I hadn't heard of ftsxml. No idea what's going on there.
 
I want to add something I've just discovered as well as a work-around for my scale-problem.

The scale-problem was "solved" changing the effect-value in the civ5artdefines_viseffects.xml inside the common-folder. Is there suppose to be a way to load that file in a mod? I tried to include it by just adding it to the project, it also didn't work trying to update the database with it, though I don't see how that could've worked as it doesn't seem to have any table.

I suppose the logic is that the effects are included like the unitmembers-file. You put an entry there, change the scale the way you want, then use it where-ever you want. It's probably why a lot of effects have a unit's name in them like tank-death. Though since you load the FTSXML-file with the Nexus-viewer and change the effects to the proper times there, I really think changing the effect-scale should be a part of that file, so you can scale it there as well.

One thing that still makes me think there could be a scale-attribute hidden there is that the tangent-attributes aren't listed in the Nexus-viewer for the transfer-trigger. Maybe there's some clever way to use those tangent-attributes to change the scale? I tried settings them all to 0.1 and duration to 1 hoping whenever they're used they're multiplied on all the effects coordinates times the time or something, thus scaling it down to 0.1. It didn't work though.

Addition to OP

I noticed after I had managed to change the scale of the muzzle-effect that the hit-effects weren't displaying properly. The only real difference between my own FTSXML-file and any other was that I had removed those action-triggers. I simply added those with the ec-attribute the same as the rest of my effects, like this:

Code:
<trigger_system type="FGrannyTimedTriggerSystem">
  <triggers>
	<trigger type="FTimedTriggerAction" id="53" time="0" duration="0" repeat="0" ec="1160" track="4" tier="0" action="1" />
	<trigger type="FTimedTriggerAction" id="39" time="0" duration="0" repeat="0" ec="1140" track="4" tier="0" action="1" />
	<trigger type="FTimedTriggerAction" id="54" time="0" duration="0" repeat="0" ec="1100" track="4" tier="0" action="1" />
	<trigger type="FTimedTriggerAction" id="55" time="0" duration="0" repeat="0" ec="2100" track="4" tier="0" action="1" />
	<trigger type="FTimedTriggerAction" id="59" time="0" duration="0" repeat="0" ec="1180" track="4" tier="0" action="1" />	  
    <trigger type="FTimedTriggerEffect" id="103" time="0" duration="0" repeat="0" ec="1160" track="2" tier="0" event="ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_MUZZLE" bone="marker_muzzle" />
    <trigger type="FTimedTriggerEffect" id="100" time="0" duration="0" repeat="0" ec="1140" track="2" tier="0" event="ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_MUZZLE" bone="marker_muzzle" />
    <trigger type="FTimedTriggerEffect" id="104" time="0" duration="0" repeat="0" ec="2100" track="2" tier="0" event="ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_MUZZLE" bone="marker_muzzle" />
    <trigger type="FTimedTriggerEffect" id="94" time="0" duration="0" repeat="0" ec="1100" track="2" tier="0" event="ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_MUZZLE" bone="marker_muzzle" />
    <trigger type="FTimedTriggerEffect" id="283" time="0" duration="0" repeat="0" ec="1180" track="2" tier="0" event="ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_MUZZLE" bone="marker_muzzle" />
  </triggers>
</trigger_system>

Then I got both the muzzle-effects as well as the hit-effects.

I checked in the Nexus-viewer under the action-triggers it says "ActionCode Attack1" and "ActionCodeValue 1" which makes me think they're related to the first attack, possible the first weapon-attribute in the unitmembers-file. Though I haven't found a single FTSXML-file using anything other than action=1. The Mech for example that've got several guns though have got ID-tags in it's weapon-tags and no action-trigger. It's probably related though I'm not entirely sure how.

I hoped that just maybe this could make the fire-effect scale with the hit-effect scale or so, but sadly it doesn't. What I really don't understand, based on what I think about the way they imagined the uniteffects-file would be used (in the same way as unitmembers) is why there are even hit-effect scale-attributes at all. Oh well, I'll continue my research during the week :)

EDIT: Addition to appease Google. I tried going from action="0" and onward and check what Nexus calls the code. It says None on 0, then the numbers to up to 5 showing "attack1-5" before showing nothing above.
 
Back
Top Bottom