Home ] Contents ] Search ] Contact ] Links ] Feedback ] Home ]

Torpedoes 1.0 + CoC Torpedo Test Vehicles 1.0

Torpedoes have been the essence of modern naval warfare for over 100 years. The Chain of Command is proud to present the first torpedo addon for OFP.

DOWNLOAD ADDON


Overview:

Quick Instructions
The Torpedoes
Test Mission
Multiplayer
Notes for addon makers
   -Creating units using torpedoes
   -Creating your own torpedoes
Revision History


 

Quick Instructions

Installation

This package includes the CoC Torpedoes and 5 sample air units (Torpedo Test Vehicles) armed with the available torpedoes (3 West, 4 East). To install the package copy the (the Torpedoes addon) CoC_Torpedoes.pbo and (the Torpedo Test Vehicles) CoC_ttv.pbo to your OFP addon directory.

Note: You do not have to install the sample units. They are not meant to be military or even physically accurate. Their primary purpose is showing addon makers how torpedoes can be fitted to vehicles and to showcase how the torpedoes can be seamlessly integrated into the standard OFP weapon system.

Usage
The Torpedo Test Vehicles (TTVs) can be found under the (West&East) "CoC - Vehicles" class and are ready to use as is.

Active torpedoes that you can put in the water can be found under (Empty) CoC - Ordnance.

To add torpedos to any other vehicle (boat or aircraft - NOT including the TTVs) you have to add one line in the unit's INIT field:

[this, torpedoName, torpedoCount] exec "\Coc_Torpedoes\init\init.sqs"

where torpedoName is one of the following (including quotes):

"CoC_Mk48"
"CoC_Mk46"
"CoC_Mk50"
"CoC_5365KE"
"CoC_APR3E"
"CoC_Shkval"
"CoC_ShkvalNuc"

torpedoCount is the number of torpedoes. Should always be larger than 0 which is reserved for addons where the weapons are added through the config.cpp (see this section for details on addon making). If you are using a vehicle that has missiles/bombs by default then the torpedoCount should preferably be set to the number of missiles/bomb the vehicle has by default. This is because the torpedoes will be mounted on the positions where the missiles/bombs were in the default case.

Example: (adds 8 Mk-46 torpedoes to the vehicle):

[this, "CoC_Mk46", 8] exec "\Coc_Torpedoes\init\init.sqs"

Note: If you wish to see the torpedoes attached to the vehicle, then you must issue a removeAllWeapons command before the torpedo init command:

removeAllWeapons(this); [this, "CoC_Mk46", 8] exec "\Coc_Torpedoes\init\init.sqs";

You can after that add more weapons. Note that you don't have to remove the weapons. The torpedoes will still be added and you can use them - the only difference is visual that the torpedoes then won't be attached below the vehicle.

For a full overview of the available torpedoes see below (here).
For instructions for addon makers see below (here)

Additional notes:
Note on the Nuclear Shkval underwater missile: Although it's low-yield it's still a nuke, don't be near it when it detonates ;-) Nominal safe distance at sea level is 900-1000m.

Known Issues:

  • Torpedo fired from a generic boat (that hasn't been created with the torpedoes in mind) will cause a brief muzzle flash from the main gun.
     
  • AI likes from time to time drop torpedoes on land targets, often getting itself killed in the process.
     
  • The release of the torpedoes from underneath a generic aircraft that hasn't been made with the torpedoes in mind will most likely drop in the incorrect order. This can only be avoided through making an addon out of that vehicle. See "Creating units using torpedoes" section for details.
     
  • In Multiplayer torpedoes may display erratic behavior for a second or two before detonating when hitting ground (above sea level). This is due to synchronization lag that may occur. See Multiplayer section for details.
     
  • Torpedo propeller does not spin in Multiplayer. Tough luck ;-)

 

Back to overview


 

The Torpedoes

