-
Notifications
You must be signed in to change notification settings - Fork 6
Status Effects
Skelerealms comes included with a status effects system, inspired somewhat by Baldur's Gate 3. Status effects are comprised of 2 elements:
- The script
- The tags
The script is a resource, however, the on_update
function will be called by the host (more later) which will allow you to change things about the effected entity or world object on a frame-by-frame basis. Scripts can simply do nothing, if needed.
Status effects also come with a set of tags, and can be set to negate or be incompatible with certain tags or other effects by name.
For example, you can have a "dirty" tag applied to the status effects "slimy" and "muddy". The "wet" status effect will negate status effects with the "dirty" tag, removing "slimy" and "muddy".
To use a status effect, first you must register it with the SkeleRealmsGlobal
singleton, who keeps track of every status effect available to use in a game. This is most easily done through the SKConfig
resource, but can be done at runtime as well. Then, to apply an effect, you only have to add byh name instead of passing in a resource.
Status effects belong to Hosts, which are nodes that understand how to use status effects, and act as a medium by which status effects can affect the scene. To be useful, though, hosts bust be the child of a "vessel". Despite the rather ominous name, vessels simply enact the commands given to a host by a status effect. For example, one of the two default vessels is the EffectsComponent, which is an entity component that allows status affects to affect entities. An example of this convoluted chain of command is as follows:
Status effect sends message "Damage for 1 HP" -> Host relays the message to a vessel -> The vessel, an entity component, broadcasts the "damage" message to the entity and thus to all other components -> DamageableComponent receives message -> Entity is damaged for 1 HP
There is also a vessel for interacting with worldobjects.
Please note that this method may be reworked in the future.