Mod Installer script

MCMLXXXIVMCMLXXXIV Join Date: 2010-04-14 Member: 71400Members
edited February 2011 in Modding
<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.

Comments

  • LazerLazer Join Date: 2003-03-11 Member: 14406Members, Contributor, Constellation, NS2 Playtester
    I'll be using this it works really nice. Thanks!
  • MCMLXXXIVMCMLXXXIV Join Date: 2010-04-14 Member: 71400Members
    edited February 2011
    I've updated this script a bit. It now creates a dedicated server link as well and has proper icons.

    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.
  • spellman23spellman23 NS1 Theorycraft Expert Join Date: 2007-05-17 Member: 60920Members
    Cool. Installers/managers like this are always useful once more and more mods become available.
  • MCMLXXXIVMCMLXXXIV Join Date: 2010-04-14 Member: 71400Members
    It's occurred to me that some kind of mod manager/auto-updater is going to be a key requirement for getting mods to work long-term (due to the high pace of updates, people are going to be downloading a lot of installers otherwise!) Does anyone know of any open-source mod manager and downloader frameworks for e.g. World of Warcraft that we could appropriate for NS2 mod management? I had a quick google but couldn't see anything obviously fit for purpose.
  • DepotDepot The ModFather Join Date: 2002-11-09 Member: 7956Members
    Nice work, MCMLXXXIV.
  • puzlpuzl The Old Firm Join Date: 2003-02-26 Member: 14029Retired Developer, NS1 Playtester, Forum Moderators, Constellation
Sign In or Register to comment.