Download

How to Boleon based three or more PlayerControllers

As an example, I have 2 different player controllers. AI1 and AI2. I made a blueprint for a box with point light and I want the light to change green if the player jumping on the box is using AI1 and purple if the player jumping on the box is AI2.

I understand how to get the colors to change on an event overlap, my trouble is how to make a blueprint that says if a specific controller is overlapping do one thing color change or the other.

This should ddo thee trick:

@silik1 Thank you. Now the next step for me is to find how to set a percentage chance to destroy a characters over the other every 5 seconds until there is only one controller type left.
I do have a question about where you made the Ai1. You just created an AI1 blueprint and then in the variables added in the Variable reference to the side to point to AI1 controller class reference?
If so, why did you not just use the drop down that shows up in the “=” section that is after the “get class” blueprint after? Just like to understand other peoples reasoning to see if I want to adopt it or not.

I created the var A1 for clarity because I was just quickly testing the solution before posting it.
And in my test project I just used the default AIController class from thirdPerson template :slight_smile:

Okay, i see, thanks.

@silik1 Apologies, just thought of an easier way to do something, would you by chance have an idea on how to do an action based on the last remaining controller. For example, if AI1’s characters are the last remaining, it print “AI1 Remains”, and if AI2’s or AI3’s controller characters are left, it will say “AI2 Remain” or “AI3 remain”?

I think I am headed in the right direction, but hoping there is an easier method to tell that when only one controller type remains do an action, because this is super messy and I still would have to add in more an booleons for AIController3 and any other ones I may create in the future.

One good practice while working with BP is to always keep the execution flow (the thick white line) as straight as possible.

Also, ssince you got more than two AIController to check, you could use an enum (ControllerID_Enum for example), set its value in beginplay or contruct of the AIController, then you coul djusst check that value on the overlap event(you’d have to cast to the AIController, though).

Perhaps its because i have little knowledge on enum’s, would I not have to basically set this up the exact same way though to do an action if one controller type remains though?