timedAction#

The timedAction script block is used to define an action which can be used in craftRecipes. You can specify the animation played, props in hands during the action, the sound played. Also define its impact on the player character, including effects on calories burned and body heat generation.

Below are a few examples of timedAction blocks from the vanilla game:

timedAction UseLathe
{
    metabolics      = Default,
    actionAnim      = UseLathe,
}
timedAction BuildCairn
{
    metabolics      = HeavyWork,
    actionAnim      = Loot,
    animVarKey      = LootPosition,
    animVarVal      = Low,
    sound           = BuildingGeneric,
    completionSound = BuildFenceCairn,
    muscleStrainFactor = 0.0025,
    muscleStrainSkill = Strength,
    muscleStrainParts = Neck,
}
timedAction BuildBarbedWireFence
{
    metabolics      = HeavyWork,
    actionAnim      = Loot,
    animVarKey      = LootPosition,
    animVarVal      = Low,
    sound           = BuildingGeneric,
    completionSound = BuildMetalStructureSmallWiredFence,
}

Hierarchy#

Valid Parent Blocks:

ID Properties#

This block should have an ID.

Parameters#

actionAnim#

Type:

string

The actionAnim parameter is used to define the animation played during a timed action. It links to a PerformingAction define in the action AnimSets of the player.

animVarKey#

Type:

Any

The animVarKey and animVarVal parameters are used together to link to a specific AnimNode Conditions. animVarKey will correspond to the m_Name field and animVarVal to the m_Value field.

This allows for easy swapping between variants of actionAnim. For example, for the AnimNode:

<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="Loot.xml">
  <m_Name>LootHigh</m_Name>
  <m_AnimName>Bob_IdleLooting_High</m_AnimName>
  <m_Conditions />
  <m_Conditions />
  <m_Conditions>
    <m_Name>LootPosition</m_Name>
    <m_Type>STRING</m_Type>
    <m_StringValue>High</m_StringValue>
  </m_Conditions>
</animNode>

You can define those parameters in the timedAction as follows:

actionAnim      = Loot,
animVarKey      = LootPosition,
animVarVal      = Low,

animVarVal#

Type:

Any

See animVarKey for more details.

completionSound#

Type:

block (block: sound)

Defines the sound played at the end of the action.

metabolics#

Type:

Any

The metabolics parameter is used to define the impact of the action on the player character’s metabolics, such as the calories burn rate or body heat generation. It uses predefined enumeration values to specify the multiplier on the metabolism. You can find a list of metabolic types and their associated values in the Metabolics documentation.

muscleStrainFactor#

Type:

Any

Muscle strain is an effect which applies to the character limbs, simulating the fatigue and strain of performing certain actions. A timedAction script can be set to apply muscle strain to specific limbs and based on the level of the character in a specific skill.

muscleStrainFactor serves as a parameter of how much muscle strain will be gained.

muscleStrainParts will indicate the limbs affected by the muscle strain, which needs to be an array of BodyPartType.

If muscleStrainSkill is provided, the skill will be used to reduce the muscle strain when the player gets better at something.

strain = deltaTime * muscleStrainFactor * (1 - skillLevel * 0.5)

muscleStrainParts#

Type:

array (array of string, separator: ‘;’)

Needs:

muscleStrainParts

See muscleStrainFactor for more details.

muscleStrainSkill#

Type:

Any

See muscleStrainFactor for more details.

prop1#

Type:

block (block: model, with module)

No description

prop2#

Type:

block (block: model, with module)

No description

sound#

Type:

block (block: sound)

Defines the sound played during the action.

soundTime#

Type:

string

Default:

action_start

Attributes:

Useless

This parameter is used in the Lua to indicate when the sound should be played during the timed action. This is notably used to play a sound at the end or the start of the action during crafting.

By itself, this doesn’t do anything and requires implementation in Lua). For example inside ISHandcraftAction.

For a full list of the accepted events, see this.