This highly sophisticated yet conservative AI script automates tedious aspects of the game and leaves the cool stuff to the player. The script offers many configurable settings and provides lots of feedback. All class combinations and all of the NPCs are fully supported, so the script can be used by the entire party.
The xParty.bs file in the scripts folder is the party script. Copy it to your Baldurs Gate 2\Scripts folder.
Once the file is in place, you can change your characters' scripts through their Character Record -> Customize -> Script. Simply choose XPARTY for all of them. It's a "one size fits all" script.
Just delete the file.
This is a list of the HotKeys used by the script:
None of these keys is used by the default Baldur's Gate 2 installation.
Press [F] to have the selected character(s) [F]ix damage. For the next 120 seconds, healing spells will be cast on whoever needs it most until either the spells run out or everyone is whole again. It is easiest to simply select the entire party and press [F].
Your party will speak the following lines:
The script tries to heal the most damaged people first. Heal will be cast on the really bad cases (people missing at least 50 hit points and/or at least 2/3 of their hit points.) Mass Cure will be cast if at least two people are damaged. Cure Medium/Serious/Critical Wounds will be cast if it seems warranted or if no lesser cure spell is available. Cure Light Wounds (including the Bhaalpower) is considered expendable and will be cast on anyone not at maximum hit points.
The script supports Monk's, Paladin's, and Mazzy's Lay On Hands, and will also cast Wondrous Recall to recall healing spells. The script will also attempt to use the Gloves of Healing as well. Make sure these gloves are not in a Bag of Holding.
Shapeshifters (such as Cernd) will shapeshift to their Natural Form if they can shapeshift back when done. If they would not be able to shapeshift back, they will say they're Shapechanged, and it'll be up to you. They'll start doing their thing as soon as you manually order them to shapeshift back.
The party can also be configured to drink healing potions when ordered to heal. See the Drink healing potions section for details.
Party cohesiveness is important in battles. A barbarian charging blindly at a lone foe can draw the attention of many more enemies that were hidden in the fog of war. A frail wizard charging mindlessly into melee is equally problematic. The script allows you to configure each individual character to avoid drawing undue aggression.
Press [S] to have the selected character(s) change fighting [S]tyle. The character(s) will select the next style and tell you about it:
The default style. This character will engage nearby opponents in melee and will switch to a ranged weapon to shoot at distant foes. The character will prefer to shoot enemies at a distance of 10 feet (which is 1/3 sight radius), but will join the fray regardless of range if another party member is already engaged in melee. This is a good all-round setting.
If no ranged weapon is available, the character will recklessly charge the enemy at any range. If you do not wish that to happen, either give them a ranged weapon or set their style to Guard.
This character will only use a ranged weapon. If an opponent tries to engage them in melee, they'll temporarily switch to a melee weapon to avoid the gruesome penalties for using a ranged weapon in melee and then backpedal a short distance before trying again. This specialized setting is meant for dedicated archers and fragile mages. Make sure they have a ranged weapon available at all times.
Note that each time the character moves out of melee range, the opponent's initiative is reset and if you're lucky the opponent will not be able to make an attack in time.
Characters unable to keep their distance (either because they're being chased or because they're up against a wall) will periodically alert you to their predicament by shouting Help!!
This character will only engage nearby opponents in melee. If the nearest opponent is more than 10 feet away, the character will simply do nothing unless another party member is already engaged in melee. This is a specialized setting for dual wielders (who can't switch to a ranged weapon) to keep them from breaking ranks. The character will say No! Stay back! when holding the line this way. If you wish them to engage, you'll have to manually order them to attack or move them within 10 feet of the enemy.
This character will sing, and will not attack. This style is only available to Bards.
People with the Staff of the Magi now have access to a special fighting style; Staff of the Magi. They'll try to stay invisible. The staff has to be their most damaging melee weapon for this to work. This style will not work if the character also has the Staff of Rynn or Staff of the Ram available, for instance, since those are considered "more damaging."
Anyone armed with Melf's Minute Meteors or Energy Blades will be unable to switch to a melee weapon. As such, they will try to keep their distance regardless of their style.
Several spells last longer than the 8 hours it takes to rest. Ideally, the party rises with all spells memorized and the maximum amount of stoneskins. Press [B] to prepare the party for [B]edtime. They will cast the following spells on themselves:
Each of these spells will be cast once, regardless of how many meteors or skins are still left, to make sure you start the next day with the full amount. Characters will cast Wondrous Recall to get back Iron Skins if necessary.
Shapeshifters (such as Cernd) will shapeshift to their Natural Form if they can shapeshift back when done. If they would not be able to shapeshift back, they will say they're Shapechanged, and it'll be up to you. They'll start doing their thing as soon as you manually order them to shapeshift back.
If any of your characters has Minor Sequencer, Spell Sequencer or Spell Trigger memorized but does not have one active in their abilities menu, you will get a little reminder; the character will say Minor Sequencer, Spell Sequencer or Spell Trigger as appropriate.
Press [E] to have the selected character(s) [E]xorcise undead. Whenever undead come near, they will stop attacking and focus on turning undead. Press [E] again to stop, though you can usually just leave this on since the character(s) will go about their business when no undead are around. The only time you actually need to turn this off is when you are facing undead that you cannot turn and your Cleric has to resort to old-fashioned violence.
Your character(s) will report their status by saying Turning Undead or Stopped Turning Undead as appropriate.
Note that turning undead only has a 12 foot range. Characters will not attempt to turn undead unless they get within 15 feet.
Press [V] to have the selected character(s) [V]anish. They will not engage enemies while hidden, though they will act normally once revealed. Use this mode to scout ahead or to manually position characters for backstabbing. Press [V] again to turn off stealth mode.
When backstabbing, once the character has revealed him- or herself, simply run out of sight (either around the nearest corner or out of the enemy's sight radius) and the character will immediately hide again. This allows you to dart in and out of the shadows and backstab multiple times per combat.
Because spells cannot be cast on invisible people, hidden characters will leave the shadows when ordered to heal unless they do not need any healing. Leaving the shadows tends to take a while, though, so the script has hidden characters speak to themselves to reveal themselves instantly. Improved invisible characters will not reveal themselves, since they could still not be targeted anyway.
Note that characters trying to stay hidden cannot also look for traps, but with a bit of fiddling you can temporarily get the best of both worlds. If you press [V] to deactivate stealth mode, they'll immediately start to look for traps but it'll take a while for them to leave the shadows. Press [V] again to reactivate stealth mode before they become visible. Be careful, though; the amount of time you have ranges from mere seconds to several rounds.
Press [K] to have the selected character(s) place a bunch of traps at their feet. About half a dozen traps will be placed in total, so you can order multiple characters at once. Characters will try to place at least one "tactical" trap (Special Snare, Time Trap, Exploding Trap) and as many "damage" traps (Snare, Spike Trap) as they can, though they will use whatever they have.
Press [N] to turn the AI off or back on for the selected character(s) only. While AI is toggled off, the script will take no actions. The script will still respond to HotKey configuration.
Does your party have more healing potions than they know what to do with? Press [D] while the main character is selected to set the type of healing potions that the party is allowed to use when you order them to heal. Your main character will state each level as you cycle through them:
Characters will drink anyting up to the specified type, so if you set it to Potions of Extra Healing they'll also drink Potions of Healing. They'll start with the biggest potions allowed. They will only drink a potion if they need at least half of the healing the potion provides, so you don't have to worry about potions being wasted on a character that just needed 1 hit point healed. The potions do not have to be in the quickslots, and they will be taken out of a Potion Case or Bag of Holding if necessary. Note that there is no need to keep potions in quickslots anyway, since you can right-click them and drink them from the backpack.
Characters will pass potions to others that need them. Make sure your characters have empty inventory slots available. Characters will not pass potions if they still have Cure Light Wounds memorized, so if you wish your party to only use potions when the healing spells run out, have your healer carry the potions.
The script will defend itself in combat, and will automatically engage enemies in the manner appropriate to their combat style. The party will try to focus their attacks. Many variables affect their decisions, but they prefer finishing off wounded enemies and ignore disabled enemies (panicked, held, etcetera) until all the "live" enemies are dead.
D&D is not kind to ranged attackers, and Baldur's Gate is no exception. Creatures using a ranged weapon in melee suffer a whopping -8 to hit. Conversely, enemies attacking them in melee gain +4 to hit and +4 to damage. For this reason, the script rather anxiously switches to a melee weapon whenever an enemy comes near. It will also switch to a melee weapon before engaging in the modal actions of Hide In Shadows, Battle Song, and Turn Undead, since switching later would abort those actions.
The party will try to stay together. Characters will not stand idle while while party members are beaten up just around the corner. For example, if Keldorn attacks an Ogre, and Minsc can see Keldorn but not the Ogre, Minsc will move to Keldorn. If you wish to have one character do all the work (such as when fighting Beholders with the Shield of Balduran), make sure to keep the others out of sight.
In general, the script will try to stay out of your way. If you order a character to do something, the script will not interrupt except under these extremely specific and urgent circumstances:
Thieves and Monks will automatically look for traps whenever they're not busy doing other things (such as hiding or fighting).
The script takes a minimalistic approach to spell and item use, and will only expend resources when it is almost certainly correct to do so.
The script is aware that it cannot cast more than one spell every 6 seconds, and will not needlessly queue up spells. Instead, it will intelligently alternate between spellcasting and attacking. It will also not try to cast anything if silenced, or if there is a chance of spell failure or a wild surge.
The script knows all about the Cowled Wizards. It will not cast spells in patrolled areas unless you have paid the bribe or crushed all of their patrols. The script knows exactly which areas are not patrolled, and will resume its normal duties as soon as you move off the streets.
Charm and hold spells are situational and could be scripted to a sufficient degree of accuracy to let the script handle them. The exact circumstances in which the script will use these spells differ as appropriate. The script takes many variables into account, including the number and distance of opponents, their immunities, magic resistance and saving throws, and their hit points and Experience values. The script will use the following spells and items on suitable targets:
This spell has a small area, and the script will try to catch multiple enemies.
Rangers get this ability for free, but its application is extremely limited.
Druid spell selection is rather lacking in the level 2 slot, with only this and Slow Poison being (barely) worth memorizing.
This ring can be quite effective under the right circumstances, but I often forget I have it.
The ring must be equipped.
The following spells are so important that they will automatically be cast even during combat:
Cast any time no stoneskins remain.
Cast any time no meteors remain and the character is not engaged in melee.
The following spells, items and abilities will automatically be used outside of combat:
Cast any time no iron skins remain. Unlike Stoneskin, this spell is too slow for combat.
Used after resting, any time no stoneskins remain and the boots still have a charge left in them. Unlike the Stoneskin spell, the boots only give two skins and take half a round to activate.
The character does not actually have to be wearing the boots; they merely need to be in the character's backpack.
Used after resting.
The character does not actually have to be wearing the girdle; it merely needs to be in the character's backpack.
Cast whenever 9 hours have passed. The script can't tell when Armor is active, so it has to look at the clock.
Cast any time the character has neither Iron Skins nor Insect Plague remaining. If your Druid plans to memorize neither of these spells, you may wish to rethink your strategy.
Used after resting, provided Jan is still carrying around his Flasher Launcher.
The party will automatically try to cure poison whenever they're not busy fighting, without being ordered to. They will use the following spells and items to do so:
The items do not have to be equipped, and potions will be taken from a Bag of Holding or Potion Case if needed. The party will also pass around Antidotes and Elixirs of Health. Characters prefer to use spells for curing others but antidotes for curing themselves (to avoid having their spell disrupted by the poison), though they will use what they can.
I was rather involved in the Infinity Engine scripting scene a decade ago, writing Beholder AI for laughs and eventually working on the semi-official Ascension mod and the (never finished) Return to Windspear mod, after which I made the mistake of moving over to the (then still promising) Neverwinter Nights series.
I initially wrote this script for my personal convenience. I decided to replay the series after ten years and I got tired of all the clicking I had to do to heal my party. One thing led to another. The script is tuned to my playstyle, which is evidenced in the heavy support for Stoneskin and Melf's Minute Meteors. I am a huge fan of dual- and multiclassed spellcasters. This is the first party I used:
After that I decided to play a Thief to test the script under different circumstances, and so I added a lot of support for that as well. This was the second party:
After that I decided there were still a few character classes and NPCs that I hadn't tried, resulting in heavy support for Cernd's shapeshifting. This was the third party:
I installed the following content:
The script can't overwrite any existing files and should generally play nice with mods. Let me know if you suspect otherwise.
Extreme care has been taken to fix all issues that could be fixed. The remaining issues remain because of limitations in the scripting engine. They are generally the product of a choice between two evils.
The following issues are known:
Some care has been taken to reduce overhealing, but if you order multiple characters to heal it is quite possible that several people will begin casting a healing spell on a person that just needed one. Usually, only Cure Light Wounds gets wasted like this. I consider this a minor inconvenience compared to the excessive mouse-clicking that healing would otherwise require. It was either this or not allowing multiple healers to go to work at the same time.
It is also possible that if a character gets poisoned, several solutions are applied at the same time.
Scripts cannot tell just how many hit points a character needs healed, but an approximation can be made. This approximation may be off by a few points, especially on characters with really low or really high hit point maximums.
Characters will go look for enemies when there's fighting going on just around the corner. There is a slight delay before the script can see that the fight is actually over, so the party will move around for a couple of seconds looking for more enemies whenever a fight ends.
There is a corner case where the party is only slightly injured and the only healing available is reserved for serious cases. The Heal spell and healing potions will not be wasted on a character that only needs 1 hit point healed. The script will not report to be out of spells but there won't be any healing done either. It's left up to you, though you will not receive any notification.
The script can't tell whether the character has a ranged weapon, so it relies on you for setting the correct combat style. If the character runs out of ammo (such as a mage running out of darts), they'll rush into melee armed with their fists. If they were set to the Archer style they'll then back off, but since they still don't understand that they no longer have a ranged weapon they'll keep alternating between backing off and rushing in. This problem is common to scripts. Check your ammo.
If their backpack is full, characters that get potions passed their way (either because they're poisoned or because they've been ordered to drink healing potions) will drop the item in their top left backpack slot. If they get more than one type of potion passed their way, they may even drop another item. Make sure there's room in the backpacks if you order your party to pass potions around.
Characters may end up with more potions than they need if they get passed potions from several others at once. Potions can also be passed in stacks of up to 5. They get passed one at a time from containers, but the game will pass the entire stack from backpack slots or quickslots.
The script can't tell whether an item is inside a container (such as a Bag of Holding or Potion Case). Items inside a container cannot be used, but that wouldn't stop the script from trying. The workaround the script uses is to have the character give the item to him- or herself before using it. This ensures the item is no longer inside a container, so the script can't get hung up.
Invisible characters that are asked to reveal themselves have to do so by talking to themselves. This is the most expedient way of breaking invisibility. Waiting for a hidden Thief to leave the shadows can take up to 20 seconds otherwise. This attempt at conversation never results in actual dialog, but it does add a line saying <GABBER>- has nothing to say to you. to the text area (where GABBER is, of course, the name of the character.)
Improved invisible creatures cannot be the target of spells or abilities from others, but they can still target themselves. The targeting that the script uses when ordered to heal does not take this into account. Doing so would increase its already considerable complexity even further, and I'm not willing to go that far for such a corner case. Improved invisibility cannot be broken at will, so improved invisible healers will simply not cast any spells or use any targeted items on themselves.
All is not lost, though. "Unimproved invisible" healers will reveal themselves and then heal themselves normally. Improved invisible people will still drink potions, and others will still pass potions to them.
The script has trouble telling who can use what item, and no attempt has been made to sort through the mess that is Baldur's Gate's "Usable by" versus "Unusable by" item limitations. Don't give Gargoyle Boots to your Wizard Slayer! Unless he's a Wizard Slayer/Thief with Use Any Item, of course.
Note that the Gloves of Healing have undocumented limitations; they cannot be used by single-classed Clerics, Druids or Mages (including Sorcerers), but are usable by all multiclass variants (including even Cleric/Mage.) You'll notice that they have a reddish tint if their current owner can't use them.
For most other cases, it should be obvious when this happens.
The script will use healing potions in quickslots if ordered to do so. A strange engine glitch may cause these potions to still appear in the quickslot even after they are used up. These virtual potions cannot be used and do not cause any problems; it just looks weird.
If you give a Monk a melee weapon, the script will equip it even if the Monk would be better off using his or her fists. The game mistakenly thinks the weapon would do more damage.
The script cannot tell the difference between a Blade in Defensive Spin and a Blade that cast Blur. The script will assume that a blurred Blade is in Defensive Spin, and will select weapons and targets accordingly.
Healers will attempt to heal characters protected by (Minor) Spell Deflection/Turning/Trap, with predictable results. These protections cannot be accurately detected by the script. Move any problem characters out of sight when ordering the script to heal.
The xParty.baf file in the script compiler\source folder contains all the source code, in case you're interested. It has been extensively commented. I also documented many features of the scripting engine at the bottom of the file.
I might well be the last person to have written a script, but I wasn't the first. You may or may not like these other scripts better:
Both of those script series are excellent work, but they try to do far too much for my liking. I also believe my script is smarter in what it does do.
Smart alternating between casting spells and attacking can allow you to do up to twice as much in a single round. This is explained fully in my Baldur's Gate II Spells Reference.
At the risk of sounding like a deodorant commercial... Stoneskin provides incredible protection for 12 hours, don't leave home without it! Mirror Image occasionally serves as a poor man's Stoneskin.
Liches, dragons, demon lords... everything falls to the mighty meteors. The only thing these babies will not punch through is Protection from Magical Weapons. Stoneskin only slows them down (the fire damage still gets through and they eat five skins per round regardless), and Spell Turning only reflects a negligible part of their damage (while at the same time being depleted rapidly.) Their high rate of fire makes them excellent for filling the gaps between spellcasting.
I love me some clone spell abuse. Project Image and to a lesser extent Simulacrum can double up on your spellbook and your "one use per day" items, and give you a virtually infinite supply of "one use ever" items. Clones also ignore the limits on summoned creatures.
I save all the Time Stop and Wish scrolls I find for cloning, never writing them into my spellbook. I also keep the Mind Flayer Control Circlets and some Scrolls of Protection from Undead. Aerie's clones can cast Greater Restoration, healing the entire party without fatiguing Aerie herself. Jan's clones can set Spike Traps, though they do not ignore the trap limit. They can also summon multiple planetars and devas. A clone with the Rod of Resurrection can heal the entire party, and a clone with the Wand of Monster Summoning can generate ridiculous amounts of fodder.
I have the game set to Auto-Pause: Enemy Sighted, and if I run into enemies I usually back off immediately. This can give you a lot of time to prepare. Chances are they haven't even noticed the party, especially if the person to spot them is wearing Boots of Speed. Get the party into position, buff up, or send in the summons.
This tactic is especially effective against mages; they can't cast spells on what they can't see, and they're often too busy casting defensive spells to go after you. Dodging back through an area transition will also waste whatever spells they try to throw at you. Often they'll even cast Gate and then attack their own Pit Fiend.
When it is obvious that there is a fight ahead, simply summon some sturdy minions, send in your army and sit back. I finished many big fights without actually showing up myself. You can cast Wizard Eye or Farsight if you wish to view the spectacle, but often that isn't even needed unless you include clones.
A Nishruu or the Skeleton Warrior you get from Animate Dead once you're level 15 can clear out a room on its own if it doesn't run into Death Spell. Both of these are practically immune to magic and unenchanted weapons.
I consider these summon spells worth memorizing, in order of awesomeness:
This version was not released to the public.