> For the complete documentation index, see [llms.txt](https://docs.uci.ucserver.it/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uci.ucserver.it/uncomplicatedcustomitems/archive/uci-4.0./customflagsettings/switchroleonuse.md).

# SwitchRoleOnUse

{% hint style="danger" %}
This is archived all will not work on the latest version.\
Archived version: 4.0.\*
{% endhint %}

**Description**\
When the item is used, this setting can switch the player's role (class) after an optional delay. Supports switching to built-in roles or to custom role systems (UCR/ECR).

**Parameters**

* `delay` — `float?` — Seconds to wait before the role switch occurs. Default: `1`.
* `role_type` — `string?` — `"UCR"` or `"Normal"`. Leave blank to use default behavior. Default: `""`.
* `role_id` — `uint?` — Role identifier. If `role_type` is `Normal`, this should be a [`RoleTypeId`](/uncomplicatedcustomitems/api/enums/external/roletypeid.md) enum value. If `role_type` is `UCR`/`ECR`, this should be the custom role ID. Default: `1`.
* `spawn_flags` — [`RoleSpawnFlags`](/uncomplicatedcustomitems/api/enums/external/rolespawnflags.md)`?` — For `Normal` role types, controls how the new role spawns: `None`, `AssignInventory`, `UseSpawnpoint`, or `All`. Default: `None`.
* `keep_location` — `bool?` — If `true`, the player remains at their current position after the role change (useful for role swaps without teleporting). Default: `false`.

**Behavior notes**

* `Delay` allows for animations/sfx before the switch completes.
* When using `role_type: Normal`, `spawn_flags` determines whether to give the new role its normal inventory, spawnpoint, or both.
* `RoleId` must match the expected identifier for the selected `role_type`. Be careful mixing `Normal` and `UCR` without correct IDs.

**Example Yaml context**

```yaml
flag_settings:
  switch_role_on_use_settings:
  - delay: 6
    role_type: "Normal"
    role_id: 0
    spawn_flags: "None"
    keep_location: true
```


---

# 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.uci.ucserver.it/uncomplicatedcustomitems/archive/uci-4.0./customflagsettings/switchroleonuse.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.
