Character
- Static Events / Methods
- Fields
- Events
- Constructors
- Methods
Destroy()
TakeDamage(container)
PredictDamage(container)
SetDefaultProps(props)
GetDefaultProps()
GetAppliedProps()
GetAllStatusEffects()
GetAllActiveStatusEffects()
GetAllStatusEffectsOfType(constructor)
GetAllActiveStatusEffectsOfType(constructor)
HasStatusEffects(statuses)
GetSkills()
GetAllActiveSkills()
GetSkillFromString(name)
GetSkillsDerivedFrom(constructor)
GetSkillFromConstructor(constructor)
ApplyMoveset(moveset)
GetMoveset()
GetMovesetName()
GetMovesetSkills(name?)
ClearMoveset()
ApplySkillsFromMoveset(moveset)
Static Events / Methods
CharacterCreated
An event. Fires whenever a character gets created.
Parameters:
- Character:
Character
- a character that gets created.
CharacterDestroyed
An event. Fires whenever a character gets destroyed.
Parameters:
- Character:
Character
- a character that gets destroyed.
GetCharacterMap()
Starts the handler.
Returns:
- CharacterMap:
Map
. A map where key isInstance
and the value isCharacter
attached to it.
GetCharacterFromInstance(instance)
Retrieves the character associated with the given instance.
Parameters:
- Instance:
Instance
Returns:
- Character:
Character?
. A character associated with the provided instance.
GetLocalCharacter()
Retrieves the character associated with the local player.
Returns:
- Character:
Character?
.
Fields
Instance
@readonly
An instance Character object is attached to.
DisableSkills
A boolean value. Character's skills cannot be started if true.
Humanoid
@readonly
A Humanoid associated with character's instance.
Player?
@readonly
A Player associated with the character.
Retrieved internally by Players:GetPlayerFromCharacter(self.Instance)
.
Events
SkillAdded
An event. Gets fired when a skill gets added to the character.
Parameters:
- Skill:
Skill
- A skill that got added.
SkillRemoved
An event. Gets fired when a skill gets removed from the character.
Parameters:
- Skill:
Skill
- A skill that got removed.
SkillStarted
An event. Gets fired when a skill that is assigned to the character starts.
Parameters:
- Skill:
Skill
- A skill that got started.
SkillEnded
An event. Gets fired when a skill that is assigned to the character ends.
Parameters:
- Skill:
Skill
- A skill that got ended.
StatusEffectAdded
An event. Gets fired when a status effect gets added to the character.
Parameters:
- Status:
StatusEffect
- A status effect that got removed.
StatusEffectRemoved
Gets fired when a status effect gets removed from the character.
Parameters:
- Status:
StatusEffect
- A status effect that got removed.
StatusEffectStarted
An event. Gets fired when a status effect that is assigned to the character starts.
Parameters:
- Status:
StatusEffect
- A status effect that got started.
StatusEffectEnded
Gets fired when a status effect that is assigned to the character ends.
Parameters:
- Status:
StatusEffect
- A status effect that got ended.
HumanoidPropertiesUpdated
Gets fired when character's humanoid data gets updated.
Parameters:
- Props:
AffectableHumanoidProps
- a map ofpropertyName
and it's newvalue
.
DamageTaken
Gets fired when character takes damage from any skill / status effect.
Container's source will always be nil
on client
Parameters:
- Container:
DamageContainer
.
DamageDealt
Gets fired when any skill or status effect that belongs to this character damage another character.
Parameters:
- Container:
DamageContainer
.
Destroyed
Gets fired when character gets destroyed.
MovesetChanged
Gets fired when character's current Moveset changed.
Parameters:
- NewMoveset:
string?
- a name of the new moveset. - OldMoveset:
string?
- a name of the old moveset.
Moveset object can get retrieved using :GetMovesetObjectByName()
Constructors
new(instance) -> Character
Accepts the instance and returns a new WCS Character. Instance must contain a Humanoid.
Parameters:
- Instance
Methods
Destroy()
Destroys the object and performs necessary cleanup tasks. You usually suppost to fire this manually when your humanoid dies.
TakeDamage(container)
Calculates the damage based on status effects and fires a DamageTaken
event.
Returns the calculated damage.
Parameters:
- Container:
DamageContainer
Returns
- Container:
DamageContainer
- a container with calculated damage after status effect affection.
PredictDamage(container)
Calculates the damage based on status effects. Returns the calculated damage.
Parameters:
- Container:
DamageContainer
Returns
- Container:
DamageContainer
- a container with calculated damage after status effect affection.
SetDefaultProps(props)
Sets default humanoid properties of the character.
Parameters:
- Properties:
AffectableHumanoidProps
- A map of aPropertyName
and itsValue
.
- TypeScript
- Luau
Char.SetDefaultProps({
WalkSpeed: 32,
})
Char:SetDefaultProps({
WalkSpeed = 32,
})
GetDefaultProps()
Retrieves the default humanoid properties of the character.
Returns
- Properties:
AffectableHumanoidProps
- A map of aPropertyName
and itsValue
.
GetAppliedProps()
Retrieves the currently applied humanoid properties, depending on current HumanoidData
.
Returns
- Properties:
AffectableHumanoidProps
- A map of aPropertyName
and itsValue
.
GetAllStatusEffects()
Retrieves all status effects.
GetAllActiveStatusEffects()
Retrieves all active status effects.
GetAllStatusEffectsOfType(constructor)
Retrieves all status effects of a given type.
Parameters:
- Constructor:
Constructor<AnyStatus>
- A status effect class to check.
GetAllActiveStatusEffectsOfType(constructor)
Retrieves all active status effects of a specific type.
Parameters:
- Constructor:
Constructor<AnyStatus>
- A status effect class to check.
HasStatusEffects(statuses)
Checks if character has any active status effects of the specified type.
Parameters:
- Statuses:
Constructor<AnyStatus>[] | Constructor<AnyStatus>
- A list of status effect classes to check.
Returns
- boolean
GetSkills()
Retrieves the skills stored in the skills object and returns them as an array.
Returns
- Skills:
Constructor<AnySkill>[]
GetAllActiveSkills()
Retrieves all active skills and returns them as an array.
Returns
- Skills:
Constructor<AnySkill>[]
GetSkillFromString(name)
Retrieves the skill instance by its name.
Parameters:
- Name:
string
- a name of the skill.
Returns
- Skill:
Skill?
GetSkillsDerivedFrom(constructor)
Retrieves all skills that extend from constructor.
Parameters:
- Constructor:
Constructor<AnySkill>
.
Returns
- Skills:
Skill[]
GetSkillFromConstructor(constructor)
Retrieves a skill instance based on the provided constructor.
Parameters:
- Constructor:
Constructor<AnySkill>
- A constructor of the skill class.
Returns
- Skill:
Skill?
ApplyMoveset(moveset)
Applies a Moveset to the character.
Parameters:
- Moveset:
Moveset | string
- A Moveset object or it's name.
GetMoveset()
Returns the current Moveset.
Returns
- Moveset:
Moveset?
GetMovesetName()
Returns the current Moveset's name.
Returns
- Moveset:
string?
GetMovesetSkills(name?)
Gets the skills that belong to a provided Moveset.
Parameters:
- MovesetName:
string?
- A name of the Moveset to get skills from.@defaults
to the currently applied Moveset.
ClearMoveset()
Clears the Moveset and destroys all skills that belong to it.
ApplySkillsFromMoveset(moveset)
Adds the skills from a given Moveset. Does not set the Moveset.
Parameters:
- MovesetName:
Moveset
- The Moveset to apply from.