Adding Custom Aliases In Your Mod - NarcoMarshDev/Enforce-Script-Extensions GitHub Wiki

ESE Contains a class of aliases for easy references to resource names, constants, etc. You can add your own aliases to ESE in your own mod using the following steps.

Checking ESE Is Installed

To make sure your mod will work with or without ESE being installed and doesn't cause any errors, it's important to put everything to do with it in an '#ifdef' statement like the following:

#ifdef ESE_INSTALLED
// Your ESE additions here...
#endif

With this, you can ensure that none of your ESE code will get compiled if it isn't installed, and no errors should occur. (Except one potential scenario, see the known issues here.

When working within the #ifdef ESE_INSTALLED statement, you don't actually need ESE added as a dependency to your project for it to work (in fact I recommend against it for basic addons), although I highly recommend adding it temporarily to test that the alias is working correctly then removing it again before release.

Adding The Aliases

To add your own aliases to the ESE ones, you need to modify the ESE_Aliases class and ensure the alias is added under the right category. The different categories and standard naming schemes are:

Define⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Naming Scheme
ESE_ALIASES_MATERIALS ADDON_MAT_MATERIALNAME
ESE_ALIASES_WEAPONS ADDON_WEP_WEAPONNAME_VARIANT
ESE_ALIASES_ATTACHMENTS Use ADDON_OPTIC_, ADDON_UGL_, ADDON_HGUARD_ or what makes the most sense and is short, not set in stone
ESE_ALIASES_MAGAZINES ADDON_MAG_MAGAZINENAME_AMMOTYPE
ESE_ALIASES_EQUIPMENT ADDON_EQP_EQUIPMENTNAME
ESE_ALIASES_VEHICLES ADDON_VEH_VEHICLENAME_VARIANT
ESE_ALIASES_OTHER ADDON_RES_RESOURCENAME

Note: The ADDON_ prefix should be whatever shorthand name or abreviation you use for your addon, e.g. the base game uses the AR_ prefix for Arma Reforger, my wasteland mod uses WR_ for Wasteland Reforger, etc.

All aliases are a static const ResourceName, and are created using the CreateAlias() method with the path to the resource, and optionally a resource type descriptor using the enum ESE_ResourceType.

As an example I'm going to create a file in scripts/Game named ESE_Aliases_MyProjectName.c and add an alias for a custom M16A3 weapon resource from my wasteland mod, using ESE_ALIASES_WEAPONS.

#ifdef ESE_INSTALLED
modded class ESE_Aliases
{
    #ifdef ESE_ALIASES_WEAPONS
    static const ResourceName WR_WEP_M16A3 = CreateAlias("{9C38B35C2CC96D4B}Prefabs/Weapons/Rifles/M16/Rifle_M16A3.et", ESE_ResourceType.AssaultRifle);
    #endif
}
#endif

Note: Due to some issue with the workbench script editor, auto completion doesn't work inside modded classes, so CreateAlias() may not seem to exist until compile time.

If you have ESE installed and your aliases aren't showing up when you try to access them, make sure that you have duplicated ESE_Config.c as !ESE_Config_YourProjectName.c and enabled #define ESE_ALIASES_ALL or whatever specific category your entry comes under.