Custom preset animations setup

The following guide explains how to create your own custom preset animations for the nss_emotes resource. You can create your own animations by using the available functions in LUA and make them available in your JavaScript config files to show them in the emote menu.

We do not provide support for creating custom preset animations, but this guide should help you to get started.

Use on your own risk!


Basics

To create your own custom preset animations there are two important things to consider:

  • First, you need to create the actual animation setup in LUA using the available functions.

  • Second, you need to make the newly created animations available in your JavaScript config files.

It is helpful to have an idea how animations in REDM work. You can find more information about that in the animation presets.


Steps to create custom preset animations

  1. Create a new file in the folder nss_emotes/animations/ named e.g. my_custom_animations.lua.

  2. Add your custom animations using the available functions (see below) to the newly created file. See animation presets for available preset animations.

  3. Make the new animations available in your JavaScript config file (e.g. nss_emotes/html_nss_emotes/config.js) to show them in the emote menu.

  4. Restart the resource or your server to apply the changes.

  5. Test your new custom animations in-game.

  6. Enjoy your custom animations!


Simple example

  1. Create a new file (if not allready exists) nss_emotes/animations/my_custom_animations.lua with the following content:

  2. Add the new animation to your JavaScript config file (e.g. nss_emotes/html_nss_emotes/config.js):

  3. Restart the resource or your server to apply the changes.

  4. You can now trigger the animation by using the command act mywave or by selecting it in the emote menu.

  5. Enjoy your custom animation!


Working with prefixes

It is recommended to use a prefix for your custom animation commands to avoid conflicts.

For example, if you set Config.AnimationEmotePrefix to emote-, you can define your custom animation command as emote-mywave instead of just mywave.

There are some prefixes you can choose from, e.g.:

All these prefixes are used in the base command act <command> to trigger the animation. For example, if you use the emote- prefix, the full command to trigger the animation would be act emote-mywave.

Example:


Resources & path references

  • animation presets (often used in animDict and animName parameters)

  • flags documentation (often used in flags parameter)

  • Custom icons for JavaScript config (e.g. nss_emotes/html_nss_emotes/config.js) must be placed in nss_emotes/html_nss_emotes/icons/ and subfolders. Consider the correct path when adding the icon in the config. If an icon is in a subfolder, the path must include the subfolder, e.g. subfolder/icon.png.


addSimpleAnimation

This function works like a wrapper for TaskPlayAnim native function to easily add simple animations.


addSimpleEmoteAnimation

Works like the native TaskPlayEmoteWithHash.


addActionEmote

Adds a simple animation of type action emote (emote class 1, see emote class types for more information).


addTauntEmote

Adds a simple animation of type taunt emote (emote class 2, see emote class types for more information).


addGreetEmote

Adds a simple animation of type greet emote (emote class 3, see emote class types for more information).


addReactionEmote

Adds a simple animation of type reaction emote (emote class 0, see emote class types for more information).


addScenarioInPlaceHash

Adds a scenario and uses the native TaskStartScenarioInPlaceHash to start it. With TaskStartScenarioInPlaceHash smoother transitions can be achieved compared to TaskStartScenarioInPlace.

The loop prefix is recommended for scenarios that are intended to be looped.


addScenarioInPlace

Adds a scenario and uses the native TaskStartScenarioInPlace to start it.

The loop prefix is recommended for scenarios that are intended to be looped.


Complex animations with steps

addGenderedAnimation

Adds a gendered animation with different animation steps for male and female characters.

It is possible that some animations are only available for one gender. In that case, you can provide only the animation steps for the available gender.

The animation steps can be different types of animation steps. Animation steps are special functions that can be chained.

The loop prefix is recommended for scenarios that are intended to be looped.


addMultipleAnimations

Like addGenderedAnimation but without gender distinction.


addPartnerAnimation

Adds a partner animation with different animation steps for two players.

createSimplePartnerAnimation

Shortcut for addPartnerAnimation for simple partner animations with only one animation step.

Important:

  • This function always uses Config.AnimationPartnerPrefix as prefix for the command.

  • To use this function your lua file must have to be loaded after partner_animations.lua file. You can ensure this by naming your lua file with a prefix that comes alphabetically after p, e.g. z_my_partner_animations.lua.


Step creation functions

Important: These functions are only usable in Complex animations with steps functions.

createAnimScenarioInPlaceHashStep

Creates an animation step like addScenarioInPlaceHash but without command and returns the step.


createAnimScenarioInPlaceStep

Creates an animation step like addScenarioInPlace but without command and returns the step.


createAnimStep

Creates an animation step like addSimpleAnimation but without command and returns the step.


createEmoteHashAnimStep

Creates an animation step like addSimpleEmoteAnimation but without command and returns the step.


Last updated

Was this helpful?