Skip to content

Skill Functions

Skill Info Queries

All take a skill index (number) and return number.

Function Description
GetSkillDamage(index) Base damage of the skill
GetSkillMana(index) Mana cost
GetSkillBP(index) AG (BP) cost
GetSkillType(index) Skill type (attack, buff, etc.)
GetSkillEffect(index) Effect ID the skill applies
GetSkillDelay(index) Cooldown time
GetSkillDamageType(index) Damage type (physical, magic, etc.)
GetElementImprintBonus(index) Elemental imprint bonus value
GetAddDamageOption(index) Additional damage option value
local manaCost = GetSkillMana(41) -- Mana cost of skill 41
local dmg = GetSkillDamage(41)
LogAdd(LOG_BLUE, "Skill 41: damage=" .. dmg .. " mana=" .. manaCost)

Skill Info (Object-Dependent)

Function Description
GetSkillRange(lpObj, index) Effective range for the player
GetSkillRadio(lpObj, index) AoE radius for the player
GetSkillSlot(lpObj, index) Slot index of the skill in the player's skill list
GetSkillMultiCount(lpObj, lpSkill) Number of multi-hit targets
local range = GetSkillRange(player, 41)

GetSkillNumber(index, level)

Returns the resolved skill number for a base skill at a given level.

local resolved = GetSkillNumber(41, 10)

GetSkillAngle(x, y, tx, ty)

Calculates the angle between two positions (for frustrum skills).

  • Returns: number — angle value
local angle = GetSkillAngle(player.X, player.Y, target.X, target.Y)

AttackDirection(aIndex, bIndex)

Returns the attack direction byte from attacker to target.

local dir = AttackDirection(player.Index, target.Index)

GetDirectionAboutByte(dir)

Converts a direction byte to a normalized direction value.

local normalized = GetDirectionAboutByte(dir)

Skill Requirement Checks

All return boolean.

Function Description
CheckSkillMana(lpObj, index) Has enough mana
CheckSkillBP(lpObj, index) Has enough AG
CheckSkillRange(lpObj, index, x, y, tx, ty) Target is in range
CheckSkillRadio(lpObj, index, x, y, tx, ty) Target is in AoE radius
CheckSkillDelay(lpObj, lpSkill, type) Skill is not on cooldown
CheckSkillTarget(lpObj, aIndex, bIndex, type) Target is valid
CheckSkillRequireLevel(lpObj, index) Player meets level requirement
CheckSkillRequireEnergy(lpObj, index) Player meets energy requirement
CheckSkillRequireLeadership(lpObj, index) Player meets leadership requirement
CheckSkillRequireKillPoint(lpObj, index) Player meets kill point requirement
CheckSkillRequireGuildStatus(lpObj, index) Player meets guild status requirement
CheckSkillRequireClass(lpObj, index) Skill is available for player's class
CheckSkillRequireWeapon(lpObj, index) Player has the required weapon equipped
CheckAttackRange(nIndex, nTargetIndex, nDistance, nAttackType, nSubAttackType) Attack range check
if CheckSkillMana(player, 41) and CheckSkillBP(player, 41) then
    LogAdd(LOG_GREEN, "Player can cast skill 41.")
end

IsSkillItem(index)

Returns true if the given skill index belongs to an item skill.

if IsSkillItem(41) then
    LogAdd(LOG_BLUE, "Skill 41 is an item-based skill.")
end

Skill Add/Remove