West:

  • Mk-48 Heavyweight torpedo
     
    Location (Active Torpedo):
    [Empty]->[CoC_Ordnance]->[Mk-48]
    Add to a unit (in the INIT field of the unit):
    [this, "CoC_Mk48", 2] exec "\CoC_Torpedoes\init\init.sqs"
    (adds two torpedoes to the unit)

    Properties (OFP):
    Max Speed: 20 m/s
    Max Range: 5,000 m
    Min Range: 100 m
    Scan Range: 1,200 m
    Scan Angle: 70 degrees

    Notes for addon makers:
    Active torpedo name: CoC_Mk48
    Model name: "\CoC_Torpedoes\mk48\mk48"
    Ammo: CoC_Mk48P, CoC_Mk48PB
    Weapons: Mk48Launcher, CoC_Mk48LauncherBoat

 

  •  Mk-46 Lightweight torpedo
     
    Location (Active Torpedo):
    [Empty]->[CoC_Ordnance]->[Mk-46]
    Add to a unit (in the INIT field of the unit):
    [this, "CoC_Mk46", 3] exec "\CoC_Torpedoes\init\init.sqs"
    (adds three torpedoes to the unit)

    Properties (OFP)
    Max Speed: 30 m/s
    Max Range: 2,000 m
    Min Range: 75 m
    Scan Range: 500 m
    Scan Angle: 30 degrees

    Notes for addon makers:
    Active torpedo name: CoC_Mk46
    Model name: "\CoC_Torpedoes\mk46\mk46"
    Ammo: CoC_Mk46P, CoC_Mk46PB
    Weapons: Mk46Launcher, CoC_Mk46LauncherBoat

 

  •  Mk-50 Advanced Lightweight torpedo
     
    Location (Active Torpedo):
    [Empty]->[CoC_Ordnance]->[Mk-50]
    Add to a unit (in the INIT field of the unit):
    [this, "CoC_Mk50", 4] exec "\CoC_Torpedoes\init\init.sqs"
    (adds four torpedoes to the unit)

    Properties (OFP)
    Max Speed: 35 m/s
    Max Range: 2,000 m
    Min Range: 75 m
    Scan Range: 500 m
    Scan Angle: 30 degrees

    Notes for addon makers:
    Active torpedo name: CoC_Mk50
    Model name: "\CoC_Torpedoes\mk50\mk50"
    Ammo: CoC_Mk50P, CoC_Mk50PB
    Weapons: Mk50Launcher, CoC_Mk50LauncherBoat


East:

  • 53-65KE Heavyweight torpedo
     
    Location (Active Torpedo):
    [Empty]->[CoC_Ordnance]->[53-65KE]
    Add to a unit (in the INIT field of the unit):
    [this, "CoC_5365ke", 1] exec "\CoC_Torpedoes\init\init.sqs"
    (adds one torpedo to the unit)

    Properties (OFP)
    Max Speed: 25 m/s
    Max Range: 4,000 m
    Min Range: 100 m
    Scan Range: 1000 m
    Scan Angle: 50 degrees

    Notes for addon makers:
    Active torpedo name: CoC_5365KE
    Model name:"\CoC_Torpedoes\53-65KE\5365ke"
    Ammo: CoC_5365KEP, CoC_5365KEPB
    Weapons: CoC_5365KELauncher, CoC_5365KELauncherBoat

     

  • APR-3E Lightweight missile/torpedo
     
    Location (Active Torpedo):
    [Empty]->[CoC_Ordnance]->[APR-3E]
    Add to a unit (in the INIT field of the unit):
    [this, "CoC_APR3e", 2] exec "\CoC_Torpedoes\init\init.sqs"
    (adds two torpedoes to the unit)

    Properties (OFP)
    Max Speed: 37 m/s
    Max Range: 2,000 m
    Min Range: 40 m
    Scan Range: 600 m
    Scan Angle: 40 degrees

    Notes for addon makers:
    Active torpedo name: CoC_APR3E
    Model name: "\CoC_Torpedoes\APR-3E\apr3e"
    Ammo: CoC_APR3EP, CoC_APR3EPB
    Weapons: CoC_APR3ELauncher, CoC_APR3ELauncherBoat

     

  • F-111k "Shkval" Underwater rocket
     
    Location (Active Torpedo):
    [Empty]->[CoC_Ordnance]->[Shkval]
    Add to a unit (in the INIT field of the unit):
    [this, "CoC_Shkval", 2] exec "\CoC_Torpedoes\init\init.sqs"
    (adds two torpedoes to the unit)

    Properties (OFP)
    Max Speed: 120 m/s
    Max Range: 2,000 m
    Min Range: 60 m
    Scan Range: 600 m
    Scan Angle: N/A

    Notes for addon makers:
    Active torpedo name: CoC_Shkval
    Model name: "\CoC_Torpedoes\Shkval\shkval"
    Ammo: CoC_ShkvalP, CoC_ShkvalPB
    Weapons: CoC_ShkvalLauncher, CoC_ShkvalLauncherBoat

     

  • F-111k-A "Shkval" Underwater rocket with low yield 1 kt nuclear warhead
     
    Location (Active Torpedo):
    [Empty]->[CoC_Ordnance]->[Shkval Nuclear]
    Add to a unit (in the INIT field of the unit):
    [this, "CoC_ShkvalNuc", 2] exec "\CoC_Torpedoes\init\init.sqs"
    (adds two torpedoes to the unit)

    Properties (OFP)
    Max Speed: 100 m/s
    Max Range: 4,000 m
    Min Range: 60 m
    Scan Range: 600 m
    Scan Angle: N/A

    Notes for addon makers:
    Active torpedo name: CoC_ShkvalNuc
    Model name: "\CoC_Torpedoes\Shkval\shkvalN"
    Ammo: CoC_ShkvalNucP, CoC_ShkvalNucPB
    Weapons: CoC_ShkvalNucLauncher,CoC_ShkvalNucLauncherBoat


