I’d create an event in the character BP that would be called every time the character changes color, with a color input (be that Vector or Enumerator or whatever you use to change the color). On Begin Play, each moving platform should bind to this character event; this way the platform will receive the information on the character color and act accordingly.
This event would come in handy in case if the character changes the color while standing on the moving platform so that it could stop.
Alternatively to events, you can read the character color on Tick/Timer whenever the platform trigger is overlapped. Just make sure you get the player character On Begin Play and save the reference into a variable, to avoid casting to the character on Tick.
I’d personally go with character events, because you obviously have numerous mechanics based on player color, so lots of other actors would make use of such events.
So basically i have the player that can change colors by pressing 1, 2 and 3, and if you let’s say press 1 to become red, you can pass trough the red door but you can’t pass over the green bridge. All good.
Now what i am trying to do is to make a blue platform move, while under the player is the color blue and stop when it is any other.
My only issue is that this is using the third person BP for it with “EventBeginPlay” which i use in my character BP as a way to initiate the color change mechanic.
Is there any way to make the platform “call” upon what color the player currently has and toggle moving on and off?
Maybe “OnCollisionBeginOverlap” and using “Casting” to the player character?
Also for clarification, this is how the color change works by using capsule collision (see attachments)
So i managed to get the platform moving when it makes contact with the player character using a sequencer and this (see picture), in the level editor.
In theory it sound simple, “if character is blue = move, if not blue = don’t move”.
I just can’t figure out how to put the character color in there. I am not sure if i am just dumb or if this is beyond my current capacity of understanding on how unreal works.
This might sound stupid but i just thought, instead of doing it like this could i just make it so that the platform moves and stops when i press different buttons? Since 1 turn me red, rather than checking for color, the platform will just stop moving when i press 1 and if i press 3 which turns me blue, it just starts moving again. Is that possible?
I can’t see why not. You can use input in the platform BP, just make sure that 1) you uncheck Consume Input box and 2) you use not 1,2,3 keys, but input actions set in your project settings. Otherwise if a player changes the bindings, your platform BP won’t work right.
Platform color should be public (the little eye icon next to the variable name) so that you could set in after placing the platform into the level.
BTW, it seems that you’re making it all in Level BP? You really should make a separate Platform BP and use a Timeline and/or a Spline Component to move the platform instead of a Sequencer. It will make it a lot easier for you in the long run.
Edit: PS. you also have to consider the case when the character changes its color while already moving on the platform so that it could stop/reverse.