uScript (Universal Script for BG2)
Creator Name: Rich Martel
Creator Email: martelr@mediaone.net
Web URL: http://groups.yahoo.com/group/bwscript/files/COMPLETE/
Last Modified: 2001-09-27
PLEASE: If you modify this script in any useful way, or have any suggestions, please send me an e-mail with the info (martelr@mediaone.net). I'm always interested in improving it. Thanks.
COMPATIBLE GAMES:
[x] Baldur's Gate II: Shadows of Amn
[x] Baldur's Gate II: Throne of Bhaal
DESCRIPTION:
This is a Baldur's Gate II AI script for player characters that can be used with any class. Many useful ideas were borrowed from scripts and discussions in the "Bioware Scripting" group on Yahoo (http://groups.yahoo.com/group/bwscript). Thanks to Tim, Sarkyn, C.Enders, Xyx, Jason & Quitch for help & suggestions.
Features:
- Individual AI toggle for each character
- Smart Targeting system
- Move to Combat routine (no more idle characters)
- Detect Traps, Turn Undead, and Battle Song
- Assistance to injured
- SoA Class Abilities
- ToB Spells
- ToB Class Abilities
- Performance Saver (script cutoff)
- TimeStop target switching
- "Stay in melee range 1 round then run" routine for Casters, Archers, and Injured
- Efficient healing system
- Wand & Potion usage
- Shapeshift abilities for druids
- Summoning Item usage (Efreeti Bottle, Black Spider Figurine, etc.)
- Improved Nymph, Djinni, Planetar, Deva, & Moon Dog (Cerebus) scripts
- Dynamic Party Protection
- Cast & Attack
- Intellegent Simulacrums, Projected Images, & Misleads
- Healing potion hand offs
HOW TO INSTALL:
Place all .bs files into your \SCRIPTS directory. You may want to replace your /SCRIPTS/default.bs file with uScript.bs (when some NPCs join your party, they sometimes automatically use default.bs). Place all .bcs & .spl files into your \OVERRIDE directory. Then when in the game, click on a character, select it's record, click customize, click scripts, then choose uScript from the bottom of the list. Repeat for each party member.
HOW TO COMPILE:
If you want to compile these files yourself, you need to update the IDS files in your \SCRIPT COMPILER directory with the new versions that gets installed into you \OVERRIDE directory when you install ToB & the latest patches. If you do not do this, all ToB spells & abilities will not be compiled properly, and problems may occur with your script.
Be careful using custom SPELL.IDS files from the internet, I only use Bioware released IDS files. I noticed a non-Bioware version that renamed "DISPEL MAGIC" to "REMOVE MAGIC" (which is really the correct name of the spell, but it's not the name that BioWare uses). I opted to use the spell number for any spells that are missing from the official SPELL.IDS (ToB) file to keep compatability with vanilla installs.
Place the .baf files in your \SCRIPT COMPILER\SOURCE directory. Go to a Command Prompt (DOS), and cd to the \SCRIPT COMPILER directory. Then type "compile uScript". Check for errors in the \SCRIPT COMPILER/ERRORS (0KB = No errors). Repeat process for uNymph, uDjinni, uPlanet, uMoondog & uMislead. Then go to your \SCRIPT COMPILER\COMPILED directory and make the following changes:
- Rename uNymph.bs to nymph.bcs
- Rename uDjinni.bs to djinni01.bcs
- Make a copy of uPlanet.bs, rename one to plangood.bcs, and the other to devagood.bcs
- Rename uMoondog.bs to moondog.bcs
- Make 2 copies of uScript.bs, rename one to simulacr.bcs and the another to projimag.bcs
- (optional) Replace your /SCRIPTS/default.bs file with uScript.bs. When some NPCs join your party, they sometimes automatically use default.bs
- Move uScript.bs to the /SCRIPTS directory
- Move all .bcs files to /OVERRIDE directory
I'd like to recommend using the following programs if you are interested in scripting:
HOW TO USE:
- See the spells-items.htm for the list of spells & items that have been scripted into uScript.
- If you want the auto backstab routine to work for your thief/stalker, make sure you have the "T" formation in the 3rd formation slot.
- Make sure you have at least 1 Magic Missile memorized for Mages and Bards (to check for spell depletion).
- Make sure you have 1 Doom memorized for Clerics & Druids (to check for spell depletion).
HOTKEY |
ASSOCIATION |
DEFAULT |
DESCRIPTION |
D |
[D]isable AI |
On |
Toggles AI for the selected characters |
S |
[S]pellcasting |
On |
Toggles spellcasting for the selected characters |
N |
[N]o movement |
On |
Toggles all auto-movement such as MoveToCombat, RunFromAttacker, RunToHealer, etc. |
B |
[B]uff |
Off |
Toggles casting of defensive "buffs" and healing spells that don't require seeing the enemy. If used during combat, it makes buffing a priority. |
V |
Reset [V]ariables |
N/A |
Set's all toggles to their default settings (good to use if you forget what their current status is) |
ESDFKLVBN
VERSION HISTORY:
2001-09-27
- Added in an Archer detection routine... Archers will not become PartyProtectors unless necessary
- Archers will not become PartyProtectors unless necessary
- Implemented C.Enders suggestions for changing the Move To Combat routine
- Fixed quite a few spells improvements
- Added in all bard harps
- Added the disable AI feature to all minions and misleads
- Misleads should be a little more controllable
2001-09-24
- Added in a routine to make all classes run from enemy at 50% health
- Made some modifications from suggestions recieved from C.Enders
- Fixed a few bugs with last release
2001-09-23
- Fixed multiple bugs from the last version (biggest one being the the characters were interrupting their own spell casting)
- Improved potion passing
- If a character has the Bag of Holding or Potion Case, they will now equip the potion before using it
- Improved good berries (they now pass them around)
- Improved Mislead script
- Implemented switching to a null script if an enemy is using script or mislead
2001-09-22
- Restructured performance saver so that healing & skins happen during idle time
- Added an AttackReevaluate workaround
- Old Help/Assistance system totally removed... Assistance is determined by MostDamagedOf() which should be more efficient
- Attempted to fix some inefficiencies with the InMeleeRange movement
- Attempted to fix the problem where true sight and invis purge were not being cast
- Fixed clone SPL files so that they work on the RACE script level
- Added a routine to give potions to most damaged character
2001-09-20
- Added protagonist innate abilities (Slow Poison, Cure Light Wounds, Draw Upon Holy Might)
- Added Good Berries which will now be used to heal outside of combat
- Party protector system will now resets after resting (correcting a problem if you change your party line-up, some numbers go out-of-wack)
- Adjusted healing potion usage theshhold from 70% health to 60%
- Moondog (Cerebus) is now cast at the rangers feet instead of the enemies feet, allowing it to prepare for battle
2001-09-19
- Added Simulacrum, Project Image, and Mislead (including modified spells)
- Added Vhailor's Helm as a usable item
- Added Shakti Figurine as a usable item
- Made some changes to try to fix the "indecision" when interrupted
- Made some slight tweaks to the PartyProtector system
- Moved Improved Alactrity to happen after TimeStop
- Doubled Protection from Magic Weapons to happen before casters go into combat (in addition to when hit)
- Improved shapeshifting
2001-09-18
- Added a Defensive Spell timer to mix offensive spells in with defensive spells
- Added both mage & priest Energy Blades... similar to Melf's Meteors
- Fixed & optimized a few small issues here and there
2001-09-16
- Finally implemented Xyx's Cast & Attack routine which seems to be working out nicely
- Fixed threshhold setting for PartyProtector from [50,100,150,200,250,300] to [35,50,75,100,150,200,300] which should make more sense (Thanks Quitch)
- If a character has the Bag of Holding or the Potion Case, the script requires that the potion be equiped to be used (Thanks Quitch & Xyx)
- Fixed the EnemyDetect routine so that it picks up on sleeping enemies (thanks C.Enders)
2001-09-15
- Fixed Moondog spell casting
- Fixed a problem with weapon switching
- Made some slight tweaks to the healing section
2001-09-14
- Added a "PartyProtector" section to determine if the character should be tanking for the group (sparked from Quitch's appropriate criticism)
- Characters should run away from danger more often now
- Improved healing section
- Added improved Djinni script
- Removed some sections that I found out weren't working
2001-09-11
- Added usage of Summoning Items; see spells-items.htm for details
- Items will now only be used if equiped; but potions do not have to be equiped
- Created improved Nymph, Planetar, Deva, & Moon Dog (Cerebus) scripts to be bundled with uScript
2001-09-07
- Added 5 new potions; see spells-items.htm for details (Thanks Jason)
2001-09-06
- Added Strength & Melf's Meteors to the Buff/Defensive section (Thanks CE)
- Lessened the conditions that fire off a class ability, making them occur more often (Thanks Jason)
2001-09-05
- Removed ActionListEmpty from Healing & Curing spells
2001-09-03
- Optimized healing section (again) to only cast healing spells if it will heal at least 10% of the max hitpoints (otherwise it's a waste of time)
- Made Greater Restoration only cast if the character has a ToB spell (Greater Restoration heals 100% to all party members if ToB is installed)
- Added HotKey(B) to so that prep & heal spells can be cast in between battles
- Added HotKey(V) to restore all other hotkey settings to their original state
- Corrected Lower Resistance (Thanks CE)
- Added in more checks to disabling spells that cause a state change - do not stun if already stunned (Thanks CE)
- Added 3 ToB mage spells that I forgot to put in (both Bigby spells & Dragons Breath)
- Changed single target disable spells to only fire off when there is more then one enemy
- Moved Power Word Blind to the area disable section
- Put in Fighter/Paladin/Ranger check for giant strength potions
- Added Rogue's Potion of Frost Giant Strength (Thanks Jason)
- Fixed some of the GlobalTimers, which were only 1/2 as long as they should have been
2001-08-31
- Removed spells that would be a waste to memorize (and take up a slot for) in the first place
- Improved many spell conditions to keep sorcerers from wasting spells
- Improved the backstab routine
- Moved the switching to melee weapon near to top of the script, to prevent getting hit with the penalty if hit while ranged weapon is equipped
- Moved Detect Enemy routine to top so that characters with their AI off will still set the flag if they can see an enemy
- Changed the order of the heal routines to make self preservation top priority
2001-08-28
- Fixed a few offensive actions that were not using the targeting system (most importantly the Combat Attacks!!)
- Changed some of the Detect Enemy, and Move to Combat routines with help from C.Enders
- Added back the Move to Healer upon heal depletion
- Fixed some bugs with some OR(x) not being the correct number
- Fixed a problem when the AI was turned off, it would constantly be stopping any movement initiated by the player
2001-08-27
- Added shapeshifting abilities for druid, including ToB elemental shapeshift
- Fixed in party fighting if someone is charmed
- Fixed summoned demon targeting
- Added a Turn timer to allow clerics & paladins to cast or attack in between turning undead
- Switched to Attack() rather then AttackReevaluate() since I found out that the 'Reevaluate is flawed
- Added a few missing spells that should have been there
2001-08-26
- Added in a Detect Enemy section that was needed to replace the redundant See/Detect([EVILCUTOFF]) that was happening. Now if Player1 can detect an enemy, a global variable (Player1DetectEnemy) will be set to 1. All CombatCounters were replaced with this also.
- Removed Alert system since Detect Enemy essentially replaced it
- Fixed a few bugs I missed before
2001-08-25
- Changed spell to check for spell depletion to Doom for both Clerics and Druids (more of a useful spell then what I was using before), as a result, I needed to add this spell to the script since it wasn't there before
2001-08-24
- Added Spells & Abilities that weren't in the default SPELLS.IDS
- Improved Move to Combat again to keep people in combat range more
- Added in a PriorityTarget selection based on the level of the Enemy
- Optimized healing and curing between all party members
- Added more potions (haste and strength)
- Added in the ability to use most wands
- Tried to minimize spell wastage (mostly in defensive section)
2001-08-23
- Fixed the Move to Combat routine
- Changed order of preference in Move to combat (start with Player6 vs. Player1) / Removed MostDamagedOf
- Re-wrote "run from melee", so that Casters, Archers, and Injured stay in melee range for 1 rounds, then run
- Removed all untested and unnecessary features to keep it simple, rather then the kitchen sink scenario
- Added an auto-movement HotKey ("N") toggle for those who want to have total cotrol over positioning of characters (this disables any auto movement features in the script)
- Added healing notification to not waste heal spells (using a GLOBAL timer "u_Healing")
2001-08-20
- Merged all previous "SmartScript" functionality into a single unified script now called "uScript"
- Added a Targeting system (I believe the idea originated from Sarkyn)
- Added an Alert system
- Added in all SoA & ToB class abilities that I know of
- Added a TimeStop targeting routine
- Fixed quite a few other problems, too many to count