Attribute
Scripting with the Attribute class.
An attribute can be used as type for a stat, ability, character, etc. This class is used by the Stat class to help define a its strengths and weaknesses.
Fields & Properties
displayName
The display name of the attribute.
string
public
icon
An icon that represents the attribute.
Sprite
public
effectivenesses
Effectivenesses against attributes.
List<Effectiveness>
public
Creating Attributes
It's not at all recommended to create attributes at runtime, but it is possible. Attribute
's are scriptable objects which cannot be created as assets at runtime for later use.
The attribute IDs must be unique. When creating them from the Attributes tab, unique IDs are set automatically. However, this is not done when creating them at runtime. You'd need to create your own method of ensuring IDs of generated attributes are unique.
Getting Attributes
Attributes created through the Attributes tab can be retrieved at runtime.
Get a Single Attribute
You can get an attribute by its ID, or name with the Inventool.GetAttribute
method.
Get All Attributes
Effectiveness
Add Effectiveness
Adding an effectiveness requires a reference to an attribute.
Remove Effectiveness
Removing an effectiveness requires a reference to an attribute.
Check If An Effectiveness Exists
Get Effectiveness
You can get the effectiveness multiplier value with the GetEffectiveness
method.
Strengths/Weaknesses
There are multiple methods available to get both the attack and defense weaknesses of an attribute.
Attack Strengths
The GetAttackStrengths
method returns a list of attributes that an attribute is more than 1x effective against.
Attack Weaknesses
The GetAttackWeaknessess
method returns a list of attributes that an attribute is less than 1x effective against.
Defense Strengths
The GetDefenseStrengths
method returns a list of attributes that are more less 1x effective against an attribute.
Defense Weaknesses
The GetDefenseWeaknesses
method returns a list of attributes that are more than 1x effective against an attribute.
Last updated