Skip to content

[MOD] Better IWD Pregen (v7.5) - a minimalist script and tweak pack

Dan_PDan_P Member Posts: 129
edited November 9 in General Modding
GitHub: https://github.com/D2-mods/Better-IWD-Pregen
Download: https://github.com/D2-mods/Better-IWD-Pregen/releases
Compatible with classic and EE versions of BG1, BG2, IWD, and IWD2 (including EET/BGT/IWD2EE).

--

A minimalist script and tweak pack for Infinity Engine games. This mod was started as an attempt to make an improved version of the "IWD Pregen" party AI script from Icewind Dale: Enhanced Edition.

--

Script components:
  1. Better IWD Pregen
  2. Better AI for Call Woodland Beings (EEs, BG2)
  3. Auto-assign script to new characters

Tweak components:
  1. Adjust enemy damage at higher difficulties (classic IWD, IWD2)
  2. Add or remove Avarine Decanter (IWD2)
  3. Unnerf Animate Dead (IWD2)
  4. Shapeshift movement bonuses bypass Free Action (EEs)
  5. Increase movement speed of IWD shapeshifts (IWD1, IWDEE)
  6. Give party starting equipment (IWD games)
  7. Give party a Bag of Holding at game start (classic and EEs)
  8. All classes get full HP bonuses from Constitution (classic and EEs)
  9. Reduce delay for Sneak Attacks + uncap Crippling Strike (EEs)
  10. Salamander auras hit only enemies of the caster (IWDEE)
  11. Allow Minsc to use his Berserk ability at will (BG games)
  12. Patch visuals for shortbows (IWDEE) or scimitars (IWD-in-BG2)
  13. Remove alignment restrictions for classes (classic and EEs)
  14. Prevent paladins and rangers falling at low rep (EEs)

Additional info:
  • All components can be installed independently and in any order, except for auto-assigning the script.
  • Script components should be installed after AI mods (ex. SCS or atweaks).
  • Note that all tweaks are fine to install even after mods like SCS (this is the order I use for testing).
  • If using tweaks from other mods that do similar things, whichever is installed last will usually be used.
  • All tweaks have at least 2 subcomponents. i.e. if you say to "install all components", it won't automatically install any tweaks.

See GitHub page for more detailed info on individual components.



Script - Quick Info:
  • Better IWD Pregen (d2scrp): Base script. Includes all features listed below.
  • d2scrp+: Same as base script, except calls for help are enabled.
  • d2scrp-: Same as base script, except default mode is Cooldown.
  • IWD Pregen (iwdpgen): Same as vanilla IWD Pregen, but with shaman abilities added. (EE-only)

Auto-attack features:
  • Melee aggro range is dependent on class (see below for full breakdown); range from 5 ft. (mages) to 27 ft..
  • Will not attack if under the effects of Invisibility or Sanctuary.
  • Will not attack if using Stealth, Bard Song, Turn Undead or Shamanic Dance.
  • EEs: Active retargeting if a character's current weapon cannot hit or damage an enemy.
  • Priority targeting against enemy casters (limited to within 5 ft. or in range of current weapon).
  • Cooldown hotkeys to reduce melee aggro range to 5 ft. for 30 seconds, or set back to normal instantly.

Other features:
  • Classes with Search will use it when not attacking (note: for IWD2, auto-Search only works if a character has Rogue or Monk levels).
  • Will not auto-Search if using Stealth, Bard Song, Turn Undead or Shamanic Dance.
  • Will attempt to stop attacking, or stop a Bard Song, if suddenly invisible (ex. from a contingency or area invisibility spell).
  • Shamanic Dance is NOT stopped if suddenly invisible. This is to preserve summons.
  • Will not auto-attack at under 15% HP, unless an enemy is in range of current weapon.

Cooldown hotkeys:
  • If the B key is pressed, the character will enter a Cooldown mode for 30 seconds.
  • Cooldown reduces melee aggro range to 5 ft. and disables some of the retargeting actions.
  • If the E key is pressed, the Cooldown mode will be deactivated.
  • If the game is saved while a character is in Cooldown mode, it will be deactivated on reload.
Note: Stealth, Bard Song, Turn Undead and Shamanic Dance will prevent any Cooldown-related actions from triggering.



