User Commands are instructions that are handled by the Grapple Component. They are usually sent over by other Objects, like Character Blueprints or Controllers. The Grapple Component sends these User Commands over to its User Command Targets (by default, the Applied Grapple Object and the Controlled Grapple Object).
User Command Targets
User Commands are sent over to all Blueprint Objects that are registered as User Command Targets. Each Grapple Component contains a list of User Command Targets that are currently active. This list can be accessed using function Get User Command Targets. User Command Targets can be added or removed using functions Add User Command Target and Remove User Command Target
The Objects added as User Command Targets can add functionality on their end by implementing Blueprint Interface BI_GrappleComponentInterface, more specifically its Event Process Incoming User Command
Grapple Objects implement this Interface natively. They are automatically added as User Command Targets on all Grapple Components that are Participants, as well as their Grapple Component. This can be disabled by modifying the following variables on the Grapple Object:
- Auto Receive User Commands from Participants during Grapple Sequence ; and
- Auto Receive User Commands from Master during Grapple Sequence.
How to use
Processing User Commands on the Grapple Component
User Commands are sent to the Grapple Component using Input Function Process User Command (Input).
The User Command will be processed according to the selected input mode. The input mode is selected using an variable of type enum_GC_UserCommandInputMode. This enumeration describes the way in which a User Command should be processed.
|Execute||The User Command is Executed (i.e. sent over to all User Command Targets) immediately.|
|Queue||Add the User Command to a Queue, where each User Command is executed in whenever Input Function Consume Next Queued User Command (Input) is called.|
Store the User Command on the Grapple Component. If a Grapple Sequence is initiated, all stored User Commands that were input after the input that lead to the successful Attempt will be queued (meaning that they will only be executed when Input Function Consume Next Queued User Command (Input) is called.
This input mode is designed for specific situations in network environments.
When performing a Grapple Attempt in a multiplayer project, there is usually a small delay between the input on the Client and the moment the Grapple Sequence is initiated. This is the case because all Grapple Attempts need to be verified on the server before the Grapple Sequence is initiated. However, it is possible that you still need the inputs during this small delay to be registered, in case they need to be used in the Grapple Sequence (for example, in a situation where a character does a variation of an attack when the input is pressed twice).
Implementation on the Grapple Object
User Commands can be accessed on Grapple Objects by implementing Event On User Command Received. Incoming User Commands can be filtered by using themacro.