Character¶
The Character
library contains utility methods relating to characters. The vast majority of them are available on both contexts.
CharacterLib Class¶
Inherits from Library
.
Events and Hooks¶
StatusApplied (event)¶
TODO move somewhere else, since victim could be an item
@field SourceHandle EntityHandle
@field Victim Character|Item
@field Status EclStatus|EsvStatus
ItemEquipped (event)¶
@field Character Character
@field Item Item
@field Slot ItemSlot
CreateEquipmentVisuals (hook)¶
Client-only.
@field Character EclCharacter
@field Item EclItem
@field Request EclEquipmentVisualSystemSetParam
Hookable.
@field RawEvent EclLuaCreateEquipmentVisualsRequestEvent
GetSkillAPCost (hook)¶
Fired from Character.GetSkillAPCost()
if Ext.Stats.Math.GetSkillAPCost()
is unavailable.
@field Character CDivinityStats_Character
@field Skill StatsLib_StatsEntry_SkillData
@field AiGrid EocAiGrid
@field Position vec3
WorldPos of the character.
@field Radius number
AI bounds size of the character.
@field AP integer
Hookable. Defaults to the value from `Game.Math.GetSkillAPCost()`
@field ElementalAffinity boolean
Hookable. Defaults to the value from `Game.Math.GetSkillAPCost()`
Methods¶
CanUseSkill¶
Returns whether char can enter preparation state for a skill.
@param char Character
@param skillID string
@param itemSource Item?
Get¶
@param identifier GUID|PrefixedGUID|NetId|EntityHandle
@param isFlashHandle boolean?
If true, the identifier will be passed through DoubleToHandle() first.
GetActionPoints¶
@param char Character
GetCombatID¶
function CharacterLib.GetCombatID(char)
-> integer?, integer? -- The combat ID and team ID. `nil` if the character is not in combat. This is different from the osi query, which returns a reserved value.
Returns the combat ID and team ID of char, if any.
@param char Character
GetCurrentSkill¶
function CharacterLib.GetCurrentSkill(char)
-> string? -- `nil` if the character has no active skill state.
Returns the ID of the skill that char is preparing or casting.
@param char Character
GetDynamicStat¶
@param char Character
@param statName string
GetEquippedItems¶
Returns the equipped items of char, per slot.
@param char Character
GetExperience¶
Returns the current experience points of char.
@param char Character
GetExperienceRequiredForLevel¶
Returns the cumulative experience required to reach a level.
@param targetLevel integer
GetGender¶
Returns the gender of char.
@param char Character
GetHighestPartyAbility¶
Gets the highest stat score of all characters in char's party.
@param char Character
@param ability string
Needs to be a property indexable in char.Stats
GetInitiative¶
Returns the initiative of char.
@param char Character
GetLevel¶
Returns the level of char.
@param char Character
GetMaxCarryWeight¶
Returns the maximum carry weight of char.
@param char Character
GetMovement¶
Returns the calculated movement stat of a character.
@param char Character
GetOwner¶
Returns the character's owner, if it is a summon or party follower(?).
@param char Character
GetPartyMembers¶
function CharacterLib.GetPartyMembers(char) -- (Server-only)
-> EsvCharacter[] Includes the char passed per param.-- the char passed per param.
Returns a list of party members of char's party. Char must be a player.
@param char EsvCharacter
GetPartyMembers¶
function CharacterLib.GetPartyMembers(char) -- (Client-only)
-> EclCharacter[] Includes the char passed per param.-- the char passed per param.
Returns a list of party members of char's party. Char must be a player.
Depends on PlayerInfo.
@param char EclCharacter
GetRace¶
Returns the current race of char.
Checks racial tags.
@param char Character
GetRacePreset¶
function CharacterLib.GetRacePreset(char)
-> Character_creationRaceDesc? -- `nil` if the character has no PlayerData.
Returns the race preset ID of a character.
@param char Character
Should be a player.
GetRealRace¶
Returns the original race of a player char, before any transforms.
@param char Character
Must be tagged with "REALLY_{Race}"
GetResistance¶
Returns the computed resistance value of char.
@param char Character
@param damageType DamageType
@param baseValuesOnly boolean?
If `true`, base value will be returned. Defaults to `false`.
GetSkill¶
function CharacterLib.GetSkill(char, skillID)
-> (EclSkill|EsvSkill)? -- `nil` if the character does not have the skill in any way.
Returns the record for a skill.
@param char Character
@param skillID skill
GetSkillAPCost¶
function CharacterLib.GetSkillAPCost(char, skillID)
-> integer, boolean -- AP cost and whether elemental affinity was applied.
Returns the character's AP cost to cast a skill.
@param char Character
@param skillID skill
GetSkillBarRowContents¶
Returns the contents of a character's skillbar row.
@param char Character
Must be a player.
@param row integer
@param slotsPerRow integer?
Defaults to 29.
GetSkillState¶
Returns the current skill state of char.
On the server, this can only return the state while using the skill. Preparation state cannot be accessed.
@param char Character
GetSourcePoints¶
Returns the current and maximum source points of char.
@param char Character
GetStatusByHandle¶
Returns a status by handle.
@param char Character
@param handle EntityHandle
GetStatusByNetID¶
Returns a status on char by its net ID.
@param char Character
@param netID NetId
GetStatusesFromItems¶
Returns a list of statuses the character has from its equipped items.
@param char Character
HasDagger¶
Returns whether char has a dagger equipped in either slot.
@param char Character
HasImmunity¶
Returns wether char has a certain immunity.
@param char Character
@param immunityName StatsLib_ImmunityID
HasMeleeWeapon¶
Returns whether char has a melee weapon equipped in either slot.
@param char Character
HasOwner¶
Returns whether char has an owner.
@param char Character
HasRangedWeapon¶
Returns whether char has a bow or crossbow equipped.
@param char Character
HasShield¶
Returns whether char has a shield equipped.
@param char Character
IsActive¶
Returns whether char is currently the active character of any player.
IsCastingSkill¶
Returns whether char is casting a skill.
@param char Character
IsDead¶
Returns true if the character is dead.
@param char Character
IsDisarmed¶
Returns whether char is disarmed.
@param char Character
IsIgnoredByAI¶
Returns whether char is ignored by AI.
@param char Character
IsInCombat¶
Returns whether the character is in a combat.
@param char Character
IsInStealth¶
Returns whether char is sneaking or invisible.
@param char Character
IsInvisible¶
Returns whether char is invisible - as in, has the INVISIBLE status.
@param char Character
IsMale¶
Returns true if char is male.
@param char Character
IsMuted¶
Returns whether char is muted.
@param char Character
IsOrigin¶
Returns whether char is a non-generic origin.
@param char Character
IsPlayer¶
Returns whether char is a player.
A player is any character that is controllable by the users,
including summons and party followers.
@param char Character
IsPreferredByAI¶
@param char Character
IsPreparingSkill¶
Returns whether char is preparing a skill.
@param char Character
IsSkillInnate¶
Returns whether a skill is innate to a character.
Returns false if the character doesn't have the skill in any way.
@param char Character
@param skillID string
IsSkillLearnt¶
Returns whether char has a skill learnt. Returns true for innate skills.
@param char Character
@param skillID string
IsSkillMemorized¶
Returns whether char has a skill memorized. Returns true for innate skills.
@param char Character
@param skillID string
IsSneaking¶
Returns whether char is sneaking.
@param char Character
IsSummon¶
Returns true if char is a summon.
@param char Character
IsUndead¶
Returns true if char is undead.
@param char Character
IsUnpreferredByAI¶
Returns whether char is unpreferred by AI.
@param char Character
IsUnsheathed¶
Returns whether char has their weapon(s) unsheathed.
@param char Character