How to make Headshot and another in LYRA UE5

Hello everyone! I saw in LYRA when i hit to head i give GunDamage*2, when i hit in body or hands, legs or another i give only GunDamage. So I have a question. Where can I change these damage multipliers?
I found only default damage

2 Likes

I didn’t have the Lyra project. Downloading it right now. Going to help you. But I recommend studying Gameplay Ability System (GAS) to understand these mechanics better.

Here are some of the good sources for you:

This one is particularly good.

tranek/GASDocumentation: My understanding of Unreal Engine 4’s GameplayAbilitySystem plugin with a simple multiplayer sample project. (github.com)

2 Likes

Yes, thank you for your answer. I don’t have time to study right now. I’ll do it later.

Hi! It’s me again :slight_smile:
I found where you can change the multipliers for weak spots.

It’s defined in C++ but exposed to Blueprints. You can change the value inside the B_WeaponInstance_[WeaponNameHere] classes.

If you want to add your own class different than these you can create a child bluerpint class from B_WeaponInstance_Base

These tags are added to a special PhysicalMaterialClass Called PhysicalMaterialWithTags. You can create new one based on this class and apply them to your Skeletal Mesh’s Physics Asset


To create new tags you can go to Project Settings → Project → GameplayTags

Hope this was helpful. :slight_smile:

7 Likes

thank you. I will try this right now

2 Likes

Thank you very much! Your answer has help me

2 Likes

Is there a way to allow only headshot damage to the bots in lyra? Been trying to figure out how to make the body take 0 damage, and headshot is insta-kill. Aka zombie mode

As explained before, headshots are handled via Physical Material “PhysMat_Player_WeakSpot” attached to the mesh’s Physics Asset “PA_MAnnequin”, but only for the bodies Neck_01, Neck_02 and Head. All other bodies use “PhysMat_Player”. Therefore, a quick fix would be to change the “PA overwrite” based on Bots/ Player criteria. For zombies, remove all PhysMats from all bodies but neck and head. For players, duplicate PA_Mannequinn, replace “PhysMat_Player_WeakSpot” by “PhysMat_Player” in those bodies, and set this new PA in the event Possessed.

The damage amount dealt is handled in each Weapon Instance BP

4 Likes

thank you!! that makes it a lot more clear. love your videos btw!!!

edit: one thing that’s not working correctly is switching to the different PA_mannequin on event possessed. Although I’m sure it probably has to do with my setup. I’ll figure it out. thanks again!

1 Like

It should work, because get player state->IsABot may not be available to clients on Begin Play and Event Possessed. This is because clients and server have different timing when it comes to initializing certain game classes.

Glad to know my videos helped you.

Just give a tag to bots and check for it when you’re dealing damage.

That’s a way better aproach. It streamlines the damage code flow and removes unecessary branches.

Tags would help too but why would you check when you are already checking for physical materials.

Sorry if my response was misleading :pray::

This was the response I gave.

2 Likes

How do I get if I killed someone by aiming at their weakspot or not (headshot)? I’m trying to do what the image shows from B_EliminationFeedRelay (I’m trying to know if it has the weakspot tag from both the target tags and instigator tags, but I’m getting false, it should be true). All my characters have a well-assigned weakspot.

I just want to know if he was shot in the head or not, that’s all. Maybe there is another way.

It’s a good idea to look at GCNL_Character_DamageTaken, Execute Function, to see how weak spots are handled. From there, there is a branch when health is <=0, and you can link a custom headshot message in that branch. Or, try to add a custom gameplay tag and use it with Has Tag inside the B_Elimination Feed Relay. I may be wrong, but when the target is eliminated, the GAS is disabled, uninitialized and all tags are removed. So, perhaps the query after the elimination message node will always return false. Give it a try and let us know if works.

1 Like