# Stat Groups & Identities

You can get stat groups and stat identities through code at runtime. However, they cannot be created at runtime.

## Stat Groups

Stat groups are used to group together stats that are meant for a similar purpose.

### Getting All Groups

```csharp
var myGroups = SkillTree.GetAllStatGroups();
```

### Getting a Single Group

#### By Name

```csharp
var myGroup = SkillTree.GetStatGroup("My Group Name");
```

#### By ID

```csharp
var myGroup = SkillTree.GetStatGroup(0);
```

## Stat Identities

A stat identity is a way to identify a stat and set general rules for it.

### Getting All Stat Identities

```csharp
var myStatIDs = SkillTree.GetAllStatIdentities();
```

#### From a Stat Group

You can access all stat identities in the group with the `myStatGroup.statIdentities` field.

### Getting a Single Stat Identity

#### By Name

```csharp
var myStatID = SkillTree.GetStatIdentity("My Stat Name");
```

#### By ID

```csharp
var myStatID = SkillTree.GetStatIdentity(0);
```


---

# Agent Instructions: 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://stylishesper.gitbook.io/skill-tree/systems/stats/scripting/stat-groups-and-identities.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.
