Mod Installer script
<div class="IPBDescription">Customisable script for installing mods.</div>I've been getting further along with the Combat Mode mod and I noticed that there's no easy way to distribute mods yet, so I have written an NSIS script which you can re-use as a template for distributing your own mods.
It has the following features:
<ul><li>Auto-detects where the natural selection 2 folder resides and by default will install in the correct subfolder there.</li><li>Puts an entry in Add/Remove programs if you need to uninstall your mod.</li><li>Puts a link on the Start Menu and Desktop that launches your mod directly (no need to use Launchpad or a cmd window)</li><li>Displays a splash screen when the menu loads (which you can change easily). Supports Alpha Transparency too I think.</li></ul>
If you're interested in using it, install NSIS from here:
<a href="http://nsis.sourceforge.net/Download" target="_blank">http://nsis.sourceforge.net/Download</a>
Then get the installer and files from my GitHub repository here (click "download" on the top right which will get the latest version):
<a href="https://github.com/AlexHayton/NS2-Combat-Mode/tree/origin/installer" target="_blank">https://github.com/AlexHayton/NS2-Combat-Mo...rigin/installer</a>
<b>Usage Instructions</b>
Make a subfolder in your mod directory called "installer" and copy the files from my "installer" directory into there.
Edit installer.nsi in your favourite text editor, and modify these variables at the top of the file:
<ul><li>APP_NAME</li><li>COMP_NAME (your name)</li><li>WEB_SITE</li><li>VERSION (must be in the format x.x.x.x where all "x" are integers)</li><li>COPYRIGHT (name of the license you are using for your mod)</li><li>DESCRIPTION</li><li>INSTALLER_NAME (name of the generated installer)</li><li>MAIN_APP_EXE ("Launch <Your Mod Name>.lnk")</li><li>SM_FOLDER (start menu folder)</li><li>MOD_FOLDER (mod directory name under the "natural selection 2" folder. No spaces or hyphens in your mod's directory name or the launcher won't work! e.g. "Combat" is good, "NS2-Combat-Mode" bad!)</li></ul>
Change the list of files and directories in the "MainProgram" section after line 111. They are listed file-by-file, with each directory grouped together. I have used relative paths so it works from anywhere as long as your installer script lives in a folder inside your mod directory's root (e.g. in the "installer" folder). Only the files that are listed will be copied over, which is useful if you keep a load of crap in your working directory like me!
Edit the files in the "Uninstall" section. This needs to mirror the files that you added in the "MainProgram" section or you will get files and directories left behind.
Edit the "splash.bmp" and put your own file in there. The dimensions of the bitmap aren't fixed, so if you prefer it bigger/smaller that should work ok. Optionally, replace it with an empty bmp file ("New->Bitmap Image") and it'll disable the splash screen entirely (or you can comment out the relevant lines in the installer if you know how).
(Optional) Edit LICENSE.txt to put your own license text in there (if wine is more your thing). This is what is displayed in the "LICENSE" section of the installer.
Now right-click on the installer and click "Make NSI file". NSIS will get to work and tell you if there are any errors (if you're stuck paste them here and I'll try and help). It generates an EXE in the same directory as the NSI file. If you're feeling fancy you can use the second option on the explorer menu to get it to test each compression type and choose the best one automatically.
It has the following features:
<ul><li>Auto-detects where the natural selection 2 folder resides and by default will install in the correct subfolder there.</li><li>Puts an entry in Add/Remove programs if you need to uninstall your mod.</li><li>Puts a link on the Start Menu and Desktop that launches your mod directly (no need to use Launchpad or a cmd window)</li><li>Displays a splash screen when the menu loads (which you can change easily). Supports Alpha Transparency too I think.</li></ul>
If you're interested in using it, install NSIS from here:
<a href="http://nsis.sourceforge.net/Download" target="_blank">http://nsis.sourceforge.net/Download</a>
Then get the installer and files from my GitHub repository here (click "download" on the top right which will get the latest version):
<a href="https://github.com/AlexHayton/NS2-Combat-Mode/tree/origin/installer" target="_blank">https://github.com/AlexHayton/NS2-Combat-Mo...rigin/installer</a>
<b>Usage Instructions</b>
Make a subfolder in your mod directory called "installer" and copy the files from my "installer" directory into there.
Edit installer.nsi in your favourite text editor, and modify these variables at the top of the file:
<ul><li>APP_NAME</li><li>COMP_NAME (your name)</li><li>WEB_SITE</li><li>VERSION (must be in the format x.x.x.x where all "x" are integers)</li><li>COPYRIGHT (name of the license you are using for your mod)</li><li>DESCRIPTION</li><li>INSTALLER_NAME (name of the generated installer)</li><li>MAIN_APP_EXE ("Launch <Your Mod Name>.lnk")</li><li>SM_FOLDER (start menu folder)</li><li>MOD_FOLDER (mod directory name under the "natural selection 2" folder. No spaces or hyphens in your mod's directory name or the launcher won't work! e.g. "Combat" is good, "NS2-Combat-Mode" bad!)</li></ul>
Change the list of files and directories in the "MainProgram" section after line 111. They are listed file-by-file, with each directory grouped together. I have used relative paths so it works from anywhere as long as your installer script lives in a folder inside your mod directory's root (e.g. in the "installer" folder). Only the files that are listed will be copied over, which is useful if you keep a load of crap in your working directory like me!
Edit the files in the "Uninstall" section. This needs to mirror the files that you added in the "MainProgram" section or you will get files and directories left behind.
Edit the "splash.bmp" and put your own file in there. The dimensions of the bitmap aren't fixed, so if you prefer it bigger/smaller that should work ok. Optionally, replace it with an empty bmp file ("New->Bitmap Image") and it'll disable the splash screen entirely (or you can comment out the relevant lines in the installer if you know how).
(Optional) Edit LICENSE.txt to put your own license text in there (if wine is more your thing). This is what is displayed in the "LICENSE" section of the installer.
Now right-click on the installer and click "Make NSI file". NSIS will get to work and tell you if there are any errors (if you're stuck paste them here and I'll try and help). It generates an EXE in the same directory as the NSI file. If you're feeling fancy you can use the second option on the explorer menu to get it to test each compression type and choose the best one automatically.
Comments
I also fixed a bug that SN.Wolf found where it wasn't picking up the location of Steam properly on 32-bit systems.
I also have a section in there that installs NS2GmOvrMind for you (it won't overwrite anything if it's already present).
The above link is still valid, and it contains the latest version.