State Tags

Concept

State Tags are Objects that are added to and removed from a State Tag Manager. They each hold an array of 'Reasons' that keep them active. If they run out of Reasons, they are removed from the State Tag Manager. State Tags are used to define certain circumstances the Grapple Component needs to take into account, that are an exception  rather than the rule.  As such, you might only need the Grapple Component to do certain things if there are any (one or more) reasons to do so. Examples of such things are:

  • Refuse Input from the user - Input should be accepted if there are no reasons to refuse it. However, it may be ignored in certain situation eg. the character being a Participant in a Grapple Sequence of performing another action.
  • Prohobit the Grapple Component from entering a Grapple Sequence - This could be done while the Grapple Component is already a Participant in another Grapple Sequence.
  • Have Ticking Enabled - By default, ticking is disabled on the Grapple Component. However, certain functionalities (like Repositioning and Push Character) do require some logic to be executed every tick. This is why these graphs will add a state tag with consequence should tick enabled when they activate. When they are no longer active, the state tag is removed.


State Tag Manager

The State Tag Manager is an object that handles State Tags which can be applied to the outer Object it has been assigned to. State Tags are Objects that are added to and removed from a State Tag Manager. They each hold an array of 'Reasons' that keep them active. If they run out of Reasons, they are removed from the State Tag Manager. They are used to define certain circumstances the Grapple Component needs to take intro account, that are an exception  rather than the rule. 

A State Tag Manager is automatically assigned to each Grapple Component, which uses State Tags in several of its functionalities.

To access the State Tag Manager on a Grapple Component, use function Get State Tag Manager.

Other Objects can implement the State Tag Manager as well (although this is not done in any of the assets relevant to the Grapple Component). To access the State Tag Manager for any Object, use Interface Call Get State Tag Manager for Object (from Blueprint Interface BI_StateTagInterface).

Adding and removing state tags

State tags can be manipulated by accessing the State Tag Manager on the Grapple Component and using the Add/Remove State Tag function on it.

  • Performing the add operation adds a State Tag to the list of active State Tags. If a State Tag with the same name already exists, nothing will happen.
  • Performing the remove operation removes the State Tag with the provided name. Its consequences will then no longer be applicable if there are no other active State Tags with the same consequence enabled.


Evaluating current State Tags and consequences

State tags can be manipulated by accessing the State Tag Manager on the Grapple Component and using the Check State Tag or Check State Tag Advanced function on this linked State Tag Manager.

This function will return 'true' if a State Tag of the specified class is active, and will also return a list of State Tag classes that 'justify' this state tag being active.

It is also possible to use function Check State Tag Advanced on the State Tag Manager. This allows you to specify override causes. These are the state tag classes that should not be considered as a reason when checking if the specified State Tag is active.

Consequences

State tags are linked to one another in the sense that each State Tag class has a set of other State Tag classes that are the consequences of that State Tag. What this means, is that activating some State Tags will lead to the activation of other State Tags. The relation between State Tags is based on consequence, rather than being a strict hierarchy.


Built-in State Tags

The following State Tags are built in to the Grapple Component and are used for its different functionalities.


State Tag Name


Description

(This state tag is added while … )


On update

(Functions On State Tag Added and 
On State Tag Removed do the following)


Consequences

(When this State Tag is added, the following ones are added as well)

ST_CannotEnterGrappleSequenceThis Grapple Component cannot become a Participant in a new Grapple Sequence. Usually checked when evaluating the Grapple Criteria during a Grapple Attempt(no action on update)(no consequences)
ST_CharacterPushActiveAny Character Push Object is active on the Linked Actor of this Grapple Component.(no action on update)ST_ShouldTick
ST_GrappleAttempt_EveryTickThis Grapple Component is performing a Grapple Attemptevery tick.(no action on update)ST_ShouldTick
ST_GrappleAttempt_PendingThe Grapple Component has any pending Grapple Attempt.(no action on update)(no consequences)
ST_GrappleAttempt_Verifying

A Grapple Attempt is successful on the Client (and variable Notify If Attempt Fails on Server is set to true for its Class). 

Deactivated when the Server tells the Client that the Grapple attempt has failed, or when a Grapple Sequence is entered (usually on success).

(no action on update)(no consequences)
ST_GrappleSequenceActiveThe Grapple Component is a Participant in a Grapple Sequence.(no action on update)

ST_RefuseInput

ST_CannotEnterGrappleSequence

ST_RefuseInputThe Grapple Component is ignoring from the player. Usually checked when performing a Grapple Attempt.(no action on update)(no consequences)
ST_ShouldTickActive when the Linked Object (in this case, the Grapple Component) should have tick enabled.Update ComponentTickEnabled if the Linked Object is an Actor Component.(no consequences)