mhekel / nwnee-sams-menzo

http://nwnmenzo.com
1 stars 0 forks source link

Framework howto #2

Closed mhekel closed 6 months ago

mhekel commented 7 months ago

Core Framework

This project is a framework for managing a Neverwinter Nights module. At the most basic, it is a set of scripts to hook all events in a module. Scripts can then subscribe to the hooks and be run when the event is triggered. This allows the module builder to modularize script systems instead of combining scripts.

This system is in alpha. Things will change and will break. You have been warned.

Prerequisites

Installation

Get the code:

git clone https://github.com/squattingmonk/nwn-core-framework.git
cd nwn-core-framework
git submodule update --init

Run the build script:

nasher install demo erf

This will create the following files in your Neverwinter Nights user directory:

Note: sm-utils relies on script extensions added by nwnsc. This prevents error messages when compiling with nwnsc, but prevents compilation in the Toolset. If you want to compile the scripts in the toolset instead, you can comment out the lines beginning with #pragma near the bottom of the script util_i_library.nss. Note that util_i_library.nss will still not compile on its own, since it's meant to be included in other scripts that implement its functions.

Usage

Note: some events may be triggered before the module loads. An example is the OnAreaEnter event being triggered by NPCs placed in the toolset. If you want to capture these, you will either have to set those event scripts to hook_nwn.nss manually or somehow call InitializeCoreFramework() from core_i_framework.nss before they are run (e.g., using NWNX).

Acknowledgements

This system was heavily influenced by HCR2 and EPOlson's Common Scripting Framework.

Huge thanks to @tinygiant98 for his continued testing and contributions.

mhekel commented 6 months ago

moved to wiki