agentskills.codes
HY

hytale-npc-templates

Documents Hytale's JSON-based NPC template and behavior system for defining NPC AI via data-driven templates. Covers template structure, variants, states, substates, sensors, actions, motions, state transitions, components, detection (sight/hearing), combat (melee attacks, chaining), inter-NPC inter

Install

mkdir -p .claude/skills/hytale-npc-templates && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16644" && unzip -o skill.zip -d .claude/skills/hytale-npc-templates && rm skill.zip

Installs to .claude/skills/hytale-npc-templates

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Documents Hytale's JSON-based NPC template and behavior system for defining NPC AI via data-driven templates. Covers template structure, variants, states, substates, sensors, actions, motions, state transitions, components, detection (sight/hearing), combat (melee attacks, chaining), inter-NPC interaction (beacons), leashing, searching, and reusable instruction components. Use when creating NPC behavior, defining NPC templates, adding NPC states, configuring NPC detection/combat, or building reusable NPC components. Triggers - NPC template, NPC behavior, NPC state, NPC sensor, NPC action, NPC motion, state transition, NPC combat, NPC detection, NPC component, Template_, Variant, BlankTemplate, Instructions, StartState, Random action, Timeout, PlayAnimation, StateTransitions, Component_Instruction, Component_Sensor, Intelligent_Chase, Soft_Leash, Standard_Detection, Damage_Check, beacon, NPC group, AttitudeGroup, DefaultPlayerAttitude, InteractionVars, melee attack, attack chaining, Root Interaction.
1014 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)

About this skill

Hytale NPC Template & Behavior System

Use this skill when defining NPC behavior through JSON templates. This covers the data-driven side of NPC creation — how NPCs think, act, detect threats, fight, interact with other NPCs, and transition between behavioral states. For programmatic NPC spawning via Java, see the hytale-spawning-npcs skill instead.

Prerequisite: Familiarity with JSON asset structure under Server/ directories and the Hytale ECS architecture.


Quick Reference

ConceptDescription
TemplateAbstract JSON file defining base NPC behavior, parameters, and states
VariantConcrete NPC role that extends a template with specific parameter overrides
StateA top-level behavioral mode (e.g., Idle, Sleep, Combat)
SubstateA state nested within another, prefixed with . (e.g., .Default, .Guard)
SensorCondition that gates instruction execution (e.g., State, Target, Beacon, Mob, Damage)
ActionOperations performed when sensor conditions are met (e.g., State, Timeout, Random, Attack)
MotionMovement behavior (e.g., Seek, Wander, Nothing, Follow_Path)
StateTransitionActions performed sequentially when transitioning between states (e.g., animations)
ComponentReusable instruction/sensor module referenced via "Reference"
ParameterConfigurable value exposed in the template's Parameters block
BeaconMessage-based inter-NPC communication system
NPC GroupNamed set of NPC roles used for filtering (attitudes, beacons, food targets)
Attitude GroupDefines Friendly/Hostile/Neutral relationships between NPC groups

File Locations

File TypePath
NPC TemplatesServer/NPC/Templates/Template_<Name>.json
NPC Variants (Roles)Server/NPC/Roles/<Name>.json
NPC ComponentsServer/NPC/Components/Component_<Class>_<Name>.json
NPC GroupsServer/NPC/Groups/<GroupName>.json
Attitude GroupsServer/NPC/AttitudeGroups/<Name>.json
Appearance filesServer/NPC/Appearances/<Name>.json
Root InteractionsServer/Item/RootInteractions/Root_NPC_<Name>.json
Attack InteractionsServer/Item/Interactions/<Name>.json
Spawn BeaconsServer/NPC/SpawnBeacons/<Name>.json

Template Structure

Blank Template (Starting Point)

Always start from BlankTemplate and customize. A template is "Type": "Abstract" and defines defaults through Parameters.

{
  "Type": "Abstract",
  "Parameters": {
    "Appearance": {
      "Value": "Bear_Grizzly",
      "Description": "Model to be used"
    },
    "DropList": {
      "Value": "Empty",
      "Description": "Drop Items"
    },
    "MaxHealth": {
      "Value": 100,
      "Description": "Max health for the NPC"
    },
    "NameTranslationKey": {
      "Value": "server.npcRoles.Template.name",
      "Description": "Translation key for NPC name display"
    }
  },
  "Appearance": { "Compute": "Appearance" },
  "DropList": { "Compute": "DropList" },
  "MaxHealth": { "Compute": "MaxHealth" },
  "MotionControllerList": [
    {
      "Type": "Walk",
      "MaxWalkSpeed": 3,
      "Gravity": 10,
      "MaxFallSpeed": 8,
      "Acceleration": 10
    }
  ],
  "Instructions": [
    {
      "Sensor": {
        "Type": "Any"
      },
      "BodyMotion": {
        "Type": "Nothing"
      }
    }
  ],
  "NameTranslationKey": { "Compute": "NameTranslationKey" }
}

Variant (Role) File

A variant extends a template with concrete parameter values. Place next to the template.

{
  "Type": "Variant",
  "Reference": "Template_Goblin_Ogre",
  "Modify": {
    "Appearance": "Goblin",
    "MaxHealth": 124
  }
}

Variants can also override InteractionVars, Parameters, and NameTranslationKey.


Parameters

Parameters are defined in the "Parameters" block and referenced via { "Compute": "ParamName" }. They support computed expressions like "Compute": "ViewRange / DistractedPenalty".

