this is a new seperate script that is place on my environment objects. Like for this instance it is placed on a wall!
Right then get owner had no meaning eh?
What would be more logical would be that before the project destroys itself, it sends a message back to the launcher to clear the variable.
You need the projectile to destroy itself when it hits something, the thing it his should have nothing to do with it.
So I am pretty new to using unreal and its blueprinting system.
But I have no idea what i need to place in this object of the cast:
Currently i have the 'Get Owner’placed in it but that doesn’t seem to be working at all.
I also placed a ‘Print String’ behind it so i can check that everything happend in the script.
So what i am trying to do is when i shoot my rocket into a wall i want the rocket to be destroyed and i want the boolean ‘Rocket Created’ to be set to false. In the rocket launcher script i use this bool to make sure the player can only fire one rocket at the time.
Thank you for reading my question, I am sorry that i have to ask these silly questions, but none of my friends or videos helped me solve the issue. Hopefully we can find a solution for this issue, that would really help me a lot!
What is this code in? The launcher or the rocket?
Right i knew that the get owner was quite stupid
but the thing is i destroy my ‘Projectile’ and i do not destroy my ‘RocketLauncher’ so i don’t think that destroying it before that i change the bool changes that much?
When you spawn the projectile, set the owner in the spawn call.
Then, when your missile wants to explode, it can use GetOwner ( because you actually set the owner ), and clear the bool before calling Destroy on itself.
It’s a weird issue in my eyes because i had to do this once for when my rocket would hit an AI the ai would be destoryed and the rocket would also be destoryed. And that works fine, while when i try it with the wall i doesn’t work at all.
So ClockworkOcean i fixed the issue!
I just dit the same for the other object but instead of destroying the wall i only destroy the rocket!
Why cant i think of this myself :), Thanks again for the help.
I really appreciate it when you help me ClockworkOcean!
So ClockworkOcean i fixed the issue!
I just dit the same for the other object but instead of destroying the wall i only destroy the rocket!
Why cant i think of this myself :), Thanks again for the help.
I really appreciate it when you help me ClockworkOcean!
Yeah, having used that exact config in my game, it turns out epic have ‘tweaked’ things again, you just have to fiddle endlessly with collision settings and spawning etc.
Now I have this:
( The cylinder is my launcher )
So what we’re seeing for some reason is that cast isn’t working, you’ll just have to fiddle around I’m afraid…
There are two things wrong (or not as performant) with your set up here:
- This is your Ai code apparently, so it has no owner, therefore GetOwner does not return rocket launcher, because obviously the two don’t relate to eachother.
- Every time in your game the AI overlaps anything, this code checks to see if the actor it’s overlapping is a projectile. It’s much better and performant to do this check in projectile code.
What was wrong with your previous setup? As I recall, you were doing the check in the projectile and you said it worked.
Ok! …
EDIT: I might need a bit more tweaking, I see a lot of destroy nodes in there…
Also, to be clear, only the launcher and missile need code. There should be no code in rocks etc…
No problem. Glad you’ve figured this out too.
No i was trying to make the rocket get destroyed when it would hit a wall
My problem before this was that it didn’t work for the AI.
But you helped me solve that one, thank you for that ScratScrat!
thx for the tip ClockWorkOcean!