NWShacker's projects

In this thread you will find descriptions, links and updates to my original projects I submitted so far to the vault. Most of these are “utility” modifications - they influence the game experience rather than provide new modules to play. This is another place for you to ask your questions, get help, report bugs and perhaps request new features.

Always up-to-date list of my projects can be found here: https://neverwintervault.org/tags/nwshacker.

Below are abstracts of five projects released until today, presented in order of their initial release. Each project contains a demo module so you can test whatever is going on in there.

1. STREAMLINED USER INTERFACE
https://neverwintervault.org/project/nwn1/other/gui/streamlined-user-interface
Initial release: 2017-11-21, last update: 2017-11-22

This project aims to streamline the graphic user interface of NWN. This means: to make it more organized and efficient from player’s perspective while blending in with the established themes (no fancy colors, etc).

2. IPRP FEATS
https://neverwintervault.org/project/nwn1/other/patch/iprp-feats
Initial release: 2017-11-27, last update: 2018-10-14

This project provides a modified iprp_feats.2da file which increases the number of feats available as item properties from vanilla 63 to 818. New properties can be easily managed in the toolset and with scripting. With exception for few minor cost tweaks, changes introduced by this project are backward-compatible with vanilla NWN.

3. INVENTORY SORT
https://neverwintervault.org/project/nwn1/script/inventory-sort
Initial release: 2018-08-28, last update: 2018-09-22

This project allows sorting of player’s inventory. Items are taken away to a temporary storage and returned in specified, but adjustable order. Everything is done by a single script, which works with every module out of the box (even with already started games) and with custom content.

4. LEGACY RUN ANIMATION
https://neverwintervault.org/project/nwn1/model/legacy-run-animation
Initial release: 2018-09-26, last update: N/A

This project introduces pre-HOTU running animations to HOTU female and male animation models. It replaces the “cross-country skiing” animation with “bunny hop” animation, which is more dynamic and looks more like a real running. This project supports both genders (each runs in different style), both phenotypes, visible cloaks, coat robes and custom content.

5. NAMED COLOR TOKEN SYSTEM
https://neverwintervault.org/project/nwn1/hakpak/original-hakpak/named-color-token-system
Initial release: 2018-09-28, last update: 2019-01-15

This project enables 146 color names to be used as color-changing tokens in dialogue, object names and descriptions and PC chat messages. Instead of using hard-to-remember <CUSTOMxxxx> tokens or hard-to-type NWN ASCII tokens (such as <c~!!>), you can now use simple named color tokens like this: <ncOrange>this text is now orange</nc>. This project also provides a library for color token generation from RGB and HSV color structs.

6. NWN DEMODULATOR
https://neverwintervault.org/project/nwn1/other/tool/nwn-demodulator
Initial release: 2018-10-31, last update: 2019-01-03

This command line program allows modification of required game version string and expansion number stored in MOD V1.0 files (*.mod, *.sav). It may be used to prevent the NWN engine from refusing to load a module or a save made by an updated version of the game. This allows, for example, to play an Enhanced Edition module on 1.69 (Diamond XP3) or to perform debug / compatibility tests. This DOES NOT guarantee however that such module or save will be playable or that the game won’t hang up or crash while trying to run them. Use at your own risk and always make backups.

7. AUXILIARY MATH LIBRARY
https://neverwintervault.org/project/nwn1/script/auxiliary-math-library
Initial release: 2019-02-05, last update: 2019-02-19

This project provides a library of several mathematical functions, from such fields as linear algebra, computational geometry and pseudo-random number generation, and a support for homogeneous, variable-length lists.

4 Likes

Since it might not be easy to see it in above post, I’ll repeat it here: almost one year later I managed to update IPRP Feats today. Backward compatibility with version 1.0 has been broken, but if you are already using it in your module then you don’t need to update, unless you care about cost parameters of PRESTIGE_ENCHANT_ARROW and EPIC_ENERGY_RESISTANCE feats.

