top of page
Set player attack settings

Now let's put the necessary software to make the character attack with a sword.

1- First we have to create a flipbook to make the character attack and we will find the attack movement pattern in the character file from number 8 to 13 and we name it char_blueAttack and then we move it to the file flipbook

image.png

2- We open the allanimation file to put the animation for the attack.

image.png

3- We have to determine the moment of the sword attack at which we will inflict damage on the animation frames page by moving to the ideal moment to inflict damage, which is frame number 3.
We click the left mouse button, then add notify (new notify) and name it attack.
notify
: moment of damage

image.png

4- Now we move to the character’s blueprint and create a custom event.
custom event and we call it attacking .

image.png

5- We add the point line trace for object : It defines a line from the beginning of the character’s movement to its end, and it will start immediately after the attack.

image.png

We will do exactly the same steps we did with the enemy (orc).
6- We will add a get actor location point and connect it with start.
7- We will add a point get actor forward vector and connect it with end
8- Add the multiply point that we will use to multiply the value we want the line to end at and connect it with get actor forward vector: It takes the value of the enemy’s movement from the front and its default value is (1). We multiply the value of get actor forward vector by the number we want the line to end at, for example (50).
We only want to make the character move right or left, i.e. in the X axis only.
9 So we have to click with the left mouse on the axes and then click split struct pin so that we can divide the character’s movement on all axes.
10- We add the point add, where we will add the forward vector value of the enemy get actor forward vector with the enemy location value get actor location.
10- object types : What type of objects do you want the line to track (we will make the character track other characters)
(
make array ( pawn ) )
actors to ignore : What kind of things do you want the plot to ignore (we'll make the character ignore himself by calling the dot ( make array ( get player character ) )

image.png

Out Hit : Gives details of everything the character will attack.
11- We extract a point from Out Hit, which is the break hit result.
break hit result : divides the types of injury

image.png
image.png

12- We want to make the character attack other characters so we take out the hit actor point It is called apply damage and we make its value 2 to deal damage to any other character (actor) then we connect it with the line trace for the object   

image.png

13- Now we have to go to the blueprint file for the animation to put the animation for the attack ( animation_bp ) and we will find in the ( functions ) list the attack movement frame that we created previously and we click on it.

image.png

14- We call the character variable bp_char and call the custom event
(
attacking )
What will happen is that if the animation frame we created
recieve notify: attack occurs, then the custom event scripts
( attacking ) will be triggered .

image.png

15- Go to the AnimGraph page, then all animation.

image.png

16- Because we will move from any state to the attacking state, there is something we can add called ( jump node ) that makes us jump from any state with the click of a button. When we click the left mouse button, Jump will appear at the end of the list and we name it attackingevent.
17- We exit the jump point of the animation state that we want to run (attack) if the jump node is achieved and we call it attack.

image.png

18-Inside the attack state, we put Play attack.

image.png

19- We link the attack state with the idle and jump states so that we can make the character return to the stationary movement pattern after the attack.

image.png

20- We have to write in the search box time remaining and time remaining(attack) will appear automatically.
time remaining : is the time remaining until the animation ends. In it, we can specify the time remaining until we move from the attack state to the idle/run state.

21- We put less to get the remaining time for the impulse in the last 0.1 seconds.

image.png

We are done with the animation blueprint now we will move on to the basic character blueprint but before we move on we have to set the necessary settings to make the character attack when we press the F button and to do that:

22- First we have to create an input and call it attack.

image.png

23- Make the input value axis1D float
24- We go inside the file that contains all the entries, which is allmovement.
25- Click on add action mapping and put the attack entry.

image.png

26- We have to go to the personal blueprint bp_char and call the attack entry

image.png

27- We create a do once point so that we do not attack endlessly.
28- Now we have to call the jump animation that we created in the Blueprint Animation (jump node).
We can do this by calling the character's animation component.

image.png

29- Then we call the anim instance point of the Blueprint animation page so that we can call the jump nodes for the attack.

29- Then we call the anim instance point of the Blueprint animation page so that we can call the jump nodes for the attack.
We name the jump node with the name we gave previously,
attackingevent.
We create a delay point so that there is 0.5 seconds between each stroke.

image.png
bottom of page