Script Compatibility:
Script Compatibility:
  • EEs: BG:EE, BG2:EE, IWD:EE, EET (tested on v2.5/v2.6)
  • Classic: BG1, BG2, IWD, IWD2 (tested with GOG versions)

Also compatible with any BG2 conversion mods (ex. BGT or Classic Adventures).

Classic BG2 engine:
NOTE: I'm not 100% sure the scripts work with expansionless versions of the classic games.

--

Auto-attack breakdown:

BG(EE), BG2(EE), IWD(EE)
Class: Fighter, Ranger, Paladin, including any multiclass combinations
Conditions (one must be met to auto-attack)
  1. Enemy is within range of the currently equipped weapon
  2. Enemy is within 27 ft.
  3. Attacked by enemy

Class: Kensai, Monk, Shapeshift/Polymorph (without Fighter levels)
Conditions (one must be met to auto-attack)
  1. Enemy is within range of the currently equipped weapon
  2. Enemy is within 19 ft.
  3. Attacked by enemy

Class: Cleric, Druid, Shaman, Thief, Bard, Cleric/Thief
Conditions (one must be met to auto-attack)
  1. Enemy is within range of the currently equipped weapon
  2. Enemy is within 13 ft.

Class: Mage, Sorcerer, Mage/Thief, Cleric/Mage
Conditions (one must be met to auto-attack)
  1. Enemy is within range of the currently equipped weapon
  2. Enemy is within 5 ft.
  3. If THAC0 is less than 5, will attack if enemy is within 13 ft.
IWD2
Class: Fighter, Ranger, Paladin or Barbarian (single-class or multiclass with 3+ levels)
Conditions (one must be met to auto-attack)
  1. Enemy is within range of the currently equipped weapon
  2. Enemy is within 27 ft.
  3. Attacked by enemy

Class: Monk (Level 9+), Wild Shape/Tenser's/Iron Body (without 3+ warrior levels)
Conditions (one must be met to auto-attack)
  1. Enemy is within range of the currently equipped weapon
  2. Enemy is within 19 ft.
  3. Attacked by enemy

Class: Cleric, Druid, Monk, Thief or Bard, including multiclass with Wizard or Sorcerer
Conditions (one must be met to auto-attack)
  1. Enemy is within range of the currently equipped weapon
  2. Enemy is within 13 ft.

Class: Wizard or Sorcerer
Conditions (one must be met to auto-attack)
  1. Enemy is within range of the currently equipped weapon
  2. Enemy is within 5 ft.

--

