Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AFL Docs

What is AFL?

AFL - Selkie Medical Mod (AFL) is an Arma 3 mod that aims to add medical functionality to ACE and KAM medical systems, with the aim to enhance and fix both mods.

This mod was created for the Selkie Platoon, an OPTRE Arma 3 unit. However, it does not have any dependencies on OPTRE or any unit-specific mods and therefore can be used by anyone.

Contributing

AFL is free and open source. You can find the source code on GitHub. Bug reports and feature requests can be posted on the issues page. You can also track the status of this project on the projects page. If you wish to contribute to this project, please read the contributor's guide!

License

AFL is licensed under the GNU Public License v3.0.

Installation

AFL can be installed by subscribing to the mod on the Steam Workshop or by installing manually. Subscribing in the workshop is the recommended way to install AFL.

Dependencies

AFL requires the following dependencies to be installed either via the workshop or manually.

Steam Workshop

AFL can be downloaded via the Steam Workshop or from GitHub. Downloading from the Steam Workshop is the recommended way.

Subscribing

Navigate to the AFL Workshop Page and subscribe to the mod.

Selkie Medical Mod. On the right, there is a green button with a checkmark that says

Once subscribed to, the mod will begin downloading automatically.

Updating

Steam Workshop mods are managed by the Steam client and should update automatically.

Note

Sometimes, Steam Workshop mods fail to update automatically. If so, force the mod to update by going to the "Mods" category in the Arma 3 launcher, expanding the "AFL - Selkie Medical Mod" entry, opening the "..." menu, and clicking on the "Verify" option.

GitHub

If you wish to use a specific version of AFL (i.e. do not wish to have automatic updates) or you do not want to use the Steam Workshop for managing your mods, you can download and install AFL manually on GitHub.

Downloading

Each AFL release can be downloaded on the Releases Page on GitHub.

Once downloaded, extract the archive (e.g. AFL_v0.6.8.zip) file into your directory of choice. The mod can then be added as a local mod via the Arma 3 launcher.

Updating

To update a mod that is installed manually, download a new version from GitHub and replace the files you installed on your file system.

Loading AFL

Once installed, AFL can be loaded in the Arma 3 Launcher. To load a mod, navigate to the "Mods" section in the launcher. Then, find AFL in the list of installed mods and click the check mark on the right to load it.

Features

This chapter covers the most important features of AFL and how to use them. This chapter will cover the firing range, the medical simulator, medical tweaks, and the status monitor. This chapter does not cover all features of AFL exhaustively, but should give you a good idea to what to expect from the mod.

Firing Range

AFL adds Selkie_FiringRange.Stratis, a firing range map that includes targets, a medical simulator, and a vehicle spawner.

Medical Simulator

AFL includes a medical simulator interface for practicing KAT Advanced Medical.

Includes the following functions:

  • Spawn and apply medical conditions to patients:
    • Wounds.
    • Airway.
    • Cardiac arrest.
    • Pneumothorax.
    • Fractures.
  • Preset system.

Medical Tweaks

AFL modifies the behavior of ACE Medical and KAT Advanced Medical. This page lists some of the important tweaks and fixes.

Dressing Vacuum (NPWT)

The NPWT has always been broken in KAM. Where it would often not bandage and stitch the patient in one go, and would kick the medic out of the medical menu as well. AFL completely rewrites the NPWT functions to address these issues.

The NPWT now bandages and stitches the patient's wounds fully. It also returns the medic back to the medical menu on completion. The NPWT now can be used on bruises and body part trauma, not just when there are open or bandaged wounds.

Neck Tourniquets

Whereas the original neck tourniquet feature was an April Fools joke by the KAM developers1, AFL turns this joke feature into a real feature.

Medics can now apply a tourniquet to a patient's neck. This stops bleeding, but stops breathing, causes pain, increases then decreases heart rate, and eventually causes cardiac arrest.

