I wrote these scripts for personal convenience. These highly sophisticated scripts automate tedious parts of the game, leaving the cool stuff to the player. Highlights include healing the party at the press of a key, configurable fighting styles, smart use of Stoneskin, Iron Skins and Melf's Minute Meteors, stealth mode, turn undead mode, and automatic trap finding. The AI of several summoned creatures has been rewritten to make better use of their abilities.
Each component can be installed separately:
The Xyx.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 XYX for all of them. It's a "one size fits all" script.
The files in the override folder are the summoned creature scripts. Copy these to your Baldurs Gate 2\override folder.
Just delete the files.
In case the rest of the ReadMe is tl;dr, the important functions are:
Thieves and Monks will automatically look for traps.
Characters will automatically cast Stoneskin whenever it wears off. They will take care not to anger the Cowled Wizards.
Press the following keys to configure the script:
Press [S] to change the fighting style of the selected character(s). The styles are:
Press [F] to have the the selected character(s) cast healing spells until the party is healed.
Press [B] before resting to have the selected character(s) cast spells that last longer than 8 hours, such as Stoneskin and Melf's Minute Meteors.
Press [E] to toggle turn undead mode for the selected character(s), making them turn undead that come close enough.
Press [V] to toggle stealth mode for the selected character(s), making them hide whenever possible. Note that this turns off trapfinding.
Press [N] to have the selected character(s) set a bunch of traps.
Details on any of these features can be found below.
You are now ready to kick butt for goodness!
This is a list of the HotKeys used by the scripts:
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. Mass Cure will be cast if at least two people are damaged. Heal will only be cast on the really bad cases (people missing at least 50 hit points and/or at least 2/3 of their hit points.) 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 innate Bhaalspawn ability) 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.
Characters will drink healing potions when ordered to heal, and will even pass them around. They will initially only drink Potions of Healing (the crappy 8 hit point ones). Once you reach the Shadows of Amn Experience cap (2,950,000 Experience), they will also drink Potions of Extra Healing (the 27 hit point ones), since by that time you probably have too many of them anyway. Potions will be handed out even if they are in a Potion Case or Bag of Holding.
The types of potions that characters will drink might be made configurable in the next version.
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 scripts allow 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 switch weapons at a distance of 10 feet, which is 1/3 sight radius. 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.
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.
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 a party member is engaged in melee, in which case they will attempt to help out. 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 order them to attack or move them within 10 feet of the enemy.
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.
If a character is using a throwing axe or throwing dagger, don't forget to right-click the quickslot and select 'Thrown'. Scripts cannot do this.
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.
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 may take a while, though. If you are in a hurry, order the character to open a container or pick something up. This will instantly reveal them.
Note that sneakers cannot also look for traps.
Press [N] to have the selected character(s) [N]uke the area with traps. Traps are placed at the character's 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.
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 generally not interrupt. If you have trouble getting a character to keep attacking a certain enemy, make sure they're closest to that enemy.
Thieves and Monks will automatically look for traps whenever they're not busy doing other things (such as hiding or fighting).
The following spells will automatically be cast, even during combat:
Cast any time no stoneskins remain.
Cast any time no stoneskins remain (which only happens after all Stoneskin spells are used up) or any time damage is taken regardless (from, say, a fireball.)
Cast any time no meteors remain and the character is not engaged in melee, provided the character is using the Archer fighting style.
Aggressively cast on vulnerable targets. The script knows a good target when it sees one, and will capitalize on the occasion.
The scripts are aware that they cannot cast more than one spell every 6 seconds, and will not needlessly queue up spells. Instead, they will intelligently alternate between spellcasting and attacking. They will not try to cast anything if silenced, if there is a chance of spell failure, or if doing so would anger the Cowled Wizards.
The following spells, items and abilities will automatically be used outside of combat:
Cast any time someone is poisoned.
Cast any time no iron skins remain. Unlike Stoneskin, this spell is too slow for combat.
Used after resting, any time no stoneskins remain. 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 any time neither of these spells is active.
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 any time after resting, provided Jan is still carrying around his Flasher Launcher.
The script cannot tell if an item is drained, so it will only try to use items after the character has "slept" with them.
Several important summoned creatures have had their AI considerably improved. These creatures will now attempt to use all their abilities where appropriate, with some thought put into target selection regarding resistances and immunities, and will alternate between spellcasting and attacking for maximum efficiency (though some of them can become overly focused on attacking.) The enhancements apply only to creatures controlled by the party; these scripts do not make enemies smarter. All of the enhanced creatures will greet their master when summoned by saying: I serve only <PRO_LADYLORD> <CHARNAME>! (filling in the variables, of course), with the exception of the elemental princes, who retain their own lines.
The scripts are extremely careful with spells that have been deemed "unsafe", such as Fireball, Globe of Blades or Dispel Magic. Unsafe spells will only automatically be cast when there is no risk of collateral damage. Manually order your creatures to cast these spells if you wish to use them.
Several creatures have the same set of spells. This is the Ogre Mage list, and some of the other creatures likely ended up with this list due to sloppy copy/pasting by the game's developers. These spells are nevertheless put to good use. The list includes:
The planetars are excellent fighters and spellcasters. They have a long list of spells, but because they are so fearsome in melee (average 84 damage against AC 0) they will forego many of these spells in favor of simply cutting their opponents to ribbons. They will cast the following spells:
Dispel Magic, Earthquake, Globe of Blades and Firestorm were deemed too risky for scripted use. Chaos and Flame Strike were ignored because they pale in comparison to the planetar's hack and slash damage output. Cure Disease, Raise Dead, Remove Curse and Restoration cannot be scripted. Unholy Word is useless since enemies are almost never Good aligned. Detect Invisibility is pointless since planetars can see invisible creatures anyway and have True Sight to dispel illusions.
The devas are good fighters and spellcasters, though not as awesome as the planetars. Their script has the following features:
Globe of Blades was deemed too risky. Cure Disease and Remove Curse cannot be scripted (and hardly matter anyway.) A bug in their spell list prevents them from casting their Chaos spell (which would have been decent) and their third Globe of Blades spell.
Chan now uses his Whirlwind, which appears to be a sort of Ring of the Ram thing.
Zaaman Rul now uses his superfast Flame Strike.
The efreeti is a decent fighter and has several useful spells, even though it is only a low-level spellcaster. It has the Ogre Mage list described above, and on top of that a Flame Strike and a Flame Arrow. Ghost Armor is not scripted since it would not improve the efreeti's AC anyway.
The djinni is much like the efreeti, but he does not have the two additional spells and the ring disappears if he dies (unless the ring was used by a Project Image or Simulacrum clone, that is.) The djinni will cast Ghost Armor to slightly improve its AC.
The Nishruu has the Ogre Mage spell list, which it uses to good effect even though its primary purpose is soaking up enemy spells. It now casts Ghost Armor right after being summoned, a quick spell that greatly improves the nishruu's AC.
The hakeashar (from Summon Hakeashar) also uses this script. However, since the hakeashar is only a minimal upgrade from the nishruu and there are stupidly powerful spells available at its level, it is a waste of a spell slot.
This lady is rather frail in combat (despite her startling 7 attacks per round), but has an impressive array of spells:
The nymph will try to stay out of trouble as long as she still has relevant spells to cast, but will chip in with the occasional punch if she's next to something that isn't immune to her unenchanted fists.
Note that the nymph instantly casts Barkskin on herself when she sees an enemy. This is not a new feature, and it does not interfere with her other spellcasting.
Kitthix will now fire its Web Tangle at vulnerable enemies, and will teleport around slightly more intelligently.
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.
These scripts are tuned to my personal playstyle since I initially wrote them for myself. This is evidenced in the heavy support for Stoneskin and Melf's Minute Meteors, as I am a huge fan of dual- and multiclassed spellcasters. These are the parties I used while working on the scripts:
I installed Baldur's Gate 2, Throne of Bhaal, the lastest (non-beta) patch and the Baldur's Gate 2 fixpack v9.
None of the included files overwrite any existing files in that setup. If you already have one or more of these files because you installed another mod, I'd suggest not overwriting any existing files.
Some mods (particularly Spell Revisions and aTweaks, I am told) are likely to conflict with the summoned creature AI. This AI is completely optional and separate from the party script, so if you do not feel comfortable altering the summoned creature AI, simply stick with the Xyx.bs file and do not copy any of the .bcs files to your override folder.
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.
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.
When the last enemy falls, characters will move around for a few seconds. This is a side-effect of the script that keeps the party together when enemies are around corners. They try to move to another party member that might have line of sight to an enemy, but there are no enemies left. Unfortunately, the script does not realize this in time.
Archers will try to keep some distance from their enemies. However, since the script is completely blind to its surroundings, they may end up running into a wall. Since they will keep trying to run, they will not attack. If they did, they would suffer heinous penalties for using a ranged weapon in melee. They will say "Help!" to warn you about it so that you can tell them what to do.
Characters in stealth mode will attempt to hide at the first opportunity. The script cannot distinguish between enemies still being right around the corner and combat actually being over, so it waits for the music to die down. Hiding will cause the loot interface to close, so if you try to open a container or pick something up in the 10 seconds it takes for the music to change, chances are you will have to do it again. This annoyance is tolerated because it lets characters hide as soon as they dodge out of sight, allowing them to come back for another backstab several times in a fight.
There is a corner case where the party is only slightly injured and the priest only has Heal. The script will not report to be out of spells but there won't be any healing done either. The script will not cast Heal unless it's really needed, so it's left up to you.
The scripts folder contains the party script:
The override folder contains the summoned creature AI scripts:
The files in the script compiler\source folder contain 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 Xyx.baf.
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 slightly smarter in what it does do.
Unfortunately, the gMinion download link is broken... but I believe that my minions are slightly smarter (the ones I wrote scripts for, at least).
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, demons... 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, and Spell Turning only reflects a negligible part of their damage. 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.
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 have the game set to Auto-Pause: Enemy Sighted, and if I run into any mages I usually back off immediately. They can't cast spells on what they can't see, and they don't always follow. Chances are they haven't even noticed the party, especially if the person to spot them is wearing Boots of Speed. I then send in either a single Skeleton Warrior or a single Nishruu for them to waste all their spells on. If they somehow manage to kill it I simply send in another.
I consider these summon spells worth memorizing, in order of awesomeness: