CustomAIRedux
"Define precise AI behavior for your companions with conditional logic and party-wide coordination."
CustomAI Redux allows you to program your party members’ combat behavior using conditional instructions with support for AND logic, party-wide coordination, and flexible targeting.
Each instruction follows: IF [Entity] [Condition] [Comparison] [Value] THEN [Action]
Example:
Translation: "If any ally has less than 50% HP, cast Cure Wounds on that ally"
AND conditions let you combine multiple requirements before taking action. When you switch to checking a different type of character, the system performs a new search. When you keep checking the same type of character, it validates the same entity meets all conditions.
Example 1: Entity Type Changes (Multiple Searches)
First checks if anyone is within 2 tiles. If yes, performs NEW SEARCH for wounded ally without poison. The distance check gates the healing – "only heal when not fighting alone."
Example 2: Same Entity Type (Single Search)
Searches for closest ally who meets ALL three conditions simultaneously. All checks apply to the same ally because entity type (ALLY) doesn’t change.
Single-Target Entities (Direct Reference):
• TARGET – Current combat enemy
• PLAYER – The player character
• SELF – The AI-controlled companion itself
• RIDING – Player’s mount
Search Entities (Find Closest Match):
• ALLY – Party members (alive, visible, excludes self/player/mount)
• ANY_PARTY – All party members including player (alive, visible)
• ANY_ENEMY – All hostile visible enemies
• DEAD_PARTY – Dead ex-party members (for resurrection spells)
Special Entities (Universal Quantifiers):
• WHOLE_PARTY – Validates ALL party members meet condition, casts on entire party
• ALL_ENEMIES – Validates ALL enemies meet condition, casts on all enemies
HP – Hit points (number or percentage: "50" or "50%")
MP – Mana points (number or percentage: "30" or "30%")
SP – Stamina points (number or percentage: "20" or "20%")
DISTANCE – Distance in tiles (number: "5")
STATUS – Status effect check (name: "Blind", "Haste", "Poison")
SUMMONS – Number of active summons (number or "100%" for max)
DEAD – Is dead ("True" or "False")
= – Equals
!= – Not equals
> – Greater than
< – Less than
>= – Greater than or equals
<= – Less than or equals
Note: STATUS condition only allows = and !=. DEAD condition only allows =.
The "Cast On" dropdown allows you to override which entity receives the action, separating who you check from who you affect.
Example:
Translation: "If my current enemy is wounded, heal myself instead"
Toggle that allows companions to cast spells that have been stashed from Vanilla AI using NPCSpellManager mod’s Stash feature. Spells appear in action dropdown with [Stashed] suffix.
Toggle for detailed debug logging of instruction evaluation. Shows which conditions matched/failed and entity resolution results. Useful for debugging complex instruction sets.
When enabled and no custom instruction matches, character switches to vanilla AI. If EnableFallbackTactics config is enabled, a dropdown appears to select which vanilla tactics profile to use (archer, healer, tank, mage, etc.).
When disabled (default), character shows "doesn’t know how to respond" message if no instruction matches.
Config file location:
Default: false
QOL Mode (false):
• Friendly spells with CanSelectParty show "Whole Party" option
• Hostile spells with RequireChara show "All Enemies" option
• Example: Cure Minor Wound can cast on whole party
Vanilla Mode (true):
• Only spells with ForceParty flag or party-cast genes can target whole party
• Stricter but more faithful to base game mechanics
Default: true
Enabled (true):
• When "Fallback to Default AI" is enabled, a dropdown appears to select vanilla tactics profile
• Provides fine-tuned control over fallback behavior
Disabled (false):
• Works as before this feature was added
• Fallback uses character’s original tactics without modification (for veterans who prefer to use Brain Cells to change NPC Combat AI)
Exports to clipboard as JSON with complete instruction data:
• Entity type, condition, comparison, test value
• Action name, action entity, targeting flags
• Fallback setting, human-readable descriptions
When importing instructions:
• Action Validation: Only imports actions the character actually knows
• Skipped Actions: Logs warning for unavailable spells/abilities
• Fallback Preserved: Imports fallback toggle state from exported data
• Log Reports: Shows count of imported vs. skipped instructions
• Save Preset: Store instruction set with custom name per character
• Load Preset: Quick-load saved configurations
• Auto-Load: Automatically loads last used preset for each character
Only heal allies below 40% HP who don’t already have regeneration buff.
Prioritize resurrection, then emergency healing, then offensive actions.
• Elin version: Stable / Nightly
• Save-compatible: Uses character data storage, no save file modifications
• Mod conflicts: Should not conflict with other mods unless they also patch Chara.SetAIAggro
• Tome of Memory Loss integration: Optional, enables stashed spells feature
Requires YK Framework. Tested on Nightly builds.
Companion mods:
NPC Spell Learning: https://steamcommunity.com/sharedfiles/filedetails/?id=3557997205
Tome of Memory Loss: https://steamcommunity.com/sharedfiles/filedetails/?id=3561086399
Player Gene System: https://steamcommunity.com/sharedfiles/filedetails/?id=3568525292
Original CustomAI mod by air1068
https://steamcommunity.com/sharedfiles/filedetails/?id=346365
If you like the work I do, please support me with a small tip on https://ko-fi.com/catalystwyrm