Player Resource Consortium

 

Author Topic: PRC Module Integration  (Read 711 times)

0 Members and 1 Guest are viewing this topic.

October 10, 2022, 05:30:41 PM

Preparation:
   
 1.) Have the target module & all associated hak & tlk files downloaded & put into the correct folders in your User's Documents.
 2.) Have the PRC updated & installed correctly. Make sure the *.hif files go into the haks folder.
 3.) Have Notepad++ installed along with the Comparison plugin & NWScript Tools.
 4.) Have a 2DA editor that you are comfortable using.  I recommend the Excel 2DA editor. (https://neverwintervault.org/project/nwnee/other/tool/nwn2datool-excel-spreadsheet)
 5.) Have the PRC's tlktools availble to convert TLK files if needed.
 6.) Extract prc_include.hak to a folder & point NWScript Tools at it for compiling scripts.
 6.) OPTIONAL: have the base NWN files availible for review if needed.  I use this repo: (https://github.com/urothis/nwn-assets)
 7.) OPTIONAL: have the PRC's SVN available for file comparison.  You can also just extract the files from the haks, but this is slower.


Conversion:

 1.) Copy module in place & rename it to have "[PRC]" at the end.
 2.) Open copied module up in toolset.
 3.) Open module properties, remove tlk file if one already exists.
 4.) Update Module Description for new requirements.
 5.) Save & close the module.
 6.) Open & run the PRC module injector on the module.  If there are overriden files, copy & save the list for a top hak.
 7.) If the module had no custom content of its own, the Conversion step is complete & you can move on to Integration.
 
 
 Advanced Conversion:
 
 1.) If the module uses CEP, CEP 2, CEP 3 or ProjectQ grab the appropriate merge haks & tlk from the PRC's Google Drive Archive (https://drive.google.com/drive/u/0/folders/1x3_U3JHblhh4K63NNy3gPy9AHYDwttkw) and associate them with the module in the Custom Content section.  Make sure the merge hak goes above the PRC's 2DA hak.
 
 2.) If the module uses CEP 2 or CEP 3, replace cep2_add_sb_v1.hak with prc_add_sb.hak in the Custom Content section.  This will allow the new weapon types to use corrected versions of the CEPs weapon blueprints.
 
 3.) The following CEP 3 haks can be added to any "basic" module to spruce up appearances without effecting anything mechanically: cep3_armor, cep3_facelift, cep3_reforge & cep3_vfx.
 
 4.) If the module has custom content that conflicts with PRC 2DAs, those files will need to be merged & placed in a new top hak that will go above any merge haks as well as the PRC's 2DA hak.  I may cover these steps further in another tutorial if needed.
 
 5.) If the module has a custom TLK file, this will need to be merged with the PRC's TLK file & associated with the module in the Custom Content section.  I may cover these steps further in another tutorial if needed.
 
 
 Integration:
 
 1.) Compiling the module
   a.) Paste the text below into a textfile named "compile temp0.bat" and save it in your working folder where nwnsc.exe resides.  You will likey need to edit the paths to be correct for your environment.
 
Code: [Select]
:loop
"C:\NWN Work\nwnsc.exe" -o -w -n "C:\Games\Steam\steamapps\common\Neverwinter Nights" -i "C:\Users\Jason\Documents\Neverwinter Nights\modules\temp0";"C:\Users\Jason\Documents\Neverwinter Nights\includes\PRC INCLUDES"  "C:\Users\Jason\Documents\Neverwinter Nights\modules\temp0\*.nss"
if %errorLevel% == -1 goto :loop
pause 
 
   b.) Using the batch file above, perform a full compile of all the scripts in the module.  You'll be surprised what the Toolset script editor allows that the nwnsc.exe will not.  This step requires beginner to intermediate scripting ability, depending on how bad the original author was at it.
   
   c.) After you've caught all of the oritinal authors errors, save the module.
 
 
 2.)  NPC Event Scripts
   a.) Open all of the nw_c2_default*.nss scripts in Aurora Script Editor except nw_c2_default5.nss.
   
   b.) Save nw_c2_default7.nss as prc_pwondeath.nss.
   
   c.) In prc_pwondeath, remove any scripting that also exists in the PRC's version of nw_c2_default7.nss.  Use the Notepad++ Comparison plugin to make this easy.  Compile the script when you're done.
   
   d.) Save nw_c2_default9.nss as prc_pwonspawn.nss.
   
   e.) In prc_pwonspawn, remove any scripting that also exists in the PRC's version of nw_c2_default9.nss. Use the Notepad++ Comparison plugin to make this easy. 
   
   f.) Add the line "ExecuteScript("prc_npc_spawn", OBJECT_SELF);" to the top of the script, under the void main(). Compile the script when you're done.
   
   g.) Add the following lines under void main() to the rest of the NPC event scripts as shown below:
   
