Author Topic: Hak pak creation  (Read 571 times)

Legacy_captain venus

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Hak pak creation
« on: August 03, 2014, 09:52:05 pm »


               

Hello,


 


I am wanting to group various custom scripts together so that I can access them in any modules that I play or make, and the simplest way to do that would seem to be to make them all into a hak pak.


 


However, I cannot find any kind of Hak Pak creator software; I am assuming there must be something like this to collate all the relevant information together.


 


I appologise if I am asking an obvious question, but I have been looking around and cannot find any links to hak pak creation stuff.


 


I would be grateful if someone could point me in the right direction. Thanks '<img'>



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Hak pak creation
« Reply #1 on: August 03, 2014, 10:00:22 pm »


               

hak pack is usually the worst place for scripts because then they cannot be modified in toolset (though for situation like this I dont think there is any better place - usually advicing to just put them into erf and import but your situation is different)


 


so to make a hak, open NWN/utils/nwhak.exe


add any files and press File-Save As, then put hak into NWN/hak/


and in module go to the module properties, Custom Content tab and select the hak in menu


press add butoon and then press OK



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Hak pak creation
« Reply #2 on: August 03, 2014, 10:29:37 pm »


               Exactly.


It's a good technique, for appropriate situations - you keep the master scripts in a separate module, compile them there, then reload the hak from the temp0 folder using nwhak.


The advantages over the erf method are [1] confidence that all modules are using the same source [2] changes only have to be done once [3] scripts in a hak don't impact toolset performance


For the latter reason, I sometimes put stable scripts in a hak, even if they're only required in one module.
               
               

               
            

Legacy_captain venus

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Hak pak creation
« Reply #3 on: August 03, 2014, 10:32:37 pm »


               

Hi Shadooow and proleric,


 


Thanks for the rapid response.


 


I just knew that hak pak making would be somewhere obvious, didn't even consider to think it might be in the game folders themselves!


 


Sorry I have another question now. How would I add scripts to the hak pak exactly? The scripts are tied up in a simple module I have made, but how do I separate the scripts so that I can add them to the hak pak?


 


Hak.exe gives the option to *add rescources* but obviously I cannot navigate to the scripts like that?


 


Do I need to export the scripts from the module or something like that? or do I just copy the scripts to a .txt file and add them to the hak pak as .txt files?



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Hak pak creation
« Reply #4 on: August 04, 2014, 12:58:58 am »


               

Open the module in the toolset then open the /temp0 folder in your NWN /modules folder (which is created when the module is opened). Navigate to the /temp0 folder in the "Add Resources" window in nwhak.exe and add the .nss and .ncs files for the scripts you want to import into the hak file.



               
               

               
            

Legacy_captain venus

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Hak pak creation
« Reply #5 on: August 05, 2014, 12:51:01 am »


               

Thanks Pstemarie.


 


There's so much to learn about how to do all this.



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Hak pak creation
« Reply #6 on: August 05, 2014, 02:02:16 am »


               

The hard part of learning is that there are so many ways to do things.



               
               

               
            

Legacy_Verilazic

  • Sr. Member
  • ****
  • Posts: 263
  • Karma: +0/-0
Hak pak creation
« Reply #7 on: August 05, 2014, 04:36:58 am »


               

You're in good company. I'm a relative newcomer too, and my only regret is not coming here earlier.



               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Hak pak creation
« Reply #8 on: August 05, 2014, 05:29:40 am »


               

Another way to do it, if only scripts are used in your hak is to open your toolset and load the module they are found in. Then export them them all into an erf that you have named as your desired hak name. When done, simply transfer the erf into your hak folder, then open the erf's properties. Change the extension from .erf to .hak and then add the hak to the modules you play. If its only scripts (or even creatures, items, encounters, triggers, waypoints, and doors) and not any 2da files, then exporting as an erf and changing the extension works just fine and you don't need to use the NWN Hak Utility at all.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Hak pak creation
« Reply #9 on: August 05, 2014, 07:15:58 am »


               

btw i recommend to assign *.erf, and *.mod files in windows to the nwhak.exe so you can open these files directly without need to rename them to hak, its normally possible to save them as well



               
               

               
            

Legacy_captain venus

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Hak pak creation
« Reply #10 on: August 06, 2014, 04:03:58 am »


               

Thank you all for your very helpful answers. I am really getting somewhere with what I wanted to do now. Using Hakpaks to transfer scripts is working out great. '<img'>


 


Another query if anyone can answer for me. The X2 tag based scripting works very reliably, but seems as if the tag based scripting switch Has to be enabled in the module properties; is there any way round this? Could I enable tag based scripts/set the tag based scripting switch via a hakpak? (From my knowledge, the answer would seem to be no, since it would seem the ONLY way of doing it is to enable it in the module properties, but I'm just asking just in case there is a way of doing it).


 


Thanks again for all the helpful answers.



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Hak pak creation
« Reply #11 on: August 06, 2014, 08:49:35 am »


               The default OnModuleLoad script has a line which can be enabled like this:


SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
A script in the hakpak which has the same name as the OnModuleLoad script in the module properties will over-ride it, without changing the module properties. Alternatively, you can turn that switch on in any hakpak script, as long as you're sure that script will definitely run before any event that might need tag based scripting.