-
Book Overview & Buying
-
Table Of Contents
CryENGINE 3 Game Development: Beginner's Guide
By :
In order to be able to execute C++ code from Lua, we need to write a new, so-called Scriptbind function. Scriptbind functions are functions that are exposed to Lua, which means that this C++ function can be called from our Lua script code.
Open the ScriptBind_Actor.h file. You will find all actor-related functions, which are accessible in Lua, as seen in the following screenshot:

If you scroll down, you can simply add a new function there.
So, let's add a new function and name it TeleportTo. Search for SetSearchBeam (which is the last Scriptbind function in this file), and add your new function right under it in the ScriptBind_Actor.h file:
//teleport the actor to targetPos virtual int TeleportTo(IFunctionHandler* pH, Vec3 targetPos);

A Scriptbind function always returns an int (number) and gets an IFunctionHandler *pH as the first argument. Each following argument can be user defined. You can add as many arguments as you want...
Change the font size
Change margin width
Change background colour