Skip to content

useSkillBase

useSkillBase is a hook that reads the level a player has earned in a skill — what is left when a boost or a drain is taken away — and makes the component follow it. useSkill is the level they have right now.

useSkillBase(skill: SkillRef): Int
src/skills.ts2
/** The same twenty-three again, unboosted. A total is counted from these. */
const baseAttack = useSkillBase(Skills.ATTACK);
const baseStrength = useSkillBase(Skills.STRENGTH);
const baseDefence = useSkillBase(Skills.DEFENCE);
  • skill: A Skills.* reference, named at the call — the same rule as useSkill.

The base level, as an Int.

  • The reference is named at the call (TS2E123 otherwise). Pass the level down, not the skill.
  • Read-only.
  • Use the base level for a requirement. A boost should not unlock content; a drain should not lock it.
src/skills.ts2
<SkillTile icon={SkillIcons.get(Skills.STRENGTH)} level={strength} base={baseStrength} x={1} y={1 + TILE_H} />
src/skills.ts2
<text x={44} y={16} w={15} h={12} text={`${base}`} font={Fonts.SMALL}
align="center" shadow color={Colors.YELLOW} />
src/skills.ts2
const total = baseAttack + baseStrength + baseDefence + baseRanged + basePrayer
src/skills.ts2
<text x={2} y={2} w={{ fill: 4 }} h={{ fill: 4 }} text={`Total level: ${total}`}
font={Fonts.SMALL} align="center" valign="middle" shadow
color={Colors.YELLOW} />

The number does not move when a boost is applied

Section titled “The number does not move when a boost is applied”

If you wanted the boosted level, read useSkill.