So I think I have finally figured out the mechanism of Beat Em Up games to get the NPCs to circle around you. As shown in the hand drawn diagram, I believe they are using two spots or locations. One being just in front of the player, and the other one being just behind the player. I will call these spots Y1, and Y2, respectively as they occur on the Y plane.
I created two macros, MoveToTPC_Y1 and MoveToTPC_Y2. Whereas the Y1 macro adds, the Y2 macro subtracts. I created two booleans to go inside these macros. Y1Occupied? and Y2Occupied?. In theory, the NPCs both initially move to Y1, and as soon as one is occuping Y1, the Y1Occupied bool is set to true, and a second or other NPC will then try to move to Y1, but hit a branch first with this bool, and then move to Y2. The MoveToTPC_Y2 macro is a copy of Y1 with just the add nodes traded for subtract, and the Y1 Occupied bools changed to Y2 Occupied? bools. If or when an NPC moves out of those Y spots, the bools will be set to false. To get my calculations for Y1 and Y2 I am using the TPC’s capsule, adding in front of it on the Y for Y1, and subracting behind it on the Y for Y2.
So I began testing this idea. For now just using the macros one at a time to make sure the NPCs are going to where they should.
MoveToTPC_Y1
Macro
Video
MoveToTPC_Y2
Macro
Video
While the NPCs seem to be moving to the right spots, I do not understand why that Y2 print string is not firing. Considering the Y2 macro is just a duplicate with a few things replaced. Perhaps someone out there can enlighten me to that.
Now I will attempt to set it up how I think it should go. The far left wire in this pic is an Event Tick fire.
Here is the enemy movement line 3 here. All you need to know here is that in a BEU game using UE4/5 I find that I have to use a gate to stop things like NPCs sliding around on the floor moving to you when they are supposed to be knocked down. The move X, move Y. move Z variables are floats.
drum roll
Here is the result.
Video
Well…that didn’t pan out. Seems the NPCs are moving straight to Y2 like the boolean did nothing. Why?
Y1 Occupied? default value is set to false, so it’s not that.
Hmm…
I will bypass the MoveToTPCY2’s two booleans just for simplicity sake of the test.
Try again…and still they are moving to Y2. Then perhaps I need a way to assign an NPC to Y1 once they are in Y1 and the bool is set, so they don’t try to move to Y2. Is that my problem? Any help or ideas here are appreciated, thanks!