I have my grenade setup, launching and exploding. Just having issues getting it to damage enemies on explosion. Any advise on the best way to configure this in blueprints? I dont want the damage range to effect enemies differently, I just anything with a radius to be have health got to zero.
Then however you have your grenade exploding, you would run a server event to get overlapping actors of whatever your player pawn’s class is (mine is PP_Game in this instance) and iterate through and call the Apply Damage node.
Then on your pawn you would use the Event AnyDamage node to do whatever you want with the damage (i.e. subtract it from health, show screen effect on client side, camera shake, etc.)
Hi thanks so much for the detailed response. I am working through it now. I am using a timer for the explosion. I am also using the collision to determine the range so this is perfect. If i am taking 100 percent damage how would that change the Event Any Damage node setup. Just a little unsure about that last step…
The **Apply Damage **node takes a float for damage - not a percentage. If you want grenades to take 100% of the players health, you don’t need the Apply Damage and **Any Damage **- you would just call a “KillPlayer” event or something instead that would simply kill the player if they got hit with a grenade. Hopefully that makes sense - sorry if I’m misunderstanding what you’re asking.
An actor can only have 1 single **Any Damage **node inside of the blueprint. So we’re calling Apply **Damage **here from the **Grenade **passing in our **Pawn **as the Damaged Actor. The **Pawn **blueprint, if it has an **Any Damage **node implemented, will execute the Any Damage node and pull in the information from the Apply Damage node.
Here’s how the input pins on the **Apply Damage **correspond with the **Any Damage **node just as an FYI if you’re interested. The Damage Type is a class you can set on the Apply Damage node which will instantiate and then pass a reference of that **Damage Type **to the player as well (purple pin on the Apply Damage node - which means it’s a class reference and then it’s a blue pin on the Any Damage node indicating that there’s an object reference now that’s been ‘spawned’ so-to-speak - realistically it’s an actual instance of the Damage Type class).
^ All of that info might have been useless, but figured if you don’t use this info, someone else in the future may :rolleyes:
This would be on your pawn. So on your pawn you’d probably want some “Health” variable and you would subtract the damage from the health. Then you can use the grenade reference to say something like “Hey bud, you just nom-nom-nom’d a grenade!”
@DomusLudus the OP mentioned that he didn’t care to do ranged damage - he just wanted to bring anyone’s health within the blast radius to 0 (thanks for your response because it made me re-read his original post and realized I missed that last piece of setting health to 0).
@IIINAYLZ Apologies for misreading your original post. When your event timer triggers the explosion event, iterate through all the overlapping actors that are of type **Pawn **and set their health to 0
Switch has Authority is used because something is happening on the server side as well as the client side. I don’t know how OP’s logic is setup but the “KABOOM!” RPC you see in the image would be something that would only happen on the server side (if I was setting up my game that is) which would handle dealing the damage to the players. If you print string you would see that the event is only running on the server so the Switch has Authority’s “Remote” output would *never *execute - the client is never running this “KABOOM!” RPC.
At the end of the execution chain I would then call a **Multicast **that will handle telling all of the relevant clients to “play grenade visual explosion / sound / particle effects” etc. In theory, if I’m running on a dedicated server, sound, particle effects, etc. don’t exist on a dedicated server so you can essentially use a Switch has Authority after the **Multicast **and only play the visuals/audio of the grenade on Remote (client) machines and your dedicated server does nothing more at that point - i.e. doesn’t even try to run any more logic after your Multicast event is called.