Skip to content

Facewear Randomization

jonpas edited this page Sep 7, 2019 · 2 revisions

Introduction

Facewear Randomization is a simple config framework allowing randomization of facewear (such as glasses) during unit initialization using config-defined weighted randomness. It can be seen as a replacement for BIS_fnc_unitHeadgear/allowedHeadgear but instead of being located in headgear's config, it resides in unit's config and works exactly like headgearList[].

Usage

Randomization function runs automatically on unit's initialization, to use it one must simply define CBA_facewearList[] in the config of the unit as seen in the following examples:

class CfgVehicles {
    class MyUnit {
        // Default - ignore and use facewear from BIS_fnc_unitHeadgear instead
        CBA_facewearList[] = {};

        // No facewear - delete and overwrite facewear from BIS_fnc_unitHeadgear
        CBA_facewearList[] = {"", 1};

        // Weighted randomization - sum of propabilites must not necessarily equal 1
        CBA_facewearList[] = {
            "", 0.4,                // 40% no facewear
            "G_Balaclava_blk", 0.3, // 30% balaclava
            "G_Bandanna_blk", 0.3   // 30% bandana
        };
    };
};

Disable Randomization

Additionally, Facewear Randomization supports the following ways of disabling randomization on a given unit or class: