The attribute manager consists of the following key features:
- Attributes
- State Effects
- Temporary Effects
All the logic is combined into one attribute manager that can be assigned to any actor.
State Effects #
The attribute manager has a state effect system. This means that it is possible to add certain effects, such as being sick or poisoned, to your character. These states are visualized in the player’s HUD and can change based on the environment or by consuming something.
An example provided is the drunk state effect. In this state, there is an animation camera modifier and more. This is achieved by spawning and attaching a state effect actor to the character. This actor will add and remove the required state effects and handle their removal if they are temporary using timers. The attribute manager itself will handle the camera modifier.
You can add or remove state effects in the datatable. There are numerous settings that can be changed for each state effect, such as auto-recover, damage duration, etc. This way, you can easily add your own custom state effects.
- Sick: Bad stats, slowly recovering
- Healthy: Normal stats
- Infection: Needs medicine, bad stats, and slowly dying
- Wounded: Bad stats but slowly restoring. Small chance of infection if not attended to
- Poisoned: Random chance of recovery. Antidote helps to restore
- Drunk: Temporary dizzy screen, more hunger and thirst, a bit more energy
Misc States #
This affects the chill temperature of the individual:
- Wet: When in rain or just out of water. Faster cold
- Warming: Near a fire, faster not wet and faster too hot, and less fast too cold
- On Fire: Fire particle, dying, not wet
Temperature States #
Based on “external temperature,” the temperature state is switched. This temperature can be set by a weather system or something similar. Be aware the character also has a “Chill” temperature, which can differ per character, depending on a chill temp penalty. The penalty is determined by factors like clothing, whether the character is wet, or near a fire and warmed. Each state has a screen animation effect.
- Very cold: Bad stats and small amount of damage
- Cold: Bad stats, faster hunger
- Normal
- Hot: Bad stats, faster thirst
- Very hot: Bad stats and small amount of damage
Fire: Stand in the fire to get the state effect on fire. When you walk to other characters, they will also catch on fire. Standing near a fire warms you and raises your temperature.
Attributes #
Many attributes have been defined and implemented for you. They are defined in six main categories:
- Non-Persistent Character Attributes
- Persistent Primary Character Attributes
- Persistent Character Survival Attributes
- Persistent Generic Combat Attributes
- Persistent Ranged Combat Attributes
- Persistent Level Attributes
The attribute manager keeps track of attribute states:
- Base value
- Added value
Both values can be changed temporarily or permanently. Attributes are assigned to items in the datatable DT_Items. When you perform an action on an item, you can read out these attribute values. For instance, on consumption, you add the assigned attribute. When unequipping, you remove the attributes. These same attributes are shown in the tooltip.
Non-Persistent Character Attributes #
You can disable and enable different stats easily in the attribute manager. Changing these values will automatically propagate throughout the settings and switch in the HUD. All non-persistent attributes can be changed using the ‘On Change *attribute*’ function. Here you can input the amount you want to change that attribute.
Health #
Health can be affected in various ways. The most common is taking damage from an attacker. Fall damage is also implemented and can be adapted. The player will die when reaching 0 health. Health can be visualized using the pawn in radius component as shown in the picture.
Stamina #
The character includes stamina logic. You can sprint with shift. Sprinting uses stamina. You can jump with the spacebar. Jumping consumes stamina. When the stamina is in the low range, you can’t jump or sprint. The character will automatically stop sprinting when it reaches zero. The stamina has a regeneration rate variable. When the stamina is in the low range, an out-of-breath sound is spawned.
Food #
The character has food logic. Food decreases over time by a consumption rate variable. When the food is in the low range, a stomach growling sound is spawned. When the food is at zero, damage will be applied to health, not armor.
Hydration #
The character has hydration logic. Hydration decreases over time by a consumption rate variable. When hydration is in the low range, a stomach growling sound is spawned. When hydration is at zero, damage will be applied to health, not armor.
Mana #
The attribute manager also has mana implemented. However, no spells are included.
Energy #
Fatigue is implemented, but there are no consequences programmed. This is left open for you to decide if you want to use it and what you want to do with it. For instance, you could let the character require sleep.
Weight #
The weight attribute is tracked. This attribute can be manipulated by an inventory. Currently, it is implemented that when the weight exceeds the max weight, the character will activate the state effect encumbrance.
Persistent Primary Character Attributes #
The persistent primary character attributes hold the max and regeneration values of the non-persistent attributes. This also includes movement speed. These values will usually be the same and not constantly changing like the current values (health, etc.).
Persistent Character Survival Attributes #
This category holds the maximum and regeneration values for the survival attributes like food, etc. This category also holds the chill temperature penalty value.
Persistent Generic Combat Attributes #
The persistent generic combat attributes are usually assigned to equipment like swords and armor. These values determine the effectiveness of that equipment piece.
Persistent Ranged Combat Attributes #
The persistent ranged combat attributes are used for ranged weapons and these values determine the effectiveness of that weapon.
Persistent Level Attributes #
In combination with a level manager, this will regulate the level of certain skills. This can be applied to any item.
“`