Modding
From NS2 community wiki
Guide to importing your own custom textures can be found here.
Contents |
Where to find your Natural Selection 2 directory
The directory can be found at "C:\Program Files\Steam\steamapps\common\Natural Selection 2" if steam was installed in the default location. When ever you see NSROOT on this page it means this directory
Launching you mod
The -game commandline argument sets the mod directory/zip archive(the compression must be none/store) which the engine will search for files first before searching in "NSROOT\ns2". It can either just be a directory name like this "-game mymod" the engine would treat that as a path to "NSROOT\mymod" or it can be a full path like this "-game "c:\mystuff\mymod"". When ever you see MODDIR on this page it means the directory set by this commandline.
game_setup.xml
The optional game_setup.xml file in a mods directory controls what the first lua file the Client and Server lua VMs will load also what the title of the ns2 window will be.
If your mod doesn't have one in its root directory the engine will default to loading "NSROOT\ns2\game_setup.xml"
The default game_setup.xml looks like this:
<game> <name>ns2</name> <description>Natural Selection 2</description> <client>lua/Client.lua</client> <server>lua/Server.lua</server> </game>
The description node controls what title of ns2 window will be. If client and server nodes are empty in your game_setup.xml file the game will default to loading "MODDIR\lua\Client.lua" for the client vm and
"MODDIR\lua\Server.lua" for the server VM.
if either of those don't exist the game default to loading the normal ns2 entry point lua files
"NSROOT\ns2\Client.lua" for the Client VM and "NSROOT\ns2\Server.lua" for the server VM
Key Input Example - Hello World to Console
function SendKeyEvent(key, down)
-
if key == InputKey.Q and down then
-
Shared.Message('Hello World')
-
-
end
-
end
Event.Hook("SendKeyEvent", OnSendKeyEvent)
Other tips
If you want to write something to the console use Shared.Message("some message")
