Template_Flying_Aggressive
Server/NPC/Roles/_Core/Templates/Template_Flying_Aggressive.json, 26.1 KB
Fields
| Field | Type |
|---|---|
Type | string |
DeathAnimationTime | object |
DeathParticles | object |
Appearance | object |
ApplySeparation | boolean |
AttitudeGroup | object |
Debug | string |
DefaultNPCAttitude | string |
DefaultPlayerAttitude | string |
DisableDamageGroups | array[2] |
DropList | object |
IsMemory | object |
KnockbackScale | number |
MaxHealth | object |
MemoriesCategory | object |
MemoriesNameOverride | object |
NameTranslationKey | object |
SeparationDistance | number |
SeparationMode | string |
StartState | string |
Instructions | array[4] |
Parameters | object |
MotionControllerList | array[1] |
Source
{
"Type": "Abstract",
"DeathAnimationTime": { "Compute": "DeathAnimationTime" },
"DeathParticles": { "Compute": "DeathParticles"},
"Appearance": { "Compute": "Appearance" },
"ApplySeparation": true,
"AttitudeGroup": { "Compute": "AttitudeGroup" },
"Debug": "",
"DefaultNPCAttitude": "Ignore",
"DefaultPlayerAttitude": "Hostile",
"DisableDamageGroups": [ "Self", "Void" ],
"DropList": { "Compute": "DropList" },
"IsMemory": { "Compute": "IsMemory" },
"KnockbackScale": 0.5,
"MaxHealth": { "Compute": "MaxHealth" },
"MemoriesCategory": { "Compute": "MemoriesCategory" },
"MemoriesNameOverride": { "Compute": "MemoriesNameOverride" },
"NameTranslationKey": { "Compute": "NameTranslationKey" },
"SeparationDistance": 2,
"SeparationMode": "Push",
"StartState": "Idle",
"Instructions": [
{
"Sensor": {
"Type": "State",
"State": "Idle"
},
"Instructions": [
{
"$Comment": "Detect hostile targets",
"Reference": "Component_Instruction_Generic_Detection",
"Modify": {
"_ExportStates": [ "Alerted", "Alerted", "Combat", "Search.Confused" ],
"ViewRange": { "Compute": "ViewRange" },
"ViewSector": { "Compute": "ViewSector" },
"HearingRange": { "Compute": "HearingRange" },
"AlertedRange": { "Compute": "AlertedRange" },
"DetectBeacons": false
}
},
{
"$Comment": "If configured to do so, follow a path",
"Enabled": { "Compute": "IdleFollowPath" },
"Sensor": {
"Type": "Path",
"Range": { "Compute": "IdleFollowPathRange" }
},
"BodyMotion": {
"Type": "Path",
"UseNodeViewDirection": true,
"Shape": { "Compute": "IdleFollowPathShape" },
"NodeWidth": 0.5
},
"Actions": [
{
"Type": "SetLeashPosition",
"ToCurrent": true
}
]
},
{
"$Comment": "Else, do a general wander motion sequence",
"BodyMotion": {
"Type": "Sequence",
"Looped": true,
"Motions": [
{
"Type": "Timer",
"Time": { "Compute": "IdleWanderTime" },
"Motion": {
"Type": "Wander",
"MaxHeadingChange": 90,
"MaxWalkTime": 4,
"MinWalkTime": 2,
"RelativeSpeed": 0.5
}
},
{
"Type": "Timer",
"Time": { "Compute": "IdleWanderInCircleTime" },
"Motion": {
"Type": "WanderInCircle",
"MaxHeadingChange": 90,
"MinWalkTime": 2,
"Radius": { "Compute": "IdleWanderInCircleRadius" },
"RelativeSpeed": 1
}
},
{
"Type": "Timer",
"Time": { "Compute": "IdleNothingTime" },
"Motion": {
"Type": "Nothing"
}
}
]
}
}
]
},
{
"Sensor": {
"Type": "State",
"State": "Alerted"
},
"Instructions": [
{
"$Comment": "Play an alerted animation",
"Continue": true,
"Sensor": {
"Type": "Any",
"Once": true
},
"Actions": [
{
"Type": "SpawnParticles",
"ParticleSystem": "Alerted",
"TargetNodeName": "Head"
},
{
"Type": "PlayAnimation",
"Slot": "Status",
"Animation": "Alerted"
}
]
},
{
"$Comment": "Watch the target",
"Continue": true,
"Sensor": {
"Type": "Target",
"Range": { "Compute": "AlertedRange" },
"Filters": [
{
"Type": "LineOfSight"
}
]
},
"BodyMotion": {
"Type": "MatchLook"
},
"HeadMotion": {
"Type": "Watch"
}
},
{
"Reference": { "Compute": "AlertedAdditionalBehaviorComponent" },
"Modify": { },
"Interfaces": [ "Hytale.Instruction.Combat" ],
"Nullable": true
},
{
"$Comment": "If damage is taken, enter combat immediately",
"Sensor": {
"Type": "Damage",
"Combat": true
},
"Actions": [
{
"Type": "AddToHostileTargetMemory"
},
{
"Type": "State",
"ClearHeadMotion": false,
"ClearBodyMotion": false,
"State": "Combat"
}
]
},
{
"$Comment": "If the target starts moving away, enter combat",
"Sensor": {
"Type": "And",
"Sensors": [
{
"Type": "Target",
"Range": { "Compute": "AlertedRange" }
},
{
"Type": "Target",
"TargetSlot": "LockedTarget",
"Filters": [
{
"Type": "MovementState",
"State": "Sprinting"
}
]
}
]
},
"Actions": [
{
"Type": "Timeout",
"Delay": [ 0.5, 0.5 ],
"Action": {
"Type": "State",
"State": "Combat"
}
}
]
},
{
"$Comment": "After a time out, enter combat",
"Sensor": {
"Type": "Target",
"Range": { "Compute": "AlertedRange" }
},
"ActionsBlocking": true,
"Actions": [
{
"Type": "Timeout",
"Delay": { "Compute": "AlertedTime" }
},
{
"Type": "State",
"ClearHeadMotion": false,
"ClearBodyMotion": false,
"State": "Combat"
}
]
},
{
"$Comment": "If target is lost, wait the time out and go to Idle instead",
"ActionsBlocking": true,
"Actions": [
{
"Type": "Timeout",
"Delay": { "Compute": "AlertedTime" }
},
{
"Type": "State",
"State": "Idle"
}
]
}
]
},
{
"Sensor": {
"Type": "State",
"State": "Combat"
},
"Instructions": [
{
"$Comment": "Try switching targets once in a while",
"Reference": "Component_Instruction_Combat_Target_Swap",
"Modify": {
"TargetRange": { "Compute": "TargetRange" },
"NextTargetRangeView": { "Compute": "ViewRange" },
"NextTargetRangeHearing": { "Compute": "HearingRange" },
"TargetSwitchTimer": { "Compute": "TargetSwitchTimer" }
}
},
{
"Reference": { "Compute": "CombatAdditionalBehaviorComponent" },
"Modify": { },
"Interfaces": [ "Hytale.Instruction.Combat" ],
"Nullable": true
},
{
"$Comment": "Basic combat behaviour",
"Sensor": {
"Type": "State",
"State": ".Default"
},
"Instructions": [
{
"$Comment": "Set the desired combat altitude range",
"Continue": true,
"Actions": [
{
"Type": "OverrideAltitude",
"DesiredAltitudeRange": { "Compute": "MotionDesiredAltitudeCombat" }
}
]
},
{
"$Comment": "Attack the target when within ranged attack distance",
"Continue": true,
"Sensor": {
"Type": "Target",
"Range": { "Compute": "RangedAttackDistance" },
"Filters": [
{
"Type": "LineOfSight"
}
]
},
"HeadMotion": {
"Type": "Aim",
"HitProbability": 1,
"Spread": 0
},
"Actions": [
{
"Type": "Attack",
"AimingTimeRange": { "Compute": "RangedAttackAimingRange" },
"Attack": { "Compute": "RangedAttack" },
"AttackPauseRange": { "Compute": "RangedAttackPauseRange" }
}
]
},
{
"$Comment": "Flying: execute combat-oriented movement when the target spots the NPC",
"Sensor": {
"Type": "Target",
"Range": { "Compute": "CombatBehaviorDistance" },
"Filters": [
{
"Type": "LineOfSight"
}
]
},
"BodyMotion": {
"Type": "Seek",
"DesiredAltitudeWeight": 1,
"RelativeSpeed": { "Compute": "CombatRelativeSpeedFlyMotion" },
"SlowDownDistance": { "Compute": "CombatSeekSlowdownDistance" },
"StopDistance": { "Compute": "CombatSeekStopDistance" }
},
"HeadMotion": {
"Type": "Aim"
}
},
{
"$Comment": "Fallback: go to .Chase (target loss is handled there)",
"Actions": [
{
"Type": "State",
"State": ".Chase"
}
]
}
]
},
{
"$Comment": "Chase the target",
"Sensor": {
"Type": "State",
"State": ".Chase"
},
"Instructions": [
{
"$Comment": "Try chasing the target to its altitude range when LoS is broken",
"Continue": true,
"Sensor": {
"Type": "Target",
"Filters": [
{
"Type": "Not",
"Filter": {
"Type": "LineOfSight"
}
}
]
},
"Actions": [
{
"Type": "OverrideAltitude",
"DesiredAltitudeRange": [ 0, 2 ]
}
]
},
{
"$Comment": "If stuck, climb to try unstucking (?!) itself",
"Continue": true,
"Sensor": {
"Type": "Or",
"Sensors": [
{
"Type": "Eval",
"Expression": "blocked"
},
{
"Type": "Nav",
"NavStates": [ "Blocked", "Aborted", "Defer" ]
}
]
},
"BodyMotion": {
"Type": "Wander",
"DesiredAltitudeWeight": 1,
"RelativeSpeed": { "Compute": "CombatRelativeSpeedChase" }
},
"Actions": [
{
"Type": "OverrideAltitude",
"DesiredAltitudeRange": { "Compute": "MotionDesiredAltitudeSearch" }
}
]
},
{
"$Comment": "When the target is back into attack distance, go to .Default",
"Sensor": {
"Type": "Target",
"Range": { "Compute": "RangedAttackDistance" },
"Filters": [
{
"Type": "LineOfSight"
}
]
},
"Actions": [
{
"Type": "State",
"State": ".Default"
}
]
},
{
"Reference": "Component_Instruction_Soft_Leash",
"Modify": {
"_ExportStates": [ "Idle" ]
}
},
{
"Reference": "Component_Instruction_Intelligent_Chase",
"Modify": {
"_ExportStates": [ "Search.Confused", "Search.Confused", "Idle" ],
"ViewRange": { "Compute": "AlertedRange" },
"HearingRange": { "Compute": "HearingRange" },
"RelativeSpeed": { "Compute": "CombatRelativeSpeedChase" },
"DesiredAltitudeWeight": 1
}
}
]
}
]
},
{
"$TODO": "Maybe we can transfer some of this logic over to the Generic Search macro element instead since it's mostly duplicated from the Predator template.",
"Sensor": {
"Type": "State",
"State": "Search"
},
"Instructions": [
{
"$Comment": "Act confused for a short period where detection range is drastically lowered so the target has a chance to get away properly",
"Sensor": {
"Type": "State",
"State": ".Confused"
},
"Instructions": [
{
"$Comment": "Try reacquiring the previous target",
"Sensor": {
"Reference": "Component_Sensor_Lost_Target_Detection",
"Modify": {
"ViewRange": { "Compute": "ViewRange / 2" },
"ViewSector": { "Compute": "ViewSector" },
"HearingRange": { "Compute": "HearingRange / 2" },
"AbsoluteDetectionRange": { "Compute": "AbsoluteDetectionRange" },
"TargetSlot": "LockedTarget"
}
},
"Actions": [
{
"Type": "State",
"State": "Combat"
}
]
},
{
"$Comment": "Standard detection component: listen for beacons and check for nearby hostiles",
"Reference": "Component_Instruction_Generic_Detection",
"Modify": {
"_ExportStates": [ "Alerted", "Combat", "Combat", "Combat" ],
"ViewRange": { "Compute": "ViewRange / 2" },
"ViewSector": { "Compute": "ViewSector" },
"HearingRange": { "Compute": "HearingRange / 2" },
"AbsoluteDetectionRange": { "Compute": "AbsoluteDetectionRange" },
"AlertedRange": { "Compute": "AlertedRange" },
"DetectBeacons": false
}
},
{
"$Comment": "Timeout before starting to prowl for the target",
"ActionsBlocking": true,
"Actions": [
{
"Type": "Timeout",
"Delay": { "Compute": "ConfusedTimeRange" }
},
{
"Type": "State",
"State": ".Prowl"
}
]
}
]
},
{
"$Comment": "Search the area for a bit with the expectation of going straight into combat if you find something.",
"Sensor": {
"Type": "State",
"State": ".Prowl"
},
"Instructions": [
{
"$Comment": "Set the desired altitude range",
"Continue": true,
"Sensor": {
"Type": "Any"
},
"Actions": [
{
"Type": "OverrideAltitude",
"DesiredAltitudeRange": { "Compute": "MotionDesiredAltitudeSearch" }
}
]
},
{
"$Comment": "Try reacquiring the previous target",
"Sensor": {
"Reference": "Component_Sensor_Lost_Target_Detection",
"Modify": {
"ViewRange": { "Compute": "AlertedRange" },
"ViewSector": { "Compute": "ViewSector" },
"HearingRange": { "Compute": "HearingRange" },
"AbsoluteDetectionRange": { "Compute": "AbsoluteDetectionRange" },
"TargetSlot": "LockedTarget"
}
},
"Actions": [
{
"Type": "State",
"State": "Combat"
}
]
},
{
"$Comment": "Standard detection component: listen for beacons and check for nearby hostiles",
"Reference": "Component_Instruction_Generic_Detection",
"Modify": {
"_ExportStates": [ "Alerted", "Combat", "Combat", "Search.Confused" ],
"ViewRange": { "Compute": "ViewRange" },
"ViewSector": { "Compute": "ViewSector" },
"HearingRange": { "Compute": "HearingRange" },
"AbsoluteDetectionRange": { "Compute": "AbsoluteDetectionRange" },
"AlertedRange": { "Compute": "AlertedRange" },
"DetectBeacons": false
}
},
{
"$Comment": "Play particles while prowling",
"Continue": true,
"ActionsBlocking": true,
"Actions": [
{
"Type": "Timeout",
"Delay": [ 4, 8 ],
"DelayAfter": true
},
{
"Type": "SpawnParticles",
"ParticleSystem": "Question",
"TargetNodeName": "Head"
}
]
},
{
"$Comment": "Look around for a bit and then go back to idling",
"BodyMotion": {
"Type": "Sequence",
"Looped": true,
"Motions": [
{
"Type": "Timer",
"Time": [ 2, 5 ],
"Motion": {
"Type": "Wander",
"DesiredAltitudeWeight": 1,
"MaxWalkTime": 2,
"MinWalkTime": 2,
"RelativeSpeed": { "Compute": "SearchRelativeSpeed" }
}
},
{
"Type": "Timer",
"Time": [ 5, 10 ],
"Motion": {
"Type": "WanderInCircle",
"DesiredAltitudeWeight": 1,
"Radius": { "Compute": "SearchRadius" },
"RelativeSpeed": { "Compute": "SearchRelativeSpeed" }
}
},
{
"Type": "Timer",
"Time": [ 2, 3 ],
"Motion": {
"Type": "Nothing"
}
}
]
},
"ActionsBlocking": true,
"Actions": [
{
"Type": "Timeout",
"Delay": { "Compute": "SearchTimeRange" }
},
{
"Type": "State",
"State": "Idle"
}
]
}
]
}
]
}
],
"Parameters": {
"Appearance": {
"Value": "Eye_Void",
"Description": "Model to be used"
},
"MaxHealth": {
"Value": 100,
"Description": "Max health for the NPC"
},
"DropList": {
"Value": "Drop_Eye_Void",
"Description": "Drop Items"
},
"MotionFlyMaxHorizontalSpeed": {
"Description": "Parameter MaxHorizontalSpeed",
"TypeHint": "Double",
"Value": 6
},
"MotionFlyMinHeightAboveGround": {
"Description": "Parameter MotionMinHeightAboveGround",
"TypeHint": "Double",
"Value": 2
},
"MotionFlyMaxHeightAboveGround": {
"Description": "Parameter MotionMaxHeightAboveGround",
"TypeHint": "String",
"Value": 20
},
"MotionDesiredAltitudeCombat": {
"Description": "The altitude range the NPC prefers attacking from",
"Value": [ 5, 10 ]
},
"MotionDesiredAltitudeSearch": {
"Description": "The altitude range the NPC prefers searching in",
"Value": [ 15, 20 ]
},
"ViewRange": {
"Value": 40,
"Description": "View range"
},
"ViewSector": {
"Value": 180,
"Description": "View sector"
},
"HearingRange": {
"Value": 10,
"Description": "Hearing range"
},
"AbsoluteDetectionRange": {
"Description": "The range at which the NPC will always detect players and NPCs",
"TypeHint": "Double",
"Value": 3
},
"IdleWanderTime": {
"Description": "How long the NPC will wander for",
"Value": [ 4, 6 ]
},
"IdleWanderInCircleTime": {
"Description": "How long the NPC will wander in circle for",
"Value": [ 5, 6 ]
},
"IdleWanderInCircleRadius": {
"Description": "The radius of the WanderInCircle motion",
"TypeHint": "Double",
"Value": 30
},
"IdleNothingTime": {
"Description": "How long the NPC will stand still for while wandering",
"Value": [ 1, 2 ]
},
"IdleFollowPath": {
"Description": "Whether the NPC will follow a path while idling",
"TypeHint": "Boolean",
"Value": false
},
"IdleFollowPathRange": {
"Description": "The maximum distance within which the NPC will look for a path",
"TypeHint": "Double",
"Value": 30
},
"IdleFollowPathShape": {
"Description": "The shape of the followed path",
"TypeHint": "String",
"Value": "Line"
},
"AlertedRange": {
"Value": 40,
"Description": "A range within which the player can be seen/sensed when the NPC is alerted to their presence"
},
"AlertedTime": {
"Description": "How long the NPC will stay in the alerted state before engaging the target",
"Value": [ 2, 2 ]
},
"AlertedAdditionalBehaviorComponent": {
"Description": "The component defining additional alerted behavior",
"TypeHint": "String",
"Value": "$Null"
},
"CombatBehaviorDistance": {
"Description": "The distance at which the NPC will use combat movement",
"TypeHint": "Double",
"Value": 30
},
"CombatRelativeSpeedFlyMotion": {
"Description": "The relative speed at which the NPC will move when within attack range and while flying",
"TypeHint": "Double",
"Value": 0.3
},
"CombatRelativeSpeedChase": {
"Description": "The relative speed at which the NPC will move when chasing",
"TypeHint": "Double",
"Value": 1
},
"RangedAttack": {
"Value": "Eye_Void_Blast",
"Description": "The ranged attack to use in combat"
},
"RangedAttackDistance": {
"Value": 20,
"Description": "The distance at which an NPC will execute attacks"
},
"RangedAttackAimingRange": {
"Description": "How long the NPC will take to aim at the target",
"Value": [ 3, 3 ]
},
"RangedAttackPauseRange": {
"Description": "How often the NPC will attack the target",
"Value": [ 1, 2 ]
},
"TargetSwitchTimer": {
"Value": [ 5, 5 ],
"Description": "Minimum time the NPC will be locked onto a single target before switching"
},
"CombatSeekSlowdownDistance": {
"Description": "The target distance at which a chasing NPC will slow down",
"TypeHint": "Double",
"Value": 2
},
"CombatSeekStopDistance": {
"Description": "The target distance at which a chasing NPC will stop",
"TypeHint": "Double",
"Value": 1
},
"TargetRange": {
"Value": 15,
"Description": "The distance the target needs to be within to maintain priority over other targets while in combat"
},
"CombatAdditionalBehaviorComponent": {
"Description": "The component defining additional combat behavior",
"TypeHint": "String",
"Value": "$Null"
},
"AttitudeGroup": {
"Value": "Empty",
"Description": "This NPCs attitude group"
},
"ConfusedTimeRange": {
"Description": "The range during which the NPC will be confused after losing a target",
"Value": [ 1, 2 ]
},
"SearchTimeRange": {
"Description": "The time range during which the NPC will search for a lost target",
"Value": [ 20, 30 ]
},
"SearchRadius": {
"Description": "The radius within which the NPC will search for a lost target",
"TypeHint": "Double",
"Value": 5
},
"SearchRelativeSpeed": {
"Description": "The relative speed of the chase motion",
"TypeHint": "Double",
"Value": 0.75
},
"IsMemory": {
"Value": false,
"Description": "Defines if the NPC is a memory"
},
"MemoriesCategory": {
"Value": "Other",
"Description": "Defines the category of the memory"
},
"MemoriesNameOverride": {
"Value": "",
"Description": "Overrides the memory name if set"
},
"NameTranslationKey": {
"Value": "server.npcRoles.Template_Flying_Aggressive.name",
"Description": "Translation key for NPC name display"
},
"DeathParticles": {
"Value": "Effect_Death",
"Description": "The particle system that spawns when the NPC's corpse disappears."
},
"DropDeathItemsInstantly": {
"Value": false,
"Description": "Whether the NPC's drop list should be executed when the NPC dies. If set to false, items drop when the corpse disappears."
},
"DeathAnimationTime": {
"Value": 2,
"Description": "The time it takes for this NPC's corpse to disappear."
}
},
"MotionControllerList": [
{
"Type": "Fly",
"Acceleration": 10,
"DesiredAltitudeWeight": 1,
"MaxClimbAngle": 90,
"MaxClimbSpeed": 30,
"MaxHeightOverGround": { "Compute": "MotionFlyMaxHeightAboveGround" },
"MaxHorizontalSpeed": { "Compute": "MotionFlyMaxHorizontalSpeed" },
"MaxRollAngle": 40,
"MaxSinkAngle": 90,
"MaxSinkSpeed": 3,
"MaxTurnSpeed": 180,
"MinAirSpeed": 3,
"MinHeightOverGround": { "Compute": "MotionFlyMinHeightAboveGround" }
}
]
}