CinematX Actor (class)

This class provides fields/functions for managing Actors with the CinematX.lua API.

Actors extend NPCs and make it easier to access individual NPCs and give them unique behavior. By default, an actor is created for every NPC as well as the player (accessible via the cinematX.playerActor constant).

Message Tags
Each NPC's Actor is assigned unique traits and behaviors based on tags specified in the NPC's message text. Note that in order for this to work, cinematX must be configured to override the SMBX NPC message system.

Add one or more of the following tags inside curly brackets:


 * key=# (a string index that you can use to reference the Actor within your LunaLua code via getActorFromKey)
 * name=#  (the name displayed in the interaction prompt when approaching the NPC)
 * verb=#  (the term used for interacting with the NPC in the interaction prompt -- i.e. talk, read, push, etc.)
 * icon=#  (the icon that hovers over the NPC's head)
 * routine=#  (a coroutine to be called when the NPC is spoken to)
 * scene=#  (a coroutine to be called as a cutscene when the NPC is spoken to)

Example messages:

{key=goopa1, icon=0, scene=cutscene_TestDialog} {key=goopa2, icon=1, routine=cutscene_TestQuest}

If you want to be able to reference an NPC Actor without letting the player interact with them, just define the key and nothing else.

{key=goopa3}

Movement
Actor.isUnderwater Actor.isResurfacing Actor.shouldFacePlayer

Actor.shouldDespawn Actor.isDespawned Actor.isDead

Actor.actorToFollow Actor.shouldTeleportToTarget Actor.distanceToFollow Actor.destWalkSpeed Actor.walkSpeed Actor.walkDestX Actor.shouldWalkToDest

Animation
cinematX can override the animation behavior of an NPC to allow for more expressive and nuanced animations. To do so, you'll need to do the following:


 * Extend the NPC's sprite sheet accordingly
 * Create an animation data table for the NPC
 * Assign the data table to one or more actors using Actor:overrideAnimation in the onLoop function of your lunadll.lua file

Animation tables are simple Lua arrays that specify which frames of the NPC's sprite sheet belong to which animation states. The first index stores the total number of frames in the animation for each direction and following indexes contain the first and last frames of a given state, stored as a string with a dash between the two values.

Here's a list of all existing animation state constants:
 * cinematX.ANIMSTATE_IDLE
 * cinematX.ANIMSTATE_TALK
 * cinematX.ANIMSTATE_TALK1 through TALK7
 * cinematX.ANIMSTATE_WALK
 * cinematX.ANIMSTATE_RUN
 * cinematX.ANIMSTATE_JUMP
 * cinematX.ANIMSTATE_FALL
 * cinematX.ANIMSTATE_DEFEAT
 * cinematX.ANIMSTATE_ATTACK
 * cinematX.ANIMSTATE_ATTACK1 through ATTACK7

Only _IDLE, _TALK, _WALK, _RUN, _JUMP and _FALL need to be specified in an animation table, as these are automatically applied to overridden NPCs by cinematX. The other constants are for convenience, and any states defined using those constants must be applied manually with Actor:setAnimState. You may also use numbers 23 and above for additional states.

In addition to animation tables, you can use the following functions and variables for even more control over NPC animation:

Interaction
Actor.isInteractive = false Actor.sceneString = "" Actor.routineString = "" Actor.messagePointer = "" Actor.messageString = "" Actor.nameString = "" Actor.wordBubbleIcon = nil Actor.messageIsNew = true

Miscellaneous
Actor:saveState (slot) Actor:loadState (slot)

Actor.helloVoice = "" Actor.goodbyeVoice = ""