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 Intructions
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. Thier primariy 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:

 

Back to overview


 

The Torpedoes

West:

 

 


East:


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.

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:

RC1:

BETA2:

BETA1: First Beta Release


Back to overview


Copyright © 2002 The Chain Of Command. 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.