Mod:Knightcore/ActorsKC

From PMDOWiki

Main Page: Mod:Knightcore

The following functions are found in the ActorsKC.lua file in Knightcore. These functions can be called from other lua script files by including the line require 'knightcore.ActorsKC', and then called with the prefix ActorsKC.

Note: Functions with an asteric next to their headers are imported from Halycon.

Movement

FaceMovingCharacter*

Faces a moving character.

Arguments:

  • chara, character: The character that will face the moving target.
  • target, character: The character chara will face.
  • turnFrames, integer: The amount of frames to take to turn.
  • breakDirection, direction: The direction to stop turning at.

EightWayMove*

Walks to somewhere solely using 8 direction axis movement, first diagonally then straight.

Arguments:

  • chara, character: The character that will be moving.
  • x, integer: The amount of tiles to move on the x axis.
  • y, integer: The amount of tiles to move on the y axis.
  • speed, integer: The speed to move at.

EightWayMoveRS*

Walks to somewhere solely using 8 direction axis movement, first straight then diagonally.

Arguments:

  • chara, character: The character that will be moving.
  • x, integer: The amount of tiles to move on the x axis.
  • y, integer: The amount of tiles to move on the y axis.
  • speed, integer: The speed to move at.

RunInCircle*

Runs around in a circle.

Arguments:

  • chara, character: The character that will be running around in a circle.
  • duration, integer: The amount of time to run around in the circle.
  • speed, integer: The speed to move at.
  • clockwise, boolean, optional: True if moving clockwise.
  • run, boolean, optional: True if the running animation should be used.

TurnTowardsLocation*

Turns towards the specified location. Used in cases of a character having a dynamic position.

Arguments:

  • chara, character: The character that will be turning.
  • targetX, integer: The coordinate in the x axis to turn towards.
  • targetY, integer: The coordinate in the Y axis to turn towards.
  • turnDuration, positive integer: How long to keep turning.

GlanceThere

Causes the actor to briefly "look" in a direction with a pause to delay continued execution.

Arguments:

  • actor, character: Who will be glancing.
  • direction, direction: What direction to glance in.
  • frameDelay, positive integer, optional: The frames to spend glancing. Default is 40.

SpyAround

Causes the actor to "look around" by rotating in several different directions in a particular way. The actor skips looking towards the direction they started on, ending on the specified direction.

Arguments:

  • actor, character: Who will be spying around.
  • startDir, direction: The direction the sequence starts in.
  • seqVariant, 1-4, optional: Select the specific variation of series of glances to do. Default 1.
  • endDir, direction, optional: The direction that will be ended on, default to startDir.
  • frameDelay, positive integer, optional: The amount of time to delay between each turn. Default is 20.

Ground Emotes

Emote

The actor performs a ground emote with no delay.

Arguments:

  • chara, character: The character who will emote.
  • emote, string: The emote to use.
  • sound boolean, optional: True to play sound, false/unused to not.
  • repetitions positive integer, optional: How many animation repetitions to do. Default is 1 (except for the angry emote, which is 2).

EmoteAndPause

The actor performs a ground emote, and then pauses. Auto chosen timings are based off of Halycon's.

Arguments:

  • chara, character: The character who will emote.
  • emote, string: The emote to use.
  • sound boolean, optional: True to play sound, false/unused to not.
  • repetitions positive integer, optional: How many animation repetitions to do. Default is 1 (except for the angry emote, which is 2).
  • pause positive integer, optional: The amount of time to pause for. Default is dependent on the emote.

TurnToCharaAnim

Turn to another character with animation. Used over GROUND:CharTurnToCharAnimated to simplify code using the default value.

Arguments:

  • turner, character: The character who will turn.
  • chara, character: The character to be turned to.

TurnToDirAnim

Turn to another direction with animation. Used over GROUND:CharAnimateTurn to simplify code using the default value.

Arguments:

  • turner, character: The character who will turn.
  • direction, direction: The direction to turn in.
  • ccw, boolean, optional: True to turn counter clockwise, false/unused to turn clockwise.

TurnToDirAnimClosest

Turn to another direction with an animation, calculating whenever turning clockwise or counterclockwise would be "faster" for more natural movement.

Arguments:

  • turner, character: The character who will turn.
  • direction, direction: The direction to turn in.

DoAnimThenStop

Perform a ground animation once, and then stop immediately when done.

Arguments:

  • chara, character: The character who animates.
  • anim, string: The animation to use.

ConvoStillStart

Sets animation to none for all actors passed through a table. Used for "normal" conversations where the characters in the conversation stop their idle animations.

Arguments:

  • members, table: A table of the mons whose idle animations will be stopped.

ConvoStillEnd

Stops the animations for all actors passed through a table, returning them to their idle

Arguments:

  • members, table: A table of the mons whose idle animations will resume.

ShakeHead*

Shakes the actor's head.

Arguments:

  • chara, character: The character who will shake their head.
  • turnFrames, positive integer: The number of frames to shake head for.
  • startLeft, boolean, optional: True to start from the left, false/unused to start from the right.

Hop*

Makes the actor hop.

Arguments:

  • chara, character: The character who hops.
  • anim, string: The animation to hop with.
  • height, positive integer, optional: The height to hop at. Default is 10.
  • duration, positive integer, optional: The amount of time to hop for. Default is height + 1.
  • pause, boolean, optional: True to pause a bit while hopping, false to not.
  • sound, boolean, optional: True to play a sound, false/unused to not.

DoubleHop*

Makes the actor hop twice.

Arguments:

  • chara, character: The character who hops.
  • anim, string, optional: The animation to hop with. Default is "walk".
  • height, positive integer, optional: The height to hop at. Default is 10.
  • duration, positive integer, optional: The amount of time to hop for. Default is height + 1.
  • pause, boolean, optional: True/unused to pause a bit while hopping, false to not.
  • sound, boolean, optional: True to play a sound, false/unused to not.

Recoil*

Makes the actor recoil.

Arguments:

  • chara, character: The character who recoils.
  • anim, string, optional: The animation to recoil with. Default is "hurt".
  • height, positive integer, optional: The height to recoil with. Default is 10.
  • duration, positive integer, optional: The amount of time to recoil for. Default is 11.
  • pause, boolean, optional: True/unused to pause a bit while rcoiling, false to not.
  • sound, boolean, optional: True to play a sound/unused, false/unused to not.

Complain*

Actor jumps up twice and complains.

Arguments:

  • chara, character: The character who complains.
  • anim, boolean, optional: True to set the character's portrait to angry, false/unused to not.

Shake*

Shake in place for a brief moment.

Arguments:

  • chara, character: The character who shakes.

StartTremble*

Starts trembling until stopped.

Arguments:

  • chara, character: The character who trembles.

EndTremble*

End the actor's trembling.

Arguments:

  • chara, character: The character who stops trembling.