Hytale Asset ReferenceUnofficial
Versions / 0.6.0-pre.8 / NPC / Roles / Intelligent / Passive / Klops_Merchant.json

Klops_Merchant

Server/NPC/Roles/Intelligent/Passive/Klops_Merchant.json, 6.1 KB

Fields

FieldType
Typestring
Parametersobject
StartStatestring
DisplayNamesarray[3]
DefaultNPCAttitudestring
DefaultPlayerAttitudestring
Appearancestring
DropListstring
MaxHealthnumber
DisableDamageGroupsarray[1]
BusyStatesarray[1]
Invulnerableobject
KnockbackScalenumber
MotionControllerListarray[1]
Instructionsarray[1]
InteractionInstructionobject
NameTranslationKeystring

Source

{
  "Type": "Generic",
  "Parameters": {
    "Invulnerable": {
      "Value": false,
      "Description": "Whether this NPC is invulnerable."
    }
  },
  "StartState": "Idle",
  "DisplayNames": [
    "Klops Merchant",
    "Traveling Trader",
    "Wandering Merchant"
  ],
  "DefaultNPCAttitude": "Ignore",
  "DefaultPlayerAttitude": "Neutral",
  "Appearance": "Klops_Merchant",
  "DropList": "Drop_Klops_Merchant",
  "MaxHealth": 74,
  "DisableDamageGroups": [
    "Self"
  ],
  "BusyStates": [
    "$Interaction"
  ],
  "Invulnerable": {
    "Compute": "Invulnerable"
  },
  "KnockbackScale": 0.5,
  "MotionControllerList": [
    {
      "Type": "Walk",
      "MaxWalkSpeed": 7,
      "Gravity": 10,
      "RunThreshold": 0.3,
      "MaxFallSpeed": 15,
      "MaxRotationSpeed": 360,
      "Acceleration": 10
    }
  ],
  "Instructions": [
    {
      "Instructions": [
        {
          "$Comment": "Idle state - no player nearby",
          "Sensor": {
            "Type": "State",
            "State": "Idle"
          },
          "Instructions": [
            {
              "$Comment": "Greet player when they approach (Alerted animation)",
              "ActionsBlocking": true,
              "Sensor": {
                "Type": "Player",
                "Range": 8
              },
              "Actions": [
                {
                  "Type": "PlayAnimation",
                  "Slot": "Status",
                  "Animation": "Alerted"
                },
                {
                  "Type": "State",
                  "State": "Watching"
                }
              ]
            },
            {
              "Sensor": {
                "Type": "Any"
              },
              "BodyMotion": {
                "Type": "Nothing"
              }
            }
          ]
        },
        {
          "$Comment": "Watching state - player is nearby, just watch them",
          "Sensor": {
            "Type": "State",
            "State": "Watching"
          },
          "Instructions": [
            {
              "$Comment": "Watch nearby players with head",
              "Continue": true,
              "Sensor": {
                "Type": "Player",
                "Range": 12
              },
              "HeadMotion": {
                "Type": "Watch"
              }
            },
            {
              "$Comment": "Clear animation after delay",
              "Continue": true,
              "Sensor": {
                "Type": "Any"
              },
              "Actions": [
                {
                  "Type": "Timeout",
                  "Delay": [
                    2,
                    2
                  ],
                  "Action": {
                    "Type": "PlayAnimation",
                    "Slot": "Status"
                  }
                }
              ]
            },
            {
              "$Comment": "Return to Idle when player leaves (clear animation first)",
              "Sensor": {
                "Type": "Not",
                "Sensor": {
                  "Type": "Player",
                  "Range": 12
                }
              },
              "Actions": [
                {
                  "Type": "PlayAnimation",
                  "Slot": "Status"
                },
                {
                  "Type": "State",
                  "State": "Idle"
                }
              ]
            },
            {
              "Sensor": {
                "Type": "Any"
              },
              "BodyMotion": {
                "Type": "Nothing"
              }
            }
          ]
        },
        {
          "$Comment": "Interaction state - look at player while shop is open",
          "Sensor": {
            "Type": "State",
            "State": "$Interaction"
          },
          "Instructions": [
            {
              "Continue": true,
              "Sensor": {
                "Type": "Target",
                "Range": 10
              },
              "HeadMotion": {
                "Type": "Watch"
              }
            },
            {
              "$Comment": "Return to Watching after interaction ends",
              "Sensor": {
                "Type": "Any"
              },
              "Actions": [
                {
                  "Type": "Timeout",
                  "Delay": [
                    1,
                    1
                  ],
                  "Action": {
                    "Type": "Sequence",
                    "Actions": [
                      {
                        "Type": "ReleaseTarget"
                      },
                      {
                        "Type": "State",
                        "State": "Watching"
                      }
                    ]
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "InteractionInstruction": {
    "Instructions": [
      {
        "Sensor": {
          "Type": "Not",
          "Sensor": {
            "Type": "CanInteract",
            "ViewSector": 180
          }
        },
        "Actions": [
          {
            "Type": "SetInteractable",
            "Interactable": false
          }
        ]
      },
      {
        "Continue": true,
        "Sensor": {
          "Type": "Any"
        },
        "Actions": [
          {
            "Type": "SetInteractable",
            "Interactable": true,
            "Hint": "server.interactionHints.trade"
          }
        ]
      },
      {
        "Sensor": {
          "Type": "HasInteracted"
        },
        "Instructions": [
          {
            "Sensor": {
              "Type": "Not",
              "Sensor": {
                "Type": "State",
                "State": "$Interaction"
              }
            },
            "Actions": [
              {
                "Type": "LockOnInteractionTarget"
              },
              {
                "Type": "OpenBarterShop",
                "Shop": "Klops_Merchant"
              },
              {
                "Type": "State",
                "State": "$Interaction"
              }
            ]
          }
        ]
      }
    ]
  },
  "NameTranslationKey": "server.npcRoles.Klops_Merchant.name"
}