The above event allows one to know when frame 20 is reached in the skeleton_warrior_walk. At frame 20, the onAnimationEvent is called, and the string "footstep" is passed to it. The event string can be an arbitrarily chosen string; it is passed to the hook when it is called.defineAnimationEvent(desc)
Defines a new animation event. desc is a table with the following fields:
animation:the name of animation file to attach animation event to. The filename must end with “.fbx”
event:the animation event string, e.g. “footstep” or “attack”.
frame:(optional) a frame number in the animation to attach the event to (one frame equals 1/30th of a second).
normalizedTime:(optional) normalized time of the event in range 0-1 to be used instead of frame (0 = start of animation, 1 = end of animation).
Example:Code: Select all
defineAnimationEvent{ animation = "assets/animations/monsters/skeleton_warrior/skeleton_warrior_walk.fbx", event = "footstep", frame = 20, }
Code: Select all
--In the animationEvent -- event = "playSound:impact_blade", --
Code: Select all
defineObject{
name = "dm_floordeco_skeleton",
baseObject = "dm_redcarpet_tile",
components = {
{
class = "Model",
model = "mod_assets/dmcsb_pack/models/env/dm_floor_skeleton.fbx",
staticShadow = true,
},
{
class = "ItemConstrainBox",
offset = vec(0,0.2,0),
size = vec(0.7,0.4,2.2),
},
},
editorIcon = 136,
}