> For the complete documentation index, see [llms.txt](https://legion-studios.gitbook.io/legion-studios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legion-studios.gitbook.io/legion-studios/frameworks/skills.md).

# Skills

The skills framework aims to make it easier on mission / mod makers to check for things like if a unit is a medic, pilot, tank driver, etc.

Legion's skill framework will handle setting vanilla / ACE skills when used, e.g. using ACE's `ace_medical_medicClass` variable when using the `"medic"` skill.

## 1. Unit skill levels

To get the skill level of a unit, use the `ls_common_fnc_getSkill` function.

```sqf
private _medicLevel = [player, "medic"] call ls_common_fnc_getSkill;

private _message = [
    "Player is untrained in medical",
    "Player is a medic",
    "Player is a doctor"
] select _medicLevel;
systemChat _message;
```

To set a level in a certain skill, use `ls_common_fnc_setSkill`. This sets the player as an advanced engineer in vanilla / ACE.

```sqf
[player, "engineer", 2] call ls_common_fnc_setSkill;
```

To check if a unit possesses a certain skill level, you can use `ls_common_fnc_checkSkill`, which returns true if the unit has a greater than or equal skill level to the one given. This is just a shorthand for: `([player, "skillName"] call ls_common_fnc_getSkill) >= _requiredLevel`.

Checks if the player has at least a level 1 tech skill.

```sqf
[player, "tech", 1] call ls_common_fnc_checkSkill;
```

## 2. Configuration

### 2.1 Adding a custom skill

Adding a skill on its own is very easy and nothing is explicitly needed, you can just use `[_unit, "yourSkillName"] call ls_common_fnc_setSkill` and it will set the necessary variable that you can use with `ls_common_fnc_getSkill` and `ls_common_fnc_checkSkill`.

To have your skill appear in the Zeus module, you can add some data to the `ls_skills` config class. For example you could make a "leadership" skill to denote if a unit is an NCO / command member.

```cpp
class ls_skills {
    class default;
    class leader: default {
        scope = 2;
        name = "Leadership";
        tooltip = "Unit's skill in leading and commanding others.";
    };
};
```

## 3. Functions

### 3.1 `ls_common_fnc_setSkill`

#### Description

Sets a certain skill level for a unit.

#### Parameters

| Index | Description | Datatype(s) | Default Value |
| ----- | ----------- | ----------- | ------------- |
| 0     | Unit        | Object      |               |
| 1     | Skill name  | String      |               |
| 2     | Skill level | Number      | 1             |

#### Return Value

None

### 3.1 `ls_common_fnc_getSkill`

#### Description

Returns a unit's skill level.

#### Parameters

| Index | Description | Datatype(s) | Default Value |
| ----- | ----------- | ----------- | ------------- |
| 0     | Unit        | Object      |               |
| 1     | Skill name  | String      |               |

#### Return Value

Unit's skill level

### 3.2 `ls_common_fnc_checkSkill`

#### Description

Checks if a unit has a certain skill.

#### Parameters

| Index | Description | Datatype(s) | Default Value |
| ----- | ----------- | ----------- | ------------- |
| 0     | Unit        | Object      |               |
| 1     | Skill name  | String      |               |
| 2     | Skill level | Number      | 1             |

#### Return Value

True if unit's skill level is greater than or equal to given skill level, otherwise false.

## 4. Examples

Get a list of all advanced BLUFOR pilots

```sqf
private _bluforPilots = ([] call CBA_fnc_players) select {
    side group _x == west && {
        // 0 = untrained, 1 = trained, 2 = advanced
        [_x, "pilot", 2] call ls_common_fnc_checkSkill;
    };
};
```


---

# 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://legion-studios.gitbook.io/legion-studios/frameworks/skills.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.
