Not a member yet? Why not Sign up today
Create an account  

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Modding the new simple weapons

The new simple weapons (coming from the After Cataclysm mod) can be extensively configured, here is how you can configure them:

These are designed so that it's possible to have multiple barrels firing together or in sequence, rotating barrels, different pieces moving together, etc.

These are designed so that it's possible to have multiple barrels firing together or in sequence, rotating barrels, different pieces moving together, etc.
All that without the need of modifying the code.

Here is the common part of the configuration:
There are several types of simple weapons in the AC mod, this is the description of the configuration common to all these types.
The structure of a weapon is:

--> base                        The mesh of the block itself, doesn't move, it's the turret's base part
     +--> Shield                The SubObjects which will only rotate aroung the vertical axis, basically it's the turret's body part
           +--> Gun             The Subobjects which only elevate, it's the base of the gun itself
                 +--> Barrel    The moving part of the gun, this one can only have recoil
                 +--> Gatling   The moving part of the gun, this one can only rotate
It is possible to have several of each of these objects.
For additional 'base' objects you need to use a SubObjects with the 'DecorativeOnly' toggle set.

Global variables:
  . Caliber             The caliber of the guns in mm (default value: 20)
  . RotationSpeed       The rotation speed of the whole gun in degrees/s (default value: 30)
  . BarrelsPerObject    The number of barrels per GUN, used to avoid having several SubObjects when we want to have several guns moving the same way (default value: 1)
  . BarrelSpacing       Used only when 'BarrelsPerObject' is strictly higher than 1, to define the distance between 2 guns in meters (default value: 0)
  . AlternateBarrels    Set to 'true' to indicate that the barrels must alternate their fire, 'false' to indicate that they must fire together (default value: false)
  . Capacity            Indicates the number of shells in a magazine, if set to '1' then the gun has no magazine (default value: 1)
  . BurstReload         The reload time of the magazine, during that time no shell must be fired or the reload will have to start again from the beginning, in seconds (default value: 0)
  . MinElevation        The minimum elevation in degrees (default value: -20)
  . MaxElevation        The maximum elevation in degrees (default value: 75)
  . MaxAzimuth          The maximum azimuth angle in degrees (default value: 180)
  . FlashOverride       The size of the muzzle flash (default value: Caliber)
  . ShotsPerBarrel      The number of shells fired per barrel (default value: 1)
  . HasLaserTargeter    Does the weapon have a laser targeter? Used only when APS shells are used (default value: false)
 . NoDynamicPitch      Must we use the dynamic function to compute the pitch, or use the one from the audio file? (default value: false)

In order to have more configuration possibilities, SubObject-specific variables have been designed, they are in the description of the SubObject using the following syntax:

  . Type    The type of the object (SHIELD, GUN, BARREL, GATLING)
  . Vx      The name of the variable, one letter only (see all variables below)
  . Value   The value to set into the variable

SHIELD variables:

GUN variables:
  . D   The distance to spawn the shell (default value: 0)
  . H   The height to spawn the shell (default value: 0)
  . F   The distance to spawn the flash (by default it will be the same as the distance to spawn the shell, but for large guns we want the shell to be spawned out of the bouding box of the gun while we want the flash to be displayed just out of the barrel itself)
  . S   The distance between 2 barrels in meters (default value: BarrelSpacing)
  . I   The index of the gun, to be able to identify it. Must be unique (default value: 0)

BARREL variables:
  . D   The recoil distance (default value: associated gun flash distance (F variable) / 10)
  . T   The time to get back to the initial position after the recoil (default value: ReloadTime / 2)
  . I   The index of the gun to attach the barrel to (default value: 0)

GATLING variables:
  . B   The number of barrels (default value: 1)
  . I   The index of the gun to attach the gatling to (default value: 0)

Example: GUN(D=2,H=-0.029,F=1.45,I=0)
In this example, the object is a GUN, the shell will spawn 2m from the GUN, with a height of -0.029m, the flash will be displayed at a distance of 1.45m and a height of -0.029m, the index of the associated barrel is '0' (this variable was optional as it's the default value)

Here is the 'simple shells' specific configuration:
These simple weapons fire simple shells, requiring no configuration from the player.
The class to use is 'WorldWarCannon'.
Here are the additional variables:
  . ProjectileSpeed     The velocity of the projectile when fired in m/s (default value: 400)
  . KineticDamage       The kinetic damage of the shell (default value: 100)
  . ArmourPiercing      The AP of the shell (default value: 5)
  . Accuracy            The inaccuracy of the shell (default value: 2)
  . AmmoUse             The quantity of ammo consumed per shell fired (default value: 10)
  . ExplosiveDamage     The explosive damage of the shell (default value: 100)
  . ExplosiveRadius     The explosion radius of the shell in meters (default value: 5)
  . ShellLifeTime       The shell life time in seconds (default value: 5)
  . RecoilForce         The recoil force when a shell is fired (default value: 100)
  . ShellModel          The shell model to use, 'enumProjectileMeshType' (default value: 'autocannonshell'), if the value is equal or above 10 then it will use a custom model
  . UseTimedFuse        Does this shell has a time fuse? (default value: false)
  . TracerRed           Red component of the tracer color (default value: 1)
  . TracerGreen         Red component of the tracer color (default value: 0.8)
  . TracerBlue          Red component of the tracer color (default value: 0)

Custom shell models are 'Objects' (the ones you can add to 'Items' in the modding menu, but there's no need to put these ones in an 'Item') with the following tag in their description (for Id 1334):
[CustomShellModel 1334]
The Ids must be greater or equal to 10, and unique
In order to avoid Ids clashes, I advise modders to not use any Id under 100 (we are likely to use these Ids for vanilla custom models).
Also, it is a good practice for any mod using custom shell models to choose a base number and stick to it, for example a mode can choose 1000, and another one 1100, so the first mod can use Ids from 1000 to 1099 without problems.

Here is the 'APS shells' specific configuration:
These simple weapons will fire APS shells, so the player must assign ammo controllers to it.
The class to use is 'WorldWarCannonCustomShells'.
Here are the additional variables:

  . InaccuracyBonus     The inaccuracy bonus (default value: 1.0f)
  . MaxShellLength      The maximum shell length the weapon cann load in meters (default value: 0.5)
  . BarrelLength        The weapon's barrel length in meters (default value: 1)
 . DamageMultiplier    The damage multiplier (kinetic and HE) (default value: 1)

Note: this manual may evolve over time

Nice to see things easilly modable, even though in FtD I don't really use mods, just sometimes played around with em.
There is always a weak-spot if you search Hard enough.

If you fire enough AP at that shield, at some point you're going to come through.

There is no "best" I wouldn't even say there is anything universally good, Good is subjective, I find everything bad even if it's in theory good against this or that.


Manual updated to add the simple weapons firing APS shells.

- 'NoDynamicPitch' added to all weapons
- 'DamageMultiplier' added to custom shells weapons

- 'S' GUN variable
- 'ShellModel' variable can now use custom shell models

Forum Jump:

Users browsing this thread:
1 Guest(s)