Skip to content

SkillTrees

flango edited this page Mar 6, 2023 · 6 revisions

×× RPG/XCOM-style skill trees ××

Contents:

Skill trees!

XCOM-style skill tree

RPG-style skill tree with prerequisites


Performance impact: ❓ Should be fine but needs more testing.


Defs:

SkillTreeDef

Description.

Note: Do not put more than 4 rows of skills. Why? Just don't.

<flangoCore.SkillTreeDef>
    <defName>fc_TestTree</defName>
    <label>Ranger</label>
    <description>Test tree.</description>
    <tooltip>Fancy tooltip.</tooltip>
    <iconPath>Skills/Ranger</iconPath>
    <tab>XCOM: Ranger</tab>
    <textWidth>100</textWidth>
    <!-- <order>0</order> -->
    <rowNames>
        <li>Raider</li>
        <li>Disabler</li>
        <li>Breacher</li>
        <li>XCOM</li>
    </rowNames>
    <levels>
        <li>
            <label>Squaddie</label>
            <iconPath>Skills/Squaddie</iconPath>
            <skills>
                <li>Test_Skill_1Row1Skill</li>
                <li>Test_Skill_2Row1Skill</li>
            </skills>
        </li>
        <li>
            <label>Corporal</label>
            <iconPath>Skills/Corporal</iconPath>
            <skills>
                <li>Test_Skill_1Row2Skill</li>
                <li>Test_Skill_2Row2Skill</li>
                <li>Test_Skill_3Row2Skill</li>
                <li>Test_Skill_4Row2Skill</li>
            </skills>
        </li>
        <li>
            <label>Sergeant</label>
            <iconPath>Skills/Sergeant</iconPath>
            <skills>
                <li>Test_Skill_1Row3Skill</li>
                <li>Test_Skill_2Row3Skill</li>
                <li>Test_Skill_3Row3Skill</li>
            </skills>
        </li>
        <li>
            <label>Lieutenant</label>
            <iconPath>Skills/Lieutenant</iconPath>
            <skills>
                <li>Test_Skill_1Row4Skill</li>
                <li>Test_Skill_2Row4Skill</li>
                <li>Test_Skill_3Row4Skill</li>
            </skills>
        </li>
        <li>
            <label>Captain</label>
            <iconPath>Skills/Captain</iconPath>
            <skills>
                <li>Test_Skill_1Row5Skill</li>
                <li>Test_Skill_2Row5Skill</li>
                <li>Test_Skill_3Row5Skill</li>
                <li>Test_Skill_4Row5Skill</li>
            </skills>
        </li>
        <li>
            <label>Major</label>
            <iconPath>Skills/Major</iconPath>
            <skills>
                <li>Test_Skill_1Row6Skill</li>
                <li>Test_Skill_2Row6Skill</li>
                <li>Test_Skill_3Row6Skill</li>
                <li>Test_Skill_4Row6Skill</li>
            </skills>
        </li>
        <li>
            <label>Colonel</label>
            <iconPath>Skills/Colonel</iconPath>
            <skills>
                <li>Test_Skill_1Row7Skill</li>
                <li>Test_Skill_2Row7Skill</li>
                <li>Test_Skill_3Row7Skill</li>
            </skills>
        </li>
    </levels>
</flangoCore.SkillTreeDef>

SkillDef

Stuff that appears in the skill tree UI. Grants abilities and/or hediffs to a pawn.

Example:

<flangoCore.SkillDef>
    <defName>Test_Skill_Stun</defName>
    <label>Stun</label>
    <description>This pawn can stun nearby pawns using some magic.\nGives the Stun ability.</description>
    <iconPath>Skills/Stun</iconPath>
    <cost>5</cost> <!-- XP to unlock. Default: 1 -->
    <abilities>
        <li>Test_Ability_Stun</li>
    </abilities>
    <!--
    <hediffs>
        <li>Test_Hediff_Eggplant</li>
    </hediffs>
    <prerequisites>
        <li>Test_Skill_Tomato</li>
    </prerequisites>
    -->
</flangoCore.SkillDef>

image

Learning skill trees:

  • CompProperties_SkillTreeGiver
    gif
  • Give skill tree... debug action.
    image

Gaining XP:

  • CompProperties_SkillTreeXPGiver - Items which give a fixed amount XP. (Like skilltrainers)
  • CompAbilityEffect_GainXP - ❓ Untested.
  • HediffCompProperties_XPOverTime - XP over time.
