This small add-on fixes several issues with AI of your companions. Note that this mod is more of a showcase for the issues with original game AI, with ways to correct them, then full AI modification (like one made by TonyK).
How to install:
Just put files from archive to your Override folder.
Issues fixed:
1) Bard and Warlock companions won't cast any spells, if wearing Chain Shirt or heavier armor.
This happens due to AI not taking into consideration that spell failure chance from light armor is ignored for Bards and Warlocks. So, if AI sees failure chance higher then 15%, he would not cast any spells at all.
To fix this, I tweaked GetShouldNotCastSpellsBecauseofArmor function that handles this type of behavior. It will now, for Bards and Warlocks, tolerate spell failure chance up to 25%, if wearing light armor, or up to 35% if having Battle Caster feat and wearing medium armor.
2) Badger animal companions won't use their rage ability.
This is one case where fix is really necessary, since you can't manually control animal companions. And solution is simple: AI just needs to check beasts for having barbarian rage and not just barbarians.
3) Bard companion would Inspire Courage, even if Song of Requiem is active, thus canceling it.
The reason why this happens is because when no inspiration is active, Bard will Inspire Courage. But, this check doesn't cover Song of Requiem, which is also disrupted by inspirations (since it is continuing effect). So, to fix this, Song of Requiem needs to be added to GetHasInspireBardSongSpellEffect check.
4) Bard companion won't attempt any songs if they have active inspiration.
Usually, at opening of combat, Bard sings one song and then activates one inspiration. But code for singing song requires that no inspiration is currently active. This is leftover from times when all songs where disrupting inspirations. Since this is not case anymore, that check is removed.
5) Companions with Open Lock behavior setting won't pick locks.
The bug was introduced when adding functionality for familiars to pick locks (needed for Kaji in MotB campaign). Check wasn't done right, so every time when MASTERFAILEDLOCKPICK command was initiated, it run familiar lock picking code and skipped one for regular companions. So companion without familiar would never try to pick a lock.
For fixing this, it is necessary to check for both MASTERFAILEDLOCKPICK command and associate existence in single check, and only if both pass to bypass companion lock picking code and use one for familiars.
6) Companions with spellcasting turned off would still use Dispels or Restorative magic on player controlled character if disabled. And would never use it for other disabled party members, regardless of spellcasting settings.
First issue happens due to CheckForDisabledPartyMembers call never checking caster to see if he has spellcasting enabled or not. As for second issue, the problem was that same CheckForDisabledPartyMembers used obsolete GetHenchman function to iterate between party members, thus only returning currently controlled character. GetNextFactionMember should be used instead.
7) Druid or Ranger companions with Heal Animal Companion spell would waste it on invalid targets.
This happens since there is no special casing to prevent TalentHealingSelf and TalentHeal functions to use this spell on creatures that are not animal companions. There needs to be fallback to weaker healing talent if target is not an animal companion
8) AI controlled Weapon Master would use his Ki Damage, even if Ability usage is turned off
This one was easy to fix. Just added check to see if ability usage is not turned off before trying Ki Damage.
Ever getting annoyed when using Magic Circle vs Evil? With all those sounds playing every single time someone gets near you? If yes is the answer, then this "fix" is for you. It will prevent sp_abjuration_conjure.sef effect (that includes the annoying sound) to show every time someone gets close to you, if you are under effect of Magic Circle vs Evil or Magic Circle vs Good. For installation, just unzip downloaded visualeffects.2da file to your Override folder.
NOTE: Patch 1.23 replaced original AI, with port of TonyK AI, for all NWN2 versions, making these fixes obsolete.