Back to overview


Test Mission

One test mission is included in the pack called "CoC_TorpedoTest.Intro". You can try out the various torpedoes mounted on different vehicles in a target rich environment. To install the mission copy the "CoC_TorpedoTest.Intro to your editor mission directory.

Back to overview


 

Multiplayer

The torpedoes are fully MP compatible and ready to use as is. In theory it should function the same way as in SP.

In practice the appearence of the torpedoes depends higly on the bandwith and number of users. The direction, velocity and position of the torpedoes are all synchronized over the network while the guidance system is executed only on the client that created it. Network lag may result in updates of the torpedo data being late to some clients leaving the torpedoes to be brutalized by the OFP physics engine during the information gap. This can have some effects on the visual appearence of the torpedoes: they may jump around and spin around  a bit until the next update is recieved over the network. The function of the torpedoes is however uneffected by that and a kill is a kill on all clients, it's just that the torpedo movements might look a bit weird on closer inspection. With a good server with high bandwith or in LAN games you won't notice any of this. Also the person that fires the torpedo won't have any of these symptoms since the updates are executed locally.

Back to overview


Notes for addon makers

The torpedoes are just a weapons pack. Their full potential will first be used once the talented addon makers of the OFP community start producing vehicles that use the torpedoes. To facilitate this process CoC is providing source files of the sample UH-60 torpedo carrying chopper  and an example of how to easily make new torpedoes using the CoC Torpedo system as a foundation.

Creating units using torpedoes

DOWNLOAD Torpedo Test Vehicles source

Adding torpedoes with proxies to a vehicle is almost identical to adding missiles to a vehicle. This document assumes that you already know how to do that. If not check out some of the excellent O2 tutorials that are on the web.

A brief understanding of how the torpedo system works will facilitate the usage of them in other addons. The torpedoes are actually not ordnance in OFP but vehicles (boats to be precise). To launch them a dummy weapon is used that is switched in mid air to the real thing. This is executed by a "fired" event handler that starts a script that makes the switch. A fact that complicates matters is that boats can't have missiles in OFP and that leads to that two different weapon systems and dummy ammo is needed: one for aerial vehicles (based on the LaserGuidedBomb) and one for boats (based on the Browning MG).

