I’m following this tutorial to learn the basics of making a top down shooter. It’s my first time using blueprints, and everything was going well until I started trying to make a laser projectile I built hit my enemy.
So as you can see, it has scripting for overlap. It’s supposed to check that it’s not hitting the player character before decrementing health, as it has a weird issue with hitting the PC (is that common?)
I’ve put print string at several intervals to test what’s happening when the PC fires the laser projectile, and it’s failing every time. I even ran the laser in Simulation and it disappears instead of going one way or another as it usually would.
Here’s an image of the laser consistently failing to cast
Try checking your hit actor with a get class off the hit actor, and doing an = check against a parent class, like third person character. Otherwise, if they’re not compatible the cast will fail. So if it hits the ground? Fail cast.
This idea (as I understood it) worked mostly! Before I linked the get actor node to the “Cast to AI_Enemy” node, the laser began firing again. Did I arrange this properly?
BP_Laser is a projectile. BP_ThirdPersonCharacter is the player character in this game and AI_Enemy is the enemy that you can see closer to the top of the screen.
Sorry for not posting this initially, here’s the blueprint for firing that’s triggered on BP_ThirdPersonCharacter:
Here is your problem. So, going from your prints projectile is overlapping with itself. You do have check for player, but not for itself. It passes first if node, goes to cast, fails and destroys itself.
Check your laser components for collisions. Make them stop overlapping themselves.