# Finite State Machine Plugin and Behavior

The **Finite State Machine (FSM) Plugin for Construct 3** is a comprehensive solution consisting of **two add-ons**: a **Behavior Add-on for FSM** and a **Global FSM Plugin**. This unique combination empowers developers to manage and control game states with precision, ensuring a seamless and well-structured game flow. Whether you’re creating an RPG, a platformer, or an action-packed shooter, FSM provides the tools needed to keep your game’s logic organized.

### **Key Features:**

* **Two Add-ons for Ultimate Flexibility**:
  * **FSM Behavior Add-on**: This add-on lets you assign FSM states to individual game objects. Each object can have its own specific state machine, providing greater flexibility in managing game logic for specific entities.
  * **FSM Global Plugin**: The Global FSM Plugin manages overall game states, such as GAME\_LOADING, GAME\_READY, GAME\_STARTED, GAME\_PAUSED, and GAME\_COMPLETED. It centralizes control, ensuring consistent game state management across the entire project.
* **Efficient State Management**: Whether managing individual objects or the entire game, FSM allows you to lock game events and behaviors to the active game state. This ensures that certain actions, such as player input, are only permitted when appropriate (e.g., blocking player input during GAME\_LOADING or GAME\_PAUSED).
* **Highly Customizable States**: Both add-ons allow you to define and manage custom game states. You can easily name states based on your game’s design, helping you maintain readability and organization in your code.
* **Seamless Integration**: With FSM, integrating these add-ons into your project is straightforward. Whether you’re using the Behavior Add-on to handle individual game objects or the Global Plugin to control the game’s broader state transitions, both add-ons work together to ensure a cohesive game logic system.

{% hint style="success" %} <mark style="color:green;">**Both addons offer the same ACEs documented in this page.**</mark>
{% endhint %}

## <img src="/files/nk5DOrsoJWudD2BrKLTw" alt="" data-size="line">FSM

Finite State Machine Global Plugin for C3 allows you to create and manage global game states to better structure your game events and overall flow.&#x20;

<details>

<summary>Download</summary>

<https://store.pixelperfectstudio.mx/product/fsm/>

</details>

## Actions

***

### `Change State`

Changes the FSM state to the one specified.

| **Parameter** | **Description** |
| ------------- | --------------- |
| `State`       | State name      |

## Conditions

***

### `Compare Current State`

Evaluates if FSM's current state equals the input string

| **Parameter** | **Description** |
| ------------- | --------------- |
| `State`       | State name      |

### `On Any State Changed`

Triggered on any state change.

### `On State Changed`

Triggered when the indicated state is set by the action 'Change State'

| **Parameter** | **Description** |
| ------------- | --------------- |
| `State`       | State name      |

### `On State Finished`

Whenever you change the state of the FSM, the current state is marked as finished and the On Finished state is triggered. The new state won't be processed by this event at this point.

| **Parameter** | **Description** |
| ------------- | --------------- |
| `State`       | State name      |

### `Compare Previous State`

Evaluates if FSM's previous state equals input string

| **Parameter** | **Description** |
| ------------- | --------------- |
| `State`       | State name      |

## Expressions

***

### `GetCurrentState`

Returns the current FSM state

### `GetPreviousState`

Returns the previous FSM state

**(c) Pixel Perfect Studio 2025**


---

# 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:

```
GET https://smartui-docs.pixelperfectstudio.mx/miscellaneous-addons/finite-state-machine-plugin-and-behavior.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.