IV Enhancements

Bag Type Display

ACE Medical Menu body part overview now shows the amount and types of IV bags on a body part and their progress.

Clog Chance

AFL adds an option (disabled by default) for IV lines to clog based on fluid coagulation factor. Clearing blocked lines now only requires pushing saline though the line and does not require a separate action.

Flow Rate Rework

Note

As maximum flow rate is capped by catheter diameter, reworked flow rates may be unacceptably slow (e.g. a 16g IV is capped at 180ml/min). If that is the case, server operators can increase the "IV Transfusion Flow Rate" setting in the ACE Medical CBA settings. A flow rate multiplier of 4-5 is recommended for most groups.

AFL changes the behavior IV flow rates. The flow rate of IV lines now depends on blood pressure and fluid viscosity and is capped by the flow rate of the respective catheters (e.g. 16g IV and FAST IO). Flow rate is calculated using the following equation:

\[Q = \min((Q_{max}K_{\eta}K_{BP}),Q_{max})\]

Where \(Q\) is the volumetric flow rate in ml/s, \(Q_{max}\) is the maximum flow rate of a catheter (3ml/s for 16g IV, 1.33ml/s for IO), \(K_{\eta}\) is the fluid viscosity coefficient (1 for saline, 0.85 for plasma, 0.5 for blood. Based on relative viscosities for each fluid.2), and \(K_{BP}\) is the blood pressure coefficient.

\(K_{BP}\) is extrapolated from flow rate data by Kim et al.3 and is calculated using the following equation:

\[K_{bp} = -0.01 P_{MAP} + 1.93\]

Where \(P_{MAP}\) is the patient's mean arterial pressure.

\(P_{MAP}\) is calculated using the following equation:

\[P_{MAP} = \frac{1}{3} P_{SBP} + \frac{2}{3} P_{DBP} \]

Where \(P_{SBP}\) is systolic blood pressure in mmHg and \(P_{DBP}\) is diastolic blood pressure in mmHg.


  1. Removed on Jul 31, 2024.

  2. ‘12.4: Viscosity and Laminar Flow; Poiseuille’s Law’, Physics LibreTexts, 1 November 2015, sec. 12.4.1, https://phys.libretexts.org/Bookshelves/College_Physics/College_Physics_1e_(OpenStax)/12%3A_Fluid_Dynamics_and_Its_Biological_and_Medical_Applications/12.04%3A_Viscosity_and_Laminar_Flow_Poiseuilles_Law.

  3. Nayoung Kim, Hanna Lee, and Jeongwon Han, ‘Comparison of Fluid Flow Rates by Fluid Height and Catheter Size in Normal and Hypertensive Blood-Pressure Scenarios’, Healthcare 12, no. 23 (December 2024): 2445, https://doi.org/10.3390/healthcare12232445.

Status Monitor

AFL adds a status monitor item that adds HUD overlay showing heart rate of units in player's group. Includes TL variant that shows distance instead of heart rate.

To open the status monitor, open ACE Self Interact > Equipment > AFL Status Monitor.

The names of the status monitor items can be found in the Class Names section.

Settings

Settings for AFL are implemented using the CBA Settings Framework. This chapter covers what settings are available and what each setting does.

Medical Settings

Settings for the AFL Medical component.

Contents

Bandaging

Settings for adjusting bandage time.

Base Bandage Time (S)

Time in seconds for bandaging small wounds.

Type: Slider

Range: 0-20s

Default: 4s

Base Bandage Time (M)

Time in seconds for bandaging medium wounds.

Type: Slider

Range: 0-20s

Default: 6s

Base Bandage Time (L)

Time in seconds for bandaging large wounds.

Type: Slider

Range: 0-20s

Default: 6s

Dressing Vacuum (NPWT)

Allow Self Treatment

If enabled, allows medic to use dressing vacuum on self.

Type: Dropdown

