Player::taskPlayAnim: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
(fix CANCELABLE animation flag -- it should be a power of two)
Line 27: Line 27:
*UPPERBODY = 16,
*UPPERBODY = 16,
*ENABLE_PLAYER_CONTROL = 32,
*ENABLE_PLAYER_CONTROL = 32,
*CANCELABLE = 120,
*CANCELABLE = 128,


*Odd number : loop infinitely
*Odd number : loop infinitely

Revision as of 11:11, 17 July 2020

Plays an animation on the targetted ped.

CLIENTSIDE: You must always preload the dictionary (use Streaming::requestAnimDict to preload an animation), serverside will have some loaded but not all.

Arguments

Speed:

  • Normal speed is
8.0f

Speed Multiplier: Multiply the playback speed

Duration:

  • -1 (Default)
  • 0 (No Animation at all)
  • Small value (Slows the animation)
  • Other values (Freezes the player till ms was passed) (No effect if flag is set to be controllable.)

Animation Flags :

  • NORMAL = 0,
  • REPEAT = 1,
  • STOP_LAST_FRAME = 2,
  • UPPERBODY = 16,
  • ENABLE_PLAYER_CONTROL = 32,
  • CANCELABLE = 128,
  • Odd number : loop infinitely
  • Even number : Freeze at last frame
  • Multiple of 4: Freeze at last frame but controllable
  • 01 to 15 : Full body
  • 10 to 31 : Upper body
  • 32 to 47 : Full body > Controllable
  • 48 to 63 : Upper body > Controllable
  • 001 to 255 : Normal
  • 256 to 511 : Garbled


PlaybackRate:

  • values are between 0.0 and 1.0

Syntax

player.taskPlayAnim(animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ);

Required Arguments

  • animDictionary: String
  • animationName: String
  • blendInSpeed: float
  • blendOutSpeed: float
  • duration: int
  • flag: int
  • playbackRate: float
  • lockX: Boolean
  • lockY: Boolean
  • lockZ: Boolean

Return value

  • Undefined

Example

The example below preloads an animation and applies it into the local player.

mp.game.streaming.requestAnimDict("random@shop_robbery");//preload the animation
mp.players.local.taskPlayAnim("random@shop_robbery", "robbery_action_f", 8.0, 1.0, -1, 1, 1.0, false, false, false);

See also