Finesse: Melee Weapons and misc. fixes 0.5

   (1 review)

3 Screenshots

About This File

This adds functional Melee Weapon Finesse (melee weapon Attack increasing with either STR or DEX modifier, depending on which is higher) to KoTOR 1. It also works for unarmed attacks. Additionally, since this is a k_ai_master.ncs replacer, it restores the extra attack of repeating blasters. Another fix or two are underway (trying to restore the non-functional damage boost from Battle Stimulants at the moment). 

Melee Finesse does not currently require a feat to be taken (since I consider it a pointless fun tax for DEX builds), but if there is interest a feat-restricted version would be easy to make. The feat is currently purely cosmetic and is given to the player (at level 2 because of reasons outlined in the installer) and all party members. A version without the pointless cosmetic feat is also available in the same download.

Note that due to the (hacky) way this is implemented (ai_scripts) the finesse effect updates every 0.5 seconds (for the player and party only) and cannot update while your inventory is open, so don't panic if your bonus doesn't instantly change when you are swapping weapons. Close the inventory, wait a moment, reopen and the bonus will change. If interested, read the Limitations/Technical details section below.

Installation

Grab the file, read the readme and either run Install.exe and follow the instructions or drop k_ai_master.ncs from Optional Manual Install into your Override folder. The TSLPatcher installer contains additional instructions for disabling either extra repeater attacks or finesse, as well as instructions for installing this with other mods that modify k_ai_master.ncs.

Uninstallation

This is safe to uninstall mid-playthrough (if you follow the instructions). Go to Ebon Hawk/Taris hideout (so all of your party members are loaded). Equip a lightsaber or a regular non-repeating blaster on all of your party members who are currently wielding a repeating blaster or a melee weapon (while suffering from a case of very high dex). You can now uninstall the mod by removing k_ai_master.ncs and (if using the full version) restoring the modified .utc and .2da files from the backup folder. Note that the restoring the utc/2da files from backup should only be done if this is the last mod you installed that patched those files.

Compatibility

Incompatible with any mods that outright replace k_ai_master.ncs:

  • Repeating blaster attacks restoration: includes its main functionality. The optional power shot/sniper shot fix is compatible.
  • KOTOR 1 Improved AI:  Should work if you compile k_ai_master.ncs with Improved AI’s files. To do so download K1 Improved AI, take the files from the Source folder and drop them in tslpatchdata\Full (or tslpatchdata\ScriptOnly if installing that version), then install this mod normally.
  • Content Pack - Feats and Powers: Incompatible. Since both mods modify k_ai_master.nss, a manual patch would need to be created.

Otherwise it should be compatible with pretty much everything else.

Known Issues/Limitations/Technical details

As ai script execution is paused in the inventory, there is no way to instantly update the attack bonus display when swapping items, meaning that if you are switching from a melee weapon to a ranged weapon (or vice-versa) the attack bonus from dex (if active) won't be added/removed until after you close the inventory and reopen it after a short delay (~0.5 seconds).

Since there is no way (without hacking apart the executable) to "natively" implement this functionality, the Attack from DEX is applied as an Attack Bonus Increase effect. This means it's subject to the maximum +20 feat and effects Attack Bonus cap, which most people likely haven't heard of before since it's basically unreachable in vanilla KoTOR. The bonus is applied as a difference between DEX and STR modifiers, which means that even late game fully buffed-up builds won't be hamstrung by the cap.

