This Tutorial will help you make a NSIS installer package for Steam Mods. It has been made step by step for the person who has not assembled an installer package before. So for some, it will seem long, but this is a beginners level version, every step must be included :)

I urge you to just run through this tutorial and make a simple one first, say an installer for a single piece of content like a cfg file (text doc in the cfg folder) just to test if you got it correct. 

The steps below seem long, when you have done this a few times it can take under 2 miniutes!

 

Make an NSIS installer for DoD:S and CS:S custom content.

Description: A simple ... but long step-by-step guide to make NSIS install creator make a basic installer that automatically finds the user's dod or cstrike folder.

This will work for all Steam mods with a couple of alterations. Just remember where "dod" and "cstrike" are mentioned change the addresses to your mods main game folder where folders like "resource", "scripts", "materials" are kept.

Prepare your custom content folders.

The following will build an installer to add your custom content you have already packaged in a "dod" or "cstrike" folder with all the files already placed in the correct sub folders.

So, to prepare your custom content by putting it all in a "dod" (DoD:s) or "cstrike" (CS:s) folder. It will be quicker adding one folder during this tutorial rather than a lot of single files. 

 

1. The Programs and the Preparation you will need....

(A). Install NSIS A Free windows installer package...

Note that later on you may decide you want a fancy installer as mentioned here. In that case install this combined package instead.


(B).
Install HM NIS EDIT A Free NSIS Editor, a much better GUI to use with NSIS.


(C). Make your custom content as you would for a zip file, a lot of people place a dod or cstrike folder in their zip, do it this way for the installer, place all your custom content inside a main folder called... dod or cstrike ... make sure all the subfolders and files are in the correct place

IMPORTANT! The best way to keep things neat is to make a new folder and keep all your stuff for making these installers inside that one folder. This is one of those situations when the Author says "Trust me... just do it."

Make a folder under "C" drive, then make sub folders for each project you do. The reason is to keep the file addresses simple, if you have to add file addresses manually later on, this will help a lot.

The installer will grab the dod folder and place it and all of it's contents in the user's correct address...


C:\Program Files\Steam\Steamapps\day of defeat source

...or wherever the user installed Steam or the game.

Note: This does not always work, it depends on a healthy windows registry, gamers being gamers, they don't keep a tidy system. However it will work most times and there is a browse funtion anyway.


That is the best part of this installer, those complicated addresses and the explanation of how to place them in the user's correct folders are not required... the installer will find that address automatically...most times :)


There is only one problem... the uninstaller will report the size of the user's dod folder (in the Add/Remove screen) ... not the true size of your content. You should make the user aware of this in a readme.

 

2. Use the wizard in HM NIS EDIT...

Run the wizard in HM NIS EDIT,

click on the magic wand below "File"...image001

 

Press Next > and...

 

Fill out the text boxes in the "Application Information" screen.

 

Press Next >

image002

 

3. The Five sections to be filled out in the "Setup options" screen... 

 

Setup icon:

The icon the installer will use.

This can be changed or use the default.

To change you must have a working icon (.ico)

Compatible with NSIS and put in its address

on your local PC.

 

Setup file:
The name the icon will receive once you

compile the installer.

 

NOTE: It is wise to give it a unique name

other than "Setup.exe".


Setup Lang:
Select Languages. Leave alone if you wish.


GUI: 
The look of the installer... modern looks best for most people.

Compress: 
Leave it on default "zlib" ...works fine.

 

Press Next >

 


image003

 

4. Application directory and License screen.

This section holds info on the place the installer is going to put the files you made and a text page of a "License"...

Application default directory: 
The one you see now will make the installer find the

"Programs File" directory.

We want to find the users "day of defeat source\dod" or 

"counter-strike source\cstrike" folder.

There is more to do on this latter... but for now put in... 
$INSTDIR



The little tick box:
This is below"Application default directory".

It is always wise to leave the...

"Allow user to change the application directory"

