# setCombatRoles

<p class="callout info">An eventCall to assign roles to idAI2 in an idEncounterManager.</p>

## Usage

```
item[0] = {
	eventCall = {
		eventDef = "setCombatRoles";
		args = {
			num = 3;
			item[0] = {
				eEncounterSpawnType_t = ""; // spawnType
			}
			item[1] = {
				string = ""; // group_label
			}
			item[2] = {
				encounterGroupRole_t = ""; // group_role
			}
		}
	}
}
```

- `spawnType` are the [`eEncounterSpawnType_t`](https://wiki.eternalmods.com/books/entities-custom-encounters/page/eencounterspawntype-t "eEncounterSpawnType_t") that you want to given a role.
- `group_label` is the label for the ai be given a role by this eventCall. This parameter is optional, and can be left blank.
- `group_role` is the [`encounterGroupRole_t`](https://wiki.eternalmods.com/books/entities-custom-encounters/page/encountergrouprole-t "encounterGroupRole_t") (combat role) that you wish to give to the specified ai.

## Example Usage

```
item[0] = {
	eventCall = {
		eventDef = "spawnSingleAI";
		args = {
			num = 3;
			item[0] = {
				eEncounterSpawnType_t = "ENCOUNTER_SPAWN_MANCUBUS";
			}
			item[1] = {
				entity = "ai_target_spawn_454";
			}
			item[2] = {
				string = "defender";
			}
		}
	}
}
item[1] = {
	eventCall = {
		eventDef = "setCombatRoles";
		args = {
			num = 3;
			item[0] = {
				eEncounterSpawnType_t = "ENCOUNTER_SPAWN_ANY"; // spawnType
			}
			item[1] = {
				string = "defender"; // group_label
			}
			item[2] = {
				encounterGroupRole_t = "ROLE_DEFEND"; // group_role
			}
		}
	}
}
```

In this example, a Mancubus is spawned with the label `defender`, and then `setCombatRoles` is used to set any ai type with the `defender` label to `ROLE_DEFEND`.

## See Also

- [clearCombatRoles](https://wiki.eternalmods.com/books/creating-custom-encounters/page/clearcombatroles)