ThirdBlog-Top

Thursday, July 2, 2015

Gamemode creation (GMOD)


Gamemode Content

Gamemode content such as maps, models and sounds should be placed in gamemodes/content/ folder. (ie gamemodes/content/models/..).

Gamemode Folder

To create a new gamemode you need to create a new folder in the gamemodes folder. The folder should take the name of your gamemode. Inside of that folder there should be a text file named whatever your folder is.

For instance, if my gamemode was called "SuperKillers", I would create a folder in "garrysmod/gamemodes/" called "superkillers". Then inside that folder I would create a text file called "superkillers.txt".

Note that in previous versions of Garry's Mod this file was always called "info.txt" - but was changed in Version 13 to reflect the changes to the content.

Gamemode Text File

The .txt file you created needs to be a keyvalues file.

"superkillers"
{
                "base"                  "base"
                "title"                    "Super Killers"
                "maps"                 "^sk_"
                "menusystem" "1"
                "workshopid"    "15895"

                "settings"
                {
                                1
                                {
                                                "name"                "sk_maxfrags"
                                                "text"                    "Max Frags"
                                                "help"                   "The maxiumum number of frags before a map change"
                                                "type"                   "Numeric"
                                                "default"             "20"
                                }


                                2
                                {
                                                "name"                "sk_grenades"
                                                "text"                    "Allow Grenades"
                                                "help"                   "If enabled then grenades are enabled"
                                                "type"                   "CheckBox"
                                                "default"             "1"
                                }

                }

}
key         description
base      The gamemode you're deriving from. This will usually be base or sandbox.
title        The 'nice' title of your gamemode. Can contain spaces and capitals.
maps     The map filter for your gamemode. This is used to correctly categorise maps in the map selector. This should only be set if the maps are unique to your gamemode.
menusystem     Include and set to 1 if this gamemode should be selectable from the main menu
workshopid        Optional. If your gamemode is on Workshop then this should be the workshopid of the file. (You won't have a workshopid until you upload - so you will need to set this in an update)
settings                See Below
Settings

The settings table allows you to create server configuration convars for your gamemode. It's completely optional. Your text file doesn't have to have a settings section.

In previous versions of GMod this section used to have its own file, in gamemode/<gamemode>/content/settings/server_settings/. It was moved to the root folder to decrease load times.

These settings are configurable in the main menu in GMod. Each entry has a number of fields.


key         description
name    The name of the convar
text        The text to show in game to describe this convar
help       The help text to show on the convar (in the console)
type       Either Text, CheckBox or Numeric. These are case-sensitive!

default The default value for the convar

No comments:

Post a Comment