engineReplaceAnimation | Multi Theft Auto: Wiki Skip to content

engineReplaceAnimation

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function replaces a specific internal (default) animation with a custom one that has been loaded using engineLoadIFP function. This function only affects a specific player or ped, the internal animation is not replaced for everyone, for instance, different players and peds are able to have completely different crouching, walking, and fighting etc., animations running simultaneously at the same time. Also, it's not synchronized, you'll need to execute this function on every client in Lua to synchronize it.

Syntax

bool engineReplaceAnimation ( ped thePed, string InternalBlockName, string InternalAnimName, string CustomBlockName, string CustomAnimName )
Required Arguments
  • thePed: the player or ped you want to replace an animation for.
  • InternalBlockName: the internal block name.
  • InternalAnimName: the internal animation name inside InternalBlockName.
  • CustomBlockName: the custom block name of the loaded IFP file that you passed to engineLoadIFP as second parameter.
  • CustomAnimName: the custom animation name inside the loaded IFP file with CustomBlockName.

Returns

  • bool: value

Returns true on success, false in case of failure.

Code Examples

shared

This example loads a custom IFP file (parkour.ifp), and replaces the internal crouch animation from ped block with a custom animation. If you press C on your keyboard, the custom animation will be played instead of crouch animation.

--[[
credits to Paul_Cortez for the IFP file.
parkour.ifp has following animations:
BckHndSpingBTuck
BckHndSping
CartWheel
FrntHndSpring
HandPlant
]]
-- you can choose any name you want, do not choose a default GTA:SA block name
local customBlockName = "myNewBlock"
-- load the IFP file
local IFP = engineLoadIFP( "parkour.ifp", customBlockName )
-- let us know if IFP failed to load
if not IFP then
outputChatBox( "Failed to load 'parkour.ifp'" )
end
-- replace the crouch animation
engineReplaceAnimation( localPlayer, "ped", "weapon_crouch", customBlockName, "HandPlant" )

See Also

Engine Functions
Engine Elements