# NPC

## NPC

서버에서 사용되는 NPC 객체에요.

### **함수**

<br>

| **void MoveToLocation(Vector Target)** |
| -------------------------------------- |

캐릭터가 목표 지점까지 길찾기를 이용해 이동합니다. (NavMeshVolume를 배치해야 동작해요.)

\-- 샘플 --

```lua
local npc = Script.Parent
local goalPos = Workspace.Cube.Transform.Location

wait(3)
npc:MoveToLocation(goalPos) --해당 지점까지 길찾기로 이동해요.
```

<br>

| **void StopMovement()** |
| ----------------------- |

캐릭터의 길찾기 이동을 중지합니다.

\-- 샘플 --

```lua
local npc = Script.Parent
local goalPos = Workspace.Cube.Transform.Location

wait(3)
npc:MoveToLocation(goalPos) --해당 지점까지 길찾기로 이동해요.

wait(5)
npc:StopMovement() --진행중인 길찾기를 중지해요.
```

<br>

| **PathFollowingStatus GetPathFollowingStatus()** |
| ------------------------------------------------ |

캐릭터의 길찾기 이동 상태입니다.

\-- 샘플 --

```lua
local npc = Script.Parent
local goalPos = Workspace.Cube.Transform.Location

wait(3)
npc:MoveToLocation(goalPos) --해당 지점까지 길찾기로 이동해요.
print(npc:GetPathFollowingStatus()) --대상의 길찾기 상태를 숫자로 반환해요.
```

<br>

| **void MoveForward(number Value)** |
| ---------------------------------- |

설정된 이동 타입에 따라 앞으로 이동시켜요. (1 : 전진, -1 : 후진 이동)

\-- 샘플 --

```lua
local npc = Script.Parent

local function update(updateTime)
    npc:MoveForward(-1) --1이면 전진, -1이면 후진해요
end
npc.OnUpdateEvent:Connect(update)
```

<br>

| **void MoveRight(number Value)** |
| -------------------------------- |

좌, 우로 이동시켜요. (-1 : 좌측, 1 : 우측 이동)

\-- 샘플 --

```lua
local npc = Script.Parent

local function update(updateTime)
    npc:MoveRight(-1) --1이면 우측, -1이면 좌측으로 이동해요
end
npc.OnUpdateEvent:Connect(update)
```

<br>

| **void Jump()** |
| --------------- |

점프동작을 실행해요.

\-- 샘플 --

```lua
local npc = Script.Parent

wait(5)
npc:Jump() -- 점프동작을 실행해요.
```

<br>

| **string GetNPCName()** |
| ----------------------- |

NPC의 이름을 얻을 수 있어요.

\-- 샘플 --

```lua
local NPC = Script.Parent
print(NPC:GetNPCName())
```

<br>

| **void SetNPCName(string Name)** |
| -------------------------------- |

\-- 샘플 --

```lua
local NPC = Script.Parent
NPC:SetNPCName("기사")
```

\ <br>

## **사용 가능한 부모 오브젝트 기능들**

### **속성**

| **이름**                                                                                             | **설명**                  |
| -------------------------------------------------------------------------------------------------- | ----------------------- |
| [**Visible**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)    | **캐릭터의 가시성**            |
| [**Transform**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)  | **캐릭터의 Matring 에요**     |
| [**Location**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)   | **캐릭터 위치값이에요.**         |
| [**Rotation**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)   | **캐릭터 회전값이에요.**         |
| [**Enable**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)         | **객체 활성화 여부**           |
| [**Transform**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)      | **객체의 Matrix**          |
| [**LocalTransform**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject) | **객체의 Local Transform** |
| [**Location**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)       | **객체의 위치 Vector**       |
| [**LocalLocation**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)  | **객체의 로컬좌표 Vector**     |
| [**Rotation**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)       | **객체의 회전 Vector**       |
| [**LocalRotation**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)  | **객체의 로컬 회전 Vector**    |
| [**Scale**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)          | **객체의 크기 Vector**       |
| [**Visible**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)        | **객체의 가시성**             |

### **이벤트**

| **이름**                                                                                             | **설명**                                                                                                                       |
| -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [**OnUpdateEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)  | <p><strong>생성 후 매 프레임마다 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(updateTime), updateTime 은 number 입니다.</strong></p> |
| [**OnDestroyEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject) | <p><strong>삭제될 때 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function() 입니다.</strong></p>                                       |
| [**OnEnableEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)  | <p><strong>Enable 될때 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function() 입니다.</strong></p>                                   |
| [**OnDisableEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject) | <p><strong>Disable 될때 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function() 입니다.</strong></p>                                  |

### **함수**

