Jagged Alliance 3

Jagged Alliance 3

C-UAE Cross-Mod Universal Armament Expansion
 This topic has been pinned, so it's probably important
Lucjan  [developer] 31 Jan, 2024 @ 11:10am
Special compatibility options for modders
Logging

Be default C-UEA logs on INFO level. In order to change that adjust mod global variable CUAE_LOG_LEVEL in console

CUAE_LOG_LEVEL = CUAE_DEBUG

Or add a script

function OnMsg.ModsReloaded() CUAE_LOG_LEVEL = CUAE_DEBUG end

CUAE_DEBUG CUAE_INFO CUAE_WARN CUAE_ERROR

Exclusion Table
Calling the function CUAEAddExclusionTable allows you to implement custom exclusion logic. This prevents the mod
from distributing specified armaments to units of specific affiliations.

Example use case: A lore-friendly mod that restricts the Legion from using advanced weaponry and prevents Adonis forces
from equipping AK47s.

Table format:
cuaeExclusionTable = { Affiliation1 = {"ArmamentId1", "ArmamentId2"}, Affiliation2 = {"ArmamentId3", "ArmamentId4"}, }

Usage example (Legion units will never receive FAMAS/M16A2; Army units will not use AK47/Galil):
function OnMsg.ModsReloaded() local cuaeExclusionTable = { Legion = {'FAMAS', 'M16A2'}, Army = {'AK47', 'Galil'}, } CUAEAddExclusionTable(cuaeExclusionTable) end

Applies to: Weapons, Armor, and Ammunition.

Affiliations Supported by C-UAE
  • Rebel
  • Legion
  • Thugs
  • Army
  • Adonis
  • SuperSoldiers
  • Militia (Not a native affiliation in the source code, but treated as one by C-UAE for militia units)

Immunity Table
Calling the function CUAEAddImmunityTable protects specific items from being replaced by C-UAE. Quest items
(e.g., Pierre’s unique melee weapon) are immune by default, though their armor/rifles may still be modified.

Example use case: An AI mod where certain enemy archetypes rely on specific grenade types (e.g., smoke grenades). This
ensures they retain those grenades while other gear is randomized.

Table format:
immunityTable = { "ArmamentId1", "ArmamentId2" }

Usage example:
function OnMsg.ModsReloaded() local cuaeImmunityTable = { 'SmokeGrenade', 'TearGasGrenade', 'ToxicGasGrenade', } CUAEAddImmunityTable(cuaeImmunityTable) end

Applies to: Weapons and Armor.

Forced Mod Settings
Modders can enforce specific C-UAE configurations to ensure compatibility, including hidden options unavailable to
regular users.

Example use case: A tactical AI mod requiring enemies to always carry handguns and grenades for advanced maneuvers.

Table format:
settings = { -- Visible options ReplaceWeapons = boolean, AddWeaponComponents = boolean, ReplaceArmor = boolean, AffectMilitia = boolean, ArmamentStrengthFactor = number[-10, 10], -- Hidden options DisallowSilencers = boolean, -- Default: true ApplyChangesInSatelliteView = boolean, -- Default: true LoadoutTables = nil, -- Custom loadout tables }

Usage example:
function OnMsg.ModsReloaded() local cuaeSettings = { ApplyChangesInSatelliteView = false, LoadoutTables = customLoadoutTables, } CUAEForceSettings(cuaeSettings) end

Loadout Tables Specification

