Jump to content


Member Since 07 Aug 2006
Offline Last Active Nov 26 2018 09:26 PM

Topics I've Started

The probability field in effects

21 November 2018 - 11:15 AM

This is probably known to the cognoscenti (and is sort of on IESDP), but I didn't know it and judging by various spell files, other modders don't either, so now that I've worked it out, I thought it might be worth sharing.

Effect files have two probability fields: Probability1 and Probability2. Each should be thought of as having 100 possible values, from 0-99. (Probability1 is usually set to 100, which is confusing, but I think it could be set to 99 with no change.)

When an event fires, a random number in the 0-99 range is generated. If that number is <=Probability1 and >=Probability2, the event fires.

Some counter-intuitive cases (this is where I started to get confused):

- if you set both Probability1 and Probability2 to 0, you don't deactivate the spell: you get a spell with a 1% chance of firing (it fires whenever the random number generator spits out zero).

- if you set Probability1 to 1 and Probability2 to 0 (as, e.g., happens in BGT's implementation of the iron crisis), you don't get a spell with a 1% chance of firing, but one with a 2% chance of firing.

I saw that this was what the IESDP said, but I wasn't sure I believed it, so I ran some tests with a custom spell that kills you with low probability, a custom script that casts the spell 10x per second and displays a count of the number of castings, and a hapless NPC (the appropriately-named 'Deder', from Candlekeep). The ground outside Winthrop's inn is littered with the bodies of Deder's clones, but I've established to my satisfaction that it's correct!

I *think* there are quite a few mods where people are trying for a 1% chance of something happening and ending up with a 2% chance - hence this post.

Help needed on OSX for SSL

13 November 2018 - 12:33 PM

I have a report that the latest version of SCS doesn't install on Mac-OSX. As I have no OSX testing environment, and virtually no familiarity with the system, I'm going to need to ask for help here.

The underlying problem is that "SSL", SCS's scripting metalanguage, compiles scripts through a call to an external Perl script shipped with SCS (Wheels of Prophecy, aTweaks and Item Randomizer also use SSL". On Windows installs, I distribute an executable, and that works fine. On OSX, I assume native Perl support, and just call the script. Specifically, it's called by an AT_NOW command in stratagems/sfo/general/lib_general.tpa on lines 56-57. The relevant code is

		AT_NOW ~chmod 755 %scsroot%/%ssl_loc%/ssl.pl~
		AT_NOW ~/usr/bin/perl %scsroot%/%ssl_loc%/ssl.pl "%full_loc%\%script% %sslvariables% -o %workspace%/ssl_out -l %ssllibrary% %workspace%/autolib %booleanstring%"~ EXACT
		AT_NOW ~%scsroot%\%ssl_loc%\ssl.exe %full_loc%\%script% "%sslvariables%" -o %workspace%/ssl_out -l %ssllibrary% %workspace%\autolib %booleanstring%~
The windows bit works fine. The OSX bit is black magic to me, and apparently has stopped working. (The version of SSL distributed with SCS v32 has been updated, so that may have something to do with it.)

I'd welcome any help (without which, I'll have to stop supporting non-Windows installs). You will need to test your suggestions yourself, as I don't have an OSX environment. Probably the quickest way to get an SSL call in SCS v32 as-is is to try to install component 5000. Quicker still, edit setup-stratagems.tp2 to uncomment component 0, and then edit stratagems/test/test.tpa to read


    LAF ssl_to_bcs STR_VAR script=ogremasu locbase="iwdspells/resource" END

SCS v32: installation times

12 November 2018 - 07:27 PM

One of the things I've tried to do in v32 is optimise the installation time a bit, since it's been getting a bit out of hand (especially in heavily-kitted installs).


Here are the install times I got for a clean install on BG2EE and BGEE (in both cases on a reasonably good 2016-vintage desktop PC). If you get radically longer times, even on a heavily modded install, I'd be interested to know.

(Components marked with + will take longer in rough proportion to how many NPCs you have installed; components marked with * will take longer in rough proportion to how many creatures you have installed.)




