how to destroy gun turret ammo projectile?

hi. how do i destroy ammo projectile after it has spawned with a delay :)? because ive tried loads of different methods but the ammo projectiles just collect and eventually causes the play in editor mode to exit used blueprints as well.

Hey, what is an “ammo projectile”? Do you mean the shell that flies away to the left or right of your weapon after you shot? Or do you mean the projectile itself? How did you create the ammo projectile? Is it a simple blueprint?

Please show me your blueprints (spawn and the ammo projectile) and show me what you have tried till now, so i can try to help you (:

The easiest way to achieve a despawn regardless if the projectiles have hit something or not would be to set a lifespan.

its a standard projectiles that is spawned by my turret gun :slight_smile:

here is a screenshot showing the result in play mode.

how would i

set the lifespan in my blueprint :)?

Im not even sure what you want to achieve with this blueprint code but you code set the initial life span in the default values or you could say trigger the lifespan after you received a hit event that would be like in the picture.

27874-lifespan-blueprint.png

You could also set it with the same node in the construction script if you want different lifetimes corresponding on some other value.

i just want the projectile to disappear after a few seconds of hitting the floor :slight_smile:

Well if the collision and stuff works you could also use the delay node and call after that destroy actor.

ive added the set the life span like in your screenshot but they are not disappearing :confused: could some other factor effect this ?

well at least something should be destroyed maybe you have the wrong target when calling this.

isn’t working. is there a way to trigger an event when the player collides with the turret gun trigger box, the gun trigger is activated then another event to stop when out of the trigger box :)?

if the collisions are setup correctly you could overwrite the actorbeginoverlap / actorendoverlap events but that would be a completely new topic. Did you debug your blueprint with the set lifetime and did you try the other way with delay + destroy?

You could try something similar to this:

What I did was to set the life span of the projectile as soon as it’s spawned in the level. This makes sure that if it doesn’t hit anywhere within a few seconds (depending on it’s speed), say like when you are shooting at the sky, it will get destroyed automatically after a while.

In the other cases, where it hits somewhere, you can add something like this inside the projectile blueprint:

Doesn’t need to be overlap, you can try other types of collision as well, but it makes sure that as soon as the projectile gets in contact with some other object, it will destroy itself after spawning a hit particle effect.