Hytale Asset ReferenceUnofficial
Versions / 0.5.0-pre.9 / NPC / Roles / Intelligent / Passive / Klops_Merchant_Wandering.json

Klops_Merchant_Wandering

Server/NPC/Roles/Intelligent/Passive/Klops_Merchant_Wandering.json, 6.6 KB

Fields

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

Source

{
  "Type": "Generic",
  "StartState": "Idle",
  "DisplayNames": [ "Klops Merchant", "Traveling Trader", "Wandering Merchant" ],
  "DefaultNPCAttitude": "Ignore",
  "DefaultPlayerAttitude": "Neutral",
  "Appearance": "Klops_Merchant",
  "DropList": "Drop_Klops_Merchant",
  "MaxHealth": 62,
  "DisableDamageGroups": [ "Self" ],
  "BusyStates": [ "$Interaction" ],
  "KnockbackScale": 0.5,
  "MotionControllerList": [
    {
      "Type": "Walk",
      "MaxWalkSpeed": 7,
      "Gravity": 10,
      "RunThreshold": 0.3,
      "MaxFallSpeed": 15,
      "MaxRotationSpeed": 360,
      "Acceleration": 10
    }
  ],
  "Instructions": [
    {
      "Instructions": [
        {
          "$Comment": "Idle state - wander around continuously",
          "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"
                }
              ]
            },
            {
              "$Comment": "Walk in a direction, then pause, then walk again",
              "Sensor": {
                "Type": "Any"
              },
              "BodyMotion": {
                "Type": "Sequence",
                "Looped": true,
                "Motions": [
                  {
                    "$Comment": "Walk for 15-30 seconds in roughly the same direction",
                    "Type": "Timer",
                    "Time": [ 15, 30 ],
                    "Motion": {
                      "Type": "Wander",
                      "MaxHeadingChange": 5,
                      "RelativeSpeed": 0.2
                    }
                  },
                  {
                    "$Comment": "Pause for 5-10 seconds",
                    "Type": "Timer",
                    "Time": [ 5, 10 ],
                    "Motion": {
                      "Type": "Nothing"
                    }
                  }
                ]
              }
            }
          ]
        },
        {
          "$Comment": "Watching state - player is nearby, stop and 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"
              }
            },
            {
              "Sensor": {
                "Type": "Any"
              },
              "BodyMotion": {
                "Type": "Nothing"
              },
              "Actions": [
                {
                  "Type": "Timeout",
                  "Delay": [ 1, 1 ],
                  "Action": {
                    "Type": "Sequence",
                    "Actions": [
                      {
                        "Type": "ReleaseTarget"
                      },
                      {
                        "Type": "State",
                        "State": "Idle"
                      }
                    ]
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "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"
}