Jump to content

Affecting kits from mods to enemies


Recommended Posts

Hi,

Are there any guidelines to affect kits from mods to enemies ?

Readme explains how to affect a kit to a CRE through several kit files. This is the easy part. But then, I am wondering how does it applies clab*.2da files. I have searched in files but can't find any references. No more chance in script BAF files.

Let's take an exemple, SCS is able to affect berserker kits to a few enemies in BG1. If installed, I can checked those CREs and I saw they can cast their ability (rage - SPCL321).

However, in the sources, I can't find any reference to CLABFI02.2DA (berserker kit) nor SPCL321 anywhere. Admittedly, SCS is quite something when it comes to source code. Even through David W knows how to code, it would take quite some time to understand how everything works, even on a localized change like a CRE and its scripts.

Understanding how it is done would allow me to check if every original kits are properly handled. I would also check for special cases like sorcerers, monks.

Then, I want to adapt my installed SCS so it can properly use some kit mods (Faith and Powers, and maybe Artisan kitpack later on).

For the first one, I need to:

- properly apply CLAB*2DA files, hoping SCS already has a function for this.

- make new scripts for those kits (here I think it is just coding those new abilities)

- altering spell affectation for cleric and druid if sphere system is installed (just have to make one 2da files for each kit, as it was done for mage kits)

- adding new spells to script (here, this is closed to kit abilities)

 

 

 

Link to comment

Creatures outside the party do not have kit CLABs applied to them automatically, ever. Even NPCs that were once in the party get those abilities removed when they leave. If you want those effects to apply to outsiders, you need to explicitly add them.

In-game, this can be done with the AddKit script action. This, however, produces log messages such as "Gained ability: _" that you might want to avoid. The alternative is to directly add any relevant abilities and effects to the character. For example, a Dwarven Defender differs from a fighter in two major ways: their passive physical resistances, and their Defensive Stance ability. The former shows up in the CLAB as AP_SPDWD01, repeated at four different levels. Apply that spell to them in gameplay, add an effect to the CRE that grants permanent physical resistances, or just cut corners and edit the creature's base stats. The latter shows up in the CLAB as GA_SPDWD02; grant that ability. Add this innate to the CRE file with ADD_KNOWN_SPELL and ADD_MEMORIZED_SPELL, or add it in gameplay with opcode 171 or the AddSpecialAbility script action.

SCS does not have a function to simply grant all of a kit's CLAB abilities to a creature. It's not really feasible to do so, given the nature of AP_ entries that cast spells on the creature. Instead, it works ad hoc with the limited range of kits it uses. SCS has lots of berserkers, and those are easy - just add the appropriate number of instances of Enrage. Mage specialists? Even easier; there's nothing at all in their CLAB. Assassins? Their attack/damage bonus is an easy passive effect to add, and the increased backstab cap is one thing the game does handle automatically. Just add the poison ability, and you're set.

Scripting creatures to use kit abilities or alternate spell selections is another matter. Figure out sensible conditions and priorities, insert at the appropriate point in the relevant combat scripts ... this stuff isn't easy. There's a reason SCS doesn't have a lot of competition in its AI-modification specialty.

For a bit of background, I have a component in my tweak mod that grants a kit to an NPC - making Eric Vanstraaten (leader of the paladins who join you against Bodhi) into an Undead Slayer. And I don't bother with the active abilities of the class, just the passives. Add a block to his script that casts those passives on him when he's created, and that's it.

... Wait, did I say it wasn't really feasible to grant all of the CLAB abilities? Scratch that. I'm going to write that function.

Edited by jmerry
Link to comment

Thanks for your detailed answer. I already knew it wouldn't be easy and I know that applying a kit does almost nothing except a few like assassin backstab multiplier.

Still, I'm curious on how SCS does give rage ability in CRE as I wasn't able to find any relevant code. I just saw  that Drasus has only one rage at level 10 instead of 3, which means, as you said, that SCS doesn't parse CLAB files.

Now, it would be great to have a WEIDU function that would parse CLAB files, adding innates and applying those AP_* files.

I don't see much trouble in doing this:

- read CRE level1

- read CLAB

- browse all columns and for each column where row1 <= level1, add CRE SPELL all GA_* innates and apply all AP_*

For the later, either put them in their BAF file to be applied once, either those SPL files should be read and effects applied one by one.

 

 

 

Edited by aigleborgne
Link to comment
On 3/30/2023 at 2:39 PM, jmerry said:

SCS does not have a function to simply grant all of a kit's CLAB abilities to a creature.