--[[ LOADOUT CONFIGURATION SCHEMA ================================= Configures combat equipment progression for faction units based on their role and experience level. Hierarchy Structure: LoadoutTables → Affiliation → Role → Configuration Parameters Core Concepts: ---------------- • Affiliations: Military factions (Rebel, Legion, Thugs, Army, Adonis, SuperSoldiers, Militia) • Roles: Combat specialties (Soldier, Heavy, Artillery, Recon, Medic, Marksman, Commander, Stormer, Demolitions, Beast) • Component Curve: Progressive attachment unlocks based on adjusted unit level (1-20) • Component Tags: Tags (Intimate CloseQuarters Tactical Precision Strategic) • Ammo Hierarchy: Rarity tiers (AmmoBasicColor < AmmoAPColor < AmmoHPColor < AmmoMatchColor < AmmoTracerColor) • Weapons: Firearms and melee weapons types (Handgun SMG AssaultRifle Sniper Shotgun MachineGun FlareGun MeleeWeapon GrenadeLauncher Mortar MissileLauncher) • Utility: Grenades and others types (Flare Explosive Flash Fire Smoke Tear Toxic Timed Proximity Remote) --]] LoadoutTables = { --[[ AFFILIATION CONFIGURATION ------------------------------------------------------------ Contains role-specific configurations for factions. Key Format: Affiliation name from valid faction list Fallback: Uses '_default' configuration for unspecified roles --]] Affiliation = { --[[ ROLE-SPECIFIC CONFIGURATION --------------------------------------------------------- Defines equipment rules for specific unit roles. Key Format: Unit role from standard role list --]] Role = { --[[ WEAPON COMPONENT PROGRESSION SYSTEM ----------------------------------------------- Progressive attachment unlocks based on unit level (1-20) Mechanics: - Array indexes correspond to unit levels 1-20 - Values represent percentage of components to activate - Calculation: floor((percentage/100 * total_slots) + 0.5) - Example: Level 5 unit with 6-slot weapon → 42% of 6 = 2.52 → 3 components active --]] weaponComponentsCurve = {18,24,30,36,42,48,54,60,66,72,78,84,90,92,94,95,96,97,98,99}, --[[ WEAPON COMPONENT PRIORITIES SYSTEM ----------------------------------------------- Configuration Options: • tag:str - Limits available components to only containing given tag • prioritySlots:{...} - Which slots to fill first --]] weaponComponentsPriorities = { Handgun = {tag="CloseQuarters", prioritySlots={"Magazine", "Side"}}, SMG = {tag="CloseQuarters", prioritySlots={"Stock", "Muzzle"}}, AssaultRifle = {tag="Tactical", prioritySlots={"Handguard", "Under"}}, Sniper = {tag="Precision", prioritySlots={"Mount", "Scope"}}, Shotgun = {tag="Intimate", prioritySlots={"Barrel"}}, MachineGun = {tag="Precision", prioritySlots={"Bipod"}}, }, --[[ AMMO TYPE BLACKLIST --------------------------------------------------------------- Restrict specific ammunition types from appearing in loadouts Format: [AmmoType] = boolean - true: Completely exclude this ammo type - false/omit: Allow with normal rarity distribution --]] excludeAmmoRarity = { AmmoBasicColor = true, -- Block common ammunition AmmoAPColor = true, -- Block armor-piercing rounds AmmoHPColor = true, -- Block hollow-point ammunition AmmoMatchColor = false, -- Permit match-grade ammo -- AmmoTracerColor = false, -- Enable tracer rounds by not including }, --[[ WEAPON REPLACEMENT STRATEGY ------------------------------------------------------- Override default weapon distribution with specialized rules Configuration Options: • discard:true - Remove all weapons of this type • type:{...} - Weighted replacement options • size:N - Maximum allowed weapon size Replacement Logic: - Undefined categories use default type-to-type replacement - Weight values are cumulative (see examples) --]] replacements = { -- Sniper Configuration (inherits defaults if not overridden) Sniper = {}, -- Warning falsy table can be overwritten by `_default` -- Assault Rifle Upgrade Path AssaultRifle = { type = {{"Sniper", 100}}, -- Replace all ARs with sniper rifles }, -- SMG Size Restriction SMG = { type = {{"SMG", 100}}, -- Maintain SMG type but limit size size = 1 -- Only compact SMGs (UZI-class) }, -- Shotgun Removal Shotgun = {discard = true}, -- Eliminate all shotguns -- Handgun Replacement Strategy Handgun = { type = { {"MeleeWeapon", 50}, -- 50% chance (1 - 50) {"Handgun", 100} -- 50% chance (51 - 100) }, }, }, --[[ AUXILIARY WEAPON SYSTEMS ---------------------------------------------------------- Additional weapons added to standard loadouts Weapon Group Structure: • type - Weighted weapon type selection • size - Maximum allowable weapon size (default=2) --]] extraWeapons = { { -- Primary Secondary Weapon type = { {"SMG", 50}, -- 50% probability (50/150) {"Shotgun", 80}, -- 30% probability (80-50) {"AssaultRifle", 100}-- 20% probability (100-80) }, -- size = 2 -- Implicit default }, { -- Sidearm Supplement type = {{"Handgun", 75}} -- 75% chance for additional handgun }, }, --[[ TACTICAL EQUIPMENT PROVISIONS ----------------------------------------------------- Specialized grenades and combat utilities Utility Group Rules: • type - Weighted utility type selection • amount - Number of items added • nightOnly - Restrict to nighttime/underground missions --]] extraUtility = { { -- Night Combat Package type = {{"Flare", 75}}, -- High probability illumination nightOnly = true, -- Night/underground exclusive amount = 2 -- Two flare devices }, { -- General Purpose Grenades type = { {"Smoke", 50}, -- 50% screening smoke {"Explosive", 100} -- 50% fragmentation }, amount = 3 -- Three grenades total } } }, --[[ DEFAULT ROLE TEMPLATE --------------------------------------------------------------- Baseline configuration for unspecified roles. Merges with role-specific configurations. Important Notes: - Replacement rules combine with role-specific configurations - To block inheritance for specific weapon types: {WeaponType = {discard = false}} - Empty configuration --]] _default = { -- ... identical structure to Role configurations ... } } }
Last edited by Lucjan; 16 Feb @ 4:50am
< >
Showing 1-9 of 9 comments
Lucjan  [developer] 4 Feb, 2024 @ 4:03am 
Added `CUAEBuildWeaponTables` in case someone needs to force tables rebuild. By default it is executed on `OnMsg.PreLoadSessionData`
eneajade 15 Feb, 2024 @ 7:57pm 
I was trying to figure out how to exclude certain ammo types. From what I understood, when script is replacing weapon, it also replaces ammo, picking one from all available ammo types of caliber matching replacement weapon. What I cannot figured out is how to prevent it from picking let say AP, or any other specific ammo type, (In my case, modded, obtained via crafting only). I assume that putting ammo id on immunity, or exclusion won't do. Help?
eneajade 15 Feb, 2024 @ 8:13pm 
Since my programming skills are close to 0, part of the script that decides what makes replacement ammo suitable, other than caliber, might be as well on klingon :) Probably I'm looking at my solution right now, but I don't understand what I'm looking at.
Last edited by eneajade; 15 Feb, 2024 @ 8:16pm
Lucjan  [developer] 15 Feb, 2024 @ 11:12pm 
Originally posted by eneajade:
I was trying to figure out how to exclude certain ammo types. From what I understood, when script is replacing weapon, it also replaces ammo, picking one from all available ammo types of caliber matching replacement weapon. What I cannot figured out is how to prevent it from picking let say AP, or any other specific ammo type, (In my case, modded, obtained via crafting only). I assume that putting ammo id on immunity, or exclusion won't do. Help?