| **이름**                                                                                                                  | **설명**                                                                                        |
| ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [**SetEmissive**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                     | **캐릭터 Material의 Emissive 값을 변경 할 수 있어요. (자체 발광하는 수치 값)**                                      |
| [**AddForce**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                        | **캐릭터에 물리적인 힘을 가할 수 있어요. (힘을 가할 Vector 값)**                                                   |
| [**GetMaxSpeed**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                     | **캐릭터의 최대 이동속도를 얻을 수 있어요.**                                                                   |
| [**SetMaxJump**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                      | **캐릭터의 최대 점프속도를 설정할 수 있어요. (설정할 최대 점프속도 값)**                                                  |
| [**GetMaxJump**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                      | **캐릭터의 최대 점프속도를 얻을 수 있어요.**                                                                   |
| [**SetFlyControl**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                   | **공중에서 캐릭터 컨트롤 비율을 설정할 수 있어요. (설정할 비율 값)**                                                    |
| [**GetFlyControl**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                   | **공중에서 캐릭터 컨트롤 비율을 얻을 수 있어요.**                                                                |
| [**SetFlyMaxSpeed**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                  | **캐릭터의 최대 공중 이동속도를 설정할 수 있어요. 기어오르기, 날기 등의 상태에서만 반영돼요. (설정할 최대 공중 이동속도 값)**                   |
| [**GetFlyMaxSpeed**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                  | **캐릭터의 최대 공중 이동속도를 얻을 수 있어요.**                                                                |
| [**JumpEnable**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                      | **캐릭터의 점프 가능 여부를 설정할 수 있어요. (점프 가능 여부)**                                                      |
| [**MoveRightEnable**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                 | **캐릭터의 좌우 이동 가능 여부를 설정할 수 있어요. (좌우 이동 가능 여부)**                                                |
| [**MoveToSpawnPoint**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                | **캐릭터를 특정 스폰 위치로 이동시킬 수 있어요. (이동 할 스폰포인트 오브젝트, 방향 Rot 초기화 여부)**                               |
| [**ChangeCharacterType**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)             | **현재 캐릭터의 외형 타입을 바꿀 수 있어요.**                                                                  |
| [**SetCapsuleSize**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                  | **현재 캐릭터의 캡슐 콜리전의 크기를 바꿀 수 있어요.**                                                             |
| [**GetCharacterType**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                | **현재 캐릭터의 외형 타입을 가져 올 수 있어요.**                                                                |
| [**AttachObject**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                    | **캐릭터에 타겟 오브젝트를 붙일 수 있어요. (타겟 오브젝트, 붙일 AttachPoint)**                                         |
| [**AttachObject**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                    | **캐릭터에 타겟 오브젝트를 붙일 수 있어요. (타겟 오브젝트, 붙일 Bone)**                                                |
| [**DetachObject**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                    | **캐릭터에 붙어있는 오브젝트를 떨어뜨릴 수 있어요. (타겟 오브젝트)**                                                     |
| [**DetachAllObject**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/characterserver)                 | **캐릭터에 붙어있는 모든 오브젝트를 떨어뜨려요.**                                                                 |
| [**GetKey**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)                              | **객체의 키 값을 얻을 수 있어요.**                                                                        |
| [**SetTransformWithCollisionCheck**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)      | **현재 매트릭스에서 설정 된 매트릭스로 보간이 되는 매트릭스를 설정할 수 있어요 설정할 수 있어요. (Matrix 값, bool 충돌 처리 여부)**          |
| [**SetLocalTransformWithCollisionCheck**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject) | **현재 매트릭스에서 설정 된 매트릭스로 보간이 되는 매트릭스를 로컬좌표기준으로 설정할 수 있어요 설정할 수 있어요. (Matrix 값, bool 충돌 처리 여부)** |
| [**Teleport**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)                            | **순간이동 하는 매트릭스를 설정할 수 있어요. (Matrix 값)**                                                       |
| [**SetLocationWithCollisionCheck**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)       | **객체의 위치를 설정할 수 있어요. (설정할 위치 Vector 값, 충돌 처리 여부)**                                            |
| [**SetTag**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)                              | **객체의 tag를 설정해요. (설정할 tag)**                                                                  |
| [**GetTag**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)                              | **객체에 설정된 tag를 얻을 수 있어요.**                                                                    |
| [**ConnectEventFunction**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)                | **유저가 추가한 오브젝트 커스텀 이벤트에 함수를 연결할 수 있어요. (이벤트 이름, 연결 함수)**                                      |
| [**LookAt**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/worldobject)                              | **오브젝트가 해당하는 위치를 바라보게 할 수 있어요. (바라볼 위치 Vector)**                                              |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/npc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
