CinematX.lua

'NOTE: This page is currently under construction. Apologies for any messiness and incomplete/outdated information!'

The cinematX library is a framework for adding NPC interactions, cutscenes, boss battles, and other dynamic sequences and content to Super Mario Bros X.

Installation
cinematX will be included with LunaLua when it is finished. Until then, the latest version of cinematX can be downloaded from the Github repository.

To install cinematX manually, follow these steps:


 * Place cinematX.lua and the folder named cinematX into the LuaScriptsLib folder.


 * Open up mainV2.lua and below loadSharedAPI("uservar") (line 154) add the following line:


 * (Optional) copy the cinematX_World folder to the worlds directory.

Setup
In order to set up a level to work with cinematX, you'll need to add this line at top of your lunadll.lua file:

This line allows cinematX and lunadll.lua to communicate with each other.

You may optionally call the cinematX.config(toggleOverrideMsg, showDebug) function following the loadSharedAPI statement to toggle the following features of cinematX:


 * toggleOverrideMsg: If true, cinematX will override the default SMBX NPC message system (see Message Tags below.) False by default
 * showDebug: If true, you can access the cinematX console for entering cheats and stuff. False by default

Configuring cinematX
In the onLoad function of your lunadll.lua script, you may call the cinematX.config(toggleOverrideMsg, showDebug) function to toggle the following features of cinematX:


 * toggleOverrideMsg: If true, cinematX will override the default SMBX NPC message system (see Extending NPCs below.) True by default
 * showDebug: If true, you can access the cinematX console for entering cheats and stuff. False by default (is mistakenly set to true in v0.0.3)

Actors
An important feature of cinematX is the Actor wrapper class, which makes it easier to access and control NPCs with Lua code.

Coroutine Basics
cinematX makes use of special functions called coroutines to make programming cutscenes, boss battles and other dynamic/scripted sequences simpler. These functions can be paused and resumed to control timing and make it seem like you have multiple "threads" of code running simultaneously.

Coroutines in cinematX work like any other Lua functions with a few key differences:


 * They cannot have any parameters
 * They must be called via runCoroutine or runCutscene
 * They can be paused until certain conditions are met using the waitFor__ functions

Scene Mode
When calling functions like runCutscene and beginBattle, the scene will automatically change to the appropriate state. You may also use the changeSceneMode function to switch to one of the following states:

cinematX.SCENESTATE_PLAY

cinematX.SCENESTATE_CUTSCENE

cinematX.SCENESTATE_BATTLE

Boss Battles
cinematX has functions for managing boss battles and similar sequences, but the battles themselves are just coroutines like any other sequence.

Code Documentation
[This section is far from complete!]