Additionally, this attack bonus is applied based on the mainhand weapon. This means that on a high DEX build, compared to a build where all of the attack bonus comes from STR, a mainhand vibroblade/offhand lightsaber will result in a higher offhand attack bonus (offhand lightsaber will benefit from dex bonus twice, since lightsabers are already finesse in the vanilla game), while a mainhand lightsaber/offhand vibroblade will result on a lower offhand attack (offhand vibroblade won't benefit from the dex bonus). I don't consider either of these big issues (since the offhand only attacks once per round) and it would be impossible to fix since there is no effect that only grants offhand/mainhand attack bonus.

Effects (repeater attacks and the finesse bonus) are checked/updated/removed every 0.5 seconds (pseudo-heartbeat that only runs between regular onHeartbeat calls) for the 9 party members and the player and only on certain perception/combat round end/damage events for all other entities (which automatically excludes all friendly NPCs that don't participate in combat). This should make the effects react very quickly to changing stats/weapons (if the player pops a Hyper-Adrenal Alacrity or switches from a repeating blaster to a vibroblade for example) without introducing any potential lag for NPCs.

Tools used
Holocron Toolset
TSLPatcher

Credits
R2-X2 for their Repeater Restoration script, which gave me an idea on how to implement finesse. 


What's New in Version 0.5   See changelog

Released

No changelog available for this version.

  • Like 2



User Feedback

Recommended Comments

Hey just curious, it seems to be working, my melee weapons are adding +4 from dex at the start of the game. My shortsword on endar spire with 18 dex is giving me a total of +5 since I chose the melee specialization feat. However, my pistol is doing +9 on attack which seems way to high and should have parity with my shortsword. Is it possible the pistol is double stacking the bonus due to the finesse script being added on top of it? Just seems highly unusual, appreciate the great mod

Share this comment


Link to comment
Share on other sites

As I mentioned in the description, the script doesn't update instantly when you are swapping weapons in the inventory due to limitations on where it can be injected. If you are equipping the blaster after equipping the sword, exit from the inventory, wait half a second to a second and it should update to have the proper +5 attack.

Here is a video demonstration. If blasters don't return to their normal stats after this delay, that means I messed up somewhere, but since the mod and the script itself is very simple all this does every time it runs is check for a main hand weapon against the following list of base melee items types, and if it returns false it constantly attempts to remove the attack bonus effect.

 

if (GetBaseItemType(oItem) == BASE_ITEM_SHORT_SWORD || GetBaseItemType(oItem) == BASE_ITEM_LONG_SWORD || GetBaseItemType(oItem) == BASE_ITEM_DOUBLE_BLADED_SWORD || GetBaseItemType(oItem) == BASE_ITEM_VIBRO_BLADE || GetBaseItemType(oItem) == BASE_ITEM_VIBRO_SWORD || GetBaseItemType(oItem) == BASE_ITEM_VIBRO_DOUBLE_BLADE || GetBaseItemType(oItem) == BASE_ITEM_QUARTER_STAFF || GetBaseItemType(oItem) == BASE_ITEM_GHAFFI_STICK || GetBaseItemType(oItem) == BASE_ITEM_FIST || GetBaseItemType(oItem) == BASE_ITEM_GAMMOREAN_BATTLEAXE)
  

 

Edited by Nereithr
  • Thanks 1

Share this comment


Link to comment
Share on other sites

You're absolutely correct, my bad it's all good and great on my end, really appreciate the great mod!

Share this comment


Link to comment
Share on other sites

Hi there! This is great, the repeater attack restoration is a dream coming true finally.

I'd love a feat restricted version of this mod :p If you do not intend to do it, if you can tell me what to do.

 

Thx again !

Edited by CapitaineSpoque

Share this comment


Link to comment
Share on other sites

I was just made aware of this mod, and that you are using my code for the repeating blaster attacks. Would have been nice if you had messaged me about it, but oh well, glad that I have inspired you on how to implement finesse.

However, my code had a flaw, caused by scheduled scripts not persisting across some situations sometimes, such as savegames, party member changes or module transitions. Depending on how close your code is to mine, you might run into the same issue.

I updated my mod a few days ago (after many years), where the issue has been fixed. You should probably check the new code (source and comments included in download just as before) and update your mod.

Lastly, I'd appreciate it if you included in your description that the blaster attacks restoration is there because you included my mod (which I don't mind on principle, but I did state to ask me first) and provided a link to it, rather than just stating it as a feature of your mod and relegating me to a footnote.

  • Like 1
  • Light Side Points 1

Share this comment


Link to comment
Share on other sites
On 11/20/2024 at 12:48 PM, R2-X2 said:

I was just made aware of this mod, and that you are using my code for the repeating blaster attacks. Would have been nice if you had messaged me about it, but oh well, glad that I have inspired you on how to implement finesse.

However, my code had a flaw, caused by scheduled scripts not persisting across some situations sometimes, such as savegames, party member changes or module transitions. Depending on how close your code is to mine, you might run into the same issue.

I am not using "your code" for anything. You are credited for the idea, but our mods work on different principles. Here is the code comparison. You are applying a timed effect and using a preventative boolean plus timing to avoid stacking and to let the effects expire when conditions are no longer met. Your "DelayCommand" part of the code fires to keep refreshing the timed effect. Your script is called in k_ai_master at the end of the file, i.e.  every time k_ai_master is called by any loaded entity, which is to say, quite a lot.

I am applying a permanent effect with the otherwise unused Extraordinary subtype, with effect + subtype checks being used to avoid stacking additional effects as well as to explicitly remove the effect if conditions are no longer met. My script is called within OnHeartbeat as StatFixesHen() for the player and party members, with DelayCommand being used as an additional pseudo-heartbeat for faster updates. For all other entitites it is called as StatFixesDef() on a number of specific events, such as perception, dialogue end, end of combat round and attacked, meaning it should only fire for entities actively engaged/preparing to engage in non-scripted combat/perception and nobody else.

I quite literally cannot think of any way in which our code could be more different, unless someone in the modding community finds a way to grant extra attacks without using an ExtraAttacks effect. Since "your code" was never used, I did not message you and you are just credited for giving me an idea,  which, to be entirely clear, is limited to your mod just happening to be one of the first ones I opened to see how you apply effects in this scripting language, before l learned that NWN modding wiki exists.

Quote

Lastly, I'd appreciate it if you included in your description that the blaster attacks restoration is there because you included my mod (which I don't mind on principle, but I did state to ask me first) and provided a link to it, rather than just stating it as a feature of your mod and relegating me to a footnote.

Not happening because, well, I did not include your mod. It is an entirely different mod that implements the same functionality in a very different way. 

As an aside, this sort of behaviour is making me reconsider crediting you at all. You had the opportunity to check the code for months, yet instead you chose to automatically assume that I stole your code. And when you finally check the code you undermine the work of others by claiming "it is just  a bit different but obviously I should get most of the credit for my BRILLIANT idea of adding repeating attacks to repeating blasters. NOBODY COULD HAVE THOUGHT OF THAT ".

Obviously I am not going to do that out of courtesy, but take this as an opportunity to reflect on stuff.

Edited by Nereithr

Share this comment


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Add a comment...

×   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.