Adding Custom Aliases In Your Mod - NarcoMarshDev/Enforce-Script-Extensions 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:

// Your ESE additions here...

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 (suggested) naming schemes are: Define⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ | Naming Scheme | :--- | :--- ESE_ALIASES_MATERIALS | MAT_MATERIALNAME ESE_ALIASES_WEAPONS | WEP_WEAPONNAME_VARIANT ESE_ALIASES_ATTACHMENTS | Use OPTIC_, UGL_, HGUARD_ or what makes the most sense and is short, not set in stone ESE_ALIASES_MAGAZINES | MAG_MAGAZINENAME_AMMOTYPE ESE_ALIASES_VEHICLES | VEH_VEHICLENAME_VARIANT ESE_ALIASES_MATH | MATH_CONSTANTNAME

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.

modded class ESE_Aliases
    static const ResourceName WEP_M16A3 = "{9C38B35C2CC96D4B}Prefabs/Weapons/Rifles/M16/";

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.