Function Description Returns
AddSkill(lpObj, index, level, group) Adds or updates a skill number (slot)
DelSkill(lpObj, index) Removes a skill number
GetSkill(lpObj, index) Gets the CSkill object CSkill or nil
AddSkillWeapon(lpObj, index, level) Adds a weapon skill number
DelSkillWeapon(lpObj, index, level) Removes a weapon skill number
AddMasterSkill(lpObj, index, level) Adds a Master skill number
DelMasterSkill(lpObj, index) Removes a Master skill number
GetMasterSkill(lpObj, index) Gets a Master CSkill CSkill or nil
AddEnhanceSkill(lpObj, index, level, group) Adds an Enhance (4th) skill number
AddEnhancePassiveSkill(lpObj, index, level, group) Adds an Enhance passive skill number
GetEnhanceSkill(lpObj, index, group) Gets an Enhance CSkill CSkill or nil
GetEnhancePassiveSkill(lpObj, index, group) Gets an Enhance passive CSkill CSkill or nil
AddSkill(player, 41, 1, 0) -- Add skill 41 at level 1
GCSkillListSend(player, 0)  -- Refresh client skill list

Skill Tree Queries

Function Description Returns
CheckMasterLevel(lpObj) Can gain Master experience boolean
GetMasterSkillValue(lpObj, skillIndex) Computed value of a Master skill number (float)
GetMasterSkillLevel(lpObj, skillIndex) Current level of a Master skill number
CheckEnhanceLevel(lpObj) Can use 4th skill tree boolean
CheckAbilityLevel(lpObj) Can use Ability Enhancement (v1913+) boolean
GetEnhanceSkillValue(lpObj, skillIndex, group) Value of an Enhance skill number
if CheckMasterLevel(player) then
    local val = GetMasterSkillValue(player, 300)
    LogAdd(LOG_BLUE, "Master skill 300 value: " .. val)
end

Special Skill Functions

SkillSpinStepExplosion(lpObj, lpTarget, skillIndex, damage)

Executes the Spin Step Explosion skill (Rage Fighter). Available from version S6 onwards.

  • Returns: boolean
SkillSpinStepExplosion(player, target, 260, 500)

SkillMagicGladiatorExplosion(lpObj, skillIndex, damage)

Executes the MG Explosion skill AoE.

SkillMagicGladiatorExplosion(player, 90, 1000)

gObjSkillUseProc(lpObj)

Processes pending skill actions for the object. Used in monster AI.

gObjSkillUseProc(monster)

These send skill-related packets to clients for visual feedback.

GCSkillAttackSend(lpObj, skillIndex, lpTarget, type)

Notifies clients of a skill attack animation.

GCSkillAttackSend(player, 41, target, 0)

GCSkillCancelSend(lpObj, skill)

Cancels a skill effect on the client.

GCSkillCancelSend(player, 41)

GCDurationSkillAttackSend(lpObj, bIndex, skill, x, y, dir)

Sends a duration-based skill attack (e.g., area effects).

GCDurationSkillAttackSend(player, target.Index, 41, player.X, player.Y, player.Dir)

GCSkillActionSend(lpObj, lpSkill, bIndex, skillsuccess, x, y)

Sends a skill action packet (used for buff/special skills).

local sk = GetSkill(player, 41)
if sk then
    GCSkillActionSend(player, sk, target.Index, 1, player.X, player.Y)
end

GCRuneWizzardSkillAttackSend(lpObj, lpSkill, tx, ty, dir, angle)

Sends a Rune Wizard skill attack packet.

local sk = GetSkill(player, 700)
if sk then
    GCRuneWizzardSkillAttackSend(player, sk, target.X, target.Y, player.Dir, 0)
end

GCRageFighterSkillAttackSend(lpObj, skill, aIndex, type)

Sends a Rage Fighter skill attack packet.

GCRageFighterSkillAttackSend(player, 260, target.Index, 0)

GCSkillAddSend(aIndex, slot, skill, level, type)

Notifies the client that a skill was added.

GCSkillAddSend(player.Index, 5, 41, 1, 0)

GCSkillDelSend(aIndex, slot, skill, level, type)

Notifies the client that a skill was removed.

GCSkillDelSend(player.Index, 5, 41, 1, 0)

GCSkillListSend(lpObj, type)

Sends the full skill list to the player client.

GCSkillListSend(player, 0) -- Refresh after adding/removing skills