Options:

  • No
  • Body and Legs Only
  • Yes

Default: No

NPWT Bandage Time

Time in seconds for dressing vacuum to bandage wound.

Type: Slider

Range: 0-15s

Default: 5s

NPWT Stitch Time

Time in seconds for dressing vacuum to stitch wound.

Type: Slider

Range: 0-15s

Default: 3s

Normalize NPWT Time

When enabled, dressing vacuum treatment time takes body part damage into account. Total time is calculated with the following equation:

\[{t_{total}} = (1 - p)({t_{bandage}} + {t_{stitch}}) + pmd\]

Where \(t \) is time in seconds, \(p \) is the normalize proportion (50% = 0.5), \(m \) is the body part damage multiplier, and \(d \) is body part damage.

Type: Checkbox

Default: True

Body Part Damage Proportion

Proportion of body part damage in percent that makes up total NPWT treatment time.

Type: Slider

Range: 0-100%

Default: 50%

Body Part Damage Multiplier

Multiplier to multiply body part damage to.

Type: Slider

Range: 0-5

Default: 1.25

Tourniquet

Settings for neck tourniquet behavior.

Enable Neck Tourniquet

Enables the ability to tourniquet necks.

Type: Checkbox

Default: False

IV

Enable IV Fluid Blocking

When enabled, fluids have a chance to block IV lines depending on viscosity.

Type: Checkbox

Default: False

IV Block Chance Coefficient

Where a coefficient of 1 equals 0.1% block chance per coagulation value (e.g. Plasma 1000ml has coagulation value of 20).

Type: Slider

Range: 0.05-10

Default: 1

Status Monitor Settings

Settings for the Status Monitor component.

Contents

Server Settings

Update Interval (s)

Interval in seconds of how often status monitor updates.

Type: Slider

Range: 0-10s

Default: 5s

Range (m)

Distance between player and unit in meters before monitor shows as out of range.

Type: Slider

Range: 0-1000m

Default: 100m

X on PR 0

Show X if unit is in cardiac arrest.

Type: Checkbox

Default: False

Out-of-Range

Show OOR indicator if unit is out of range.

Type: Checkbox

Default: False

Client Settings

Text Color

Color of text, including unit name, PR, and icons.

Normal Color

Color when unit heart rate is in normal range.

Abnormal Color

Color when unit heart rate is not in normal range.

Out-of-Range Color

Color when unit is out-of-range.

Critical Color

Color when unit has a heart rate of 0 or out of range.

Heart Color

Color of heart icon.

Building AFL

This repo uses HEMTT for building and packaging.

Info

These instructions are intended for use on Microsoft Windows. They are not guaranteed to work on other operating systems.

Clone Repo

Clone the AFL repo using git.

git clone https://github.com/flufflesamy/AFL

Install HEMTT

To install HEMTT on Windows, run the following command:

winget install BrettMayson.HEMTT

Using HEMTT to Build AFL

To build a development version, run:

hemtt dev

The following command launches a development version of the mod:

hemtt launch

To build a release version, run:

hemtt release

For more information on HEMTT, refer to the HEMTT Book.

Hot Reload

AFL supports function hot reload when using file patching. This allows developers to recompile functions without restarting Arma 3 or even their mission, speeding up debugging considerably.

Note

Hot reload only applies to functions that are registered with PREP(). Therefore, new functions added after starting the game will require a restart.

Similarly, hot reload does not reload config files. Any changes to them will require a game restart.

Preparing for Hot Reload

In order for hot reload to work, file patching and DEBUG_MODE_FULL must be enabled. When using the hemtt launch command, this will be done automatically, and no other action is required.

Reloading Functions

In the Arma 3 debug console, run the following command:

[] call AFL_PREP_RECOMPILE;

All functions in the project that are registered with PREP() in a component's XEH_PREP.hpp file will now be recompiled.

Frameworks

