Repository navigation
[CPLUS plus ex] Skill Registration
API for registering custom level up skills with CPLUS+ Ex.
- Pilot Functions
- registerSkill
- registerPilotSkillExclusions
- registerPilotSkillInclusions
- registerSquadSkillExclusions
- registerSquadSkillInclusions
- registerSkillExclusion
- registerSkillToGroup
- getRegisteredSkillInfo
- isInternalSkill
Pilot Inclusions/Exclusions can take a function instead of a pilot id. These functions take pilotId as the arg and should return true if the pilot should not get the skill - i.e. if it should create the constraint or false if the exclusion should not be created - i.e. the pilot is allowed to get the skill. This allows for more generic exclusions in particular for things like cyborg.
There are several pilot functions included in CPLUS+ for cyborg pilots. See utils for the list and details of the available functions.
-
voidcplus_plus_ex:registerSkill(category, idOrTable, shortName, fullName, description, bonuses, skillType, defaultReusability, reusabilityLimit, slotRestriction, weight, icon, constraints)
| Argument name | Type | Description |
|---|---|---|
category |
string | Category for UI grouping (e.g., "Vanilla", "RedactedRice", "Movement", etc.) |
idOrTable |
string or table | Skill ID or table containing all skill properties (required) |
shortName |
string | Localization key for short name (required) |
fullName |
string | Localization key for full name (required) |
description |
string | Localization key for description (required) |
bonuses |
table | Table of stat bonuses (optional, default: all 0s) |
skillType |
string | "default" or "inclusion". See Key Concepts: Exclusions and Inclusions. (optional, default: "default") |
defaultReusability |
int | See Key Concepts: Reusability (optional, default: PER_PILOT) |
reusabilityLimit |
int | The most reusability allowed/supported by code. See Key Concepts: Reusability (optional, default: PER_PILOT) |
slotRestriction |
int | See Key Concepts: Slot Restriction(optional, default: ANY) |
weight |
float | Default probability weight (optional, default: 1.0) |
icon |
string | Path to 21x21 image to display in the skills config menu (optional) |
constraints |
table | Table defining relationships and constraints for this skill (optional) |
When to call: Register skills in your mod's init() function, before onModsFirstLoaded.
Registers a new level up skill. Can be called with either individual parameters or a single table. If using a single table, the same parameters are allowed, expected, and optional just as a table instead of individual args.
Bonuses table format:
| Field | Type | Description |
|---|---|---|
health |
int | Additional health points |
move |
int | Additional movement squares |
grid |
int | Additional grid defense percentage |
cores |
int | Additional reactor cores |
Constraints table format:
See Key Concepts Section for more details on what the different types of constraints mean
| Field | Type | Description |
|---|---|---|
groups |
string/table | String or array of group names this skill belongs to |
skillExclusions |
string/table | String or array of skill IDs that are mutually exclusive with this skill |
pilotExclusions |
string/fn/table | String, fn, or array of pilot IDs that cannot have this skill |
pilotInclusions |
string/fn/table | String, fn, or array of pilot IDs that can have this skill |
squadExclusions |
string/table | String, fn, or array of squad IDs that cannot have this skill |
squadInclusions |
string/table | String, fn, or array of squad IDs that can have this skill |
Example:
-- Using table format
cplus_plus_ex:registerSkill("Custom", {
id = "MySkill",
shortName = "My_Skill_Short",
fullName = "My_Skill_Name",
description = "My_Skill_Desc",
bonuses = {health = 2, move = 1},
defaultReusability = cplus_plus_ex.REUSABLILITY.PER_PILOT,
weight = 1.0
})-
voidcplus_plus_ex:registerPilotSkillExclusions(pilotId, skillIds)
| Argument name | Type | Description |
|---|---|---|
pilotIdOrFn |
string or fn | Pilot ID (e.g., "Pilot_Original") |
skillIds |
string or table | Single skill ID or array of skill IDs to exclude |
Prevents specific pilots from receiving certain skills. This is compatible with vanilla's Blacklist system.
Note: CPLUS+ automatically reads vanilla pilot Blacklist fields, so you don't need to manually register those exclusions.
Example:
-- Single skill exclusion
cplus_plus_ex:registerPilotSkillExclusions("Pilot_Zoltan", "Health")
-- Multiple skill exclusions
cplus_plus_ex:registerPilotSkillExclusions("Pilot_Rock", {"Health", "Move"})-
voidcplus_plus_ex:registerPilotSkillInclusions(pilotId, skillIds)
| Argument name | Type | Description |
|---|---|---|
pilotId |
string | Pilot ID |
skillIds |
string or table | Single skill ID or array of skill IDs to include |
Allows specific pilots to receive skills marked as skillType = "inclusion". Use this for skills that should only be available to certain pilots.
Example:
-- Allow only specific pilots to get elite skill
cplus_plus_ex:registerPilotSkillInclusions("Pilot_Zoltan", "EliteSkill")
cplus_plus_ex:registerPilotSkillInclusions("Pilot_Youth", "EliteSkill")
-- Multiple inclusions
cplus_plus_ex:registerPilotSkillInclusions("Pilot_Leader", {"EliteSkill", "CommandSkill"})-
voidcplus_plus_ex:registerSquadSkillExclusions(squadId, skillIds)
| Argument name | Type | Description |
|---|---|---|
squadId |
string | Squad ID |
skillIds |
string or table | Single skill ID or array of skill IDs to exclude |
Prevents any pilots in a squad from receiving certain skills.
Example:
-- Single skill exclusion
cplus_plus_ex:registerSquadSkillExclusions("worldbuilders", "RrNimble")
-- Multiple skill exclusions
cplus_plus_ex:registerSquadSkillExclusions("starwars_rebels", {"RrPontoons", "RrJumpJets"})-
voidcplus_plus_ex:registerSquadSkillInclusions(squadId, skillIds)
| Argument name | Type | Description |
|---|---|---|
squadId |
string | Squad ID |
skillIds |
string or table | Single skill ID or array of skill IDs to include |
Allows any pilot in the squad to receive skills marked as skillType = "inclusion". Use this for skills that should only be available to certain squads.
Example:
-- Allow only specific pilots to get elite skill
cplus_plus_ex:registerSquadSkillInclusions("redactedrice_stormbreakers", "RrAvoidEnvironment")
-- Multiple inclusions
cplus_plus_ex:registerSquadSkillInclusions("radiationSquad", {"RrGainRadiation", "RrDoubleRadiation"})-
voidcplus_plus_ex:registerSkillExclusion(skillId, excludedSkillId)
| Argument name | Type | Description |
|---|---|---|
skillId |
string | First skill ID |
excludedSkillId |
string | Second skill ID |
Creates a bidirectional exclusion between two skills. Pilots cannot have both skills at the same time.
Example:
-- Prevent redundant bonuses
cplus_plus_ex:registerSkillExclusion("HealthPlus", "Health")
cplus_plus_ex:registerSkillExclusion("MovePlus", "Move")
-- Prevent thematically conflicting skills
cplus_plus_ex:registerSkillExclusion("Aggressive", "Defensive")-
voidcplus_plus_ex:registerSkillToGroup(skillId, groupName)
| Argument name | Type | Description |
|---|---|---|
skillId |
string | Skill ID |
groupName |
string | Name of group to add to |
Register a skill as part of a group
Example:
-- Prevent redundant bonuses
cplus_plus_ex:registerSkillToGroup("HealthPlus", "Add Health")
cplus_plus_ex:registerSkillToGroup("Health", "Add Health")-
tablecplus_plus_ex:getRegisteredSkillInfo(skillId)
| Argument name | Type | Description |
|---|---|---|
skillId |
string | Skill ID |
Gets all the registered information for the passed skill if it exists (or nil otherwise). This includes info on the skill itself. It does NOT include what exclusions/inclusions are defined for it or if its enabled or not.
Example:
local info = cplus_plus_ex:getRegisteredSkillInfo("Health")
if info then
LOG(info.id .. " category=" .. tostring(info.category))
end-
boolcplus_plus_ex:isInternalSkill(skillOrId)
| Argument name | Type | Description |
|---|---|---|
skillOrId |
string or table | Skill id string, or a registered skill table |
Returns true if the skill was registered with internalSkill = true.
Example:
if cplus_plus_ex:isInternalSkill("MyHiddenSkill") then
LOG("Hidden from UI/random pools")
end