IWD arcane spells: 2m
(+)IWD divine spells: 2m 40s
(+)NPC customisation: 2m 15s
Remove unrealistically convenient items: 1m25s
Remove unrealistically convenient ammo: 25s
(*)Initialise AI components: 3m40s
(*)Smarter general AI: 3m20s
Better calls for help: 8s
(*)Smarter mages: 13m
(*)Smarter priests: 4m
(*)Potions for NPCs: 2m
Improved Golems: 35s
Improved Fiends: 1m 35s
Smarter Dragons: 25s
Smarter Beholders: 1m5s
Smarter Illithids: 25s
Smarter Vampires: 15s
Spellcasting Demiliches: 11s
Improved Bodhi: 21s
Improved Sahuagin: 27s
Improved Drow: 15s
Improved Fire Giant Temple: 15s
Improved Sendai's Enclave: 17s
Improved Abazigal's Lair: 24s
Improved BG2 minor encounters: 24s

Everything else: 10s or less



IWD arcane spells: 2m 10s
(+)IWD divine spells: 2m 25s
(+)NPC customisation: 2m 35s
(*)Initialise AI components: 4m 20s
(*)Smarter general AI: 1m 10s
(*)Smarter mages: 3m 15s
(*)Smarter priests: 55s
(*)Potions for NPCs: 1m 5s
Improved Durlag's tower: 50s

Everything else: 10s or less


I didn't do systematic timing for EET, but I did time the big ones:

NPC customisation: 3m 20s
Initialise AI components: 5m 15s
Smarter general AI: 4m 20s
Smarter mages: 18m 40s
Smarter priests: 6m

SCS v32 Release Candidate (now Version 6) Available for Testing

12 November 2018 - 07:22 PM