I’ll repeat my question I asked on NCTS vault entry:

Can anyone confirm that stringtokens.2da has to be in override folder for string tokens to work in dialogue?

When placed in a hak, this table is accessible through scripting, but conversations show unrecognized token errors. Perhaps it needs to be initialized before modules are loaded?

Shadooow did some work back in 2011 confirming that stringtokens.2da has to be in override, not hak, to work in conversation.

2 Likes

I have come across a problem. It appears that the premium module Shadow Guard does something that then screws up the three tokens StartAction, StartCheck and StartHighlight if your 2da is in the override folder. This then carries on into any module that uses those tokens in a conversation until your 2da is removed from the override. What happens is that text that was only supposed to be seen in the starting area of Shadow Guard is used to replace those tokens in game. A couple of examples from a module being developed -

C1

The text from “I thank you,” up to and including “I hope.” replaces the StartHighlight token. The text between the [] should be highlighted but isn’t and obviously the [] shouldn’t be visible.

C2

The text from “Not as yet,” up to and including “of the body.” replaces the StartAction token.

Removing your 2da fixes it.

TR

Thanks @proleric for corroborating my findings.

Yes, that is an error on my side - or rather an unfortunate consequence of having a modded stringtokens.2da in override folder. Next mod release will have this fixed.

Explaination: in my quest to make StartHighlight yellow, I changed 2da entries of StartAction, StartCheck and StartHighlight. In my stringtokens.2da their rows look like this:

51  StartAction      1          -1      16800337 16800337 16800337 16800337 0       
52  StartCheck       1          -1      16800374 16800374 16800374 16800374 0       
53  StartHighlight   1          -1      16800400 16800400 16800400 16800400 0  

The large numbers are color_tokens.tlk strrefs, obviously unused by module in question. It would be fine if my stringtokens.2da was only in a hak, but override changes everything.
In vanilla NWN, those rows look like this:

52         StartAction                        19           -1        -1        -1        -1        -1        1          
53         StartCheck                         20           -1        -1        -1        -1        -1        1          
54         StartHighlight                     21           -1        -1        -1        -1        -1        1    

The numbers 19 - 21 in 3rd column are “action codes”. They need to stay like that. Maybe 21 could be changed to 19 so StartHighlight is green instead of blue.

To fix it right now, open my stringtokens.2da and replace first piece of code above with this:

51  StartAction      19          -1      16800337 16800337 16800337 16800337 1       
52  StartCheck       20          -1      16800374 16800374 16800374 16800374 1       
53  StartHighlight   21          -1      16800400 16800400 16800400 16800400 1  

Thank you for taking time to investigate and report this.

The above bug in stringtokens.2da has been fixed. You may download the latest version from project’s page.

I added a new contribution to the vault today. This time a tool - the NWN Demodulator. Ready to download from the main page. Here’s an abstract:

This command line program allows modification of required game version string and expansion number stored in a MOD V1.0 file. It may be used to prevent the game from refusing to load a module saved by updated version of the toolset. For example, to play an EE module on 1.69 NWN. This DOES NOT guarantee however that such module will be playable or that the game won’t crash while trying to run it. Use it at your own risk.

Brief history for those who care:

I made this thing to bridge the gap between EE and 1.69.

Primary investigation suggests that the only module.ifo difference between modules saved with EE and 1.69 is Mod_MinGameVer. They both use GFF v3.28 and MOD v1.0 formats.

When the toolset saves a module, it writes a predefined number of module.ifo GFF entries. All entries that are not on this list (i.e. custom or renamed ones) are discarded and replaced with current defaults. However if an entry was read from module.ifo in the first place, its value will be written verbatim (except Mod_MinGameVer and Expansion_Pack of course).

The above is why I decided to abuse two unused entries in module.ifo that, even though they are considered deprecated, are still present in EE modules: Mod_Version Mod_Creator_ID. This program writes to those fields original values of Mod_MinGameVer and Expansion_Pack respectively. Thanks to this, you can track how the original module was modified.

