Action dictionary new value||doc135464

September 20, 2022


 Entity:setActionMapping(actionSrc, actionDst) 
  • The class to which the function belongs:Entity


Set the mapping of the action name in the action mapping table of the entity object. When the entity plays the action, if the mapping corresponding to the action name is found in the mapping table, the corresponding mapping action will be used first. Usually, it is used to change the default basic action in the game, such as Standby, walk, jump, etc.

The name of the basic action in the game

Action name Description
idle Standby
run walk
sneak sneak
walk sneak move
jump2 jump
swim_idle float
swim swim
jump_fall whereabouts


Variable name type Description
actionSrc string Action name
actionDst string map action name

Code Samples

on the client sideglobal script, register when the map initialization is completeCallback, to change the player's default walking action

Lib.subscribeEvent(Event.EVENT_LOAD_WORLD_END, function()
    Me:setActionMapping("run", "walk")