Game Characters (1st, 3rd, enemy)

Combat system (Part 1) attack anim




Import the anim in UE, choose old UE4 mannequin as skeleton

Create punch anim:


R click on imported anim → retarget anim asset → duplicate and retarget anim asset
Choose the new UE5 mannequin → Retarget
Screenshot 2022-12-23 at 12.42.54 PM.png
Rename the new retarget anim as UE5 anim

R click on new anim, create montage anim
Screenshot 2022-12-23 at 12.45.17 PM.png

Go to 3rd person BP event graph, add custom event:
Screenshot 2022-12-23 at 12.47.14 PM.png

Go to UE5 one anim, check the frame where character finishes punch and start be punched, remove those frames afterward
Screenshot 2022-12-23 at 12.48.39 PM.png

Go to anim montage, drag the clip below just after the default clip, to reset the duration
Screenshot 2022-12-23 at 12.51.16 PM.png


Create line trace for Attack enemy target:


Go to 3rd person BP, viewport, add 2 arrows components, name as start and end attack
move their arrow positions as below:
Screenshot 2022-12-23 at 12.54.14 PM.png
To event graph:
Screenshot 2022-12-23 at 1.06.22 PM.png

The attack system is done.


Make a dummy as enemy to attack:


Create a BP chararcter, name as dummy
Add the mesh (he used ue4 mannequin) in its viewport,
Collision preset: Block all

To event, add health variable and set graph below:
If health > 0, will receive damage; if not true, will destroy actor
Set health default value as 10
Screenshot 2022-12-23 at 1.13.58 PM.png

Back to 3rd person BP graph, add:
Set Base Damage value as 2
Screenshot 2022-12-23 at 1.18.42 PM.png

Drag the dummy in scene, try to attack and destroy


Bug fixing (jigging found after clicking attack frequently shortly):


to 3rd person BP, add Boolean Can Attack (set as true in default value)
add Set and Get nodes respectively as follow:
Screenshot 2022-12-23 at 1.25.46 PM.png
Add delay node at end and connect to return value:
Screenshot 2022-12-23 at 1.27.06 PM.png
Ending set can attack node as true too (for continuous attack):
Screenshot 2022-12-23 at 1.28.04 PM.png

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.