This program can also display module’s “ID” (-i switch), which NWN Explorer hand-waives as “binary data”. It can be used to fingerprint the module. Fun fact: NWN OC Prelude and chapters 1, 1E and 2 have all 0s as ID.

This is my one year anniversary post. Feel welcome to the party and read on.

On 21st of November 2017 I posted on the Vault the first version of Streamlined User Interface which - unsurprisingly - became my most-downloaded project so far. Since then, my mods have been downloaded 696 times which means some people did actually find interest in them. Here’s screenshot of today’s download table:

Some remarks:

  • It appears that some hits may be from bots since SUI 1.0 was unlisted on the page quite soon after version 1.1 was posted. I actually made first attempt on this project back in 2014, then waited 3 years to finish it and publish. Now, headache-inducing transparencies and repetitive icons are no more.
  • Four projects were posted in last three months. Before that there was only SUI and IPRP Feats 1.0 (now updated to 1.1). I admit I’m positively surprised IPRP Feats got so many hits since it’s a builder (not player) resource. Perhaps some users use its demo module as a character creator / tester or feat browser?
  • Legacy Run Animation has the fastest growing download count. If this trend will continue, it will become number 1 next year. Honestly, I’m not really sold on male running animation (it’s a bit silly), but female one is quite alright (and has some vanilla bugs removed as a bonus).
  • Inventory Sort did not get much comments on its page, even though I believe its extremely useful from UX perspective. I won’t ever play the game without it (unless your module has no items). I think I might make an update to it before end of the year. It would be useful to try to identify unknown items during the sort operation. I also didn’t include script sources in the hak file.
  • It’s really unfortunate that modified stringtokens.2da must be present in override folder to work in dialogue. This makes NCTS a bit inconvenient to use and may cause trouble with non-English versions of the game. It provides full RGB and HSV support for scripts though and is a prime example how far the NWN engine can be pushed, here with few TLK tricks (beyond what is written in Hitchhiker’s Guide to Color Tokens).
  • If you are (still) a 1.69 user, why don’t you check my latest project so far - the Demodulator?

Thanks for reading this and using the above projects. Brought to you by NWShacker through the NWN Vault.

2 Likes

Today I updated the Demodulator to version 1.1. This update is indirectly brought to by @CaveGnome, who’s comment on the tool’s vault entry made me realize there are things left to do. Possibly all issues are resolved now.

  • Added full support for save game manipulation (identical to modules).
  • Added module build / save game creation date display option (-b).
  • Streamlined reading of new version string - it is now automatically expanded to %4.2f format (i.e. “1.7” becomes “1.70”).
  • Made the program future-proof by not quitting when Mod_Creator_ID and Mod_Version entries are missing (in case they get eventually removed).
  • Hardened against vulnerability in file path comparison under Windows (it is still naive, though - it won’t catch cases such as hard links).
  • Removed display of full path to the executable on the help screen.
  • Generic code cleanup and optimization.

Also a little rant regarding the -b option mentioned above: instead of using three integer fields to store module’s build year, month and day, developers opted for year + day of the year fields (a whole 4 byte shave). So, if you even happen to struggle to convert days of the year to an actual date in POSIX C, use this piece of code:

char buffer[BUFFER_LENGTH];
struct tm my_date;
time_t my_time;

memset(buffer, 0, BUFFER_LENGTH);
memset(&my_date, 0, sizeof(struct tm));

my_date.tm_year = year // remember to subtract 1900
my_date.tm_mday = day_of_year + 2; // weird +2 is required
my_time = mktime(&my_date);

strftime(buffer, BUFFER_LENGTH, "%Y/%m/%d", gmtime(&my_time));
fprintf(stdout, "Converted date (YYYY/MM/DD): %s\n", buffer);

