#Fire Tornado Spell
1 messages · Page 1 of 1 (latest)
First, we are going to create 3 new classes. I will join the files for them, it will be easier than copy pasting everything I think.
First we have MovingEffectActor.
For his functionnality, it is kind of a mix between two previous Actors : AuraEffectActor and AuraProjectile. It is a moving area of effect damaging the enemies.
We need to pass it the DamageEffectParams created by the GameplayAbility, so we cant really extend AuraEffectActor, but unlike a normal projectile, I dont want it to be destroyed, and there is also others differences.
So i decided to create a new Actor. Maybe we should create an abtract parent class for the projectile and the MovingEffectActor, to regroup some functionnalities, but it seamed a bit overkill for the current implementation.
I also wanted to a zigzag movement for the tornado. The most straighforward approach that I have found is to use a SplineComponent on a Actor, and to make follow a point along side the spline.
So I created another class for another actor, with a SplineComponent : SplinePathActor. The idea behind it is pretty much the same as this tutorial : https://www.youtube.com/watch?v=qKIJMQJsx2Y but in c++ instead of blueprint.
Distance = Speed * DeltaTime + Distance;
FTransform SplineTransform = SplineComponent->GetTransformAtDistanceAlongSpline(Distance, ESplineCoordinateSpace::World);
With this two new actors we can create a new ability : AuraFireTornadoSpell.
If you remenber the function SpawnProjectile from AuraProjectileSpell (or maybe go check it again^^) , we will do something very similar inside the function SpawnMovingEffect.
We are going to make blueprints from the two new Actors class, and we need reference to them inside the ability :
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
TSubclassOf<AMovingEffectActor> MovingEffectActorClass;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
TSubclassOf<ASplinePathActor> SplinePathActorClass;
Before rebuild and launching the editor, we need new tags for the ability, as always. Inside AuraGameplayTags.h
FGameplayTag Abilities_Fire_FireTornado;
FGameplayTag Cooldown_Fire_FireTornado;
Then initialize them in the cpp file as always.
We can now rebuild and launch the editor.
Lets create a blueprint version of SplinePathActor (inside a folder AbilitySystem/Aura/GameplayAbilities/Fire/FireTornado).
Inside it , we want to add Spline Point (right click on the spline inside the viewport), and move them as we see fit. I found doing this exercice in the top perspective much easier.
Then, we create a blueprint for the class MovingEffectActor => BP_FireTornado.
Inside it add a Niagara component and add the Tornado Effect.
Dont forget to adjust the capsule height and radius correctly for the tornado. I put the Height at 90, and the radius at 50. For the capsule collision, I just have Generate Overlap Events, and OverlapAlldynamic for the presets.
And I have the Niagara component with a location -80 for the Z.
Lets now create a blueprint for the gameplay ability : **GA_FireTornado **(from the correct class)
Inside it, honestly it is pretty much the much the same as we did inside the Firebolt ability.
Commit -> TargetDataUnderMouse -> UpdateFacingTarget-> PlayMontageAndWait (i just use firebolt)-> Wait GameplayEvent -> Spawn Moving Effect with creating a tag (Make Literal Gameplay Tag) for the socket.
**Dont forget to correctly configure all the variables **
Like damage type, The MovingEffectActorClass, the SplinePathActorClass, DamageEffectClass, etc.
I advise to give it a Starup Input Tag for testing at least.
Lets assign it to Aura in the startup abilities => BP_AuraCharacter -> Starup Abilities.
Let also create a new entry inside DA_AbilityInfo. I reuse a lot of what we have for the FireBlast, just not the same AbilityTag, and ColdownTag, and link to the ability of course.
And if we press play, we should be able to launch the tornado.
Probably too hight, and it will fly above the enemy. This is normal if we created it with a SpawnLocation from the tip Socket.
Personally I think it was necessary to create a new socket location.
I put in on the ground in front of AUra. I called it FloorSocket (do as you wish).
Then I created a new tag AuraGameplayTags.CombatSocket_Floor, and use it inside AAuraCharacterBase::GetCombatSocketLocation_Implementation :
if (SocketTag.MatchesTagExact(AuraGameplayTags.CombatSocket_Floor)) { return GetMesh()->GetSocketLocation(FloorSocketName); }
With a new property FloorSocketName.
And inside GA_AbilityFireTornado, I changed the gameplay tag given to SpawnMovingEffect to the new socket tag.
And on the blueprint of the MovingEffectActor, I added SplineHeightOffset to help position correctly the spline actor.
And now the ability should function correclty .... except that we have a part of the NiagaraSystem that stay in place.
It is the MeshRenderer for the tornado mesh that have a problem. The rest is moving correctly.
After a bit of time searching, I have finally found it !!
https://forums.unrealengine.com/t/niagra-particle-not-moving-with-gizmo/482295
It is the Emitter properties that should be made at Local Space.
Very cool, looks like the spells menu needs more room for fire spells 🔥