For testing, I've just uploaded a release candidate for SCS v32 (now v6) to Github.
Version 32 of SCS is complete and has passed a bunch of install tests (it installs cleanly on unmodded BGEE, BG2EE, SoD, EasyTutu, BGT, and BG2-ToB, and I've done a bit of testing with SR and Ascension). But since it's a fairly substantial revision - the biggest since I merged SCS and SCSII, I think - and since it's built on the v30 codebase, not the v31, I'd like to get a bit more reassurance it's working correctly before I do an 'official' release.

Release Candidate 6 Changelog

  • fixed a critical bug which caused crashes in areas with Blackguards present (notably AR3022)
  • party-joinable rangers now get their two stars in 2-weapon fighting
  • added a few missing strings to Italian translation
  • fixed some minor glitches with Ease-of-Use AI

Release Candidate 5 Changelog

  • Updated Italian translation, thanks to improb@bile
  • Improved NPC Customisation copes better with malformed CLAB files (which inter alia fixes the problem with Archer Called Shots going missing)
  • Sarevok death movie should now play on EET
  • fixed some glitches in the new difficulty system (one of which was blocking completion of the Merchant League quest in Baldur's Gate)
  • Cause Wounds no longer restricted by alignment
  • use restrictions for scrolls properly handled
  • minor fixes to smarter mages/priests, mostly improving handling of Innocent spellcasters
  • fine-tuning of ranged AI

Release Candidate 4 Changelog

  • Fixed a critical bug in the NPC customization component that was preventing NPCs from pursuing their stories. (NB: this fix isn't retroactive, so NPCs who joined your party under RC3 or earlier are permanently silent. Apologies for this; I warned you these were release candidates, not stable releases.)
  • Substantial rewriting of the help script to (I hope!) deal with the persistent reports of contagious help calls.
  • Complete rewriting of the random-scroll code (it now applies to BG2EE as well as BGEE)
  • Beetle animations are now present on non-SoD installs
  • Fixed incomplete implementation of NPC-potion distribution on EE
  • More robust patching of cures into stores for IWD divine spells (this should help with SR compatibility issues)
  • Pure-damage mephit effects no longer break concentration on EE if you are 100% immune to the damage type
  • As of 8am 11/22 PST, fixed a new problem with Davaeorn and one with Smarter Deployment component of General AI

Release Candidate 3 Changelog

  • Second, hopefully-successful, try to get SSL to work on OSX
  • Non-English-language installs should now work
  • IWD Arcane Spells should now install properly even when some other mod has already added an IWD spell
  • Misc fixes to IWD spell-scroll distribution
  • NPC customisation now works properly when the PC is still first level
  • NPC customisation now gives creatures 10hp at start, not 1hp (the latter confuses various NPC pre-join scripts, notably causing Aerie to vanish)
  • NPC customisation is now more likely to cope with broken cre files in badly-coded NPC mods
  • Fixed other more minor glitches with NPC Customisation
  • Restored Davaeorn's AI, and fixed a bunch of other mage-AI issues shown up in the fix
  • Tweaks to the mage/priest AI for SRv4final
  • Fixes to acid-storm tonedown and to spell use if IWDification is being used rather than native IWD spells
  • Fixed minor compile bug on BG1NPC enforces
  • Stopped ranged creatures from wandering
  • Less misleading description of Stoneskin component
  • Fixed minor glitch in cleric/mage sequencer script
  • Fiends in Chain Contingency now summoned properly
  • Missing ini entry for elemental-arrow tonedown restored
  • Metadata in ini updated as per AlienQuake request

Release Candidate 2 Changelog

  • allows SCS to install on OSX
  • fixes a critical bug with Improved NPC Customisation and Management which in some circumstances would cause the player to level uncontrollably
  • prevents duplicate entries being removed from stats.ids by Detectable Spells (among other things, this allows SCS to be installed after Tweaks IWD proficiencies without errors)
  • gives the correct names to summoned orcs and hobgoblins on BG1EE installs
  • removes a (harmless) missing-high-level-ability warning on BG1EE installs
  • ensures the CONTINGENCY_TRIGGERED string is added to splstate.ids (under certain circumstances it could be absent on BG1EE installs, causing parse errors)
  • As of 9am PST 11/15, fixes the critical dependency bug that stopped earlier versions of RC2 installing

Version 32 Changelog
New or Substantially Modified Content

  • Systematic integration of the difficulty slider (and per-component difficulty customisation) into scripts; hardcoded difficulty-based adjustments are deactivated by default
  • Substantial streamlining of the mod structure:
    • "Initial" component is only required for AI/tactical components (it's silly to require its various changes if someone just wants to skip Candlekeep)
    • All spell-tweak components have been integrated into the Initial component (but can be adjusted via the ini) - since they're more-or-less assumed by the AI, playing without them doesn't cound as a "recommended" install and so I'd rather install them by default
    • Most item-tweak components have been integrated into a single component (though again, power users can deselect individual components via the ini)
    • As listed in the v31 change-log, eight of the gameplay/ease-of-use components have migrated to the Tweaks Anthology and are deprecated.
    • Remaining non-tactical/AI components have been collected together into "Gameplay".
    • All customisation options for AI and tactical components have been absorbed into the new difficulty system, so that they can be adjusted in-game rather than at install time
    • Smarter Celestials and Improved Fiends have been combined; 'Mages/Priests get High-Level Abilities' has been absorbed into the Mage/Priest components.
  • New components: include IWD:EE priest and mage spells.
  • Smarter Mages and Smarter Priests will now use Icewind Dale spells, if they are installed via IWDification or via SCS itself (and if Spell Revisions is not installed)
  • Big increase in level of support for Spell Revisions; I think I pretty much fully allow for its changes now.
  • Major overhaul of scripts (in particular targetting), to take advantage of new Enhanced Edition / ToBEx and to allow for the new spell systems. Far too many changes to list, but in particular:
    • Spellcasters will now notice your protective items only after their first failed attempt to use a spell on you. (They still notice visible spell effects immediately.)
    • Spellcasters are now more willing to use their single-target spells to try to break through a wizard's Spell Deflection. (This is experimental; let me know how it plays out.)
    • Moderate increase in the number of spells used (even without Spell Revisions / Icewind Dale spells)
    • More careful targetting of area-effects spells to avoid friendly fire (and so, more willingness to use those spells)
    • Substantial increase in the variety of contingencies, sequencers and triggers used (and sequencers/triggers are chosen at install time now, not when you first encounter the mage)
    • I make a bit more effort to make mages use more distinctive abilities. (For instance, invokers now pretty much have a monopoly on Fire Shields; necromancers are fond of cold spells.)
  • Additional tweaks to the standard spell system:
    • Removed the spell-battle framework for summoned elementals
    • Fiend-summoning spells now summon alignment-appropriate fiends (I always did this for enemy mages with 'Smarter Mages' installed, but now I do it for the PC too
    • Elemental-protection effects now give complete immunity to the effect (i.e. it doesn't disrupt spellcasting) if the damage resistance is 100% or more (EE is in the process of rolling this out but it hasn't come to BG2EE yet)
    • Player-cast Symbol spells are now party-friendly. (NPC ones always were even in the vanilla game, so this is a fairness tweak.)
  • Tweaks to the Icewind Dale spell system. (Some of these are rather more drastic than the changes I make to the vanilla system; feedback welcomed. My ulterior motive is to experiment a bit with improving priest magical defenses.)
    • Circle of Bones now lasts for 1 round per level
    • Shield of Lathander and Greater Shield of Lathander have been renamed to something neutral (Divine Protection/Greater Divine Protection), are self-only, and are not restricted to evil characters.
    • Impervious Sanctity of Mind (which was a L7 self-only spell functionally equivalent to Chaotic Commands) now has a longer duration, includes a Spell Shield, and prevents spell failure effects.
    • Thorn Spray now does a tolerable amount of damage.
    • Acid Storm now functions more like an area-effect Vitriolic sphere (previously it was more or less an automatic way to shut down spellcasters).
    • Mordenkainen's Force Missiles has been nerfed at higher levels (maximum 4 missiles, maximum 15 hp splash damage per missile), since it was pretty ridiculous otherwise, especially in Sequencers.
    • Create Boneguard has been added as a L9 necromancy spell, basically stealing the Boneguard from Monster Summoning VII.
  • Faster Bears now works on EE.
  • Early Access to Watcher's Keep now works on EE (and no longer blocks access to Watcher's Keep in SoA).
  • Big improvements in install speed, especially on heavily kitted installs. (It still takes a while, though.)
  • New EE-only component: improved NPC customisation and management. (This is an EE version of 'choose NPC proficiencies and skills', but much more powerful and (I hope) robust.)
  • New EE-only component: wider selection of random scrolls.
  • New component: make sequencers and contingencies into innate abilities.
  • I've decided that I need to require ToBEX on non-Enhanced Edition installs. Unfortunately, this means I no longer support non-Enhanced versions of the game on MacOX or Linux.
  • On the Enhanced Edition, ease-of-use AI now replaces the Advanced AI, and can be customised using the controls under "Customise/Scripts".
  • Added yochlols and rilmani to "Improved Fiends and Celestials".
  • Deprecated 'more resilient trolls' component.
  • Deprecated the auto-installer, in anticipation of Zeitgeist (and because it's a bit hacky). Scream if you want it back.
  • Deprecated 'move hell items' component, since this is now fixed both in EE and in v12 of the Fixpack.

Other Content Changes

  • Removed the beholder burn-thru option (since EE, at least, handles burnthru correctly) and fixed on the PnP-style antimagic eye as a default.
  • On EE installs, enemy invisibility spells now hide the spellcaster's animations.
  • Reduced use of fiend summoning by mages (mostly, only liches summon fiends now).
  • On EE installs, if you're not using Spell Revisions (and at the risk of their immortal soul) it is possible - though difficult - for party members to acquire the ability to summon non-hostile fiends. (This removes a piece of enemy cheating I was always a bit uncomfortable with.)
  • Demilich Trap the Soul no longer causes level drain (actually changed earlier, but only now documented)
  • Slightly reduced rate of vampire constitution drain.
  • Priest AI use of Cure Serious Wounds touch attacks slightly tweaked.
  • The "extra spell scrolls" component now includes a scroll of Improved Mantle (this was claimed in the documentation but not implemented).
  • Slightly reduced allocation of invisibility potions to thieves.
  • Alhoon now fights to the death.
  • Moved the Cloak of Mirroring to Vongoethe.
  • Daitel, being a ghost, is now immune to nonmagical attacks.
  • Added a couple of yochlol to the drow ambush groups in Sendai's enclave.
  • Carbos and Shank have been expelled from the Assassin's Guild.

Under-the-hood changes (not visible in game)

  • Recoded "add spell immunity scrolls".
  • REQUIRE_COMPONENT now used to detect components, mostly replacing marker files.
  • Rearranged external folder (and renamed it weidu_external to make it clearer that others are welcome to share it).
  • Restructured crossplatform code to allow for EET and generally be more readable.
  • Broken the single tra file into per-component tra files (for all languages).
  • Upgraded SSL to include new SSLBoolean settings, TRIGGER_REPLACE library option, and use of scsargumentN in triggers.
  • Updated function library.
  • Updated to Weidu 246.
  • Updated Detectable Spells.
  • Smarter Abazigal component no longer biffs the lizard-weapon icons on Enhanced-Edition installs (unnecessary, and messes with iOS installs).
  • Complete recoding of the mage/priest blocks to support IWDification, SR and the new spell system. Each mage and priest now has their own bespoke script.
  • Streamlined detection of BG1 characters.

Bugfixes (some but not all of the v31 fixes are called out here, as they have been implemented differently)

  • detect-cloud code no longer fails on installs where some cloud spellls are absent (including current-version BGEE)
  • Mulahey's scripting (in "tougher chapter 2 end fight") now works properly on TUTU and BGT installs
  • Extra kobold spawn in "harder kobolds" now calculates the chapter correctly on BGT installs
  • Fixed a typo that was preventing the no-dispelling-arrows component from functioning properly
  • Duplicated BG2EE use of the more discriminating LastKilled trigger for the Shade Lord's shadowmaking (and tightened it up a bit on non-EE installs too)
  • Fine longbows and shortbows no longer give an unintended +1 to damage
  • A couple of changes to allow installation on a vanilla Tutu install, even though I don't officially support it.
  • Anadramatis the yellow dragon now attacks with claws and fangs rather than unarmed
  • The Priest of Cyric in the North Forest had both dual melee weapons and a sling, which causes crashes (stealth vanilla bug); the sling has been removed.
  • Abazigal gets the effects of the "improved dragon staying power" subcomponent on non-Ascension installs
  • The various avatars in the Durlag Lovefight are now explicitly immune to Avarice's poison cloud
  • "Earlier Watcher's Keep" component now permits access to Watcher's Keep in the Shadows of Amn portion of the game
  • Ettercaps and wyverns now correctly use their poisoned weapons.
  • The staircase between the two levels of the Guarded Compound is now magically blocked during the fight with the Guarded Compound team, since there have been reports of glitches caused by people flitting between levels.
  • Baalor telekinesis power is now correctly named.
  • Invisible mages wander a little less far at the start, to avoid wandering away from the battle entirely.
  • Ini-based adjustments to spellcaster level no longer cause trouble when the adjusted level is below zero.
  • Smarter Mages and Smarter Priests now handle level adjustments to multiclass spellcasters more delicately.
  • Corrected a couple of mismatches between Improved Shapeshifter paws and their descriptions as regards paw enhancement level (werewolf tokens changed to match the descriptions; other descriptions changed to match the items).
  • On non-EE installs, attacking INNOCENT mages now causes reputation loss.
  • Planar warden was getting an erroneous extra attack
  • Creatures now correctly flee Storm of Vengeance.
  • Insect plague/fire-shield changes should now work again.
  • Player-summoned hotkey control now a bit smoother.
  • Player-summoned creatures with ranged attacks now use them properly.
  • Fixed a glitch in the Help script which in some circumstances causes enemies to home on to an invisible PC.
  • "Recover items from Hell" no longer breaks the transition to ToB on some installs; component generally recoded to be more resistant to problems in the future.
  • Support for variable libraries (and in particular for SR-specific libraries) now works properly
  • Fixed a typo causing the fission slime "fix" to install on EE installs rather than *non*-EE installs.
  • Corrected a glitch in Ascension Irenicus's Mislead.
  • Several mages (including a couple of rakshasa, a kobold witch-doctor, and a few BG2EE-added creatures) inadvertently got skipped by "Smarter Mages" and are now included properly.
  • The Cleric/Mage statue of Sendai no longer erroneously retains its old-style cleric/mage script.
  • "Improved minor BG2 encounters" now correctly changes the traps in the Guarded Compound.
  • The traps in the Prison Plane are now PC-only, as NPCs are apparently setting them off inappropriately.
  • Clerics now correctly use Blade Barrier in their prebuff sequences.
  • The tanar'ri summoners in Watcher's Keep no longer cast their spells instantly (among other things this brings the animation level in that encounter under control).
  • Vithal now gets allocated a combat script correctly.
  • Many rakshasa nobles have their level increased in Smarter Mages (the automated code was assigning a level that was too low for the powers they show in-game and that didn't respect the power differences between Ruhks, Rajahs and Maharajahs).
  • The Planar Prison warden now acts intelligently when enemies attack and then retreat.
  • Recoded fine-weapons component to update code and correct some glitches with weapon shatter.
  • The initialisation component externalises the effects of the Wand of Spell Striking to spells (you won't see this in game but it makes the wand play nicely with various tweaks to Breach).
  • Breach now properly affects rakshasas.
  • Corrected some serious logic/naming errors with Abazigal; in particular, he should now use his SCS script if "Smarter Dragons" is installed, and Tamah should spawn correctly.
  • Fixed some install bugs in "Antimagic penetrates invisibility", and taken advantage of new EE functionality.
  • Gromnir now uses Vhailor's Helm if he has it.
  • Nalmissra gets her proper script if "smarter fiends" is installed.
  • Various help-script tweaks.
  • Kobold poisoned weapons now grant saving throws properly.

Compatibility fixes

  • lib_macro is a little less fragile in the presence of third-party CLAB errors
  • Various copy routines fail a bit more gracefully when some idiot leaves a broken file in the override
  • We now recognise that SR v4 True Seeing cures blindness
  • Flagged a (hidden) fix of a Fixpack/Ascension compatibility problem to apply only on non-EE installs (EE installs don't use the fixpack)
  • We now determine the maximum spell level for any spellcasting type at install time (this fixes compatibility, in particular, with mods that increase the maximum level of bard spells)
  • Code to remove broken items (iplotxx, etc) is now a little more robust, which might help some compatibility issues.
  • RP part of Werewolf Island is now skipped if it's already been installed via The Calling.
  • Fixed various compatibility problems (notably, duplicate of Tamah) with the new EE-friendly version of Ascension.
  • Fixed a bug in new Ascension that was nerfing Demogorgon's summoning power.
  • Items moved by 'Move or modify some overpowered magic items' now only move if they haven't already been moved by another mod.

SCS v32 and spell targetting

12 November 2018 - 05:59 PM

Both the Enhanced Edition and the ToBEX-enhanced original game now have substantial advances in scripting options as compared to the original game. Version 32 of SCS (to be released fairly imminently, at least in playtest form) takes advantage of this rather more than previous versions; partly as a consequence, there are several substantive changes in targetting. These are all somewhat experimental and I'm keen to get feedback.

1) In previous versions, spellcasters totally ignore anyone protected by Spell Deflection, Spell Turning or Spell Trap. V32 is a bit more aggressive: it will use single-target spells on mages with Spell Deflection (but not the other protection types) in the hope of burning through the protection. The spellcaster's most powerful spells won't be used in this way: only spells 2 levels or more below the caster's highest level are used against Spell Deflection.

2) One dilemma in previous versions was how to handle magic items that provide protection (e.g., should you cast Domination on someone wearing a Helm of Charm Protection?) Previously, I've erred on the side of detecting these items, on the grounds that while it's a bit unrealistic for a mage to immediately see your items, it's not that obvious, whereas if a mage repeatedly targets someone who's obviously immune to an effect, it breaks immersion.

V32 takes advantage of new scripting options to do something more sophisticated: the *first time* that a spell type is cast, the caster will fail to notice the protective item, but subsequently it is noticed. (So a mage might cast Domination on the protected creature, but won't then try a Dire Charm on the same opponent).

3) Previous versions of SCS were very cautious with party-unfriendly spells like Fireball, usually only using them if the caster was immune to the spell and if there are no allies anywhere around. V32 is significantly more aggressive with area-effect spells: it tries to target clumps of enemies, and it is willing to cast with allies or an unprotected caster around because it tries to detect if they're actually in range. I'm not sure exactly how this will play out; realistically there will be *some* friendly fire, but I'm keen to find out just how much.

One consequence of embracing the full range of modern scripting options is that SCS now requires either the Enhanced Edition engine or a ToBEx-compatible engine. What that means in practice is that I no longer support OSX versions of the vanilla game. Apologies for this, but it's a very small fraction of my player base and maintaining backwards compatibility has just become too difficult.