Hytale Asset ReferenceUnofficial
Versions / 0.5.7 / NPC / Roles / Intelligent / Aggressive / Trork / Components / Component_Trork_Instruction_Greeting.json

Component_Trork_Instruction_Greeting

Server/NPC/Roles/Intelligent/Aggressive/Trork/Components/Component_Trork_Instruction_Greeting.json, 10.4 KB

Fields

FieldType
Classstring
ResetOnStateChangeboolean
Parametersobject
DefaultStatestring
Contentobject
Typestring

Source

{
  "Class": "Instruction",
  "ResetOnStateChange": true,
  "Parameters": {
    "_ImportStates": [ "Idle", "Chase", "Search", "Warn" ],
    "ViewRange": {
      "Value": 15,
      "Description": "View range"
    },
    "ViewSector": {
      "Value": 180,
      "Description": "View sector"
    },
    "HearingRange": {
      "Value": 8,
      "Description": "Hearing range"
    },
    "SmellRange": {
      "Value": 8,
      "Description": "Smell range"
    },
    "AlertedRange": {
      "Value": 30,
      "Description": "A range within which the target can be seen/sensed when the NPC is alerted to their presence"
    },
    "Greet": {
      "Value": false,
      "Description": "Whether the target should be greeted"
    },
    "Greeting": {
      "$TODO": "Replace with actual greeting",
      "Value": "Alerted",
      "Description": "The greeting animation to play"
    },
    "NotifyTarget": {
      "Value": false,
      "Description": "Whether to send a delayed message to the target along with this greeting"
    },
    "NotifyMessage": {
      "Value": "",
      "Description": "The message to send to the target"
    },
    "Approach": {
      "Value": false,
      "Description": "Whether this NPC should approach the target first"
    },
    "ApproachTo": {
      "Value": 5,
      "Description": "Distance to approach to before greeting"
    },
    "CanSee": {
      "Value": true,
      "Description": "Whether this NPC can see"
    },
    "CanHear": {
      "Value": true,
      "Description": "Whether this NPC can hear"
    },
    "CanSmell": {
      "Value": false,
      "Description": "Whether this NPC can smell"
    },
    "ReactToChests": {
      "Value": true,
      "Description": "Whether to react to chest interactions"
    },
    "GiveFocus": {
      "Value": false,
      "Description": "Whether this NPC should focus on the target and not forget them/return to their own business"
    },
    "ChestBlockSet": {
      "Value": "Trork_Chest",
      "Description": "The block set designating chests for this NPC"
    }
  },
  "DefaultState": ".Default",
  "Content": {
    "Instructions": [
      {
        "Sensor": {
          "Once": true,
          "Type": "Animation",
          "Slot": "Status",
          "Animation": "Sleep"
        },
        "Actions": [
          {
            "Type": "State",
            "State": ".Wake"
          }
        ]
      },
      {
        "Reference": "Component_Instruction_Damage_Check",
        "Modify": {
          "_ExportStates": [ "Chase", "Search" ],
          "AlertedRange": { "Compute": "AlertedRange" }
        }
      },
      {
        "Sensor": {
          "Type": "Or",
          "Sensors": [
            {
              "Reference": "Component_Sensor_Sight_By_Attitude",
              "Modify": {
                "Enabled": { "Compute": "CanSee" },
                "ViewRange": { "Compute": "AlertedRange" },
                "ViewSector": { "Compute": "ViewSector" },
                "Attitudes": [ "Hostile" ]
              }
            },
            {
              "Reference": "Component_Sensor_Scent_By_Attitude",
              "Modify": {
                "SmellRange": { "Compute": "SmellRange" },
                "Enabled": { "Compute": "CanSmell" },
                "Attitudes": [ "Hostile" ]
              }
            },
            {
              "Reference": "Component_Sensor_Sound_By_Attitude",
              "Modify": {
                "HearingRange": { "Compute": "HearingRange" },
                "Attitudes": [ "Hostile" ],
                "Enabled": { "Compute": "CanHear" }
              }
            }
          ]
        },
        "Actions": [
          {
            "Type": "Timeout",
            "Delay": [ 1, 1 ],
            "Action": {
              "Type": "ParentState",
              "State": "Chase"
            }
          }
        ]
      },
      {
        "Enabled": { "Compute": "ReactToChests" },
        "Sensor": {
          "Type": "BlockChange",
          "Range": { "Compute": "ViewRange" },
          "EventType": "Damage",
          "BlockSet": { "Compute": "ChestBlockSet" },
          "SearchType": "PlayerOnly",
          "TargetSlot": "LockedTarget"
        },
        "Actions": [
          {
            "Type": "ParentState",
            "State": "Chase"
          }
        ]
      },
      {
        "Enabled": { "Compute": "ReactToChests" },
        "Sensor": {
          "Type": "BlockChange",
          "Range": { "Compute": "ViewRange" },
          "EventType": "Interaction",
          "BlockSet": { "Compute": "ChestBlockSet" },
          "SearchType": "PlayerOnly",
          "TargetSlot": "LockedTarget"
        },
        "Actions": [
          {
            "Type": "ParentState",
            "State": "Warn"
          }
        ]
      },
      {
        "Sensor": {
          "Type": "State",
          "State": ".Wake"
        },
        "Instructions": [
          {
            "$Comment": "Animations",
            "Continue": true,
            "Sensor": {
              "Type": "Any",
              "Once": true
            },
            "Actions": [
              {
                "Type": "PlayAnimation",
                "Slot": "Status",
                "Animation": "Wake"
              }
            ]
          },
          {
            "Sensor": {
              "Type": "Any"
            },
            "Actions": [
              {
                "Type": "Timeout",
                "Delay": [ 3, 4 ],
                "Action": {
                  "Type": "State",
                  "State": ".Default"
                }
              }
            ]
          }
        ]
      },
      {
        "Enabled": { "Compute": "Approach" },
        "Sensor": {
          "Once": true,
          "Type": "Any"
        },
        "Actions": [
          {
            "Type": "State",
            "State": ".Approach"
          }
        ]
      },
      {
        "Sensor": {
          "Type": "State",
          "State": ".Approach"
        },
        "Instructions": [
          {
            "Sensor": {
              "Type": "Target",
              "Range": { "Compute": "ApproachTo" },
              "Filters": [
                {
                  "Type": "LineOfSight"
                }
              ]
            },
            "Actions": [
              {
                "Type": "State",
                "State": ".Default"
              }
            ]
          },
          {
            "Continue": true,
            "Sensor": {
              "Type": "Any"
            },
            "Actions": [
              {
                "Type": "Timeout",
                "Delay": [ 10, 10 ],
                "Action": {
                  "Type": "ParentState",
                  "State": "Idle"
                }
              }
            ]
          },
          {
            "Sensor": {
              "Type": "Target",
              "Range": { "Compute": "AlertedRange" },
              "AutoUnlockTarget": true
            },
            "BodyMotion": {
              "Type": "Seek",
              "RelativeSpeed": 0.35,
              "SlowDownDistance": { "Compute": "ApproachTo" },
              "StopDistance": { "Compute": "ApproachTo - 1" }
            }
          }
        ]
      },
      {
        "Sensor": {
          "Type": "State",
          "State": ".Default"
        },
        "Instructions": [
          {
            "Reference": "Component_Instruction_Clear_Status_Animation",
            "Modify": { }
          },
          {
            "Enabled": { "Compute": "Greet" },
            "Continue": true,
            "Sensor": {
              "Once": true,
              "Type": "Target",
              "Range": { "Compute": "ViewRange" },
              "Filters": [
                {
                  "Type": "LineOfSight"
                }
              ]
            },
            "Actions": [
              {
                "Type": "PlayAnimation",
                "Slot": "Status",
                "Animation": { "Compute": "Greeting" }
              }
            ]
          },
          {
            "Enabled": { "Compute": "NotifyTarget" },
            "Continue": true,
            "Sensor": {
              "Once": true,
              "Type": "Target",
              "Range": { "Compute": "ViewRange" },
              "Filters": [
                {
                  "Type": "LineOfSight"
                }
              ]
            },
            "Actions": [
              {
                "Type": "Notify",
                "Message": { "Compute": "NotifyMessage" }
              }
            ]
          },
          {
            "Continue": true,
            "Sensor": {
              "Type": "Any"
            },
            "Instructions": [
              {
                "Enabled": { "Compute": "!GiveFocus" },
                "Continue": true,
                "Sensor": {
                  "Type": "Target"
                },
                "Actions": [
                  {
                    "Type": "OverrideAttitude",
                    "Attitude": "Ignore",
                    "Duration": 300
                  }
                ]
              },
              {
                "Sensor": {
                  "Type": "Target",
                  "Range": { "Compute": "ViewRange" },
                  "Filters": [
                    {
                      "Type": "LineOfSight"
                    }
                  ]
                },
                "HeadMotion": {
                  "Type": "Watch"
                }
              }
            ]
          },
          {
            "Sensor": {
              "Type": "Not",
              "Sensor": {
                "Type": "Target",
                "Range": { "Compute": "ViewRange" },
                "AutoUnlockTarget": true,
                "Filters": [
                  {
                    "Type": "LineOfSight"
                  }
                ]
              }
            },
            "Actions": [
              {
                "Type": "ParentState",
                "State": "Idle"
              }
            ]
          },
          {
            "Enabled": { "Compute": "!GiveFocus" },
            "Sensor": {
              "Type": "Any"
            },
            "Actions": [
              {
                "Type": "Timeout",
                "Delay": [ 4, 6 ],
                "Action": {
                  "Type": "ParentState",
                  "State": "Idle"
                }
              }
            ]
          }
        ]
      }
    ]
  },
  "Type": "Component"
}