Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ElectroGamesDev/HyCitizens/llms.txt

Use this file to discover all available pages before exploring further.

HyCitizens exposes a deep combat configuration system built on top of Hytale’s NPC AI. You can control whether a Citizen ignores players, defends itself when provoked, or charges on sight — and then fine-tune every aspect of how it fights: attack distance, strafing weights, back-off behavior, blocking probability, and detection ranges. Health overrides, regeneration, and configurable respawn delays give you full control over the NPC’s survivability.

Attitude

The attitude field determines how a Citizen responds to nearby players before combat begins.
ValueBehavior
PASSIVEThe Citizen never initiates or enters combat, regardless of damage taken.
NEUTRALThe Citizen ignores players until attacked. After taking damage, it enters combat.
AGGRESSIVEThe Citizen detects players within its view/hearing range and attacks on sight.
{
  "attitude": "NEUTRAL"
}
Aggressive Citizens will attack players on sight regardless of any interaction configuration. Ensure takesDamage is also enabled if you want the Citizen to take damage in return — otherwise it will be invulnerable while still attacking.

Damage Settings

takesDamage
boolean
default:"false"
When false, the Citizen is invulnerable and cannot be killed. Set to true to allow players (and other entities) to deal damage.
overrideHealth
boolean
default:"false"
When true, the Citizen’s maximum health is overridden by healthAmount instead of the model’s default.
healthAmount
float
default:"100.0"
The Citizen’s maximum and starting health when overrideHealth is true.
overrideDamage
boolean
default:"false"
When true, the Citizen’s melee attack damage is overridden by damageAmount instead of the role’s default.
damageAmount
float
default:"10.0"
Melee attack damage dealt by the Citizen when overrideDamage is true.

Health Regeneration

healthRegenEnabled
boolean
default:"false"
Enables passive health regeneration out of combat.
healthRegenAmount
float
default:"1.0"
Health points restored per regeneration tick.
healthRegenIntervalSeconds
float
default:"5.0"
Seconds between each regeneration tick.
healthRegenDelayAfterDamageSeconds
float
default:"5.0"
Seconds the Citizen must go without taking damage before regeneration resumes.

Respawn

respawnOnDeath
boolean
default:"true"
When true, the Citizen automatically respawns at its spawn position after death.
respawnDelaySeconds
float
default:"5.0"
Seconds to wait before respawning. During this window the Citizen does not exist in the world.

Combat Configuration