<comps>
    <li Class="flangoCore.HediffCompProperties_XPOverTime">
        <tree>fc_TestTree</tree>
        <xpAmount>0.1</xpAmount>
        <intervalTicks>60</intervalTicks> <!-- 0.1 XP every seconds -->
   <!-- <ignoreMultiplier>false</ignoreMultiplier> --> <!-- Will be used in the future. Default: false -->
   <!-- <giveToAllTrees>false</giveToAllTrees> --> <!-- Give XP to all skill trees. Default: false -->
    </li>
</comps>

Example Skill tree/XP items:

<!--
    Note: SkillItemBase is just an example, it's not necessary to copy it over. 
          Just make sure your ThingDef is a ThingWithComps and has any of the comps. 
-->

<!-- Base -->
<ThingDef ParentName="ResourceBase" Name="SkillItemBase" Abstract="True">
    <thingClass>ThingWithComps</thingClass>
    <graphicData>
        <texPath>Book</texPath>
        <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <thingCategories>
        <li>Artifacts</li>
    </thingCategories>
    <tradeTags>
        <li>Artifact</li>
    </tradeTags>
    <resourceReadoutPriority>Middle</resourceReadoutPriority>
    <stackLimit>1</stackLimit>
    <tradeNeverStack>true</tradeNeverStack>
    <useHitPoints>true</useHitPoints>
    <relicChance>2</relicChance>
    <drawGUIOverlay>false</drawGUIOverlay>
    <techLevel>Archotech</techLevel>
    <thingSetMakerTags>
        <li>RewardStandardHighFreq</li>
    </thingSetMakerTags>
    <statBases>
        <Mass>0.5</Mass>
        <StyleDominance MayRequire="Ludeon.RimWorld.Ideology">10</StyleDominance>
    </statBases>
    <comps>
        <li Class="CompProperties_UseEffectDestroySelf" />
        <li Class="CompProperties_Styleable" />
    </comps>
</ThingDef>


      <!-- ----==== Items ====---- -->


<ThingDef ParentName="SkillItemBase"> <!-- Skill tree Giver -->
    <defName>fc_SkillItem_Tree</defName>
    <label>Test Tree Item</label>
    <description>...</description>
    <statBases>
        <MarketValue>1200</MarketValue>
        <MaxHitPoints>60</MaxHitPoints>
    </statBases>
    <comps>
        <li Class="flangoCore.CompProperties_SkillTreeGiver">
            <useJob>UseSkillItem</useJob>
            <useLabel>Learn skill tree</useLabel>
            <tree>fc_TestTree</tree>
        </li>
    </comps>
</ThingDef>

<ThingDef ParentName="SkillItemBase"> <!-- XP Giver -->
    <defName>fc_SkillItem_XP</defName>
    <label>Test XP Item</label>
    <description>...</description>
    <stackLimit>10</stackLimit>
    <relicChance>3</relicChance>
    <drawGUIOverlay>true</drawGUIOverlay>
    <statBases>
        <MarketValue>500</MarketValue>
        <MaxHitPoints>60</MaxHitPoints>
    </statBases>
    <comps>
        <li Class="flangoCore.CompProperties_SkillTreeXPGiver">
            <useJob>UseSkillItem</useJob>
            <useLabel>Gain XP</useLabel>
            <tree>fc_TestTree</tree>
            <xpAmount>5.5</xpAmount>
       <!-- <ignoreMultiplier>false</ignoreMultiplier> --> <!-- Will be used in the future. Default: false -->
       <!-- <giveToAllTrees>false</giveToAllTrees> --> <!-- Give XP to all skill trees. Default: false -->
        </li>
    </comps>
</ThingDef>

🦩 Home

🚧 - 404 Page not found.
🖼 - Preview needed.

🟡 - Works but has some TODOs.
🟠 - Basic functionality implemented.
🔴 - Not working properly.
❓ - Not tested.


--== XML ==--

💡 Abilities

General

Ability Givers

Equipment Abilities

🟡 Should recode some stuff 🟡

🌳 Skill Trees

🟠 WIP, work/kill XP gain not implemented 🟠

Defs

Comps

🏘 Buildings

⚙ Comps

🏹 Equipment

General

Weapons

Projectiles

🧪 Hediffs

🧍‍♂‍ Pawn behaviors

📊 Stats

🎲 Misc

🧔 Vanilla Expanded

✨ Debug (Dev Mode)


--== C# ==--

📂 Shared Classes

🧬 Patches


Clone this wiki locally