In other words, pass any number of days as day of January and mktime/gmtime combo will convert it to valid month and day (but don’t forget the year offset).

1 Like

tbh, changing the minversion using GFF editor is faster than messing with command line tool so I am not using it…

1 Like

The term “messing” is much more fitting to editing the module manually.

This tool is meant to do one thing and do it well and fast. Unlike generic GFF editors, it also keeps the user safe (won’t touch wrong fields, won’t overwrite source data) and provides useful functionality for developers by keeping track of original field values and module build times.

wel for me as experienced NWN user, opening module in nwhak.exe (associated), exporting module.ifo onto desktop, opening it in GFF editor (associated) saving and adding into module again and saving module is just easier than copying the module into folder with commandline tool, editing .bat file, promting UAC/admin rights, copying the module back

if there was a GUI I would gladly use it, I am really not a fan of command-line utilities in windows environment, if there is alternative way that has GUI I will always prefer that…

3 Likes

I’m surprised an experienced NWN user doesn’t save his time with TlkEdit2 which can do all these tasks by itself, with a GUI, multi-level undo capabilities and automatic session restore. 5 clicks max.

I use shell extensively, so I made this program to be like nwnmdlcomp and similar utilities. I may add a switch to allow writing in place to the source module if someone requests it. If somebody wants to hack a GUI for it, then please go ahead.

You can always put the executable into modules folder and make a shortcut to it on the desktop. One click then.

/path/to/modules/nwndemodulator.exe -V 1.69 my_module.mod my_module_1.69.mod

Because Java is evil :smile: , it has no place on my desktop haha.

NCTS has been updated to version 2.0: enjoy the most advanced (and documented) text color management project on the vault.

Major version number increase since changes introduced today make it incompatible with 1.x branch. There are several improvements - most important ones are listed below:

  • talk table (and stringtokens.2da) needed only for token use use in dialogue
  • possibility to use named tokens in PC chat
  • color application function optimization
  • color sanitization function introduction (mostly useful with chat)
  • improved demo module

Please report any bugs you encounter, but be sure to talk first to The Parrot in the demo module.

I tried to sneak tokens into PC names, but the game is really adamant about getting rid of them. You can plant them in the .bic file and they will work, but only until you join a server.

1 Like

Teaser for the next project:

2 Likes

If the above cube was not enough clue by itself, here’s a new project: Auxiliary math library (it’s like a poetry - it rhymes):

This project provides a library of several useful mathematical functions which are not readily available in vanilla NWScript. They mostly operate on floats and vectors, originating from math fields like linear algebra (rotations, projections) and pseudo-random number generation (uniform or normal distributions). Other uses include value rounding, comparisons, conversions and debugging. All functions are fast and well documented.

Even if the subject may be not interesting to you, please go ahead and check out the demo module to see how this old engine can be strained to display some amusing effects.

The beams are not visible with all camera angles and sometimes they appear to completely disappear. Not sure why. To fix that, move away from their sources (so they are no longer visible) and then go back.

1 Like

I updated AML to version 2.0 today. Biggest change is list support, already in use by some computational geometry functions. VIsit project’s website for a complete changelog.

This update is dedicated to users @xorbaxian and @TheBarbarian who took time from their busy schedules to add supportive comments and suggestions. This update wouldn’t be possible without them (and me somehow finding enough time to type all that stuff). EDIT: I should also thank user @meaglyn for discussion about TMI (I believe the sorting subroutine can be optimized for longer lists, probably via rewrite from recursive to iterative quicksort implementation).

If anyone has functions they’d like to contribute to this project, make a pull request. You can also request features to be added, but I’d rather work with ready code. Functional use cases for the demo module are also welcome. I can think of at least three right now:

  • Use item / spell on ground, PC fires a beam there that damages all enemies it passes.
  • Player walk around the map and is given names of rooms or corridors they are in.
  • Script that checks if every door in a room is closed / locked.
1 Like