This chapter lists the frameworks that developers can use to make their mods, missions, and scripts work with AFL.

Warning

As AFL is still in pre-release development, the frameworks API is not stable. Use these frameworks in your mod at your own risk.

Medical Simulator Framework

While the firing range mission provides a medical simulator, mission makers may still want to add their own medical simulator in their missions.

Mod makers can also add custom presets to the medical simulator.

Adding a Simulator Console

The Medical Simulator can be added to any mission by calling the afl_medicalsim_fnc_addSimMenu function in a mission or an eden object's init function.

Example

The following code adds medical simulator functionality to an eden editor object.

// File: init.sqf

// Initialize medical simulator

// Define list of stretchers to spawn patients on
// [object, "Display Name"]
private _stretchers = [
    [stretcher_1, "Stretcher 1"]
    // ...
];

// Create medical simulator console
[console_1, _stretchers] call afl_medicalsim_fnc_addSimMenu;

Adding a Preset

Mod makers can add custom presets to the AFL Medical Simulator by adding entries to the AFL_Medicalsim_Presets class in the config.cpp file of their mod. The preset will then be automatically parsed by the medical simulator and shown in the "Presets" section.

Example

Presets are written in the following format, where the ranges given are written in interval notation.

// File: AFL_MedicalSim_Presets.hpp

class AFL_MedicalSim_Presets {
  // Presets should inherit from this class
  class Base;

  class My_Preset : Base {
      // Wounds
      // {N} for number of wounds per bodyPart: [0,10]
      // {L, M, H} for range random chance: [0,10], [0,10], [0,10]
      wounds[] = {
          {1}, // Head
          {2}, // Torso
          {3}, // Left Arm
          {1, 5, 10}, // Right Arm
          {2, 7, 14}, // Left Leg
          {1, 2, 3} // Right Leg
      };

      // Circulation
      // ARREST_TYPE ["none", "asystole", "pea", "vf", "vt"]
      arrestType = 0.5; // Chance: [0,1); Type: [1..4]
      PAO2 = 97; // PAO2: [0..100]

      // Airway
      occluded = 0; // Chance: [0,1]
      obstructed = 1; // Chance: [0,1]

      // Pneumothroax
      // PNUMO_TYPE ["none", "initial", "tension", "hemo"]
      ptxType[] = {0.7, 0.5}; // {Type}: [0..3]; {Chance, Adv Chance}: [0,1], [0,1]
      ptxStrength = 1; // Strength: [1..4]
      ptxDeteriorate = 0.3; // Chance: [0,1]
      ptxTamponade = 0.8; // Chance: [0,1]

      // Fractures
      // {N} for fracture type: [0..3]
      // {Chance, Advanced fracture chance}: [0,1], [0,1]
      // FRACTURE_TYPE ["none", "simple", "compound", "comminuted"]
      fractures[] = {
          {0}, // Head (Unused)
          {0}, // Torso (Unused)
          {1}, // Left Arm
          {2}, // Right Arm
          {3}, // Left Leg
          {1, 0.6} // Right Leg
      };

      // Misc
      uncon = 0.75; // Chance: [0,1]
  };

  // Presets can also be partial
  class My_Partial_Preset : Base {
      arrestType = 4; // VT
      uncon = 1; // 100% chance of uncon
  };
};

Status Monitor Framework

Any item can be made into a Status Monitor by adding properties into the CfgWeapons class of your addon's config.cpp file.

Adding a Status Monitor

To add a regular status monitor, set the property AFL_isMonitor = 1. To add a TL status monitor, set the property AFL_isMonitor = 2.

Example

The following code adds status monitor functionality to an item:

// File: config.cpp

class CfgWeapons {
    // Your item class
    class My_Item : CBA_MiscItem {
      // Where 1 = Regular, 2 = TL
      AFL_isMonitor = 1;

      // Rest of your code
      // ...
    };
};

Functions

This chapter contains public API functions for use by developers to interface with AFL.