The process of adding the torpedoes consists of two steps:

  1. Adding proxies in O2
    This is done the normal way. Create proxy points and name them. You can see the proxy model names in the torpedo section above. Be sure to remember how you named them since the names are going to be used in the config.cpp later. If you are creating several versions of the same aircraft you only need to define one set of proxies. OFP can generalize for the others through definitions in config.cpp
     
  2. Writing a config.cpp
    The easiest way is to look at the TTV's commented cpp file and see how it is done. Four  things are generally required for the torpedoes to work:

    1. A custom set of weapons that extend the original torpedo launchers (here you can customize weapon count and reload time etc)
    From the UH-60T_Mk50 config: For the full list of weapons (launchers) see the torpedo section above
     
    class CfgWeapons
    {
    class Default {};
    class LAWLauncher: Default {};
    class CarlGustavLauncher : LAWLauncher {};
    class AT3Launcher: CarlGustavLauncher {};
    class HellfireLauncher: AT3Launcher {};
    class LaserGuidedBombLauncher: HellfireLauncher{};
    class CoC_Mk48Launcher:LaserGuidedBombLauncher{};
    class CoC_Mk50Launcher:CoC_Mk48Launcher {};

    class CoC_Mk50LauncherUH60: CoC_Mk50Launcher
    {


    count=2;


    };

    2.  A vehicle (what a surprise!  ;-) ) with the weapons and ammo added.
     

    class CfgVehicles
    {
    class All {};
    class AllVehicles: All {};
    class Air: AllVehicles {};
    class Helicopter: Air {};
    class UH60: Helicopter {};
    class CoC_uh60T_Mk50: UH60
    {


    vehicleClass="CoC - Vehicles";
    side=TWest;
    type = 2;
    displayName = "Uh-60 (Mk50)";
    transportSoldier = 10;
    model="\CoC_TTV\uh-60";
    maxSpeed=270;
    accuracy=0.20;
    armor=70;
    cost=10000000;
    weapons[]={CoC_Mk50LauncherUH60};
    magazines[]={CoC_Mk50LauncherUH60};

     

    3. And most important the following event handler added to the vehicle. Without it the torpedoes will not work!
    As you can see it is the exactly same call that is used when you add torpedoes to any other vehicles. Don't forget to change the bolded part to that type of torpedo you wish to use!

    class EventHandlers
    {
    init = " [_this select 0,{CoC_Mk50},0] exec {\CoC_Torpedoes\init\init.sqs}";
    };
     

    For custom user made torpedoes the EH looks slightly different. See the section below for more info.

    4.  And at last we need some definitions of the proxies made in O2. Only one per model is needed.
     

    class CfgNonAIVehicles
    {


    class ProxyWeapon{};
    class ProxyCoC_Mk50Proxy : ProxyWeapon
    {


    model="\CoC_Torpedoes\mk50\mk50";
    simulation="maverickweapon";


    };


    };

And that's it. Pretty simple: Create proxies in O2. Define and add weapons. Add the event handler. Add proxies in config.cpp

Back to overview

Creating your own torpedoes

DOWNLOAD "MY_TORPEDO" SOURCE

If you are planning on making some WW2 torpedo boats and feel that the nuclear Shkval is a bit out of context: Fear not! The CoC Torpedo system was designed with extensibility in mind. You can easily create a new torpedo with custom characteristics based on the original torpedoes. Three steps are required:

  1. Making a torpedo model. Nothing strange there. There is one custom animation used for the propeller roatation. The selection is called "propeller" and the axis of rotation "prop_axis". See the included Mk46 model in the My_Torpedo source.
     
  2. Creating a config.

    1. You have to define two weapons and two ammo types for each torpedo (one for boats and one for aircraft). The ammo classes should extend "CoC_Mk48P" and "CoC_Mk48PB" while the weapons should extend "CoC_Mk48Launcher" and "CoC_Mk48LauncherBoat". See the sample config.cpp for a practical example.

    2. You have to define the torpedo vehicle. This is done by extending the "CoC_Mk48" class. There you adjust the name of the torpedo and add event handlers for the guidance and for the detonation "splash" (or nuke mushroom!). The guidance system uses the "init" handler while the "splash" effect is controlled by the "fuel" event handler. An optional additional "engine" event handler can be assigned for a "trail" effect present on the Shkval torpedo. Let's take a closer look at the init EH which configures and starts the guidance system:
     
    // [vehicle, maxSpeed, maxRange, minRange, scanRange, sweepAngle, "warhead"] exec {\CoC_Torpedoes\scripts\DTMGuidance.sqs}";
    init = "[_this select 0,30,2000,75,500,30,""My_TorpedoP""] exec {\CoC_Torpedoes\scripts\DTMGuidance.sqs}";

    An expanation of the parameters:



    vehicle: A reference to the torpedo. Should always be set to "_this select 0"
    maxSpeed: Maximum speed of the torpedo in m/s. Think hard before implementing real-world values since boats in OFP are generally much faster than boats IRL.
    maxRange: Maximum range of the torpedo before it runs out of fuel.
    minRange: Minimum scan range for the torpedo. Torpedoes use their sonar (both active and passive) to avoid locking on to their own acustic signals. This is simulated by the min range parameter.
    scanRange: Maximum range for the scan cone (see illustration).
    scanAngle: Angle of the detection cone. Torpedoes will lock on targets within the detection cone: i.e within an angle between scan range and min range.
    warhead: the thing that goes "boom" and that you defined in your config ;-)

  3. Scripting

    You have to let the torpedo system know that your torpedo exists. This is handled by a script that registers your torpedo with the system. What you need is only one simple init script that serves as a front end for the user:
     
    ["My_Torpedo","My_TorpedoP","My_TorpedoPB"] call loadFile "\CoC_Torpedoes\init\regTorp.sqf"

    _this exec "\CoC_Torpedoes\init\init.sqs"
    exit
     

    The bolded line shows what you need to customize. The array contains the name of your torpedo, the name of the warhead and the name of the boat warhead. All those are definitions from the config.cpp. If you have several torpedoes in your pack you can simply just add them to the same array in the same way. Make sure however that you have three correct elements for each torpedo type or it will not work!

    If your torpedo is called as defined above and the script is init/init.sqs in your addon then the user can use the torpedo on any vehicle by putting this in the INIT line of the vehicle (identical to CoC torpedo syntax):
     

    [this, "My_Torpedo", 2] exec "\My_Torpedo\init\init.sqs



    If you intend to add the torpedo via proxies to a vehicle as described in this section then you have to change the init event handler to call your brand new init function.

    init = " [_this select 0,{My_Torpedo},0] exec {\My_Torpedo\init\init.sqs}";

     

    Back to overview


Revision History

1.0:

Release version

RC2:

  • Changed: Increased nuke (vertical) yield
  • Changed: Vastly simplified interface for using torpedoes via addons
  • Changed: CoC_UH-60T.pbo is now CoC_TTV.pbo
  • Fixed: Drop in velocity when deploying a torpedo from aircraft.
  • Fixed: Missing sound
  • Added: A-10 (Mk-50), A-10  (Mk-48) and Su-25 (53-65KE) vehicles to the Torpedo Test Vehicle pack

RC1:

  • Fixed: Dual fired event handler bug
  • Improved: Torpedo registration system now only needs one initial call
  • Changed: Initial speeds for some torpedoes reduced
  • Added: Documentation
  • Changed: Added CoC prefixes to torpedo call string so that the name of the torpedo and the string are identical.

BETA2:

  • Fixed: Torpedoes crashing into choppers when dropped from some angles
  • Fixed: Reload time for torpedo was too short so multiple torpedoes could be fired at once
  • Fixed: MP torpedo spawn bug that created several instances of a torpedo
  • Fixed: Chopper definition
  • Improved: Nuclear detonation and warhead
  • Added: New textures for the nuclear Shkval
  • Added: Individual minimum activation range for the torpedoes
  • Changed: Maximum range for the nuclear Shkval
  • Added: Torpedo registration system

BETA1: First Beta Release


Back to overview

 
S end mail to walker@thechainofcommand.com with questions or comments about this web site.
Copyright © 2002 The Chain Of Command. Images where stated are Crown Copyright © or Public Domain US Department of Defense.
Crown Copyright is reproduced with the permission of the Controller of Her Majesty's Stationery Office. Codemasters® is the registered trademark of Codemasters® Operation Flashpoint™and its Logo are trademarks of Codemasters®. All other copyrights or trademarks are the property of their respective owners. The Chain Of Command wishes to acknowledge the MOD British Army picture library http://www.army.mod.uk/ as the source of all Crown Copyright images used on this site.
Last modified: May 15, 2004