[CPLUS plus ex] Pilot Overrides - Redacted-Rice/ITB-RedactedRiceExts GitHub Wiki
Pilot Overrides
Transparent overrides of memhack Pilot APIs so virtual skills (slots 3+) work through the same calls as vanilla slots 1-2. Initialized after Skill State tracking.
You normally call the standard memhack methods. CPLUS+ routes indexes 3+ to virtual skill objects. See Home for virtual skill concepts.
Table of Contents
getLvlUpSkill
PilotLvlUpSkill|nilpilot:getLvlUpSkill(index)
| Argument name | Type | Description |
|---|---|---|
index |
number | Skill slot (1-based). Must be >= 1 |
| Index range | Behavior |
|---|---|
1-MAX_SKILL_SLOTS (2) |
Original memhack implementation |
| 3+ | Virtual skill objects from CPLUS+ tracking |
Virtual index mapping: slot 3 -> first virtual skill, slot 4 -> second, etc. Returns nil if the pilot has no skill at that virtual index.
Example:
local pilot = Board:GetPawn(0):GetPilot()
local slot1 = pilot:getLvlUpSkill(1) -- vanilla
local slot3 = pilot:getLvlUpSkill(3) -- first virtual, or nil
if slot3 then
LOG(slot3:getIdStr())
end
setLvlUpSkill
pilot:setLvlUpSkill(index, structOrNewVals)
| Argument name | Type | Description |
|---|---|---|
index |
number | Skill slot (1-based). Must be >= 1 |
structOrNewVals |
PilotLvlUpSkill or table | Struct to set(), or field table |
| Index range | Behavior |
|---|---|
| 1-2 | Original memhack implementation |
| 3+ | Updates the matching virtual skill object |
For virtual slots, structOrNewVals may be:
- A
PilotLvlUpSkillstruct (_addressfunction present) ->skillObj:set(struct) - A plain table of fields -> calls setters such as
setHealthBonusfrom keys likehealthBonus
Errors if the virtual index is out of range or the value is nil/not a table.
Example:
pilot:setLvlUpSkill(3, { healthBonus = 2, moveBonus = 0 })
combineBonuses
Override of Pilot:_combineBonuses so earned virtual skills contribute to combined bonuses.
Behavior:
- Collects bonuses from all earned skill indexes (real and virtual) via
getPilotEarnedSkillIndexes - If there are no virtual skills, runs original combine then applies special health handling
- If there are virtual skills, writes the total health/cores/grid/move into slot 1 via private
_set*Bonussetters, and zeroes slot 2's combined bonuses
Health special case: After combine, if Board exists, initial skill assignment has finished, and the pilot has a pawn on the board, adjusts that pawn's max health and current health by the delta between previous and new combined health bonuses. Without this, changes do not take effect until after the current mission
Mods that only read bonuses through getLvlUpSkill/combined slot values get virtual contributions automatically.
GetSkillInfo
GetSkillInfo is overridden once per session (after other mods load so CPLUS+ can wrap last) to append virtual skill names to pilot skill descriptions.
In run/hangar (Game available)
When an available pilot has that innate skill and virtual skills:
<original description>
Extra Skills: Name1, Name2, ...
Names come from registered skill fullName via GetText.
Between missions (no Game)
If a matching time traveler candidate has virtual skills, appends comma separated skill names on a new line (no "Extra Skills:" prefix). Otherwise returns the original description.
Example effect when hovering a pilot skill that has virtual extras:
Original skill text
Extra Skills: Vigor, Vampire
Virtual skills still do not appear in the vanilla pilot skill boxes. This append (and the Extra Info UI panel) is how they show in the UI.