Creating custom actors
Now that we know how the actor system works, we can move on to creating our first actor in C# and C++.
Note
By default, it is not possible to create actors purely using the Lua scripts. Typically, the actor is created in C++ and handles custom callbacks to a Lua script contained in the Game/Scripts/Entities/Actors
folder.
Creating actors in C#
Using CryMono, we can create custom actors entirely in C#. To do so, we can derive from the Actor
class as shown:
public class MyActor : Actor { }
The previous code is the bare minimum for creating an actor in CryMono. You can then navigate to your game rules implementation and spawn the actor once the client connects via the Actor.Create
static method.
The CryMono class hierarchy
If you find yourself confused by the various CryMono/C# classes, see the following inheritance graph:
Note
Note that while querying entities using Entity.Get
(or actors via Actor.Get
), you'll get an object of type EntityBase
or ActorBase
. This is because the...