...tick box as ticked. This will allow the user to use the

browse button to choose for him/herself.

License file:
You don't have to have a "License".

To make it go away delete what's in there and leave it blank.

You may want to display your readme file here.

If you like you can browse (...) to your readme and the

wizard will place in the files address in the License File address box.

The readme file has to be a .txt type file... normal old notepad will do.

 

Press Next >

 

image004

5. Application Files screen.

 

This section can add information of the files you have made.
It can make an optional selection section with info
(the user hovers his mouse over the text of the title/tick box).

It also tells the installer where to find the files on your
local PC.

This section is very easy to fill out, it is also VERY important and can get quite difficult if you want to make an installer that can have more complex installation options.


It is so complex I will continue it in depth on another page.
We are just making a simple one for now that only has files
for a custom crosshair or whatever, so... let's continue.


Deselecting the "Allow user to select the components to install"
radio button stops the "COMPONENTS PAGE" from showing.

Even though we do not need to show this page for a
"one choice only" installer, we will tick it anyway.

 

Press Next >

 

image005
 

6. Application Icons screen.

This section is about the Start menu it can create a program group with an uninstall icon and a web address.

This can get messy for the user, it is far better not to put

these in ... we all have enough things in our

Windows start menu :)

 

For this simple Tutorial we will opt out and keep it simple... 

Application Start Menu folder name: 
just delete the name leave it blank.

Radio buttons: 
Unclick all ticks in the three options below that.

Press Next >
image006

 

7. Execute after set up screen.

This next section is used to execute the program after

install.


For our needs, custom content, we don't need to do this, 
leave it blank.


It can also show a readme, make one if you like 

but it is better to include it in a zip with the install program. 

 

The user should read about your custom content before he or she starts to install.

So, the License page may be a better option.

 
For this tutorial we will leave all sections here blank.

Press Next >
 

image007

 

8. Uninstaller screen.

This section is for the uninstaller details, it is a good idea to

include this as they often work well for

"new users to the game" oh to hell with it... n00bs OK? 

We do have to do some work in the script later for
the user's uninstalling convenience, but for now...

Use uninstaller tick box:
Make sure "Use uninstaller" is ticked.

Uninstall prompt: 
Leave this alone.

Uninstall success: 
Leave this alone.

Uninstall icon:
Leave this alone for now. We will rename it later.
 

Press Next >

 

 

image008

 

9. Wizard Finished screen and saving the script.

The Wizard Finished screen pops up...

Press Finish >

We are now out of the wizard and back into

HM NIS EDIT. Your script is in the right window pane.

Now is a good time to save the file, name it what you 
want

press "Save as..." in "File".

 

The save box pops up place it somewhere you can

find it again and give it a name. 

Important!

The same folder you have your content in is best, the
next step is a compile, run and save. Saving it there
keeps everything tidy and easy to find.


 

image009

 

Compile and test.

 

It is ready to compile a script to make an installer
that will give the user an installer that has all the
folders/sub folders corrrect and place the files
correctly.


The last step is to compile,
(this will make an installer package) and run it to test it.
Go to "NSIS" in HM NIS EDIT select "Compile and Run"
or use the icon...


Once the compiler pops up the installation program the actual
setup.exe file is saved in the same directory as you saved
the script.

 

image014
 

We are finished ... but more options can be added!

What we have just done is make an installer script that is ready to compile, run and make a setup.exe package. It will deliver your files to the user, but we can add more features if required.

If we compile and run it now it will...

  • Not find the game folder, (e.g dod or cstrike) automatically... we have manually add a section in the script.
  • It may create problems with uninstalling custom content for some users... we need to manually alter some information in the script, if you make more custom content the uninstaller icon will overwrite other uninstallers in the dod folder. That will be bad!

The next section deals with the final tidy up of the script in case you want to add more features. If you have already compiled it, and you are happy with what you have, then you are done.
 
If you want more features it gets more complex. Go to the next section...