The 3D actor object allows you to access the properties of your 3D actors. 3D actor objects are created by loading an actor definition file using the Game.LoadActor3D or Scene.LoadActor3D methods.
Actions | |
GoTo | Makes the actor walk to a given point. |
GoToObject | Makes the actor walk to a specified entity. |
GoTo3D | Makes the actor walk to a given point in 3D space. |
TurnTo | Makes actor turn to the given direction or to a given object. |
TurnToAngle | Makes actor turn to the given angle. |
IsWalking | Queries whether the actor is currently walking. |
PlayAnim | Plays an animation. |
PlayAnimChannel | Plays an animation in a specified channel. |
StopAnim | Stops a currently playing animation. |
StopAnimChannel | Stops a currently playing animation in the specified channel. |
IsAnimPlaying | Checks whether the actor is currently playing an animation |
IsAnimChannelPlaying | Checks whether the actor is currently playing an animation in a specified channel |
SetAnimTransitionTime | Sets a transition time for an animation pair |
GetAnimTransitionTime | Queries a transition time for an animation pair |
SkipTo3D | Moves the actor to a specified point in 3D space |
SetTexture | Assigns a new texture to a specified material |
SetTheoraTexture | Assigns a Theora video as a texture to a specified material |
SetEffect | Assigns an advanced material defined by effect file to a specified material |
RemoveEffect | Removed an advanced material defined by effect file from a specified material |
SetEffectParam | Sets a parameter of an effect applied to a material |
SetEffectParamVector | Sets a 4D vector parameter of an effect applied to a material |
SetEffectParamColor | Sets a color parameter of an effect applied to a material |
GetBonePosition2D | Returns current position of a specified bone in screen coordinates |
GetBonePosition3D | Returns current position of a specified bone in world coordinates |
AddIgnoredLight | Adds a light to the list of lights that shouldn't affect the actor |
RemoveIgnoredLight | Removes a light from the list of lights that shouldn't affect the actor |
Direct control | |
DirectWalk | Makes the character walk forward. |
DirectWalkBack | Makes the character walk backwards. |
DirectWalkStop | Stops character from walking. |
DirectTurnLeft | Makes the character turn counter-clockwise. |
DirectTurnRight | Makes the character turn clockwise. |
DirectTurnStop | Stops character from turning. |
Shadow related functions | |
SetShadowImage | Sets and image to be used as a simple shadow for this actor |
GetShadowImage | Gets the currently assigned image to be used as a simple shadow for this actor |
SetLightPosition | Sets the position of a light to project a real-time shadow |
Attachment functions | |
AddAttachment | Load a new model from a file and attaches it to a specified bone of this actor |
RemoveAttachment | Permanently removes a specified attachment from this actor |
GetAttachment | Gets a reference to a specified attachment object |
Animation management | |
MergeAnims | Loads animations from X file |
UnloadAnim | Unload specified named animation from memory |
Mesh related functions (deprecated) | |
HideMesh | Hides a specified part (mesh) of this actor |
ShowMesh | Shows a specified part (mesh) of this actor |
AddMesh | Load a new model from a file and attaches it to a specified bone of this actor |
RemoveMesh | Permanently removes a specified mesh from this actor |
Item functions | |
TakeItem | Adds an item into the inventory. |
DropItem | Removes an item from the inventory. |
GetItem | Queries an inventory item. |
HasItem | Queries whether a given item is in inventory of any of this object. |
Cursor functions | |
SetCursor | Sets the standard cursor. |
GetCursor | Returns the filename of the cursor sprite (or null if no cursor is set) |
GetCursorObject | Returns a reference to the cursor sprite (or null if no cursor is set) |
RemoveCursor | Removes the standard cursor. |
HasCursor | Queries whether the standard cursor is set. |
Script functions | |
AttachScript | Executes a script file and attaches it to the object. |
DetachScript | Terminates a specified script file and detaches it from an object. |
IsScriptRunning | Queries whether a specified script file is running and attached to an object. |
CanHandleMethod | Queries whether the object supports a method of a specified name. |
Sound functions | |
PlaySound | Plays a sound. If the filename is omitted, the currently assigned sound is played (if any). |
PlaySoundEvent | Plays a sound and triggers an event when the sound is over. If the filename is omitted, the currently assigned sound is played (if any). |
StopSound | Stops the currently playing sound (if any). |
PauseSound | Pauses the currently playing sound. |
ResumeSound | Resumes a paused sound playback. |
IsSoundPlaying | Queries whether a sound playback is in progress. |
SetSoundPosition | Sets the sound's current playing position. |
GetSoundPosition | Queries the sound's current playing position |
SetSoundVolume | Sets a volume of the currently playing sound. |
GetSoundVolume | Gets a volume of the currently playing sound. |
LoadSound | Initializes a sound from file and makes it ready to be played. |
Sound effects functions | |
SoundFXNone | Removes any sound effect currently assigned to this object. |
SoundFXEcho | Assigns an echo effect to the sounds played by this object. |
SoundFXReverb | Assigns a reverb effect to the sounds played by this object. |
Event functions | |
ApplyEvent | Applies a named event to the object. |
CanHandleEvent | Queries whether the object has an event handler for a specified event. |
Miscelaneous functions | |
SkipTo | Moves an object to a specified location. |
Reset | Cancels the action the object was currently performing (like talking, walking etc.). |
IsTalking | Queries whether the object is currently talking. |
StopTalking | Cancels object's talking. |
Talk | Makes the object talk. |
StickToRegion | Forces this actor/entity to act like it's inside a given region |
SetFont | Sets font of this object. |
GetFont | Gets a font assigned to this object. |
Particle functions | |
CreateParticleEmitter | Initializes the particle emitter attached to this object. |
DeleteParticleEmitter | Deletes the particle emitter attached to this object. |
CreateParticleEmitterBone | Initializes the particle emitter and attaches it to a specified bone. |
Type (read only) | Returns always "actor3d" |
Direction | The direction the actor is currently facing |
DirectionAngle | The angle the actor is currently facing, in degrees |
Active | Specifies whether the object is visible on screen |
IgnoreItems | Specifies whether the object appears to be non-interactive when an inventory item is used on it |
SubtitlesPosRelative | Specifies whether the SubtitlesPosX and SubtitlesPosY attributes are relative to default position, or absolute screen coordinates |
SubtitlesPosX | The X position of speech subtitles (either relative to speaker's position or absolute screen coordinates) |
SubtitlesPosY | The Y position of speech subtitles (either relative to speaker's position or absolute screen coordinates) |
SubtitlesWidth | Width of speech subtitles. Set to zero to restore the default behavior. |
SubtitlesPosXCenter | Specifies if the SubtitlesPosX attribute affects the center of the subtitle or its left side. |
ParticleEmitter (read only) | Returns the reference to the particle emitter object attached to this object, or null if the emitter haven't been initialized yet |
NumAttachments (read only) | Returns the number of entities attached to this object. |
Name | The internal name of the object. |
Caption | The caption of the object. |
AccCaption | A special caption of the object used for accessibility purposes. |
X | The X position of the object. |
Y | The Y position of the object. |
Height (read only) | Returns the current height of the object. In case of actors and entities the scaling is taken into account. |
Filename (read only) | Returns the filename. |
Ready (read only) | Returns whether the object isn't currently performing any action. |
Interactive | Specifies whether the object recieves user input. |
SoundPanning | Specifies whether the sounds played by this object are automatically panned depending on object's position on screen. |
NonIntMouseEvents | Specifies if the object can receive the MouseEntry and MouseLeave events even if the game is in non-interactive mode. |
Scale | The scale of this character in percent. The scale affects both the character model and its shadow. |
PosX | The 3D X coordinate of the actor's current position |
PosY | The 3D Y coordinate of the actor's current position |
PosZ | The 3D Z coordinate of the actor's current position |
Velocity | The movement velocity to be used for walking |
AngularVelocity | The turning velocity to be used for turning |
ShadowType | Specifies the shadow detail level to be used for this actor (0..none, 1..simple, 2..flat, 3..stencil shadows) |
ShadowColor | The RGBA color of the real-time shadow cast by this character |
Shadow | Specified if this character casts shadow (obsolete, use ShadowType) |
SimpleShadow | Specifies if simple shadow is used instead of real-time one (obsolete, use ShadowType) |
DrawBackfaces | Specifies whether the 3D model should display also polygons facing away from the camera. |
TalkAnimName | The name of an animation sequence to be used for talking |
WalkAnimName | The name of an animation sequence to be used for walking |
IdleAnimName | The name of an animation sequence to be used for standing still |
TurnLeftAnimName | The name of an animation sequence to be used for turning left (counter clockwise) |
TurnRightAnimName | The name of an animation sequence to be used for turning right (clockwise) |
TalkAnimChannel | The animation channel to be used for playing talking animations. |
GoToTolerance | Specifies the shortest distance between the actor's current position and its GoTo target (in pixels); If the distance is shorter than this value, GoTo command is ignored. |
AnimTransitionTime | Specifies the time taken to smoothly transition between two animations (in milliseconds) |
AnimStopTransitionTime | Specifies the time taken to smoothly transition back to basic pose after an animation finishes (in milliseconds) |
DropToFloor | Specifies whether the actor is always standing on the ground, no matter what Y coordinate is assigned to it. |
AmbientLightColor | The color of the scene ambient light, which only affects this actor (overrides scene ambient light color). |
MouseEntry | The mouse pointer has been just moved over the object. |
MouseLeave | The mouse pointer has been just moved away from the object. |
Makes the actor walk to a given point.
The GoTo method blocks the script execution until the walking is over, while the GoToAsync method returns immediately.
Makes the actor walk to a specified entity.
This method utilizes the WalkToX, WalkToY and WalkToDirection properties of the target entity. They can be set directly in SceneEdit.
Makes the actor walk to a given point in 3D space.
The GoTo3D method blocks the script execution until the walking is over, while the GoTo3DAsync method returns immediately. Unlike the standard GoTo method, this method doesn't project the target point from screen position, but rather uses the "raw" 3D point within scene geometry as a target point.
Makes actor turn to the given direction or to a given object.
The TurnTo method blocks the script execution until the turning is over, while the TurnToAsync method returns immediately. The direction can be one of the following constants: DI_UP, DI_UPRIGHT, DI_RIGHT, DI_DOWNRIGHT, DI_DOWN, DI_DOWNLEFT, DI_LEFT or DI_UPLEFT (those equal to numbers 0 to 7).
Makes actor turn to the given angle.
The TurnToAngle method blocks the script execution until the turning is over, while the TurnToAngleAsync method returns immediately.
Queries whether the actor is currently walking.
Returns true if the actor is walking.
Plays an animation.
Returns true if the animation has been played successfuly.
The PlayAnim method blocks the script execution until the animation is over, while the PlayAnimAsync method returns immediately. PlayAnim is equivalent to PlayAnimChannel with channel set to zero.
Plays an animation in a specified channel.
Returns true if the animation has been played successfuly.
The PlayAnimChannel method blocks the script execution until the animation is over, while the PlayAnimChannelAsync method returns immediately.
Stops a currently playing animation.
Returns true if the animation has been stopped successfuly.
Stops a currently playing animation in the specified channel.
Returns true if the animation has been stopped successfuly.
Checks whether the actor is currently playing an animation
Returns true if the actor is playing an animation.
If you don't specify an animation name, this method checks if any animaton is playing. Otherwise it checks if the specified animation is playing.
Checks whether the actor is currently playing an animation in a specified channel
Returns true if the actor is playing an animation in a specified channel.
If you don't specify an animation name, this method checks if any animaton is playing. Otherwise it checks if the specified animation is playing.
Sets a transition time for an animation pair
Returns true if the method succeeded.
For example, if you want to set the transition from walking to idle animation to 1 second, you'd call: actor.SetAnimTransitionTime("walk", "idle", 1000); Specify a negative Time value to restore the default transition time.
Queries a transition time for an animation pair
Returns the transition time for the specified animation pair, or a negative value if no transition time is defined.
Moves the actor to a specified point in 3D space
Assigns a new texture to a specified material
MaterialName defaults to the name of the original texture assigned to the model, without extension. For example, if the model uses texture called "path\some_texture.png", the material will be called "some_texture". TextureFilename can be either a static image or WME sprite.
Assigns a Theora video as a texture to a specified material
MaterialName defaults to the name of the original texture assigned to the model, without extension. For example, if the model uses texture called "path\some_texture.png", the material will be called "some_texture". The Theora video dimensions must be powers of two (2, 4, 8, 16, 32...) and the video is always looping until it's replaced by other texture.
Assigns an advanced material defined by effect file to a specified material
MaterialName defaults to the name of the original texture assigned to the model, without extension. For example, if the model uses texture called "path\some_texture.png", the material will be called "some_texture".
Removed an advanced material defined by effect file from a specified material
MaterialName defaults to the name of the original texture assigned to the model, without extension. For example, if the model uses texture called "path\some_texture.png", the material will be called "some_texture".
Sets a parameter of an effect applied to a material
The value can contain one of the following types: string, logical value, integer number or floating point number.
Sets a 4D vector parameter of an effect applied to a material
Sets a color parameter of an effect applied to a material
The Color parameter should contain a packed RGBA color value created using the MakeRGBA() function. Internally the color is converted to a 4D vector.
Returns current position of a specified bone in screen coordinates
Returns an object providing two properties, X and Y.
Returns current position of a specified bone in world coordinates
Returns an object providing three properties, X, Y and Z.
Adds a light to the list of lights that shouldn't affect the actor
Returns true if the method succeeded.
The light name is case-insensitive.
Removes a light from the list of lights that shouldn't affect the actor
Returns true if the method succeeded.
The light name is case-insensitive.
Makes the character walk forward.
Makes the character walk backwards.
Stops character from walking.
Makes the character turn counter-clockwise.
Makes the character turn clockwise.
Stops character from turning.
Sets and image to be used as a simple shadow for this actor
Returns true if the image has been successfuly set.
Gets the currently assigned image to be used as a simple shadow for this actor
Returns the filename of currently assigned shadow image or null if no image is set.
Sets the position of a light to project a real-time shadow
The light position is relative to actor's position.
Load a new model from a file and attaches it to a specified bone of this actor
Returns true if the attachment has been successfuly loaded and attached.
Permanently removes a specified attachment from this actor
Returns true if the attachment has been successfuly removed.
Gets a reference to a specified attachment object
Returns a reference to an attachment object or null if there's no attachment with a specified name.
Loads animations from X file
Returns true if the animations have been successfuly merged.
Unload specified named animation from memory
Returns true if the animation has been successfuly removed.
Hides a specified part (mesh) of this actor
Returns true if the mesh has been successfuly hidden.
This method is DEPRECATED and not supported by .X models.
Shows a specified part (mesh) of this actor
Returns true if the mesh has been successfuly shown.
This method is DEPRECATED and not supported by .X models.
Load a new model from a file and attaches it to a specified bone of this actor
Returns true if the mesh has been successfuly loaded and attached.
This method is DEPRECATED and not supported by .X models.
Permanently removes a specified mesh from this actor
Returns true if the mesh has been successfuly removed.
This method is DEPRECATED and not supported by .X models.
Adds an item into the inventory.
Removes an item from the inventory.
Queries an inventory item.
A reference to the item object of a given name or at a given index in the inventory.
Queries whether a given item is in inventory of any of this object.
If the specified item is in the inventory of this object, the return value is true.
Note that this method only searches the current object, use the Game.IsItemTaken() method if you want to search all game objects.
Sets the standard cursor.
Returns true if the cursor has been set succesfuly.
Returns the filename of the cursor sprite (or null if no cursor is set)
Returns a reference to the cursor sprite (or null if no cursor is set)
Removes the standard cursor.
Queries whether the standard cursor is set.
Returns true if the object has a custom mouse pointer assigned.
Executes a script file and attaches it to the object.
Returns true if the script has been executed succesfuly.
Each WME object can have multiple scripts attached.
Terminates a specified script file and detaches it from an object.
Returns true if the script has been detached succesfully.
Script threads are currently executed event handlers and methods.
Queries whether a specified script file is running and attached to an object.
Returns true if a specified script file is attached to an object.
Queries whether the object supports a method of a specified name.
Returns true if the object is able to handle the specified method.
Plays a sound. If the filename is omitted, the currently assigned sound is played (if any).
If the method succeeds, the return value is true.
Plays a sound and triggers an event when the sound is over. If the filename is omitted, the currently assigned sound is played (if any).
If the method succeeds, the return value is true.
Stops the currently playing sound (if any).
If the method succeeds, the return value is true.
Pauses the currently playing sound.
If the method succeeds, the return value is true.
Resumes a paused sound playback.
If the method succeeds, the return value is true.
Queries whether a sound playback is in progress.
If the sound is playing, the return value is true.
Sets the sound's current playing position.
If the method succeeds, the return value is true.
Queries the sound's current playing position
Returns the current playing position (in milliseconds).
Sets a volume of the currently playing sound.
If the method succeeds, the return value is true.
Gets a volume of the currently playing sound.
Returns the volume of the currently playing sound (in percent).
Initializes a sound from file and makes it ready to be played.
If the method succeeds, the return value is true.
Use this method to pre-cache a sound file. Initializing the sound takes some time and sometimes it's desirable to move all sound initialization to e.g. scene start so that the subsequent PlaySound calls don't slow the game down. That's what LoadSound is for. To play the pre-cached sound simply call PlaySound without specifying a filename, for example SomeObject.PlaySound(false);
Removes any sound effect currently assigned to this object.
Assigns an echo effect to the sounds played by this object.
Example: actor.SoundFXEcho(50, 50);
Assigns a reverb effect to the sounds played by this object.
Example: actor.SoundFXReverb(0, 0, 2000);
Applies a named event to the object.
Returns true it the event has been applied succesfuly.
Queries whether the object has an event handler for a specified event.
Returns true if the object is able to handle the specified event.
Moves an object to a specified location.
Cancels the action the object was currently performing (like talking, walking etc.).
Queries whether the object is currently talking.
Returns true if the object is talking.
Cancels object's talking.
You can also use StopTalk() abbreviation.
Makes the object talk.
Talk method blocks the script execution until the animation is over, while the TalkAsync method returns immediately. If the duration is set to zero, it's calculated automatically either from the sound file or from the length of the subtitle.
Forces this actor/entity to act like it's inside a given region
Use this method to "lock" a z-order value of an actor or an entity.
Sets font of this object.
If the method succeeds, the return value is true.
Gets a font assigned to this object.
Returns the filename of currently assigned font.
Initializes the particle emitter attached to this object.
Returns the reference to the particle emitter object
Once initialized with this method, the particle emitter object can be queried using the ParticleEmitter property.
Deletes the particle emitter attached to this object.
Returns true if the method succeeded.
Initializes the particle emitter and attaches it to a specified bone.
Returns the reference to the particle emitter object
Once initialized with this method, the particle emitter object can be queried using the ParticleEmitter property.