> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/interactivity/states-and-conditions.md).

# 상태 및 조건

아이템 상태 및 조건부 로직 관리

{% embed url="<https://www.youtube.com/watch?v=wm8ZD2kSyKA>" %}

## 조건부 로직

트리거에 조건을 추가하여 해당 조건이 충족될 때만 동작이 발생하도록 합니다. 예를 들어, 문을 클릭해도 문이 이미 열려 있지 않을 때만 "열기" 동작이 활성화됩니다.

조건을 추가하려면 다음 옆의 점 3개 아이콘을 클릭하세요 **트리거 이벤트** 를 선택한 다음 **트리거 조건 추가**.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-7bb63e09d7e61b57709e9fdc983047a25e33dc5a%2Fcondition.png?alt=media\&token=0307c6b8-b072-4bcf-805b-3b85f6793d09)

하나의 트리거에는 여러 조건을 포함할 수 있습니다. 다음을 클릭하세요 **+** 아이콘을 눌러 조건을 더 추가하세요. 조건이 두 개 이상일 경우, 다음 옵션 중 하나를 선택할 수 있습니다:

* **모든 조건이 충족되어야 함(AND)**: 트리거는 모든 조건이 참일 때만 발생합니다.
* **조건 중 하나라도 충족되면 됨(OR)** 조건 중 최소 하나가 참이면 트리거가 발생합니다.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-588927ea5768c6e3a1490d5335c5d89047a1fe2c%2Fmultiple-conditions.png?alt=media\&token=889132f5-cb4f-432f-ba48-82b042e7ef65)

### States

이 **States** 구성요소는 여러 스마트 아이템에 포함되어 있습니다. 이는 스마트 아이템이 가질 수 있는 가능한 상태를 나열합니다. 어떤 시점에서든 스마트 아이템은 이 상태들 중 하나에 있습니다. 예를 들어, 문은 *열기* 또는 *닫힘*. "열기" 동작은 상태를 *열기*, "닫기" 동작은 상태를 *닫힘*.

상태로 다음을 할 수 있습니다:

1. 트리거의 조건을 사용해 엔티티의 상태를 확인할 수 있습니다. 이렇게 하면 특정 상태가 활성화되어 있을 때만 동작이 수행됩니다.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-7bb63e09d7e61b57709e9fdc983047a25e33dc5a%2Fcondition.png?alt=media\&token=0307c6b8-b072-4bcf-805b-3b85f6793d09)

2. 다음을 통해 상태를 변경합니다 **상태 설정** 동작

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-a1d45062ce10c08e424bc3948bf2d7eaff1b15be%2Fset-state.png?alt=media\&token=b02a5064-a480-4be6-865a-707a7e97c725)

3. 다음을 통해 상태 변화에 반응합니다 **상태 변경 시** 트리거 이벤트.

두 동작을 전환하려면 상태를 확인하는 조건이 각각 포함된 두 개의 트리거를 정의하세요. 예를 들어, 문에는 "열기" 동작을 활성화하는 하나의 트리거가 있고, 이 트리거의 조건은 먼저 문의 상태가 *닫힘*이고, 또 다른 트리거는 "닫기" 동작을 활성화하며, 이 트리거의 조건은 문의 상태가 *열기*인지를 확인합니다. 플레이어가 문을 클릭할 때마다 둘 중 하나만 활성화됩니다.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-03ba26fa1e6024bd4811bac4289684be640d33c3%2Fdoor_conditions.png?alt=media\&token=e4cd0c18-b41c-4549-8e94-57c85c95e412)

스마트 아이템에는 원하는 만큼 상태를 추가할 수 있습니다. 다음을 클릭하기만 하면 됩니다 **새 상태 추가** 버튼을 눌러 목록에 하나를 더 추가하세요.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-56792d2ce50169a8f8c2707c74297df1a024aed1%2Fnew_state.png?alt=media\&token=8c933266-0c66-405a-a4ce-7374ae5e7f6b)

상태 중 하나가 기본값으로 선택되며, 씬이 실행될 때 아이템은 항상 이 상태에서 시작합니다. 다른 상태 옆의 점 3개를 클릭한 후 다음을 선택하여 다른 상태를 기본값으로 지정할 수 있습니다 **기본값으로 설정**.

{% hint style="info" %}
**💡 팁**: 아이템 간 상호작용은 단순하게 유지하세요. 예를 들어, 문을 여는 버튼이 문 애니메이션 재생, 문 소리 재생, 문의 상태 변경이라는 세 가지 동작을 트리거하는 상황은 피하세요. 대신 버튼이 문의 상태를 변경하도록 하세요. 그런 다음 **상태 변경 시** 트리거를 사용하여 상태가 변경될 때마다 문 자체가 애니메이션과 소리를 재생하도록 하세요.
{% endhint %}

### Counter

다음을 사용하세요 **Counter** 플레이어가 씬에서 동작을 수행함에 따라 변할 수 있는 숫자를 추적하는 데 사용하는 구성요소입니다. 카운터의 값을 조건부 로직에 사용할 수 있습니다.

엔티티에 카운터 구성요소가 있으면 다음 동작을 수행할 수 있습니다:

* **카운터 증가**: 카운터 값을 구성 가능한 **수량**만큼 증가시킵니다. 기본값은 1입니다.
* **카운터 감소**: 카운터 값을 구성 가능한 **수량**만큼 증가시킵니다. 기본값은 1입니다.
* **카운터 설정**: 카운터 값을 특정 숫자로 설정합니다. 예를 들어 다시 0으로 되돌리는 경우입니다.

다음을 사용하세요 **카운터 변경 시** 카운터 값이 변경될 때마다 동작을 수행하는 트리거입니다. 이 트리거에 조건을 추가하여 특정 임계값을 지난 후에만 활성화되도록 하세요.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-c32416d2c7479d26d2cb70ef7f9440d149911e0b%2Fon_counter_change.png?alt=media\&token=708c6da5-7773-4899-b45e-64f9e47e8e28)

조건에서 카운터 값이 다음인지 확인할 수 있습니다

* 주어진 값보다 큼
* 주어진 값보다 작음
* 주어진 값과 같음

{% hint style="info" %}
**💡 팁**: 크거나 같은지를 확인하려면 AND 옵션을 사용하여 트리거 이벤트에 두 개의 조건을 추가할 수 있습니다.

임계값을 지날 때 동작이 한 번만 발생하고 그 이후의 모든 증가마다 반복되지 않게 하려면, 카운터를 다음과 결합하세요 **상태** 구성요소. 원하는 값에 도달할 때마다 상태를 "완료"로 설정하고, 트리거 이벤트에서 이 상태를 확인하는 조건을 추가하세요.
{% endhint %}

### 또한 참조하세요

* [스마트 아이템 - 기본](/creator/content-creator-ko/scene-editor/interactivity/smart-items.md)
* [스마트 아이템 - 고급](/creator/content-creator-ko/scene-editor/interactivity/smart-items-advanced.md)
* [모든 항목을 스마트 아이템으로 만들기](/creator/content-creator-ko/scene-editor/interactivity/make-any-item-smart.md)
* [코드와 결합](/creator/content-creator-ko/scene-editor/extend-with-code/overview.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-ko/scene-editor/interactivity/states-and-conditions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
