New to combining hak with 2da, mdl, and plt

I wanted to combine Hak properly but don’t know about it. using other creators haks but it also includes 2da, mdl, and plt. Don’t know how to combine these all-in-ones into one hak file?

There’s a tutorial:

Not sure how up-to-date it is, so ask again if you get stuck.

What happens in the 2da file there’s a conflict, what should I do?

Let’s take line 6000 of appearance.2da as an example. Suppose hak X uses that line to define a Lion, but hak Y defines a Tiger on the same line, and you want both.

The good news is that the models and textures in both haks contain no reference to line 6000. Choose a line which is not in use - 6500, say. Make a top hak in which line 6000 is identical to hak X and line 6500 is identical to line 6000 in hak Y (apart from the line number).

When you make a creature instance in the toolset, you will then be able to choose the Lion or Tiger appearance. Behind the scenes, when you choose Lion, the instance will reference line 6000; when you choose Tiger, the instance will refer to line 6500.

Once you’ve made instances, those numbers are baked into your module, so you can’t easily change them. The same is true of templates, including erf files that you may want to import.

When adding haks X and Y to a module that doesn’t yet use creatures from either, it doesn’t matter whether you use the line numbers from X and renumber Y, or vice-versa. If line 6000 is already in use in your top hak, you can renumber both X and Y.

On the other hand, if your module already has creatures from X, or X ships with an erf you want to import, you will definitely want to renumber Y.

Similar principles apply to other 2da files.

1 Like

Is this also similar to baseitem.2da?


The line number from baseitem.2da is only stored in item templates and item instances.

So, you can copy the content of a baseitem.2da line to a new, unused, line number as long as you do that before creating any item instances or templates in your module.

1 Like

I made a few notes on the tutorial page for future reference.

There may be other, better tutorials around, but, if so, they’re hard to find.

Question can I also put erf file in hak too because wanted I gather other scripts and combine them into one hak file, is that okay?

Strictly speaking, nwhak won’t let you put an erf file into a hak, because both are containers.

What you can do is export the contents of an erf, then import those files into a hak.

For scripts, this works fine.

It can be a good way of reducing clutter, because scripts in a hak don’t appear in the toolset’s left-hand palette.

Bear in mind that if you try to edit a hak script in the toolset, the version in the hak is unchanged - it makes a local copy in your module.

So, for scripts, this is most useful for large collections of scripts that you don’t expect to change.

Regarding templates (which commonly appear in erf files), I haven’t done it myself, but I have read that templates in a hak appear in the Standard right-hand palette (i.e. exactly as though they were official templates). So, if you try to edit them, you can only make a copy in the Custom palette.

I’m trying to understand I should export erf files using the NWNTool or NWHak from the “content” (like the module?) and then imports files, I know this is probably stressful for you, but can you explain more simplified and detail to me.

Sorry, I don’t quite understand - can you give a specific example of what you want to do in detail?

What you can do is export the ‘contents’ of an erf, then ‘import those files’ into a hak.

For scripts, this works fine.

First, I’m trying to understand about this part from your reply, are trying to tell me to extract ERF files from the “content” (what is exactly the content is it the module?) and “import those files” like mdl, plt, and 2da into content right?

Second, we’re still on topic ERF file import in the Hak file, so what should I do now since both are actually containers, should I export scripts from ERF file into one Erf file or there’s is another way to make into one script files?

From this question, I assume that you have an erf file?

It would help if you said precisely what you’re trying to do, for example “copy script xxxxx from vault project xxxxx into my module’s hak”, replacing xxxxx with the actual names.

An erf file is a container. The game files in the container are the contents. For erf, those game files often include templates (.utc etc) and scripts (.nss, .ncs) amongst others.

A hak is a very similar container. It contains game files, which are its contents.

Erf and hak serve slightly different purposes.

Erf is a mechanism for copying files from one module to another, using Export and Import in the toolset (see toolset manual on the Vault). The imported files are held in the new module .mod (which is also a similar container).

Hak is a mechanism for storing game files which a module can refer to, but which are not stored in the .mod file.

I’ve already explained the pros and cons of each method.

If you already have an erf containing scripts from somewhere, and you want to add the scripts to your hak (rather than the module), open the erf with nwhak, export the scripts to a Windows folder using the Export command, open the hak with nwhak, import the scripts from the Windows folder using the Import command.

1 Like

Okay, I’ll try it.