> 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>" %}

## 조건 논리

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

조건을 추가하려면, 옆에 있는 점 세 개 아이콘을 클릭하세요 **트리거 이벤트** 을 누르고 **트리거 조건 추가**.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-7bb63e09d7e61b57709e9fdc983047a25e33dc5a%2Fcondition.png?alt=media)

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

* **모든 조건이 충족되어야 함(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)

### States

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

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

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)

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)

3. 다음을 통해 상태 변경에 반응하세요 **상태 변경 시** 트리거 이벤트.

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

![](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)

스마트 항목에는 원하는 만큼 상태를 추가할 수 있습니다. 그냥  **새 상태 추가** 버튼을 클릭하여 목록에 하나를 더 추가하세요.

![](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)

상태 중 하나가 기본값으로 선택되며, 장면이 실행될 때 항목은 항상 이 상태로 시작합니다. 다른 상태 옆의 점 세 개를 클릭하고 선택하여 다른 상태를 기본값으로 지정할 수 있습니다 **기본값으로 설정**.

{% 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)

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

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

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

임계값을 넘을 때 동작이 한 번만 발생하고 그 이후의 모든 증가마다 반복되지 않도록 하려면, 카운터를 다음과 결합하세요 **상태** 구성 요소. 원하는 값에 도달할 때마다 상태를 "Done"으로 설정하고, 트리거 이벤트에서 이 상태를 확인하는 조건을 추가하세요.
{% 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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