Hi those methods do not affect Ammo. Ammo logic is little difrent then the rest of the mod.

I wont make ammo work with immunity table as thid would require bigger refactor.

I will make it work with exlucsion table and let you know when it is possible.


What is the reason behind this? Why you want to exclude ammo in first place? I am asking to inderstend better your needs.
eneajade 16 Feb, 2024 @ 5:30am 
It's just about preserving uniqueness of ammo that ought to be obtainable via crafting only. So not easy to come by, but in turn more accurate, maybe with better range or silent, but without usual weaknesses. I mean top tier stuff that if even could be for sale, would be insanely overpriced. In game, that kind of ammo it's priority pick for replacements and I have no clue why. What are the factors that makes it so good? I mean, vanilla types seem to be draw at random, so algorithm don't see much difference between them. Knowing why I could make tweaks, getting effect of exclusion without exclusion :)
Lucjan  [developer] 16 Feb, 2024 @ 6:18am 
Originally posted by eneajade:
It's just about preserving uniqueness of ammo that ought to be obtainable via crafting only. So not easy to come by, but in turn more accurate, maybe with better range or silent, but without usual weaknesses. I mean top tier stuff that if even could be for sale, would be insanely overpriced. In game, that kind of ammo it's priority pick for replacements and I have no clue why. What are the factors that makes it so good? I mean, vanilla types seem to be draw at random, so algorithm don't see much difference between them. Knowing why I could make tweaks, getting effect of exclusion without exclusion :)

Do you refer to specific ammo or just an idea of op ammo?
Lucjan  [developer] 16 Feb, 2024 @ 7:07am 
@eneajade `CUAEAddExclusionTable` now works with ammunition
eneajade 16 Feb, 2024 @ 2:59pm 
Thank you so much. Started as OP, but in the long run I was thinking specific. Makes groundwork for plethora of future uses. Lore friendly Legion is spot on example. Low tier, easy to maintain weaponry, you rather don't go with advanced, or exotic ammo, but might have lots of it instead. Can go random, but still have very distinct factions, or classes, with own equipment preferences. Balancing nightmare I bet, and straight up chaos hell, when you put combat AI to the mix, but so entertaining. Now excuse me, I'm gonna go poke game balance until it drops upside down :)
Last edited by eneajade; 16 Feb, 2024 @ 3:05pm
Lucjan  [developer] 16 Feb, 2024 @ 3:06pm 
I was thinking about adding Penetration and Shop tiers to affect to scaling algorithm. Now after reading your comment it can be Affirmation based, so Legion can be more likely to get low penetration low Tier items.
< >
Showing 1-9 of 9 comments
Per page: 1530 50