I modified the First-Person Shooter template so that when the projectile hits something, it fires an “ApplyDamage” event, using the “Other” Actor from EventHit as the Actor for “ApplyDamage”.
I created a new blueprint using one of the cubes in the level (called “BP_Cube”), and added an “EventAnyDamage” and toggled the breakpoint on that event. I then replaced all the cubes with instances of my new “BP_Cube”.
However, when I fire the projectile at the cubes, the event graph (which shows “Simulating”) does not break at the “EventAnyDamage” breakpoint. The event “EventAnyDamage” never fires – it’s like the cube never received the event.
What am I doing wrong???
So it breaks correctly on “Apply Damage” but not on “Any Damage”? Because of the little bit of information i would guess that you probably got the collision channels wrong and because of that the hit event does not get triggered and therefore no damage at the cube. To trigger the Hit Event the Objects that are colliding have to block each other afaik.
I know the collision event is happening because the “AddPhysicsImpulse” is working. I can put a breakpoint on the “ApplyDamage” and it does make it to that point, and does seem to execute the “ApplyDamage” node when I step through it.
But the “EventOnDamage” never fires
Did you set valid value to ‘Damage’ ? EventAnyDamage won’t trigger when the damage is zero.
Yes, the damage being sent is non-zero.
Assuming your BP_Cube is a descendant of Actor class which has a cube static mesh as its component, nothing seems wrong.
When EventHit triggers, check if you get BP_Cube actor from ‘Other’.
ApplyDamage needs only two conditions to trigger EventAnyDamage
- DamagedActor should be valid.
- Damage should be a positive value
Here are the steps to re-create this issue. Perhaps an Epic staff member can tell me what I’m doing wrong…
- Create a new project using the First Person template.
- In the “MyProjectile” Blueprint, add an ApplyDamage node between the AddImpulseAtLocation and DestroyActor. Wire the “Other” from EventHit to “DamagedActor” in ApplyDamage. Set the “Damage” value to 10 (for example). Compile & Save.
- Right-Click on any cube in the level and select “Find in Content Browser” - this will find “Template Cube_Rounded”. Right-Click on this and select “Asset Actions → Create Blueprint using this” I’ll name the blueprint “BP_Cube”
- In the Event Graph for this new blueprint, add an EventAnyDamage node. Pull off the execution pin and add a Print String node. Compile & Save.
Now add some instances of your new “BP_Cube,” (it will be dark-grey instead of white) and press Play. The new grey cubes should print your string message every time they are hit by a projectile – but they do not – no message are printed.
I don’t get it. The cubes’ parent class is Actor. The “Other” pin from the OnEventHit is Actor, and the DamagedActor pin expects a type Actor. This should work, but it’s not.
I’ve even tried adding the GetInstigatorController to the “Event Instigator” and adding a reference to Self to the “Damage Causer” and setting the “Damage Type” to “DamageType” in the ApplyDamage node (even though they all seem optional). But still it doesn’t work.
Come on Epic, what’s going on?
Is there some sort of special requirement to use the ApplyDamage and EventAnyDamage nodes?
Which version are you using? I would than try your guide.
Tried it in 4.6.1 and 4.7 Preview 4
Finally figured out what was wrong. The cube needed to have the following:
- Simulate Physics needed to be checked
- Start Awake needed to be checked
- Simulation Generates Hit Events needed to be checked
- Collision Presets needed to be “BlockAllDynamic”
Additionally, the collision component in the projectile needed to have the following:
- Simulation Generates Hit Events needed to be unchecked
- Simulation Generates Overlap Events needed to be checked
- Collision Presets needed to be “Projectile”