Code: [Select]
     
OnBlocked ExecuteScript("prc_npc_blocked", OBJECT_SELF);
OnCombatRoundEnd ExecuteScript("prc_npc_combat", OBJECT_SELF);
OnConversation ExecuteScript("prc_npc_conv", OBJECT_SELF);
OnDamaged ExecuteScript("prc_npc_damaged", OBJECT_SELF);
OnDisturbed ExecuteScript("prc_npc_disturb", OBJECT_SELF);
OnHeartbeat ExecuteScript("prc_npc_hb", OBJECT_SELF);
OnPerception ExecuteScript("prc_npc_percep", OBJECT_SELF);
OnPhysicalAttacked ExecuteScript("prc_npc_physatt", OBJECT_SELF);
OnRested ExecuteScript("prc_npc_rested", OBJECT_SELF);
OnSpellCastAt ExecuteScript("prc_npc_spellat", OBJECT_SELF);
      
      NOTE: "ExecuteScript("prc_npc_hb", OBJECT_SELF);" will cause your commoners to spawn chickens w/ the PRC_CHICKEN_INFESTED enabled.
   
 3.) Treasure Scripts
   a.) With the module open in the Aurora Toolset, grab the following scripts from the PRC SVN & without overwriting them, copy them to your \modules\temp0 folder:
         
         nw_o2_boss.nss
         nw_o2_classhig.nss
         nw_o2_classlow.nss
         nw_o2_classmed.nss
         nw_o2_classweap.nss
         nw_o2_generalhig.nss
         nw_o2_generallow.nss
         nw_o2_generalmed.nss
         nw_o2_generalmid.nss
   
      This will enable PRC classes to trigger rewards if the module is using the default NWN treasure system.  If these files already exist, you will need to compare them to the PRC version & see what needs to be updated. 
      
   b.) Compile the module via the batch file & save.
   
   
 4.) PRC Integration
 
   a.) Open the module in the Aurora Toolset.
   
   b.) In Notepad++ search the NSS script files in the \modules\temp0\ folder for all instances of the "MySavingThrow" function.  Open all script files that contain this function & change every instance of "MySavingThrow" to "PRCMySavingThrow" & and add #include "prc_inc_spells" above void main().  Save & compile each modified script.
   
   c.) In Notepad++ search the NSS script files in the \modules\temp0\ folder for all instances of the "GetRacialType" function.  Open all script files that contain this function & change every instance of "GetRacialType" to "PRCMyGetRacialType" & and add #include "prc_inc_racial" above void main().  Save & compile each modified script.   NOTE: any scripts that need to get the actual racialtype of a PC (i.e. information tracking DB functions) should be left unmodified.

   d.) In Notepad++ search the NSS script files in the \modules\temp0\ folder for all instances of the "GetLevelByClass" function.  Open all script files that contain this function & change every instance of "GetLevelByClass" and review if any PRC classes should be added to the list of classes the script is querying.  This will allow PRC classes to pass various Starting Conditionals & other tests within the module.  We have a class list with common groupings here: (https://gist.github.com/Jaysyn904/f9363425c8207c1cdba4266849333b6f)  Save & compile each modified script.
   
   e.) Compile the module via the batch file & save.   
      
HEATSTROKE