Warning

As AFL is still in pre-release development, the functions API is not stable. Use these function in your mod at your own risk.

Medical Simulator Functions

This chapter lists public medical simulator functions that are available to developers.

Contents

afl_medicalsim_fnc_addSimMenu

Description

Adds a medical sim menu to an eden entity.

Parameters

  1. Eden entity <OBJECT>
  2. Stretchers <ARRAY>
    1. Stretcher <ARRAY>
      1. Stretcher Entity <OBJECT>
      2. Display Name <STRING>

Returns

Nothing.

Usage

Example

[
    _console,
    [
      [_stretcher, "Stretcher 1"],
      [_stretcher, "Stretcher 2"]
    ]
] call afl_medicalsim_fnc_addSimMenu;

Misc Functions

This chapter lists public misc functions that are available to developers.

Contents

afl_misc_fnc_addVehicleSpawner

Description

Creates a vehicle on a marker.

Parameters

  1. Eden Entity <OBJECT>
  2. Vehicle Name <STRING>
  3. Marker Name <STRING>

Returns

Nothing.

Usage

Example

[
    _vehicleConsole,
    "OPTRE_FC_Wraith_Tank",
    "mkrVehClose"
] call afl_misc_fnc_addVehicleSpawner;

afl_misc_fnc_hasItem

Description

Checks if unit has an item.

Parameters

  1. Unit <OBJECT>
  2. Item <STRING>

Returns

  1. Has Item <BOOL>

Usage

Example

[player, "AFL_statusMonitor"] call afl_misc_fnc_hasItem;

afl_misc_fnc_isDestroyed

Description

Checks if a vehicle is destroyed.

Parameters

  1. Vehicle <OBJECT>

Returns

  1. Is Destroyed <BOOL>

Usage

Example

[_veh] call afl_misc_fnc_isDestroyed;

Events

Event handlers in AFL are implemented through CBA's eXtended Event Handler (XEH) system. This chapter lists the XEH events that AFL registers, the parameters they pass, and the functions that handle them.

XEH events can be raised using CBA XEH functions. For instance, the function CBA_fnc_targetEvent raises a local event on the target's machine.

For more information on XEH, refer to CBA's XEH Documentation.

Warning

As AFL is still in pre-release development, the events API is not stable. Use these events in your mod at your own risk.

Medical Events

The following are events registered by afl_medical.

Contents

afl_medical_neckTourniquetLocal

Parameters

  1. Patient (OBJECT)
  2. Body Part (STRING)

Usage

Example

The following code raises the event to be handled by AFL.

[
    "afl_medical_neckTourniquetLocal",
    [player, "leftarm"],
    player
] call CBA_fnc_targetEvent;

The following code registers the event to be listened.

// File: XEH_postInit.sqf

[
    "afl_medical_neckTourniquetLocal",
    LINKFUNC(myFunction)
] call CBA_fnc_addEventHandler;

Class Names

This chapter lists class names in AFL that developers can use.

CfgVehicles

Classes added by AFL in CfgVehicles.

Status Monitor

Class NameIn-Game NameType
AFL_Item_StatusMonitorAFL Status MonitorItem_Base_F
AFL_Item_StatusMonitorLiteAFL TL MonitorItem_Base_F

CfgWeapons

Classes added by AFL in CfgWeapons.

Status Monitor

Class NameIn-Game NameType
AFL_StatusMonitorAFL Status MonitorCBA_MiscItem
AFL_StatusMonitorLiteAFL TL MonitorCBA_MiscItem

Contributors

AFL is made possible by the following contributors!

If you contributed to AFL but are not on this list, please make a pull request to add yourself in.

Special Thanks

The ACE Team and KAM Contributors projects for writing the medical system that AFL modifies.

The CBA Team for writing Arma's foundational modding library.

Members of the Selkie Platoon for requesting features and helping test AFL.