Source Mod Installers
Jump to navigation
Jump to search
Extra thanks to User:Garry Newman for relaying the basics of a mod installer.
For this, you need NSIS and HM NIS Edit.
Use the following code where:
##MODNAME##
is the Mod name.##MODVERSION##
is the installer's release version.##MODTEAM##
is the Mod's team.##MODURL##
is the Mod's website.##MODDIR##
is the Mod's root directory (i.e.cstrike
).##INSTICO##
is the location on the local computer where the icon for the installer executable is.##DESKICO##
is the location on the local computer where the icon for the desktop icon for the game is.##FILE1##
is the first file you wish to install in the mod folder.##FILE2##
is the second file you wish to install in the mod folder.##FILEX##
is the last file you wish to install in the mod folder.

setup.nsi
.
Code from setup.nsi
!define PRODUCT_NAME "##MODNAME##" !define PRODUCT_VERSION "##MODVERSION##" !define PRODUCT_PUBLISHER "##MODTEAM##" !define PRODUCT_WEB_SITE "##MODURL##" ;Uncomment this if you do not wish to have a custom desktop icon: ;!define NO_DESKTOP_ICON !define MUI_ICON "##INSTICO##" !include "MUI.nsh" !define MUI_ABORTWARNING !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "Setup.exe" ShowInstDetails show Section "Mod" SEC01 SetOverwrite ifdiff SetOutPath "$INSTDIR" File "##FILE1##" File "##FILE2##" File "##FILEX##" !ifndef NO_DESKTOP_ICON SetOutPath "$2" File "DESKICO" !endif SectionEnd Function .onInit ReadRegStr $0 HKLM "Software\Valve\Steam" InstallPath ReadRegStr $1 HKCU "Software\Valve\Steam" SourceModInstallPath IfErrors 0 lbl_end ClearErrors StrCpy $0 "$PROGRAMFILES\Valve\Steam" StrCpy $1 "$PROGRAMFILES\Valve\Steam\SteamApps\SourceMods" lbl_end: StrCpy $INSTDIR "$1\##MODDIR##" !ifndef NO_DESKTOP_ICON StrCpy $2 "$0\steam\games" !endif FunctionEnd