Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3
minLevel2
excludeOverview

Overview

To implement a new entity using Lua, two files need to be stored in the game folder.

The first one is the Ent file which is parsed by the Entity System to know the file location of the Lua script. The second one is the Lua script which implements the desired properties and functions.

With the SDK, both the .Ent ent and .Lua lua files are stored inside the <Game_Folder>\Game\Scripts.pak file.

Ent File

The Ent files are all stored inside the \Game<Game_Folder>\Entities directory and need to have the .ent file extension. The content is an XML file like the example below.

...

Property

Description

Name

Name of the Entity class.

Script

Path of the Lua script used to implement the entity class.

Invisible

Prevents it from being visible as one of the available entity class classes inside Sandbox.

Lua Script

...

You can add special comments behind a variable which can be utilized by the engine. Currently you can change the default sliders inside the editor by providing information about a number variable.

For example:

Image Modified

The comment...

Code Block
--[25,100,0.1,"Damage treshold"]

... tells the engine that:

  • The value is limited to values between 25 and 100.
  • In case of a decimal it will us a step of 0.01, this defines the fidelity of which the value can be changed in the editor.
  • "Damage treshold" will be added to the tooltip which pops up when you hover over a variable to provide additional information.

...