Menu Background Images
If you want to include backgrounds with your gamemode place
them in gamemodes/<yourgamemode>/backgrounds/. They must all be jpg
images.
Menu Logo Image
To supply a menu logo image place a png file in
gamemodes/<yourgamemode>/logo.png. This image should be 128 pixels high
and up to 1024 pixels wide. The default logo is 288 x 128.
Menu Icon
To supply a menu icon place a png file in
gamemodes/<yourgamemode>/icon24.png. This image should ideally be 24x24
pixels but it can be up to 32x32. The server list displays the icons at 24x24
while the gamemode selection uses 32x32. Here's where it will appear.
MenuIcons.jpg
Init and Shared Files
Three files are needed for your gamemode to function
properly. These go into your <gamemode>/gamemode/ folder.
Please note, that while we use shared.lua in the example
below, it is completely optional. init.lua and cl_init.lua are not!
init.lua
This file is called when the server loads the gamemode. The
example below tells the resource system to send the two files to the client,
and then loads shared.lua.
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )
shared.lua
This file sets some common variables and creates the
Initialize function. This is the only function you NEED to define. All others
will be called from the base gamemode.
GM.Name = "Super Killers"
GM.Author = "N/A"
GM.Email = "N/A"
GM.Website = "N/A"
function GM:Initialize()
-- Do
stuff
end
cl_init.lua
This file is called when the client loads the gamemode. You
would put client specific things in here. We load shared.lua. Note that you can
only 'include' files here that have been 'AddCSLuaFile'd on the server.
include( "shared.lua" )
Deriving Gamemodes
If you are deriving your gamemode from something other than
base, use this function to tell the engine that we do.
You must call the function on both, client and server, and
since our shared.lua is included from both, cl_init.lua and init.lua, we can do
it once, in shared.lua.
In the example below, let's say we derive our gamemode from
sandbox, so we add this to our shared.lua, somewhere above all function
definitions is a good place:
DeriveGamemode( "sandbox" )
Common Errors
Error loading gamemode: info.Valid
Your Gamemode Text File is invalid or was not found.
Error loading gamemode: !IsValidGamemode
The game could not find cl_init.lua or init.lua of your
gamemode.
Game crashes/freezes on death
You have not assigned a playermodel to the player.
No comments:
Post a Comment