Field manual / Level editor
actor — Actor
Actor: registering the model and animations (creation events), the command queue, state, attachment and link points. Functions without an actor argument act on host (the exe has no form for another actor).
Summary
Model and animations (on host, usually in creation events)
actor::RegisterAnimation | Maps a logical animation name to an actual animation for state 0..8 of the current actor. |
actor::RegisterIdleAnimation | Adds an idle animation to the current actor for state 0..8 with a random-selection weight. |
actor::NotInPlaceAnimation | Marks an animation of the current actor as displacing (not in place): its offsets are measured from the reference animation. |
actor::ReferenceAnimation | Sets the reference animation of the current actor; offsets of not-in-place animations are measured from its first frame. |
actor::RegisterExtraBody | Gives the current actor an extra body: a mesh drawn at the actor's position, in slot 0…3 (replacing the previous one); with still 0 the actor's animations play on it, otherwise it holds the first frame. |
actor::SetWalkSpeed | Sets the current actor's movement speed for a walk animation, in world pixels per tick; speed must be a float. |
actor::ModifyScale | Multiplies the current actor's model scale by k. |
actor::SetModelOffset | Sets the offset of the actor's model from its position; only the axes passed as float are changed. |
actor::SetModelAngle | Sets the orientation correction of the current actor's model in degrees; float only. |
actor::InitState | Sets the current actor's state (selects its animation set). |
Control and the command queue (the actor is an argument)
actor::Place | Places an enabled actor at point index of an area (the angle comes from the point), on floor 0 or 1; the form actor::Place(name, x, y[, dir]) places it on battle grid tile (x, y), dir in eighths of a turn. |
actor::SetAnimation | Queues a one-shot animation for the actor after its current commands; "idle" is the idle of the current state. |
actor::SetAsyncAnimation | Queues a one-shot animation for the actor without waiting for it to finish; reverse plays it from the last frame. |
actor::SetState | Sets the actor's state and, if the actor is not busy, picks a new idle. |
actor::QueueState | Adds a stance change to the actor's command queue; in battle 0 and 1 become 7 and 8, and stance 4 also removes meshes from link points. |
actor::TextEffect | Shows popup text from string.tab with number text (or by a UI text key: "no_ammo") above a placed actor (like "No ammo" in battle) and plays battle_noammo. |
actor::InArea | True if the actor's background position is inside the area. |
actor::Stop | Stops the actor: clears the command queue, the path and the current command. |
actor::Vibrato | Makes the actor sway with the given amplitude and phase step per tick; both must be floats. |
actor::WalkOnTrack | Places the actor at point start of area track at the given height and leads it along the remaining points at walking speed, turning along the way. |
actor::SetFloor | Puts the actor on floor 1 (.wm2) if floor is 1, otherwise on floor 0 (.wm). |
actor::QueueDelay | Adds a pause of ticks ticks to the actor's command queue. |
actor::QueueJustifyPosition | When the actor's command queue reaches this entry, shifts the actor by the offset of the displayed pose from the last frame of the current animation; the next animation starts without blending. |
actor::QueuePlace | When the actor's command queue reaches this entry, places the actor at point index of the area (floor 0) and drops the rest of the queue; the next animation starts without blending. |
actor::QueueCall | When the actor's command queue reaches this entry, calls a script function of the object named like the actor. |
actor::Call | Immediately calls a script function of the object named like the actor (not through the queue). |
actor::PutBackItem | Queues putting a two-handed weapon from the hands onto the back: "hide_back", meshes are removed from link points, the weapon goes to "back", stance 0. |
actor::PutFrontItem | Queues taking a two-handed weapon from the back: after animation blending, meshes are removed from link points, stance 1, "hide_back" in reverse without waiting, 30 ticks, the weapon goes to "two_hands". |
Attachment and link points
actor::AttachByLink | Attaches the actor to a link point of the parent's mesh, and it moves together with the parent. |
actor::Attach | Attaches the actor to the parent with the given offset, and it moves together with the parent: a and b horizontally in the parent's axes, c vertically, in world units; angle is added to the parent's angle. |
actor::DetachAllFrom | Detaches all actors attached to the parent and resets their model offsets. |
actor::LinkRider | The actor rides the calling object at this link point of its mesh and is drawn together with it in its own animations (Smoke Rider pilots). |
actor::ShowLinkMesh | Shows a mesh at a link point of the current actor (Headnail's saws). |
actor::HideLinkMesh | Removes the mesh from a link point of the current actor (the reverse of actor::ShowLinkMesh). |
actor::ShowItemInHand | Shows an item's mesh in the actor's hand (point two_hands for two-handed items, otherwise one_hand). |
actor::HideAllLinkMeshes | Removes all meshes attached to the actor's link points. |
Functions
actor::RegisterAnimation(int, string, string) → int
Maps a logical animation name to an actual animation for state 0..8 of the current actor.
actor::RegisterIdleAnimation(int, string, int) → int
Adds an idle animation to the current actor for state 0..8 with a random-selection weight. Without a weight nothing is registered.
actor::NotInPlaceAnimation(string) → int
Marks an animation of the current actor as displacing (not in place): its offsets are measured from the reference animation.
actor::ReferenceAnimation(string) → int
Sets the reference animation of the current actor; offsets of not-in-place animations are measured from its first frame.
actor::RegisterExtraBody(int, int, string) → int
Gives the current actor an extra body: a mesh drawn at the actor's position, in slot 0…3 (replacing the previous one); with still 0 the actor's animations play on it, otherwise it holds the first frame. Types are strictly int, int, string. Not used in the game's scripts.
actor::SetWalkSpeed(string, float) → int
Sets the current actor's movement speed for a walk animation, in world pixels per tick; speed must be a float.
actor::ModifyScale(float) → int
Multiplies the current actor's model scale by k.
actor::SetModelOffset(string, float, float, float) → int
Sets the offset of the actor's model from its position; only the axes passed as float are changed.
actor::SetModelAngle(float) → int
Sets the orientation correction of the current actor's model in degrees; float only.
actor::InitState(int) → int
Sets the current actor's state (selects its animation set).
actor::Place(string, string, int, ?int) → int
Places an enabled actor at point index of an area (the angle comes from the point), on floor 0 or 1; the form actor::Place(name, x, y[, dir]) places it on battle grid tile (x, y), dir in eighths of a turn. Returns 1 if placement happened.
actor::SetAnimation(string, string, ?int) → int
Queues a one-shot animation for the actor after its current commands; "idle" is the idle of the current state. noBlend = 1 means no blending with the previous animation.
actor::SetAsyncAnimation(string, string, ?int, ?int) → int
Queues a one-shot animation for the actor without waiting for it to finish; reverse plays it from the last frame. noBlend = 1 means no blending with the previous animation.
actor::SetState(string, int, ?int) → int
Sets the actor's state and, if the actor is not busy, picks a new idle. flag = 1 means the next animation is not blended.
actor::QueueState(string, int) → int
Adds a stance change to the actor's command queue; in battle 0 and 1 become 7 and 8, and stance 4 also removes meshes from link points. Not used in the game's scripts.
actor::TextEffect(string, any) → int
Shows popup text from string.tab with number text (or by a UI text key: "no_ammo") above a placed actor (like "No ammo" in battle) and plays battle_noammo.
actor::InArea(string, string) → bool
True if the actor's background position is inside the area.
actor::Stop(string) → int
Stops the actor: clears the command queue, the path and the current command.
actor::Vibrato(string, float, float) → int
Makes the actor sway with the given amplitude and phase step per tick; both must be floats.
actor::WalkOnTrack(string, string, ?float, ?int) → int
Places the actor at point start of area track at the given height and leads it along the remaining points at walking speed, turning along the way.
actor::SetFloor(string, int) → int
Puts the actor on floor 1 (.wm2) if floor is 1, otherwise on floor 0 (.wm).
actor::QueueDelay(string, int) → int
Adds a pause of ticks ticks to the actor's command queue.
actor::QueueJustifyPosition(string) → int
When the actor's command queue reaches this entry, shifts the actor by the offset of the displayed pose from the last frame of the current animation; the next animation starts without blending.
actor::QueuePlace(string, string, int) → int
When the actor's command queue reaches this entry, places the actor at point index of the area (floor 0) and drops the rest of the queue; the next animation starts without blending.
actor::QueueCall(string, string, string) → int
When the actor's command queue reaches this entry, calls a script function of the object named like the actor.
actor::Call(string, string, string) → any
Immediately calls a script function of the object named like the actor (not through the queue).
actor::PutBackItem(string) → int
Queues putting a two-handed weapon from the hands onto the back: "hide_back", meshes are removed from link points, the weapon goes to "back", stance 0. Does nothing without a two-handed item in hand. Not used in the game's scripts.
actor::PutFrontItem(string) → int
Queues taking a two-handed weapon from the back: after animation blending, meshes are removed from link points, stance 1, "hide_back" in reverse without waiting, 30 ticks, the weapon goes to "two_hands". Not used in the game's scripts.
actor::AttachByLink(string, string, string) → int
Attaches the actor to a link point of the parent's mesh, and it moves together with the parent. Does nothing if the point does not exist.
actor::Attach(string, string, float, float, float, float) → int
Attaches the actor to the parent with the given offset, and it moves together with the parent: a and b horizontally in the parent's axes, c vertically, in world units; angle is added to the parent's angle. All four must be floats. Not used in the game's scripts.
actor::DetachAllFrom(string) → int
Detaches all actors attached to the parent and resets their model offsets.
actor::LinkRider(string, string) → int
The actor rides the calling object at this link point of its mesh and is drawn together with it in its own animations (Smoke Rider pilots).
actor::ShowLinkMesh(string, string, ?int) → int
Shows a mesh at a link point of the current actor (Headnail's saws). The port ignores the third argument.
actor::HideLinkMesh(string) → int
Removes the mesh from a link point of the current actor (the reverse of actor::ShowLinkMesh). Not used in the game's scripts.
actor::ShowItemInHand(string, string) → int
Shows an item's mesh in the actor's hand (point two_hands for two-handed items, otherwise one_hand).
actor::HideAllLinkMeshes(string) → int
Removes all meshes attached to the actor's link points.