> For the complete documentation index, see [llms.txt](https://ditoland-utplus.gitbook.io/ditoland/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ditoland-utplus.gitbook.io/ditoland/api-reference/client/item.md).

# Item

## Item

클라이언트에서 사용되는 아이템 개체에요

### **함수**

<br>

| **void Detach()** |
| ----------------- |

(deprecated) 플레이어 캐릭터에 붙어 있는 아이템을 해제할 수 있어요.

<br>

| **void AddAction(string ActionName, number ActionCoolTime, bool bActionWhileKeyDown, function ActionFunction, Key ActionKeys)** |
| ------------------------------------------------------------------------------------------------------------------------------- |

(deprecated) AddKeyAction 함수로 사용하세요.

<br>

| **void AddKeyAction(string ActionName, number ActionCoolTime, bool bActionWhileKeyDown, function ActionFunction, Key ActionKeys)** |
| ---------------------------------------------------------------------------------------------------------------------------------- |

아이템을 착용 후 액션 추가해요. (액션 이름, 액션 실행 할 [Enum.Key.키](https://ditoland-utplus.gitbook.io/ditoland/api-reference/enums/key) , 해당 액션의 쿨타임, 자동 액션 여부, 연결 함수)

\-- 샘플 --

```lua
local item = Script.Parent
local coolTime = 0
local isActionWhileKeyDown = true

local function StartClick(player, curCameraPos , curCameraForward) --클릭시 호출할 함수에요.
    print("Fire!")
end

local function EndClick(player, curCameraPos , curCameraForward) --클릭이 끝났을때 호출할 함수에요.
    print("End Click!")
end

item:AddAction("Fire", coolTime, isActionWhileKeyDown, StartClick, Enum.Key.LeftMouseButton) --아이템에 키 입력시 호출할 함수를 연결해요.
item:AddToggleAction("CheckAction", coolTime, StartClick, EndClick, Enum.Key.LeftMouseButton) --아이템에 착용 후 토글 액션을 추가해요.
```

<br>

| **void AddToggleAction(string ActionName, number ActionCoolTime, function StartFunction, function EndFunction, Key ActionKeys)** |
| -------------------------------------------------------------------------------------------------------------------------------- |

(deprecated) AddToggleKeyAction 함수로 사용하세요.

<br>

| **void AddToggleKeyAction(string ActionName, number ActionCoolTime, function StartFunction, function EndFunction, Key ActionKeys)** |
| ----------------------------------------------------------------------------------------------------------------------------------- |

아이템 착용 후 토글 액션을 추가해요. (액션 이름, 액션 쿨타임, 액션 시작 시 연결 함수, 액션 종료 시 연결 함수)

\-- 샘플 --

```lua
local item = Script.Parent
local coolTime = 0
local isActionWhileKeyDown = true

local function StartClick(player, curCameraPos , curCameraForward) --클릭시 호출할 함수에요.
    print("Fire!")
end

local function EndClick(player, curCameraPos , curCameraForward) --클릭이 끝났을때 호출할 함수에요.
    print("End Click!")
end

item:AddAction("Fire", coolTime, isActionWhileKeyDown, StartClick, Enum.Key.LeftMouseButton) --아이템에 키 입력시 호출할 함수를 연결해요.
item:AddToggleAction("CheckAction", coolTime, StartClick, EndClick, Enum.Key.LeftMouseButton) --아이템에 착용 후 토글 액션을 추가해요.
```

\ <br>

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

### **속성**

| **이름**                                                                                             | **설명**                  |
| -------------------------------------------------------------------------------------------------- | ----------------------- |
| [**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)        | **객체의 가시성**             |

### **이벤트**

| **이름**                                                                                             | **설명**                                                                                                                            |
| -------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| [**UseEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)              | <p><strong>아이템 사용 시 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(usePlayer), usePlayer 는 Player 객체 입니다.</strong></p>         |
| [**EquipEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)            | <p><strong>아이템 장착 시 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(equipPlayer), equipPlayer 는 Player 객체 입니다.</strong></p>     |
| [**UnEquipEvent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)          | <p><strong>아이템 탈착 시 호출되는 이벤트에요.</strong><br><strong>연결함수 형식은 function(unequipPlayer), unequipPlayer 는 Player 객체 입니다.</strong></p> |
| [**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>                                       |

### **함수**

| **이름**                                                                                                                  | **설명**                                                                                        |
| ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [**GetItemCount**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)                               | **아이템의 개수를 얻을 수 있어요.**                                                                        |
| [**IsEquiped**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)                                  | **현재 아이템 장착상태인지를 확인 할 수 있어요.**                                                                |
| [**GetActionCoolTime**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)                          | **아이템에 설정한 해당 액션의 쿨타임을 얻을 수 있어요. (설정할 액션 이름)**                                                |
| [**SetActionCoolTime**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)                          | **아이템에 설정한 해당 액션의 쿨타임을 설정할 수 있어요. (설정할 액션 이름, 설정하고 싶은 시간)**                                   |
| [**GetEquipSlot**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)                               | **해당 아이템의 장착 슬롯을 가져올 수 있어요.**                                                                 |
| [**GetIconImg**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)                                 | \*\*\*\*                                                                                      |
| [**AddAction**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)                                  | **아이템 착용 후 액션을 추가해요. (액션 이름, 해당 액션의 쿨타임, 연결 함수)**                                             |
| [**AddToggleAction**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/item)                            | **아이템 착용 후 토글 액션을 추가해요. (액션 이름, 액션 쿨타임, 액션 시작 시 연결 함수, 액션 종료 시 연결 함수)**                       |
| [**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)**                                              |
