Activity


Another feature of State Manager Component are Activities.
In contrast to states, owner can have multiple activities enabled at same time.

Activities are defined as gameplay tags and stored in file DCSTags_Activities.

They can be used for any kind of actions, when owner is immortal, is resistant to smth, if should have visible crosshair etc.
Basically anything that you can describe as bool ( true / false ).

Why do we need them? Well, we could create multiple bool variables in player’s blueprint like IsZooming, IsBlockingPressed, CanParryHit, IsImmortal etc, then do the same for AI.
This way we would receive pretty much the same results, but it creates a lot of mess and requires casting if we would like to set those variable outside of these character blueprints.
And what if we want to set them through animation notifies?

Activities are cleaner implementation and are easier to manage.
We can set Activity value through component, check if it’s active or get notified when any activity has changed through OnActivityChanged event dispatcher.

These are functiosn to modify activities.

Activities can stack, means that if we add same activity multiple times, its counter will increase
then after removing activitiy counter will decrease until its 0, then activity will remove.
This behavior is useful if same activity can be triggered from multiple places.

For example if both stun and frozen statuses are adding activity to disable movement of player
and we apply both of them at same time with different durations, then player will get Activity.DisableMovement with counter 2
and will be able to move again only when last status will end, because first one will only decrease counter of this activity to 1 instead of removing it completly


Activities can also be modified through animations with notify ANS_Activity

And in behavior tree with service S_SetActivity.


Whenever Activity changes, it triggers an event that owner can react to.