Skip to content

Logistics Setup

HakonRydland edited this page Nov 21, 2022 · 13 revisions

Basics

Antistasi uses a custom logistics system that allows the loading of cargo and mounting of turrets to vehicles, this system is based on vehicle nodes and cargo data to determine if and how to load/mount cargo to vehicles

The data for all this is contained within one of the following: ConfigFile >> A3A, ConfigFile >> CfgVehicles >> {Vehicle class}, or MissionConfigFile >> A3A.

For Data contained on the vehicle/cargo it is simply contained in the class A3A_Logistics_Nodes/A3A_Logistics_Cargo respectivly.

For the rest its in the class A3A_Logistics_Cargo >> {Class name/model}/A3A_Logistics_Nodes >> {Class name/model} respectivly, this is regardless of its the config or mission config file.

The prioritisation for the nodes/cargo are as follows:

  • MissionConfig
    • Class name based
    • Model based
  • CfgVehicles
  • Config
    • Class name based
    • Model based

All Antistasi nodes are defined in the config and prefere model based where possible, this gives 3rd party extensions and vehicle makers the abbility to overwrite the default nodes/cargo data.

Adding a vehicle

The file structure

Config.cpp

This is a boiler plate example of the most basic config.cpp for node definitions that we recomend.

#include "script_component.hpp"

class CfgPatches {
    class ADDON {
        name = COMPONENT_NAME;
        units[] = {};
        weapons[] = {};
        requiredVersion = REQUIRED_VERSION;
        requiredAddons[] = {};
        author = AUTHOR;
        authors[] = { AUTHORS };
        authorUrl = "";
        VERSION_CONFIG;
    };
};

class A3A {
    #include "CfgLogistics.hpp"
};

CfgLogistics.hpp

this is the main file to gather all the logistics data in a orderly fasion.

//add a define to cheat the macro for 3rd party development (this is only for external mods)
#undef TRIPLES(var1,var2,var3)
#define TRIPLES(var1,var2,var3) A3A_Logistics##_##var2##_##var3

class A3A_Logistics_Nodes
{
    class A3A_Logistics_Nodes_Base; //import base class
    #include "Nodes\yourModFile.hpp" //hpp file for your mods vehicle nodes
};

class A3A_Logistics_Cargo
{
    class A3A_Logistics_Cargo_Base //import base class;
    #include "Cargo\yourModFile.hpp" //hpp file for your mods cargo definitions
};

//re-define the triples macro (this is only for external mods)
#undef TRIPLES(var1,var2,var3)
#define TRIPLES(var1,var2,var3) ##var1##_##var2##_##var3

this would give you a file structure as follows:

  • Mod folder (Example: A3AE)
    • addons
      • your addon folder (Example: Logistics)
        • Config.cpp
        • CfgLogistics.hpp
        • Nodes
          • yourModFile.hpp (Example: Vanilla.hpp)
        • Cargo
          • yourModFile.hpp (Example: Vanilla.hpp)

Getting the node data

To make a vehicle capable to load cargo, use the function "A3A_Logistics_fnc_generateHardPoints" to generate a vehicle hard point array (the nodes may be a bit rough).

Example: [cursorTarget, [0,-0.7,-0.7],2.1, true] call A3A_Logistics_fnc_generateHardPoints;

where the parameters for the function are:

0. The vehicle your defining the hard points for
1. The start of the cargo plane, relative to model center
2. The length of the cargo plane
3. If the nodes are model based or vehicle (usefull if there many different vehicles use the same model with animations)

ArmA 3 Screenshot 2022 11 20 - 16 34 51 66 (2)

This will give you a generated class to copy past in to your node hpp file. if you followed the file structure above that would be {your mod}/addons/{Your addon}/Nodes/{yourModFile}.hpp ArmA 3 Screenshot 2022 11 20 - 16 45 38 90 (2)

Remember to verify the nodes by loading a cargo of both node size 1 and 2 in the vehicle afterwards (assuming it has two or more points). And to check for conflicting animations in the garage