Actually I’m pretty sure SCS already does this? I recall some back-and-forth with DavidW back in… v28? v30? SCS was scanning all kit tables in kitlist.2da to apply the proper kit effects. It got really unwieldy in games with hundreds of kits, because SCS was processing all those tables, but of course it was for no purpose because there were no AI NPCs with those kits. So, IIRC, SCS scaled it back and now only processes the vanilla game kits to apply kit abilities. 

Applying passive kit abilities to NPCs would not be very hard, and it would be perfectly efficacious… the real problem is that almost no AI NPCs actually have kits that require this. And none of them require it for mod-added kits. (Any mod that adds a kit and adds an NPC with that kit will almost certainly do the work of applying the kit abilities, leaving no need for SCS to do anything.)

It could be kind of interesting to, say, make one out of every four AI thieves into a Swashbuckler with a massive AC bonus. Or give some druids the Totemic kit, and maybe start the encounter with a spirit animal already summoned? And sending an undead hunter after Bodhi is a nice touch. But overall, the effect of this sort of thing will be pretty small. 

(The most noticeable thing will be Berserkers. In my last game I modded Berserk Rage to add a temporary Min1HP effect… and then in BG1, in combination with SCS, most of the ogres I met were temporarily immortal! :O )

Link to comment
13 hours ago, aigleborgne said:

Now, it would be great to have a WEIDU function that would parse CLAB files, adding innates and applying those AP_* files.

I don't see much trouble in doing this:

- read CRE level1

- read CLAB

- browse all columns and for each column where row1 <= level1, add CRE SPELL all GA_* innates and apply all AP_*

Yeah it would not be hard. If you want a bit of a head start with the code you can look at what I did over here

Link to comment
On 3/31/2023 at 10:40 PM, subtledoctor said:

Actually I’m pretty sure SCS already does this? I recall some back-and-forth with DavidW back in… v28? v30? SCS was scanning all kit tables in kitlist.2da to apply the proper kit effects. It got really unwieldy in games with hundreds of kits, because SCS was processing all those tables, but of course it was for no purpose because there were no AI NPCs with those kits. So, IIRC, SCS scaled it back and now only processes the vanilla game kits to apply kit abilities. 

I have just looked a few CRE and they only get one ability when they should get 2 or 3, so it doesn't seem to work properly. I'm running EE, so it might be that.

Additionally, I have looked at kit.2da for BG1 mages. Most of them are conjurer and invoker. I like more diversity so I tried to put TRANSMUTER to one of them and after install, it was NECROMANCER. I think there might be some bugs somewhere as TRANSMUTER is never affected in 2da files.

I will have to look at these issues when I have time.

Link to comment

For mages, SCS knows how to build conjurers, enchanters, invokers, and necromancers. The other four specializations are not available, and neither are wild mages. I personally think that illusionists should be added, but the last three (abjurer, diviner, transmuter) are clearly mechanically inferior.

Link to comment
12 hours ago, jmerry said:

For mages, SCS knows how to build conjurers, enchanters, invokers, and necromancers. The other four specializations are not available, and neither are wild mages. I personally think that illusionists should be added, but the last three (abjurer, diviner, transmuter) are clearly mechanically inferior.

Totally agree, but if we take performance into considération, all single classes should have a kit, which is not the case, at least in bg1

Personally, I don't think all mages should be limited to those kits, especially with SR

Edited by aigleborgne
Link to comment

The inability of transmuters to remove spell protections and abjurers to use stoneskin means any enemy mage with those kits is free xp unless you have intentionally gimped your own party (eg. no arcane casters).

Wild mages should never be enemies because they can kill themselves with their own spells on bad surges.

Diviner just seems to lose a couple of things for no meaningful gain.

Illusionists could easily swap skulltrap for fireball but losing horrid wilting for -2 save modifier on spook was probably not worth the effort.

I havent played with SR for years but unless stoneskin and mage duel spells are universal school and there are offensive divination spells they don't add anything in terms of enemy variety.

If SR adds some of the offensive illusion spells from 3e you could probably make a case to DavidW to include them. The shadow magic spells were pretty cool.

Link to comment
1 hour ago, rigidjelly said:

The inability of transmuters to remove spell protections and abjurers to use stoneskin means any enemy mage with those kits is free xp unless you have intentionally gimped your own party (eg. no arcane casters).

On bg1 with low level mages, transmuter are fine. Thematically, it allows them to focus on transmuting school. For example, SR polymorph self is quite potentiel in bg1

1 hour ago, rigidjelly said:

Wild mages should never be enemies because they can kill themselves with their own spells on bad surges.

Maybe, but they can also do great things too. Admitelly, maybe not at low level. 

1 hour ago, rigidjelly said:

llusionists could easily swap skulltrap for fireball but losing horrid wilting for -2 save modifier on spook was probably not worth the effort.