Nymph AI script (Call Woodland Beings):
Option 1 - Revised script:
  • Smarter spellcasting (better targeting, checks magic resist, etc.).
  • May cast Barkskin, Mass Cure, Entangle, or Summon Insects once each per combat encounter. When the AI uses these spells, it doesn't require or consume any memorized spells.
  • Slightly increased movement and casting speed.
  • Teleports to catch up with the party (ex. while traveling with Boots of Speed).
  • Preserves invisibility (won't attack or cast spells).
  • Cooldown hotkeys to delay spellcasting (B to enable, E to disable).

Compatible with EEs and classic BG2 engine, including SCS.
Not compatible with atweaks PnP Fey (use option 2).

--

Dimension Door: The nymph can teleport if conditions are met. It will alway teleport to either the nearest enemy or to a PC (usually, its summoner). It will not use Dimension Door if invisible, unless instructed to by the player (with the D key).

Marking: The nymph "marks" a PC as an object for various actions (by default, this is the summoner). If the marked PC is not on the map for any reason, the nymph will choose another PC on the same map. The nymph will always switch back to its summoner if in visual range. Note that the summoner, as an identifier, is not saved if a summon is still on the map (so if reloading, script will default to Player1 as the "marked" PC).

--

Hotkeys:
  • If the D key is pressed the nymph will teleport to its summoner (or other PC). Only works when not in combat.
  • If the B key is pressed, the nymph will enter Cooldown for 3 rounds. Cooldown mode disables most combat actions.
  • If the E key is pressed, the Cooldown timer is set to 0 (deactivated).

--

Option 2 - Patch existing script:
  • Adds Cooldown hotkeys (B to enable, E to disable)
  • Adds D hotkey to teleport to party (out of combat only)
  • Teleports to party if not in visual range (and not invisible)
  • Preserves invisibility (won't attack or cast spells)
  • Usable with atweaks PnP Fey, as well as AI mods that still use NYMPH.BCS (ex. SCS)

NOTE: Dimension Door is more limited with this patch. Will only teleport to the summoner or Player1.

--
Post edited by Dan_P on

Comments

  • Dan_PDan_P Member Posts: 129
    UPDATE v3.0:

    v3.0
    - Fixed an issue where some Bioware NPCs could target each other for 1-2 seconds after killing enemies. I didn't notice this until recently because I did most of my early testing with custom characters only.

    - Removed Calls for Help responses. I think what I had was pretty good, but it took away control from the player, which goes against the intent of a minimalist script. Shout actions are still in the script, in case I want to use them later (they should have a negligible effect on efficiency).

    - Added support for classic Baldur's Gate (that's BG1 on the BG1 engine). Key info:
    • characters will preserve Hide/Invisibility/Sanctuary
    • melee aggro ranges working
    • calls for help working (REMOVED, but theoretically, I could add it back in)
    • Cooldown hotkeys working
    • no auto-Search (the FindTraps() script action doesn't work)
    • Bard Song, Turn Undead, and Search won't prevent auto-attacking, but you can keep them active during battle if the character is standing outside melee aggro range (obviously with a melee weapon equipped)

    - Added the following tweaks:
    • EEs: Allow movement bonuses from shapeshift forms to bypass Free Action
    • IWDEE: Increase movement speed of Winter Wolf and Polar Bear forms
    • Give party starting equipment (IWD games)
    • Give party a Bag of Holding at game start (classic and EEs)
    • All classes get full HP bonuses from Constitution (classic and EEs)

    - Tested and confirmed that the BG2 script is working with various conversion mods, including IWD-in-BG2, Classic Adventures, and Epic Endeavors. The Bag of Holding tweak is also working with these.

    - This mod is pretty much finished now besides bug fixes, or making minor adjustments. The only TODO I have planned in my notes is PsT:EE support, which I'll probably only add if/when I get around to replaying it.
  • Dan_PDan_P Member Posts: 129
    edited February 2022
    UPDATE v3.2

    v3.2
    - Added component: Auto-assign script to new characters. This is a one-time action for each character in the party. Joinable NPCs in the EEs will also have their starting script changed.

    - Added the following tweaks:
    • Misc fixes for backstab-related 2DA files (EEs)
    • Reduce delay for Sneak Attacks + uncap Crippling Strike (EEs)
    • Fix weapon styles for some kits, if incorrectly changed by a tweak (EEs)
    • Weapon Style tweak for Deities of Faerun (EEs)
    • Allow Minsc to use his Berserk ability at will (BG games)
    Post edited by Dan_P on
  • GraionDilachGraionDilach Member Posts: 589
    edited February 2022
    How does Call Woodland Beings AI react to Atweaks's CWB changes?

    Also, it seems to me that the starting item pack ignores proficiency tweak revamps. I'd suggest to go with a bags of holding-based method based on the starting class IMO (maybe with one which doesn't allow storing items, like what Abel did in his Nonrandom Treasures).
  • Dan_PDan_P Member Posts: 129
    How does Call Woodland Beings AI react to Atweaks's CWB changes?

    Currently uses base-game spells only. I'll take a look at the atweaks changes when I get a chance. I remember having it in my notes somewhere to look at it, but I guess I forgot about it because I haven't been using atweaks in my EE installs.

    Also, it seems to me that the starting item pack ignores proficiency tweak revamps. I'd suggest to go with a bags of holding-based method based on the starting class IMO (maybe with one which doesn't allow storing items, like what Abel did in his Nonrandom Treasures).

    This is true. For EEs it gives weapons based on proficiencies (with priority of weapons arbitrarily set by myself). So it's assuming profs are mostly the same as vanilla. Small changes, like to scimitar or flail groups are okay as long as flail and scimitar are still in the group. I really like the way it currently works, so I'm going to keep it as the main option. I was planning to eventually add some adjustability to one or two major tweaks, but to be honest, I'm just not too motivated to do it right now.

    But the bag method might be a good idea as an alternate option. Like you said, it's more flexible with major proficiency tweaks. Since I already have a bag of holding component, it shouldn't take too long to add the option. It's basically the exact same thing, except put items in the bag as well. I'll need to test it in all iwd games, including even iwd-in-bg2, so might take a few days.
  • Dan_PDan_P Member Posts: 129
    UPDATE v3.3

    Small upate to scripts:
    - the B and E hotkeys (Cooldown Mode) now give feedback in the dialogue box

    Call Woodland Beings script
    - will now be skipped if the atweaks PNP Fey component is installed. It's not impossible to make it compatible, but I don't have time for that right now.

    Changes/fixes for the "Give party starting equipment" tweak:
    - IWD-in-BG2: greataxe was set to wrong item resource
    - classic IWD1 (with component 1): improved scripting and more ranged weapons can spawn

    - Added a new subcomponent:
    • Component 1: This is the original component. It auto-equips or adds weapons to inventory. The way items are chosen is game-dependent. For IWDEE, it's based on proficiencies, and currently only supports the unmodded prof system.
    • Component 2: Instead of adding to inventory, this component will give the party a bag, containing a selection of weapons. A single bag is given and the player can choose what to do with unwanted items (i.e. sell or throw away).

    NOTE: If the separate "Give party a Bag of Holding" component is not installed, then items can only be taken out of the weapon bag. If it is installed, then the bag is changed to a normal Bag of Holding. You only have one bag with both installed, and install order doesn't matter.
  • Dan_PDan_P Member Posts: 129
    edited April 2022
    UPDATE v3.5

    Call Woodland Beings AI (EEs)
    • added subcomponent: Use existing script, but patch in a few actions
    • adds Cooldown hotkeys (B to enable, E to disable)
    • adds D hotkey to teleport to party
    • will teleport to party if not in visual range (and not invisible)
    • will preserve invisibility
    • usable with atweaks PNP Fey, as well as AI mods that still use NYMPH.BCS (ex. SCS)
    Give party starting equipment (IWD games)
    • Option 1 (auto-equip) is now skipped if certain tweaks are installed
    • Option 2 (start with items in a bag) can be used with any tweaks
    • detects BG/IWD-style profs (from cdtweaks) and Proficiency Overhaul (from Skill and Abilities mod)
    classic BG2
    • the party script will fail to install if the Extended Event Text component from Improved GUI mod is detected (also called Extended messages/sounds or Extended Items/Quest/Spell messages)
    • installing these together will crash the game when attempting to load a save
    Readme fix
    • fixed/added info, relating to the experimental gold-exchanging Bag of Holding option (EEs)


    EDIT:
    Just realized today that Dimension Door no longer removes invisibility in EE v2.6. I'll probably just leave the nymph scripts as they currently are for backwards compatibility with v2.5. The D hotkey can still cast it whenever not in sight of enemies. They just won't use it automatically if invisible. Clicking the "Select All" button will also select summons, so you can have them teleport to the party, even if offscreen.
    Post edited by Dan_P on
  • Dan_PDan_P Member Posts: 129
    UPDATE v3.7

    classic BG2 (script):
    • added fixed DLL file if TobEx is detected (made by Insomniator from Spellhold Studios forum)
    • fixed compatibility issue with Extended Event Text component from Improved GUI mod
    Better AI for Call Woodland Beings
    • now compatible with original BG2 engine
    • as with the EEs, the patch option is compatible with atweaks PnP Fey
    "Give party starting equipment" tweak:
    • IWD-in-BG2: fixed potential issues caused by AR1006.BCS (starting area script)
    • classic IWD1: fixed items sometimes not being added if using an existing save
  • Dan_PDan_P Member Posts: 129
    UPDATE v4.3

    Added a couple tweaks:
    • Remove alignment restrictions for classes (classic and EEs)
    • Paladins and Rangers do not fall at low rep (EEs)
    These affect all classes and kits, including mod-added ones.


    Also, since the last time I posted in this thread, this component:
    • Adjust enemy damage at higher difficulties (classic IWD, IWD2)
    was also made compatible with IWD2, thanks to an exe patch by Bubb.
  • Dan_PDan_P Member Posts: 129
    edited February 2023
    The v7.0 update revises what the main script component adds to the game. It now installs a couple script options. It also installs the vanilla IWD Pregen script (with addition of shaman abilities), alongside my own scripts from this mod. Various compatibility issues with other mods or with the classic games have also been fixed over the last few updates.


    v7.0 update
    Fix for "Auto-assign script" with classic BG1:
    • It was firing every time loading the game, due to using a local variable (which don't get saved in BG1).
    • I've changed it to use a Global variable (for BG1 only). However, it won't run for every character.
    • It will now run once per party slot per playthrough (Player1, Player2, etc.).

    Changes for "Better IWD Pregen":
    • Main Script file renamed to d2scrp.BS (changed from iwdpgen.BS).
    • Added D2SCRP-: Same as base script, except some retargeting actions are disabled.
    • Added D2SCRP+: Same as base script, except calls for help are enabled.
    • IWDEE: Will patch the vanilla IWD Pregen script to include shaman abilities (basically what the v0.1 of this mod did).
    • BGEE/BG2EE/EET: Will also install the vanilla IWD Pregen script (with shaman added) as iwdpgen.BS.
    • Rewrote the install. Easier to edit or insert new script blocks.

    Changes for "Give party a Bag of Holding":
    • Improved scripting for adding the bag, based on work with the D2-Mira mod.
    • Option D (gold is exchanged) will now also add the bag if starting a new game in ToB. The other options won't give a bag in ToB because you already start with one.
    • All options now compatible with Black Pits 1 & 2.

    Changes for "Increase movement speed of IWD shapeshifts":
    • Can now install on classic IWD.
    • Will increase speed of all shapeshift forms (game only has the 6 Druid shapeshifts).
    • Wolf is faster than normal speed. Other forms are same speed or slower (but faster than unmodded).


    v6.0 update
    Script update:
    • EEs: Any character with skill points in detecting traps or illusions will now have auto-Search enabled. Previously, the feature was only for specific classes.

    "Give party starting equipment" (auto-equip):
    • for IWD2 and IWD-in-BG2, it will now give a reminder in the dialogue box to update the quick weapon icons by saving/reloading or re-equipping weapons.
    • Increased ammo stacks given to 40 (was 20)

    "Give party starting equipment" (item bag):
    • will now have at least 1 of every weapon type (i.e. battle axe, greataxe, and throwing axe are 3 different weapons)
    • Increased ammo stacks given to 40 (was 20)
    • if Thrown Hammers mod is installed, 5 Throwing Hammers are added to the bag

    Other updates:
    • Fixed compatibility issues or install issues with a few other mods.
    • Updated install files for several other components.
    • Made some of the component info during install more descriptive (i.e. compatibility with other mods).
    • Updated GitHub page with all the info from the Tweaks readme.
  • Dan_PDan_P Member Posts: 129
    edited February 7
    Made a couple recent updates. The main notable thing is, the mod has now been tested with the IWD2EE mod. It is compatible with IWD2EE. Install this mod after IWD2EE. If using the "Give party starting equipment" tweak, also make sure to install this mod before the IWD2EE compatibility patch. Note that the "Unnerf Animate Dead" component will be skipped if the IWD2EE Spell Revisions component is installed.

    Also:
    • expanded options for a couple tweaks
    • added 1 new tweak (salamander auras in IWDEE)
    • many internal improvements with installer files
    • GitHub page now has more detailed info on components.

    Download on GitHub: https://github.com/D2-mods/Better-IWD-Pregen/releases


    v7.3 update
    • Added tweak for IWDEE: Salamander auras hit only enemies of the caster. Has multiple options. Can patch all salamander auras, or just the Avenger shapeshift (i.e. if you want enemy auras to still damage anyone). Can also optionally make Cloudburst party friendly.
    • classic BG2: the tweak for Minsc's Berserk will now update the description if using the Improved GUI mod from Insomniator. Install this mod after Improved GUI. The description uses the same layout as Improved GUI, with duration changed to match the component.
    • BGEE/BG2EE: Fixed issue (caused by v7.2 update) that made description for Minsc's Berserk always say 1 turn duration, even if setting to 5 rounds or 2 turns.
    • Added more detailed component info to GitHub page.
    • More improvements to install files.


    v7.2 update
    IWD2/IWD2EE mod:
    • This mod is compatible with IWD2EE. Install this mod after IWD2EE.
    • 'Unnerf Animate Dead' will be skipped if IWD2EE 'Spell Revisions' is installed (it splits zombies and skeletons into separate spells, which include the stronger summons).
    • If using the 'Give party starting equipment' component, then also install this mod before the IWD2EE compatibility patch. It adds an effect to the 'Worn Garment' starting armor. Otherwise, I don't think it should matter.

    Fix/update for 'All classes get full HP bonuses from Constitution':
    • The '3e-style bonuses' option was only updating non-warriors. It will now apply to warrior classes. (Warning: Prism from BG1 will spawn dead if using '3e-style bonuses'.)
    • Added 3rd option: 'Mixed (use 3e-style at 10+, normal BG penalties at under 10)'.
    • Note that this component edits only the HP bonus. If you install this after another Con tweak, any changes to other Con effects will be kept.

    More options added for these components:
    • 'Remove alignment restrictions for classes': Now has multiple subcomponents, allowing to skip certain classes (paladins, clerics, monks, etc.).
    • 'Prevent paladins and rangers falling at low rep': Can now install for rangers only or paladins only.

    Other Updates:
    • Removed component: Fixes for backstab-related 2DA files. Not really a fit for this mod.
    • Minsc's Berserk tweak was using wrong description for '1 turn duration' option (it was saying 5 rounds).
    • Internal installer improvements.
  • ConnellyConnelly Member Posts: 79
    Hey Dan_P, pretty convenient stuff, but I seem to have stumbled upon an issue with the starting bags that I'm unable to pinpoint. The file "d2#ngbag.ITM" installs correctly, but other mods being installed after it (with the only common point being that they look for/over .itm files) seem to trip on it because they're expecting "d2#ngbag.ITM.ITM" for some reason. Once I add that second .ITM to the file name, the installation can proceed without any more issues.

  • Dan_PDan_P Member Posts: 129
    @Connelly thanks for the report. Can you tell me one of the mods that fails, so I can look at it? I can install my Workshop Kitpack after fine, and it does checks for all .itm files. (note: I don't recommend installing Workshop kitpack after, I just did this to check).
  • ConnellyConnelly Member Posts: 79
    I swear I took notes but I can't find them. I'll get back to you on this once I finish another install.

    What I do have right now is something I just found between the Salamander component and SubtleD's Spell Tweaks "Innate Cantrips". I picked the "Option 2 and Cloudburst being party friendly", and it seems to choke on D5CTPTS.SPL:

    //ERROR: illegal 2-byte read from offset 152 of 114-byte file D5CTPTS.SPL
    //ERROR: [D5CTPTS.SPL] -> [override/D5CTPTS.SPL] Patching Failed (COPY) (Failure("D5CTPTS.SPL: read out of bounds"))
    //Stopping installation because of error.
  • Dan_PDan_P Member Posts: 129
    edited February 8
    @Connelly thanks. That error with Subtled tweaks was my mistake for not putting tighter parameters for patching. I have it fixed on my local version of the mod (which I should get a new version up in not too long).

    --

    Edit:

    Mod updated to v7.4
    • Fixed an issue that would cause the salamander tweak for IWDEE to fail at install, if a previous mod added SPL files with no headers to the override folder.
    • Fixed an issue that made archers/beast masters still able to fall if using the "Prevent paladins and rangers falling" component.
    • Can now choose to skip mod items for the shortbow patch for IWDEE. (modders might make weird items with intentionally different visuals than normal).
    • Also fixed a potential issue with the shortbow patch. It could previously fail (not an error, just do nothing) if installed after a proficiencies overhaul on a non-English install of the game.

    Download on GitHub: https://github.com/D2-mods/Better-IWD-Pregen/releases
    Post edited by Dan_P on
  • Dan_PDan_P Member Posts: 129
    @Connelly

    I updated the v7.4 downloads (in the OP and on GitHub) that should prevent the issue you were having (with the ".ITM.ITM"). I was able to recreate your error message, by doing these:

    - installed the "start with bag containing items" component for IWDEE
    - installed a small test mod with not-great parameters for patching (a simple "file exists" check, prevents the error)

    Regardless, this particular error will definately not appear again (as in, it's 100% not possible). Note that version number isn't changed yet, but some files are updated.
  • ConnellyConnelly Member Posts: 79
    Well, that was fast, didn't get the opportunity of starting a new test install, but won't complain. :P
Sign In or Register to comment.