Finally, you need to add in the seats occupied by each node, to do this:

  1. start the game with the newly added "logistics_vehicleHardpoints" entry
  2. load the vehicle full of size 1 cargo (Example: "Box_IND_Wps_F")
//spawns crate and adds load action to it
private _object = "Box_IND_Wps_F" createVehicle getPos player;
[_object] call A3A_logistics_fnc_addLoadAction;
  1. while looking at the vehicle run this command in debug console. vic = cursorObject;

  2. then run this command moveOut player; player moveInCargo [vic, 0]

Increasing the number at the end until your put back in the first seat, and for each increase fill in the seat number into each node where you collide with the cargo (the nodes go from front to back).

Example from vanilla logistics nodes:

//Offroad node definitions before adding the blocked seats
class A3_soft_f_Offroad_01_Offroad_01_unarmed_F : TRIPLES(ADDON,Nodes,Base)
{
    class Nodes
    {
        class Node1
        {
            offset[] = {-0.05,-1.3,-0.683};
            seats[] = {};
        };
        class Node2
        {
            offset[] = {-0.05,-2.3,-0.683};
            seats[] = {};
        };
    };
};
//Offroad node definition with the blocked seats added
class A3_soft_f_Offroad_01_Offroad_01_unarmed_F : TRIPLES(ADDON,Nodes,Base)
{
    class Nodes
    {
        class Node1
        {
            offset[] = {-0.05,-1.3,-0.683};
            seats[] = {3,4};
        };
        class Node2
        {
            offset[] = {-0.05,-2.3,-0.683};
            seats[] = {1,2};
        };
    };
};

Here we fill in the seat number into the empty array in the nodes.

Note: if the vehicle is covered or closed, you need to canLoadWeapon = 0; to it's class.

class A3_soft_f_Offroad_01_Offroad_01_unarmed_F : TRIPLES(ADDON,Nodes,Base)
{
    canLoadWeapon = 0;
    class Nodes
    {

Adding a cargo type

To add a cargo type you need to add an entry to logistics_attachmentOffset, this array consists of elements like this [Model, Offset from hardpoint, Rotation, Size, Recoil (only for weapons)]

Model: the model same as with vehicles, you can alternatively get this by using classname and this function "_classNameToModel"

  • Example: "Box_NATO_AmmoVeh_F" call _classNameToModel

Offset: This is the relative offset to the bottom of the cargo you want to load. for the most part its just a bit positive on the Z-axis.

  • Example: [0,0,0.85]

But some vehicles have there center off from cargo plane center, here youd need to adjust the X-axis as well

  • Example: [-0.1,0,0.85]

Rotation: This is model relative rotation between the vehicle and the cargo, simple trial and error works fine here

  • Example: [1,0,0]

Size: how many vehicle hardpoints this cargo needs, usually sorted into visual size of how big it is from small (1 node), medium (2) to large (6), you can go beyond this as you see fit.

  • Example: 2

Recoil: This is only needed when the new cargo is a weapon (static) and defines how hard the weapon should affect the vehicle. (leave empty for non-weapon cargo)

  • Example: 500

so the resulting example array would look like this: ["Box_NATO_AmmoVeh_F" call _classNameToModel, [0,0,0.85], [1,0,0], 2] (the recoil was left out as this is a crate and not a weapon) ["Box_NATO_AmmoVeh_F" call _classNameToModel, [0,0,0.85], [1,0,0], 2, 500] (if left in, works fine too)

In addition if your adding a weapon, you need to add its model name to "logistics_weapons" along with a list of blacklisted vehicles its not allowed on (usually empty array)

  • Example: ["B_static_AT_F" call _classNameToModel, []] (no unique blacklisted vehicles)
  • Example 2: ["B_Mortar_01_F" call _classNameToModel, ["C_Boat_Civil_01_F" call _classNameToModel, "B_Boat_Transport_01_F" call _classNameToModel, "C_Boat_Transport_02_F" call _classNameToModel]] (this mortar is not allowed on boats, so we added the boats to the blacklist)