Not an issue in bg1 and again, would add more diversity. 

1 hour ago, rigidjelly said:

I havent played with SR for years but unless stoneskin and mage duel spells are universal school and there are offensive divination spells they don't add anything in terms of enemy variety. 

Through kit choice, it implies a dedicated spellbook. Having 1 or 2 spells per level on chosen school is all it requires. Of course, there are tradeof that might do more harm but it shouldn't be that bad. 

Granted, diviner and abjurer are out. But I think transmuter and illusionnist have some potential. 

Link to comment
8 hours ago, aigleborgne said:

<snip> take performance into considération, all single classes should have a kit <snip>

<snip> limited to those kits, especially with SR <snip>

Mage kits add 1 spell per spell level and a +2/-2 saves for their chosen school in exchange for a full school of magic. They are inherently limiting. There is no point in having a mage kit assigned to an enemy unless it is to make use of the buffed saves.

Presumably the kits DavidW chose to allow SCS to generate spell lists from lost things that were easy enough to work around (invokers unable to sleep charm or chaos) or gained benefits that were simple to set up for (necromancers blowing pcs away with sequencer skulltrap). 

1 hour ago, aigleborgne said:

<snip> low level mages, transmuter are fine <snip>

<snip> maybe not at low level. 

Not an issue in bg1 <snip>

<big snip>

I do not believe SCS is an appropriate way to implement what you're talking about. I don't profess to know the under-the-hood mechanics but broadly speaking SCS systematically assigns spells to mages on a given set of criteria and generates ai scripts to use those spells under given circumstances.

Things like a wizard who only uses summons or does some sort of polymorph gimmick or only uses spook and blindness sound to me like interesting one-shot encounters with specific custom scripting but don't really mesh well with the automated nature of SCS.

I mean, I'm sure its possible, but you keep talking about variety of kits instead of variety of spellbook composition and I just don't really get it.

2 hours ago, aigleborgne said:

<snip>

Through kit choice, it implies a dedicated spellbook. <snip>

This information is not available to the player in game. I don't see how it can imply anything.

Link to comment
16 hours ago, aigleborgne said:

Personally, I don't think all mages should be limited to those kits

It’s just DavidW’s vision for how to make encounters more interesting. It’s his mod. 

Enemy transmuters would give you a save penalty on Flesh to Stone and Disintegrate. Anything else? Enemy illusionists would give you a save penalty on Spook. 

Given the presumed amount of work required to make distinct kitted enemy wizards, I highly doubt it’s worth the effort, for just those three spells. From a ‘bang for your buck’ perspective, Conjurer/Evoker/Necromancer/Enchanter are by far the best use of resources to make enemy mages dangerous. You talked about optimizing performance, and these kits do that. 

As far as other classes: there are only three druid fights between the two games. No enemy rangers or paladins AFAIK. A smattering of clerics here and there which are generally not suitable for the in-game cleric kits. No enemy bards that I can recall, except maybe Silke. There are no enemy sorcerers or shamans, and the only monks I’m aware of are handled by Beamdog in Rasaad’s quests. Don’t know if SCS changes them at all. 

So it boils down to thieves and fighters. Some are assassins, some are berserkers, and there are a handful of kensai - but the kensai have their bonuses built into the .cre file and don’t really need anything from SCS. Berserkers use Rage, and Assassins use invisibility potions and try to backstab. 

If you want to mix up enemies a bit, I would not try to twist SCS into doing it, but just make a separate mod for it. Change some thieves into Swashbucklers and apply passive bonuses. Change some fighters into Wizard Slayers and apply passive bonuses. Et cetera. With passive bonuses it’s easy - I give enemy fighters and thieves all sorts of extra tricks with my Combat Skills mod.

I would NOT try to mix SCS with sphere systems. I promise you it won’t work well, unless you put an ungodly amount of work into it - basically have to completely rewrite all of the SCS cleric AI code to account for an undefinable set of potential spells…? Just no. 

Edited by subtledoctor
Link to comment

Ok, you have convinced me. Your arguments are solid. 

But I'm still concerned with the fact they didn't recieved the right number of innates. In my install, they just get one innate. I haven't checked kensai but they should also get kai innate which is very important. Maybe scripts use them without depleting amount ? Or it's bug. 

Edited by aigleborgne
Link to comment

It's a deliberate choice - they're scripted to use Enrage only once, rather than renewing it in the unlikely case of a prolonged fight. And since enemies only need to build for one encounter...

Well, OK, they're probably scripted to just use Enrage if they have it. Which would have to be changed if they actually had multiple uses of the ability, setting up a timer so they don't try to use it either when it's already going or during the "winded" period.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...