BEAT EM UP GAME - How to get the other/second NPC to move to Y2 IF Y1 is currently occupied by the first NPC?


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!

bump

Anyone have any ideas? I don’t really have nothing much right now. I was able to halfway get it to somewhat work by using a gate that stopped the first NPC, then the second NPC moved to Y2.

I got to thinking for this I may need the selective power of the level bp to be able to differentiate the clones of the one enemy bp.
I used a dummy actor bp that is dragged into the world and placed between two “buildings”. And in that bp I made two actor obj refs.

In the level bp, I got a ref to that dummy bp that will execute when the level does, and used the direct references of the NPC’s to set the obj refs.

While I was at it, I decided to store the Y1 Occupied? boolean inside the dummy bp also.
For some reason…when I did that it created the effect in the video, an NPC moving fully to Y2 behind TPC. However, if I tried to use my original Y1 occupied? / etc bools in the enemy bp, the second NPC only moves a bit toward Y2 and not fully for some reason or other. But the key here seemed to be adding the close gate in the MoveToTPCY1 macro…

But when I tried to add a close gate in the second macro, that whole effect was negated and just like I had never added a close gate to start with.

Any ideas or opinions here would be greatly appreciated, thanks.

bump bump…

bump

Bumping this discussion to keep it alive. I don’t have anything really solid yet. But I am experimenting with using a switch on enum to switch the fast fire from the Event Tick.