Help - Search - Members - Calendar
Full Version: (**) Primary/SecondaryFireFLH, TurretOffset & PBarrelLength explained
TiberiumWeb.org Community Forums > Tiberian Sun > TS Modding > Modding Tutorials
Lin Kuei Ominae
After you've created a new voxel and gave it some cool new weapons in rules.ini, you surely noticed that the bullets don't start from the same point where the barrel ends.

This tutorial will show you, how you can set the right bullet starting point for your unit and will cover the art.ini keys
PrimaryFireFLH
SecondaryFireFLH
TurretOffset
PBarrelLength
SBarrelLength


This is rated with 2 stars as it's quite time consuming in the beginning, but with a bit practice this is a very easy and fast job and could be rated with 0 stars.

Finding the right FireFLH values
I.
Make sure you've turned on in the game controls the option "Target Lines". This shows you a green line from the unit to the moving point and a red line from the unit to the target point. We are only interested in the red line as it starts from the exact PrimaryFireFLH position on the unit. Use force fire to show the red line whenever you want.

II. PrimaryFireFLH
Add to your units entry in art.ini the key PrimaryFireFLH=0,0,0.
FLH stands for Forward, Lateral and Height and the distance is measured in leptons. This is an engine specific scale unit, that is not related to the size of a voxel or a pixel.

-There is no way to calculate the correct FLH value.
-To find the right FLH values you have to trial and error and look each time ingame, if the value is correct.

Go in 3 steps to find the right FLH values, beginning with the Forward value, then the Lateral and finally the Height value.
I prefer to use a multiple of 8 to come fast closer to the right value, e.g. 8, 16, 32, 64, 128 and then slowly reduce or raise the value with 8 until i have the exact position.
1. Forward: Let the unit face to the west or east ingame and force fire straight to the west/east, to see if you have the right F value.
Click to view attachment the number in the top left shows the used F value (the red line has been changed to white for a better visibility)
Adjust the F value to move this way the bullet starting point forwards/backwards along the body centre line, until it's on the exact position of the barrel end. (positive values to move forwards, negative to move backwards)
Note: some muzzleflash anims are a bit bigger and to avoid that they are shown half in the barrel, you have to move the F value a bit more forward.

2. Lateral: Let the unit face north or south ingame and force fire straight to north/south.
Click to view attachment the number in the top left shows the used L value (the red line has been changed to white for a better visibility)
Adjust the L value to move this way the bullet starting point left/right, until it's on the sideward position of the barrel. (positive value for left, negative for right side of the unit)
If you have Burst=2 (or more) on your weapon, the unit automatically switches the sides for each shot from left to right and vice versa (in this case it's irrelevant if you use negative or positive values on the L value)

3. Height: Let the unit face to the west or east ingame and force fire straight to the west/east.
Click to view attachment the number in the top left shows the used H value (the red line has been changed to white for a better visibility)
Adjust the H value to move this way the bullet starting point up/down, until it's on the exact height of the barrel end.

III. SecondaryFireFLH
Use the same technique as described in II for the PrimaryFireFLH.
Since the red target line isn't shown for secondary weapons and always shows the PrimaryFireFLH, you have find the position with the primary weapon and then copy the FLH values to the SecondaryFireFLH key.


III. TurretOffset
If your unit uses a turret which shouldn't be placed on the centre of the chassis, you can use this key to move the turret forwards or backwards along the body centre line. Positive values move the turret forwards and negative values backwards. The graphical placement of the turret with this key works only for voxel units.
However the FireFLH position is messed up for turrets which aren't in the centre. This is a calculation error of the TS engine and can't be fixed.
The best is to find the FireFLH with TurretOffset=0 and then move the Turret along the body centre line.

IV. PBarrelLength & SBarrelLength
If your unit has a voxel barrel, you should use these keys to define the bullet starting point for the primary (PBarrelLength) and secondary (SBarrelLength) weapon.
Since voxel barrels stand in a different angle for closer and farther targets, these 2 keys are used to compensate the rotation of the tilting voxel barrel.

To make them work you have to set the FireFLH key to the exact pivot of the barrel.
Lets show this on the original Titan, which has even in the latest version 2.03 wrong FireFLH and PBarrelLength values and uses
[MMCH]
PrimaryFireFLH=250,-50,100
PBarrelLength=250
SBarrelLength=250
TurretOffset=-16

1. we can remove the key TurretOffset which is wrong, as the turret is in the centre of the unit and remove the key SBarrelLength as the Titan has no secondary weapon
2. we change temporarily the key SBarrelLength to 0
3. Lets find the correct FireFLH using step I and II, so the bullet starts on the end of the barrel.
PrimaryFireFLH=250,-50,128 is better
4. Since the barrels Pivot is on the centre of the unit, we can set PrimaryFireFLH=0,-50,128 and use now the removed 250 of the Forward value for the PBarrelLength key. If you have a tank with a big turret you have to keep a small Forward value so the FLH is again on the pivot of the barrel. Then use PBarrelLength to compensate the length of the Barrel.

The result for the MMCH are the following settings.
[MMCH]
PrimaryFireFLH=0,-50,128
PBarrelLength=250


Since the Titan barrel doesn't tilts that much like a tank or artillery barrel, it gives in this case better results ingame to use PrimaryFireFLH only
[MMCH]
PrimaryFireFLH=250,-50,128



@mod/admin: please remove the old and wrong tutorial.
HeLL7iGeR
very useful thanks LKO
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.