Violet

Skill Book

On this page

Provides access to skill information. For skill usage, see input.

Skill Properties
  • id - Unique identifier
  • name - Readable skill name
  • level - Current level
  • max_level - Effective maximum (master) level

Functions

core.skill_book.get_skill(skill_id: number) -> skill | nil

Available on GMS and CW

Returns a skill object or nil if not found.


core.skill_book.get_skills() -> table<skill>

Available on GMS and CW

Returns all skills in the skill book.


core.skill_book.get_skill_level(skill_id: number) -> number

Available on GMS and CW

Returns the current level of the specified skill.


core.skill_book.get_skill_max_level(skill_id: number) -> number | nil

Available on GMS and CW

Returns the skill's effective maximum (master) level, accounting for hyper and 5th-job caps. Returns nil if the skill isn't in the skill book.


core.skill_book.is_skill_on_cooldown(skill_id: number) -> boolean

Available on GMS and CW

Returns true if the skill is on cooldown.


core.skill_book.can_use(skill_id: number) -> boolean | nil, string?

Available on GMS and CW

Returns true if the skill can be cast right now: it is learned, the character can pay its cost (HP, MP, mesos, items or a class gauge), and it isn't on cooldown. For charge skills, "on cooldown" means no charge is left, so it stays true while a charge remains even though the recharge timer is running. It also accounts for cast conditions the cooldown functions don't check. Returns nil if there is no local player. When it returns false, a second value names the reason.

ReasonMeaning
"not_learned"The character doesn't have the skill, or it is a passive skill.
"cooldown"The skill is on cooldown, or a charge skill has no charge left.
"hp"Not enough HP to pay the skill's cost.
"mp"Not enough MP, or not enough of the class's MP substitute, such as Demon Fury.
"mesos"Not enough mesos to pay the skill's cost.
"item"A required item is missing, or there aren't enough of it.
"resource"A class gauge or other required points are too low, for example Surplus Supply or a Soul Weapon's gauge.
"tag"Zero only: the skill belongs to the other form (Alpha or Beta), and Zero can't tag to it right now, for example while the tag is on cooldown or the other form is still out.
"other"The skill can't be cast for another reason.

It doesn't check every cast condition, for example seals, stuns, map restrictions, riding or the equipped weapon, so a cast can still fail while can_use returns true.


core.skill_book.can_level_up(skill_id: number) -> boolean | nil, string?

Available on GMS and CW

Returns true if a skill point can go into the skill right now: the skill is one of the character's own skills, it is below its level cap, its requirements are met, the pool it spends from has a point left, and the current map allows raising skills. Returns nil if character data is unavailable. When it returns false, a second value names the reason; an unknown skill ID gives "unavailable".

ReasonMeaning
"unavailable"SP can't raise this skill on this character: it belongs to another job, its level is fixed, or it levels another way (V and HEXA skills).
"max_level"The skill is at its max level. A hyper skill is already learned.
"master_level"The skill is at its master level; a mastery book raises it.
"character_level"The character's level is too low for the next point.
"required_skill"Another skill has to reach a level first.
"no_sp"No points left in the pool the skill spends from.
"map"Skills can't be raised on the current map.
"other"The point can't go in for another reason.

Only one reason is returned. "unavailable" comes before the others, and "no_sp" or "map" only when nothing about the skill itself blocks the point.

lua
local player = core.object_manager.get_local_player()
local ok, why = core.skill_book.can_level_up(skill_id)
if ok then
    player:level_up_skill(skill_id, 1)
end

core.skill_book.get_skill_level_up_info(skill_id: number) -> table | nil

Available on GMS and CW

Returns the details behind can_level_up: where the skill's points come from and what it still needs. Returns nil for an unknown skill ID or if character data is unavailable.

FieldTypeMeaning
can_level_upbooleanSame answer as can_level_up.
reasonstring?Same reason; absent when can_level_up is true.
poolstring?"beginner", "job", "hyper_passive" or "hyper_active". Absent when SP can't raise the skill.
tiernumber?For the beginner and job pools, the tier to pass to player:get_skill_sp.
spnumberPoints left in that pool.
levelnumberPoints already in the skill.
max_levelnumberThe skill's max level.
master_levelnumber?Mastery-book skills only: the level the character can currently raise it to. Absent when SP can't raise the skill.
required_skillstablePrerequisites, each { id, level, current }: the skill ID, the level it needs, and its level now. Empty when there are none or SP can't raise the skill.
required_anybooleantrue when one met prerequisite is enough instead of all of them.
lua
local info = core.skill_book.get_skill_level_up_info(skill_id)
if info and info.reason == "required_skill" then
    for _, req in ipairs(info.required_skills) do
        if req.current < req.level then
            core.log(("Raise skill %d to level %d first (now %d)"):format(req.id, req.level, req.current))
        end
    end
end

core.skill_book.get_skill_charges(skill_id: number) -> number | nil

Available on GMS and CW

Returns how many charges a charge skill has right now. Returns nil if the skill isn't a charge skill (it runs on a plain cooldown) or there is no local player. While a charge skill recharges, is_skill_on_cooldown and get_skill_cooldown_remaining report that recharge timer, so use this (or can_use) to know whether it can still be cast.

Sol Janus: Dawn (500001002) uses a cooldown and returns nil; its summon capacity is not a charge count.


core.skill_book.get_skill_cooldown_remaining(skill_id: number) -> number

Available on GMS and CW

Returns the skill's remaining cooldown in milliseconds, or 0 when it is off cooldown. Always agrees with is_skill_on_cooldown, and it reports the true server cooldown even while No Delay is enabled. For charge skills this is the time until the next charge, not a block on casting.