"Parameters": {
  "Appearance": {
    "Value": "Bear_Grizzly",
    "Description": "Model to be used"
  },
  "ViewRange": {
    "Value": 15,
    "Description": "View range in blocks"
  },
  "DistractedPenalty": {
    "Value": 2,
    "Description": "Factor by which view/hearing range is divided when distracted"
  }
}

Computed expressions: { "Compute": "ViewRange / DistractedPenalty" } divides ViewRange by DistractedPenalty at runtime.


States & Substates

Setting the Start State

"StartState": "Idle",

Top-Level States

Top-level states are behavioral modes like Idle, Sleep, Eat, Combat, Alerted, ReturnHome, Search.

"Instructions": [
  {
    "Sensor": { "Type": "State", "State": "Idle" },
    "Instructions": [ ... ]
  },
  {
    "Sensor": { "Type": "State", "State": "Sleep" },
    "Instructions": [ ... ]
  },
  {
    "Sensor": { "Type": "State", "State": "Combat" },
    "Instructions": [ ... ]
  }
]

Substates

Substates are nested within a parent state and prefixed with .. The .Default substate is used automatically when entering the parent state.

{
  "Sensor": { "Type": "State", "State": "Idle" },
  "Instructions": [
    {
      "Sensor": { "Type": "State", "State": ".Default" },
      "Instructions": [ ... ]
    },
    {
      "Sensor": { "Type": "State", "State": ".Guard" },
      "Instructions": [ ... ]
    }
  ]
}

Switching States

Use a State action to switch:

{ "Type": "State", "State": "Combat" }

For substates:

{ "Type": "State", "State": ".Guard" }

Sensors

Sensors are conditions that gate instruction execution.

Sensor TypeDescriptionKey Fields
StateMatches current NPC stateState
AnyAlways matchesOnce (execute only once)
TargetDetects locked/nearby targetRange, TargetSlot, Filters
MobDetects nearby NPCsRange, Filters ([NPCGroup, LineOfSight])
BeaconListens for inter-NPC messagesMessage, Range, TargetSlot
DamageReacts to incoming damageCombat, TargetSlot
LeashChecks distance from spawnRange
AndCombines multiple sensorsSensors (array)
ReferenceUses a reusable sensor componentComponent name

Sensor with Filters

{
  "Sensor": {
    "Type": "Target",
    "Range": { "Compute": "AttackDistance" },
    "Filters": [
      { "Type": "LineOfSight" }
    ]
  },
  "Actions": [ ... ]
}

Mob Sensor (NPC Group Filtering)

{
  "Sensor": {
    "Type": "Mob",
    "Range": 2.5,
    "Filters": [
      { "Type": "NPCGroup", "IncludeGroups": { "Compute": "FoodNPCGroups" } },
      { "Type": "LineOfSight" }
    ]
  }
}

Actions

Actions are operations executed when sensor conditions are met.

Action TypeDescriptionKey Fields
StateSwitch to a different stateState
ParentStateSwitch using imported state nameState (from _ImportStates)
RandomRandomly pick a weighted actionActions (array with Weight + Action)
TimeoutWait for a durationDelay ([min, max] or fixed)
PlayAnimationPlay an animationSlot, Animation
AttackExecute an attack interactionAttack, AttackPauseRange
InventoryManipulate NPC inventoryOperation, Item, Slot, UseTarget
BeaconSend message to nearby NPCsMessage, TargetGroups, SendTargetSlot
TriggerSpawnBeaconTrigger a manual spawn beaconBeaconSpawn, Range
SetStatSet an entity statStat, Value
RemoveRemove the target entity
DespawnDespawn this NPC
SequenceExecute multiple actions in same tickActions (array)

Random Action (Weighted State Selection)

{
  "Actions": [
    {
      "Type": "Random",
      "Actions": [
        { "Weight": 70, "Action": { "Type": "State", "State": ".Guard" } },
        { "Weight": 20, "Action": { "Type": "State", "State": "Sleep" } },
        { "Weight": 10, "Action": { "Type": "State", "State": "Eat" } }
      ]
    }
  ]
}

Timeout with State Switch

{
  "Continue": true,
  "ActionsBlocking": true,
  "Actions": [
    { "Type": "Timeout", "Delay": [15, 30] },
    { "Type": "State", "State": ".Default" }
  ]
}

Inventory Actions

OperationDescription
SetHotbarPlace an item in a hotbar slot
EquipHotbarSwitch active hotbar slot
{
  "Type": "Inventory",
  "Operation": "SetHotbar",
  "Item": { "Compute": "EatItem" },
  "Slot": 2,
  "UseTarget": false
}

UseTarget: false is required to act on the NPC itself, not its target.


Instruction Flags

FlagDescription
ContinueIf true, continue evaluating subsequent instructions even if this one matches
ActionsBlockingIf true, wait for all actions to complete before proceeding
Once(On sensors) Execute only once when first entering the state

Common pattern — timeout then switch state:

{
  "Continue": true,
  "ActionsBlocking": true,
  "Actions": [
    { "Type": "Timeout", "Delay": [5, 10] },
    { "Type": "State", "State": "Idle" }
  ]
}

Motions

Motions control NPC movement. Set via BodyMotion or HeadMotion on instructions.

Motion TypeDescriptionKey Fields
NothingStand still
SeekMove toward target/positionSlowDownDistance, StopDistance, RelativeSpeed, UsePathfinder
WanderRandom wanderingMaxHeadingChange, RelativeSpeed
WanderInCircleCircular wanderingRadius, MaxHeadingChange, RelativeSpeed

Content truncated.

Search skills

Search the agent skills registry