Skip to content

Latest commit

 

History

History
163 lines (105 loc) · 4.94 KB

README.md

File metadata and controls

163 lines (105 loc) · 4.94 KB

Multiplayer Vault and Mantle Movement Ability Documentation

Vault and Mantle Example

How to Set It Up Using The Third Person Template

This tutorial shows how you can set up the Vault and Mantle ability using the Third Person Template and the VaultOver animation from the Windwalker Echo, both provided by Epic.

It should be pretty straightforward to set it up on any project, just follow along and adjust according to your specific project details.

1. Create a C++ game project with the provided Third Person Template

alt text

2. Enabling Required Plugins

Launch the editor and go to Edit > Plugins and enable the following plugins:

GameplayAbilities

alt text

MotionWarping

alt text

VaultMantle

alt text

3. Adding the MotionWarpingComponent to the your Character

Just simple add the MotionWarpingComponent to your Blueprint Character:

alt text

4. Setting up the Gameplay Ability System (GAS)

For the sake of simplifying things a bit, let's set up the Gameplay Ability System Component in the Character. First, add the necessary dependencies to the project:

Add the following dependencies to YourProject.Build.cs:

PublicDependencyModuleNames.AddRange(
    new string[]
    {
        "Core",
        "CoreUObject",
        "Engine",
        "InputCore",
        "EnhancedInput",
        "GameplayAbilities",
        "GameplayTags",
        "GameplayTasks",
    }
);

Add the UAbilitySystemComponent to the YourCharacterClass.h:

In your YourCharacterClass.h add #include <AbilitySystemInterface.h> and forward declare the ability system component. Also add the interface to the character and the GetAbilitySystemComponent method declaration. You should have something like the following:

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include <AbilitySystemInterface.h>
#include "YourCharacterClass.generated.h"

class UAbilitySystemComponent;

UCLASS(config=Game)
class AYourCharacterClass : public ACharacter, public IAbilitySystemInterface
{
	GENERATED_BODY()

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = GameplayAbility, meta = (AllowPrivateAccess = "true"))
	TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;

    // other stuff

public:
	// Begin Ability System Interface
	UAbilitySystemComponent* GetAbilitySystemComponent() const override;
	// End Ability System Interface
}

Create the AbilitySystemComponent and implement interface

In your AYourCharacterClass.cpp file include the AbilitySystemComponent.h header, add the GetAbilitySystemComponent method implementation, and also setup the AbilitySystemComponent like so:

// other includes
#include <AbilitySystemComponent.h>

AYourCharacterClass::AYourCharacterClass()
{
	AbilitySystemComponent = CreateDefaultSubobject<UAbilitySystemComponent>(TEXT("AbilitySystemComponent"));
	AbilitySystemComponent->SetIsReplicated(true);
	AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
}

UAbilitySystemComponent* AYourCharacterClass::GetAbilitySystemComponent() const
{
	return AbilitySystemComponent;
}

Granting the Ability

For simplicity, let's grant the ability on Character's BeginPlay event callback:

alt text

GA_VaultMantle parameters

If needed open the GA_VaultMantle ability and setup its parameters such as montages to play, size of trace box, and so on:

alt text

5. Setting up Inputs and Triggering the Ability

Inputs

Create a new InputAction so we can trigger the ability by pressing a key:

alt text

alt text

Add it to your InputMappingContext like so:

alt text

Triggering the Ability

For this example we're going to activate the ability by using its gameplay tag everytime we press the input key:

alt text


FAQ

1. My project doesn't use the Gameplay Ability System (GAS), will it work?

Unfortunately no. There is another plugin coming soon that will enable projects without GAS to have this gameplay mechanic. Stay tuned.

2. Compatible with Lyra?

Yes, but if you want to use it with the Lyra Ability Set (ULyraAbilitySet) it requires you to create a new C++ ability based on the ULyraGameplayAbility. You can simple copy and paste the relevant code from the UGameplayAbility_VaultMantle and that's it. If using the Windwalker Echo animation make sure to retarget to Lyra's character skeleton. When opening the montage you should get something similar to the following screens:

alt text

Pick a replacement for the skeleton:

alt text

Lyra video example:

Lyra Example