Category:Lua:Articles:Gamemodes

From GMod Wiki

Jump to: navigation, search
Lua: Game Modes Explained!
Page white text.png Description:An explanation of game modes.
link=User:Do Not Know ( Edited by Esik1er ) Original Author:Do Not Know ( Edited by Esik1er )
Calendar.png Created:December 20, 2006

Contents

Gamemodes in Garry's Mod

Gamemodes refer to the scripts and content which run a server. By default this is the Garry's Mod gamemode, But other gamemodes are created with different rules, weapons and GUIs- FortWars for example.

As well as providing the controls on the server and clients and information to server hosts, they provide a virtual system for inserting content in an isolated resource tree from Garry's Mod, thus making them portable containers for content.

Creating a Gamemode

To create a game mode you first off need to know Lua. You should have a base idea of what you want in you're game mode. A game mode should have... SWEPs, SENTs, Effects, Cool base plot et cetera.

Gamemode file Structure

In a basic Game Mode folder you will have the following folders/subfolders and files. These folders/subfolders and foles will start off in this order.

steam -> steamapps -> <your name> -> garrysmod -> garrysmod -> gamemodes

Then your game modes folder should look like this.

 
Content ->
           Materials -- Put all your materials here.
           Models -- Put all your models here.
           Resource  -- Don't need to touch this.
           Scripts -- Don't need to touch this.
           Settings -- Server settings are in here.
 
Entities -> 
            Effects -- All effects you made go here.
            Entities -- All SENTs go here.
            Weapons -- All SWEPs go here.
 
Gamemode -> 
            shared.lua
            cl_init.lua
            cl_hints.lua
            cl_notice.lua
            cl_spawnmenu.lua
            cl_tooltips.lua
            cl_worldtips.lua
            commands.lua
            player.lua
            player_extension.lua
            init.lua
 
 

In the gamemodes/ folder, create a new folder. Name it "GM_test" or something- it's the main folder. Go into "GM_test" and create another folder called "gamemode". This holds your base code. Then create one called "entities". This holds all your SWEPs, SENTs, and effects. Then create one called "content". This will hold all the sounds... Models... Materials et cetera.

Make another folder called content and another called entities.

Content represents a virtual file tree of your GMod folder I.E. content/cfg/lol.txt would appear in GMod to be in cfg/lol.txt if you were running your gamemode

info.txt

This text file has information about your modification. Here's an example of what it should look like:

"Gamemode"
 {
 	"name"		"GM_test"
 	"version"	"0.1" 
 	"up_date"	"02/12/2006" // The date this version was published. Set before release!
 
 	"author_name"	"Me."
 	"author_email"	"[email protected]"
 	"author_url"	"http://www.mywebsite.com/"
 
 	"info"		"This is my modification's description. It's not very good."
 	"icon" 	 	"" // Icon to show in the Mods list inside Garry's Mod
 	"hide"		"0" // Do not hide this gamemode from the Mods list inside Garry's Mod
  }
 

It exists in the gamemodes/mymod folder and tells GMod about your Gamemode.

Subcategories

This category has only the following subcategory.

L

Pages in category "Lua:Articles:Gamemodes"

This category contains only the following page.

G

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox