I have been following along in these two threads hoping to make a combat system similar to the Arkham games Freeflow Combat blueprint System?, Help translating Unity code into Unreal Blueprints for Free Flow Combat System - #38 by Codename_Prince. I have gotten to the point of adding animations and reactions, however they won’t activate @Mind-Brain has been helping between these two forums can you help out?
Hey @somerandomguy181!
So let’s start with checking where things are stopping. Try putting a printstring here between “Cast To BP_ThirdPersonCharacter” and the “Damage Enemy” Event, and pass through your “Success” from the cast into that printstring.
This will do two things. First, it will check if the animnotify is going out; secondly, it will check if the cast is successful!
Do that and let us know what happens!
sorry i couldn’t post, this was the first time today I could get to my computer, but here it is. I’m not sure if I did it right though
Okay, so I figured out my other issue but now when i attack an enemy the rotation gets all wonky, and it will sometimes attack another enemy
BP_enemy
BP_ThirdPersonCharacter
ABP_Manny
the video doesn’t do a great job of illustrating the issue, but here it is, the player character will also get stuck on an enemy sometimes
Because you did it on Tick, the rotation will be updated every single frame (the cause of the ‘wonky’). Also, you really have to implement a more efficient system than this. It seems unscalable and will cause some performance issues. You must be very careful when dealing with ticks otherwise your project will suffer later on.
Okay, thanks for the feedback, how would you make this more efficient, or just general things I can do to improve/fix it?
Hey @somerandomguy181! Sorry for the late reply, long weekend. But you’ve made big steps!
@56legion is right, the rotation updating every single frame will cause the ‘wonky’. But something to note: you’ve really accomplished something, now build on it!
The first step to getting a system to run well is to get it to run… period! And that’s real talk. You got your rough draft, and that’s a huge accomplishment! You now have a solid base to tweak and work on until it shines, AND the skills you learn polishing will apply to your development skills across UE5 in one way or another!
So, starting on that, if you notice here on this post (Help translating Unity code into Unreal Blueprints for Free Flow Combat System - #23 by unvoicedbee) unvoicedbee has what you have on their tick- but we never talked more about that. They were trying to use that to make the enemies strafe, I said I wasn’t very versed in strafing behavior with orbiting the player, and they said they found a tutorial on it. That bit of code was from that- I recommend removing that (as 56legion said) because you truly don’t need it unless working on the enemies (it was on enemy bp not player), because the player does this automatically in the attack code!
Let us know if that fixes it and we can move on to some other things!
Thanks, I really appreciate that message!
anyway, I tried doing that and I think I fixed the rotation issues, the only issue currently is sometimes the player will attack 1 enemy but a different enemy will react to it. Kind of like the first thing I showed in the video i posted
Well if we’re going to get into that… we’ll need some closer screenshots of your code because what you posted is so far out that unreal de-renders the text and we can’t see what the nodes are . BUT I think it’s totally doable. You’re in the testing phase, you need to turn all of those traces on (debug lines) so we can see what’s happening!
For this, do that and also maybe on tick (JUST FOR TESTING THIS WILL BE DELETED AFTERWARDS) get your currently targeted enemy variable and hook it into the pink pin on a printstring node. That way you can actively see which enemy is being targeted- right now it seems like the enemy you’re hitting is being set again before the end of your animation, and you need to stop seeking enemies until that animation finishes!
Looking at your code, the rotation going wonky was because you didn’t include this part- it was just free floating down at the bottom
As far as the getting stuck issue is concerned, @Yamenisramen figured that out themselves! Maybe they could give you a tip on that!
Okay, so this code belongs in the enemy AI, right?
Nope! This is to make sure your rotation when you jump to your enemy doesn’t mess up your rotation on the Z axis. It will make your Z rotation line up to your enemy’s so as long as their feet are on the ground yours are! Though, this was probably more important for them as many of their attacks were leaps (like in the Arkham games) but it looks like your rotation could be having a hard time too so I’d suggest it. If you’re colliding with the enemies you’re gonna have some rotation drift with “Set Location” so this’ll right your character’s posture
Try this! It may help.
The reason for your runtime error is probably if you try to punch or otherwise attack before an enemy is found to target. It’s saying “I want to do the punch code, but there isn’t an enemy!”
The way you get around this is right after your attack event, first thing you should check is “?IsValid” with Target Enemy plugged in. Then if it is not valid tell it to do nothing, if it IS valid do the rest of the code.