# Launch a Projectile

> For the complete documentation index, see [llms.txt](llms.txt).

Cast a glowing projectile from a hand socket and make it affect the combatant it hits. Use the [combatant setup](cbt-first-steps.html) for the caster and target.

Procedure: Create the traveling actor

1. Make a Gameplay Effect based on `CombatEffect_RangedHit`. Create a Blueprint based on `NinjaCombatProjectileActor` and assign the effect as its Impact Effect Class.

2. Set its scan channel and hit adjustment trace channel to the combat channel your target responds to. Add a trail or mesh so you can see the projectile travel. For a Niagara trail, turn off Auto Activate.

Procedure: Launch from the release frame

1. Implement the Combat Ranged Interface on the caster. Return the mesh with the launch socket from `GetProjectileSourceMesh`. Add a Launch Projectile notify at the release frame of the cast montage. In its Request Data, set the source to Owner and its origin socket to that socket.

2. Create a `CombatAbility_LaunchProjectile` Blueprint. Set Projectile Trigger to Gameplay Event, assign the montage, and set Fallback Projectile Class to your projectile. Grant the ability and activate it from your test action. For a weapon launch, set the notify source to Weapon and use a query matching the registered weapon.

![Launch Projectile notify on the montage release frame](Documentation/cbt_guide_projectile_montage_notify.png)

Override the projectile's `LaunchProjectile` and `Exhaust` events to start and stop a trail. Call the parent implementation in both so movement and cleanup still run. C++ subclasses can implement the corresponding `_Implementation` methods. If your game fires many projectiles, add `NinjaCombatActorPoolComponent` to the attacker, include the projectile class in its pool configuration, and return the component from `GetActorPool` on the Combat Pool Provider Interface. Reset per-shot visuals on activation and clear them on deactivation. A class configured in the notify's request can override the ability's fallback projectile.

```CPLUSPLUS
#include "GameFramework/PluginLabsCharacter.h"
#include "Components/NinjaCombatActorPoolComponent.h"

APluginLabsCharacter::APluginLabsCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
	static const FName ActorPoolName = TEXT("ActorPool");
	ActorPool = CreateDefaultSubobject<UNinjaCombatActorPoolComponent>(ActorPoolName);
}

UNinjaCombatActorPoolComponent* APluginLabsCharacter::GetActorPool_Implementation() const
{
	return ActorPool;
}
```

## Try It in Play

Launch toward a stationary target, then past it. Check the socket origin, whether the projectile reaches the target, and whether health changes only on a hit. Fire again and check that a reused trail begins at the new origin.

