Moving a projectile to mouseclick

So i want to make a game in which the player can shoot rockets and the player can control te launched rocket to a clicked location in the world.

The game is topdown shooter were the mouse cursor will be visible at all times! So i have tried some things with blueprints and this is what i currently got:

So i am pretty new still to scripting in unreal but i understand a few things. The main problem is when i launch the rocket it cannot be controlled if i were to click again.

Also i use the bool “Rocket Created” to make sure you can only launch one rocket at a time, but i still do not understand how to use a variable like a bool across multiple blueprints, this is what i tried:

I have tried to put many things in the object slot but none seem to work, i am quite lost on what i need to do with that as well. And if i cant set my bool back to true i can only shoot a single rocket and that’s it.

Thank you for reading, i hope we can solve this issue together.

Hey scratscrat

Thanks for answering to my problem! I understand what you are saying and i am gonna try it out as soon as i have the chanche!

So after i tried it this is what i got, still the same problem i do not know what i need to put in the target slot under the boolean. I have skeletal meshes in the viewport but the do not have the object component.

by the way this second destroy script is on the rocket itself!

There’s a problem with your destroy actor in the second image.

If your ActorBeginOverlap is in Rocket class then after CastToNPC->DestroyActor (NPC) you could use something like this (Assuming you spawn your rocket in player character class):

GetPlayerCharacter → CastToYourPlayerCharacterClass → Set Rocket Created to false → DestroyActor (Rocket)

Is “Rocket Created” boolean in your BP_Player class? If so Use this:

In what blueprint are you using ActorBeginOverlap?

In your first setup

before cast to rocket launcher use Get Owner, cast owner to rocket launcher, and move Destroy Actor to the end.

it doesn’t work, the bool is not changed which results in the projectile not getting destroyed.

If the cast to rocket launcher fails, pass the Self to Owner when spawning projectile. Click on the arrow on SpawnActorFromClass and you’ll see the Owner.

So this is what i get as an error!

and the actorbeginoverlap is located inside the projectile script and not the launcher script

Ok so that did work!

when i put owner to self i can shoot one rocket and only if that one is destroyed i can fire another one!

thank you scratscrat

I’m assuming that Fire event in your first image happens in rocket launcher blueprint. Otherwise, this doesn’t work. If Fire event and spawn projectile happen in player character blueprint, you need to change some of your work.