I’ve been able to program most of my enemies functions, his health works fine, and his is able to find the player and chase him using raycast, but I need help with his attacks. I don’t really have a definite idea on how the combat will actually work, I was thinking he’ll attack x number of times then leave his guard open for a bit before attacking again(I already have him attacking but he attacks nonstop), or if the player is constantly attacking him he’ll block(I already have a working code for this) I’m just not sure how I’ll program his AI to do all of this. So if anyone could help me place a script together or link me to some useful tutorials preferably in C#, that’ll be great.
1 Answer
1Ok so you can have a variable that gets ++ everytime he gets attacked by the player. Once it reaches a value say 5, then he starts blocking. Also you can have a counter to count his continuous attacks. Once it reaches a threshold, have him stop attacking for 4-5 seconds. Reset the counters to 0 and then restart process again.