Best way to give classes DeflectionAC?

I’ve seen two 2da tables like the one for Pale Master that grant NaturalAC on certain levels.

I want to do the same thing, but I want all classes to get some innate DeflectionAC per level. I’m not sure what the best way to do this would be.

If you’re curious why I want to do this, it is because it seems like every other category of Amor Class has it’s own feats and bonuses, but deflection bonuses are strangely missing from feats, but only exists on a few magic items. There is “parry mode,” which seems to be garbage and it’s not what I want. I would like every class including NPC-only classes to get the same DeflectionAC per level. I think DeflectionAC should be a more integral part of the game since it would be how you would avoid getting hit when you can’t dodge (especially for one equipped with a weapon capable of blocking/parrying).

I think NWN has a bit too much of a snowballing effect causing higher-level things to be massively more powerful. To curb that a bit, I would make all classes gainDeflectionAC starting at a relatively high value like 8 or so, and then increase by 1 every 2 levels up to level 16 and then increase by 1 every 4 levels up to 40.

For example, a level 3 character would have 9 DeflectionAC, and a level 19 character would have 16 DeflectionAC.

I think 8 is a good starting AC bonus from my testing. Level 1 characters in most armor available to them at that time will still easily be able to roll with a decent chance of hitting one another, but early on in the game, it will increase the duration of combat a bit, which isn’t such a bad thing IMO since anything at levels 1-3 can die so easily, especially if you’re a lone low-level spellcaster without the help of a good grunt.

Without getting into your analysis of gameplay, here’s a script that does that for a quick see what’s going on test (in ee best thing is to use the script window in game and pick yourself and execute). I don’t know of something stock that’ll let you configure deflect ac this way outside script though:

void main()
{
    object oCreature;
    object oArea = GetArea(OBJECT_SELF);
    oCreature = GetFirstObjectInArea(oArea);
    while(GetIsObjectValid(oCreature)) {
        if(GetObjectType(oCreature) == OBJECT_TYPE_CREATURE && !GetLocalInt(oCreature, "DeflectACStuff")) {
            SetLocalInt(oCreature, "DeflectACStuff", 1);
            int nAC = 8;
            int nDice = GetHitDice(oCreature);
            if(nDice > 16) {nAC += 8 + ((nDice - 16) / 4);}
            else {nAC += (nDice / 2);}
            effect e = SupernaturalEffect(EffectACIncrease(nAC, AC_DEFLECTION_BONUS));
            ApplyEffectToObject(DURATION_TYPE_PERMANENT, e, oCreature);
        }
        oCreature = GetNextObjectInArea(oArea);
    }
}

Thanks, but the scripting method is the one I was trying to avoid. I aim to have these changes built into the game, not just any individual module. As far as I know, if I use scripts and want them to work in any module, I have to edit the base-game scripts for entering an area, on heartbeat, or some event that is sure to grab every NPC every time and run that while loop then, if there’s a module that has its scripts for entering a new area or ‘on heartbeat’ my script won’t run unless I run it myself in-game.

My main goal with this is to have players and NPCs deflect blows more often since, a lot of the time, they only dodge or stand still and take blows but rarely does anything block or parry. This is mainly an issue for players/NPCs below level 10, which tend to take hits quite a bit, but all-in-all, duels don’t seem like duels, but rather a mixture of dodging and tanking blows. To get that duel feeling I want to see the clang of the blade against blade and shield. There are plenty of dodge feats and natural AC bonuses, but there’s got to be a better way to implement more deflection into the game.

Perhaps I could create some new feats automatically granted to classes by certain levels, which increase Deflection AC. That would be even more of a win since then I could also make more feats available for selection on leveling that grant Deflection AC which seems to be a rare thing for some reason. I haven’t tried making feats yet, so I don’t know if that’s a simple thing or what I’m limited to in creating feats.

EDIT: I’ve briefly looked into adding new feats. If I’m correct, I can edit the feats.2da and whatever 2da is responsible for giving classes feats by level, write up a script that tells the feats to give Deflection AC, then throw all that stuff in the override. Would that work?

If you are looking for the high-deflection-AC change to work with any module you run locally, then the 2DA approach will still involve you modifying the module to include whatever HAK you put the modified 2DAs in. Or, if you can get away with putting them in your override folder, then that’s fine. (That won’t work if the module uses any HAKs with those 2DAs in it.) But, it isn’t necessarily an advantage over scripting, since you could also pop default NPC OnSpawn and PC OnClientEnter scripts into your override.

There are many reasons why this is bad idea. Namely the stacking issue with gear.

The script method works fine for my modules, but it’s prone to conflict or errors in other people’s modules if a module has its custom scripts set to trigger on those events, in which case, I’d then have to modify those scripts from another author, which might be some spaghetti code and I could ruin something. That’s not to mention all the effort that takes.

The while loop area script method above has a lot of the same issues but uses a loop that has to cycle through all objects in an area does sound like it would be prone to all kinds of bugs if, for whatever reason, the loop can’t finish or there’s a certain spell, feat, item whatever that messes with the AC bonus applied via script.

The level-up feats will require scripts, and editing 2da files, but at least that way, it’s built-in as a baseline to the character itself, and other bonuses will load and stack on top after without constantly running a script. Instead, there are just scripts for whatever feats I create that are built into an existing game mechanic like “feats” that already offer all sorts of unique bonuses. Somehow that seems a lot more stable to me than having a script that constantly uses events that are already common triggers for other scripts.

No longer true in nwnee. SetEventScript which runs your script which preserves the previous script name to then run on that event after (ExecuteScript). Can use tageffect and whatever the new one is…enduringeffect? to track things and adjust as needed (levelups, etc). An example is found in the dynamic light scripting in the preview.

Not quite trivial, probably not painless, but won’t take hours to do either.

1 Like

Great, that sounds much better, but I’m not sure what the pros and cons are using the SetEventScript vs. adding new feats.

In the meantime, I’m shifting all my focus onto this: Feedback on WIP weapon project?, which features some new weapon parts and a lot of my amateur icon art if you download the hak I’ve created for CEP 3; when complete it will be an alternative to the Reforged mod. I’ll also remake all the base game item blueprints and add new lore-friendly D&D stuff. I’m using and modifying a lot of other people’s work.

I could use some feedback and tips.
Screenshot 2023-02-19 224844Screenshot 2023-02-19 224902

I really like the inventory icon. That is very well done. A lot of custom content in CEP (and other sources) has really bad ones. Maybe you could improve those.

The model could use some work. The horizontal “line” in the blade doesn’t correspond with the icon to me - it seems there is a “cut” inside the blade. Forgot my limited english I don’t know how to say it. But maybe it is just screenshot deformation because it is captured from angle?