The combatConfig block fine-tunes the Citizen’s in-combat movement and attack AI. All fields map directly to the underlying Hytale NPC role system.
FieldTypeDefaultDescription
attackTypestringRoot_NPC_Attack_MeleeThe attack interaction ID used when the Citizen performs a melee swing.
attackDistancefloat2.0Distance at which the Citizen can execute an attack.
chaseSpeedfloat0.67Relative speed (fraction of walkSpeed) used when chasing a target.
combatBehaviorDistancefloat5.0Distance within which the Citizen switches from smart chasing to combat-oriented movement.
combatStrafeWeightint10Weighted chance to use strafing movement in combat. Set to 0 to disable strafing.
combatDirectWeightint10Weighted chance to move directly toward the target. Set to 0 to disable direct approach.
backOffAfterAttackbooleantrueWhether the Citizen backs away after executing an attack.
backOffDistancefloat4.0How far the Citizen retreats after an attack.
desiredAttackDistanceMinfloat1.5Minimum preferred distance from the target while in attack range.
desiredAttackDistanceMaxfloat1.5Maximum preferred distance from the target while in attack range.
attackPauseMinfloat1.5Minimum seconds to wait between consecutive attacks.
attackPauseMaxfloat2.0Maximum seconds to wait between consecutive attacks.
combatRelativeTurnSpeedfloat1.5Multiplier for how fast the Citizen turns to face its target during combat.
blockAbilitystringShield_BlockInteraction ID used when blocking. Set to empty to disable blocking.
blockProbabilityint50Percentage chance (0–100) the Citizen blocks while backing away.
targetRangefloat4.0Distance within which a target maintains priority over other nearby targets.
combatAlwaysMovingWeightint0Weighted chance for the Citizen to keep moving at all times during combat.
combatStrafingDurationMinfloat1.0Minimum seconds spent strafing in a single direction before changing.
combatStrafingDurationMaxfloat1.0Maximum seconds spent strafing in one direction.
combatStrafingFrequencyMinfloat2.0Minimum seconds between strafe bursts.
combatStrafingFrequencyMaxfloat2.0Maximum seconds between strafe bursts.
combatAttackPreDelayMinfloat0.2Minimum seconds of wind-up before the attack animation fires.
combatAttackPreDelayMaxfloat0.2Maximum seconds of wind-up before the attack animation fires.
combatAttackPostDelayMinfloat0.2Minimum seconds of recovery after the attack animation completes.
combatAttackPostDelayMaxfloat0.2Maximum seconds of recovery after the attack animation completes.
backOffDurationMinfloat2.0Minimum seconds spent backing away after an attack.
backOffDurationMaxfloat3.0Maximum seconds spent backing away after an attack.
combatFleeIfTooCloseDistancefloat0.0If the target is closer than this distance, the Citizen flees rather than attacks. Set to 0 to disable.
combatMovingRelativeSpeedfloat0.6Speed multiplier applied while the Citizen moves during combat (relative to walkSpeed).
combatBackwardsRelativeSpeedfloat0.3Speed multiplier applied while the Citizen moves backwards during back-off phases.
useCombatActionEvaluatorbooleanfalseWhen true, enables the Hytale combat action evaluator for more complex attack decision-making.
targetSwitchTimerMinfloat5.0Minimum seconds the Citizen is locked onto one target before it can switch.
targetSwitchTimerMaxfloat5.0Maximum seconds before the Citizen may switch targets.

Detection Configuration

The detectionConfig block controls how the Citizen perceives threats in its environment.
FieldTypeDefaultDescription
viewRangefloat15.0Maximum distance (blocks) at which the Citizen can see a target. Set to 0 to disable sight.
viewSectorfloat180.0Field-of-view angle (degrees) within which targets are visible.
hearingRangefloat8.0Maximum distance at which the Citizen can hear a target. Set to 0 to disable hearing.
absoluteDetectionRangefloat2.0Distance within which a target is always detected, regardless of line-of-sight or angle. Set to 0 to disable.
alertedRangefloat45.0Detection range when the Citizen is in the alerted state. Should not exceed leashDistance.
alertedTimeMinfloat1.0Minimum seconds spent in the alerted state before transitioning to combat.
alertedTimeMaxfloat2.0Maximum seconds in the alerted state.
chanceToBeAlertedWhenReceivingCallForHelpint70Percentage chance (0–100) that this Citizen becomes alerted when a nearby allied NPC calls for help.
confusedTimeMinfloat1.0Minimum seconds the Citizen acts confused after losing its target.
confusedTimeMaxfloat2.0Maximum seconds of confused behavior.
searchTimeMinfloat10.0Minimum seconds spent actively searching for a lost target before returning to idle.
searchTimeMaxfloat14.0Maximum seconds spent searching.
investigateRangefloat40.0Distance within which the Citizen will move to investigate a reported attack from another NPC.
{
  "attitude": "AGGRESSIVE",
  "takesDamage": true,
  "overrideHealth": true,
  "healthAmount": 200.0,
  "respawnOnDeath": true,
  "respawnDelaySeconds": 10.0,
  "combatConfig": {
    "attackDistance": 2.0,
    "chaseSpeed": 0.67,
    "combatStrafeWeight": 10,
    "backOffAfterAttack": true,
    "blockProbability": 40
  },
  "detectionConfig": {
    "viewRange": 20.0,
    "hearingRange": 10.0,
    "absoluteDetectionRange": 2.0,
    "alertedRange": 45.0
  }
}

Build docs developers (and LLMs) love