cant deal damage to enemy

Hi

I am trying to deal damage to my enemy in a third person mode, so I am using a custom projectile. I created a blueprint using apply damage and print string to check if its firing and it not and Im not sure why. Please can anyone help

You’ve shown absolutely no details so it’s pretty much impossible to help you other than:

Projectile

Enemy

334302-screenshot-2.png


If you need more help, you’ll need to include details.

so I am using a custom projectile

For example, how can we guess how you set it up, spawn, control and detect its collision.

This is my blueprint for the bullet spawning and for the bullet applying damage

So what is Target? How does the Bullet know about Target? Conversely, what is Damage Causer - how are you setting / propagating the reference?


Why not use Other Actor of the onComponentHit(Bullet) node? Because that’s the actor you’re hitting.

target is a object reference to the enemy and damage causer is a object reference to the player. I hasve tried it with the reference to other actor instead and it still doesnt work. I also ahev this blueprint in the enemy graph.

target is a object reference to the
enemy and damage causer is a object
reference to the player.

Sorry, but this helps very little. You did not really answer the question:

  • how are you setting Target reference, we can’t see it. Creating a variable does nothing, you need to point at a value. You’re applying damage to some target actor - how does the bullet know which target you’re hitting. Can you explain?

And now we have another mysterious function:

  • how are you calling DoDamage? We can’t see it anywhere.

Where is the Damage interface event in the target. Since you’re Applying damage, how is the target Receiving it - equivalent of Event AnyDamage in my example. And why not just use that? Or you’re using it but it’s not working - there are too many unknowns here.


Dealing damage is literally about those 3 nodes I posted initially. If you cannot get what I posted to work, you’ll need to explain how you’ve set up collision between the Target and the Projectile actor / Bullet mesh.

terribly sorry im a kind of new at this. IS there anyway you could show me from the beginning of making a projectile colide and all the bits that go with it

No worries. Can you try replicating the initial setup I posted, just for now - you can later on plug in your functions for calculating damage and so on.

Those 3 nodes. Do tell if it prints.

So here it is from scratch in 3rd person template:

bullet

Spawning bullets and receiving damage:

Image from Gyazo

I have replicated the setup you have posted with the exception of the other comp node i dont where that is plugged into. Also its not printing anything currently.

where that is plugged

It’s just the rest of the first person template. See below for the whole thing.

my projectile isnt bouncing off the enemy its is just disappearing. and nothing is printing

Could show the hierarchy of that actor? Sounds like you’re missing collision or using an overlap. As above:

334320-10d60b83-92a6-4f80-8584-7238ea04afc9-4-5005-c.jpeg

is this what you need to look at?

You have it reverse. Drag the sphere on the Default Scene Root and parent the mesh to the sphere. Projectile Movement Component only cares about the component that the root.

so make a new root of the sphere or just atatch it to the scene root

Make sphere collision the root:

Image from Gyazo